mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-07-23 05:53:12 -04:00
dev-lang/swift: add 6.1
Signed-off-by: Itai Ferber <itai@itaiferber.net>
This commit is contained in:
1
dev-lang/swift/files/swift-6.1/backtracing-noexecstack.patch
Symbolic link
1
dev-lang/swift/files/swift-6.1/backtracing-noexecstack.patch
Symbolic link
@@ -0,0 +1 @@
|
||||
../swift-6.0.3-r1/backtracing-noexecstack.patch
|
||||
@@ -0,0 +1,12 @@
|
||||
# Packages should not have `-Werror` unconditionally enabled.
|
||||
|
||||
--- a/swift-corelibs-libdispatch/cmake/modules/DispatchCompilerWarnings.cmake
|
||||
+++ b/swift-corelibs-libdispatch/cmake/modules/DispatchCompilerWarnings.cmake
|
||||
@@ -6,7 +6,6 @@
|
||||
# so that we can use __popcnt64
|
||||
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-fms-extensions>)
|
||||
else()
|
||||
- add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Werror>)
|
||||
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wall>)
|
||||
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wextra>)
|
||||
|
||||
50
dev-lang/swift/files/swift-6.1/gentoo.ini
Normal file
50
dev-lang/swift/files/swift-6.1/gentoo.ini
Normal file
@@ -0,0 +1,50 @@
|
||||
# Individual preset options:
|
||||
#
|
||||
# 1. mixin-preset: building for Linux, without compiler assertions, and with
|
||||
# most tests disabled
|
||||
# 2. build-ninja=0, skip-build-curl, skip-build-zlib: we'd prefer to pick these
|
||||
# up from the system
|
||||
# 3. extra-cmake-options:
|
||||
# * -DLLVM_USE_LINKER, -DCLANG_DEFAULT_LINKER: build LLVM, clang, Swift, et.
|
||||
# al. to link using lld, and ensure Clang uses it as its default
|
||||
# * -DBUILD_TESTING, -DSWIFT_INCLUDE_TESTS, -DSWIFT_INCLUDE_TEST_BINARIES:
|
||||
# the `no_test` preset disables building most, but not all tests; we don't
|
||||
# need to build any of them
|
||||
# * -DCOMPILER_RT_BUILD_ORC: the `compiler-rt` library defaults to building
|
||||
# the ORC LLVM JIT library, which we don't require; we disable it because
|
||||
# it builds with executable stacks, which trip up warnings on installation
|
||||
# * -DPython3_FIND_UNVERSIONED_NAMES: LLDB ships with Python bindings, and
|
||||
# uses CMake to search for Python. By default, CMake tries to find the
|
||||
# latest version installed on disk (currently, `python3.13`, then
|
||||
# `python3.12`, then...). This might not be the version of Python specified
|
||||
# by `PYTHON_SINGLE_TARGET`, which we want to respect. We use
|
||||
# `python_setup` to place `${EPYTHON}` at the front of `PATH` as the
|
||||
# unversioned `python3`, so we want CMake to discover and use this binary
|
||||
# first before falling back to its search
|
||||
# 5. llvm-targets-to-build: we don't currently support architectures other than
|
||||
# amd64, so there's no point in building LLVM for multiple architectures; if
|
||||
# this changes (or we start supporting cross-compilation), we'll need to
|
||||
# build for more than just the host
|
||||
# 6. build-wasm-stdlib=0, wasmkit=0: the Swift Wasm targets are currently
|
||||
# experimental, and supporting them requires supporting cross-compilation.
|
||||
# (An additional wrinkle is that Gentoo CFLAGS/CXXFLAGS/etc. typically
|
||||
# contain an `-march` flag, which isn't valid for cross-compiling to the Wasm
|
||||
# target triple, but stripping it out for just the Wasm target is tricky with
|
||||
# Swift's build system)
|
||||
|
||||
[preset: gentoo]
|
||||
mixin-preset=buildbot_linux,no_assertions,no_test
|
||||
build-ninja=0
|
||||
build-wasm-stdlib=0
|
||||
extra-cmake-options=
|
||||
-DLLVM_USE_LINKER:STRING=lld
|
||||
-DCLANG_DEFAULT_LINKER:STRING=lld
|
||||
-DBUILD_TESTING:BOOL=NO
|
||||
-DSWIFT_INCLUDE_TESTS:BOOL=NO
|
||||
-DSWIFT_INCLUDE_TEST_BINARIES:BOOL=NO
|
||||
-DCOMPILER_RT_BUILD_ORC:BOOL=NO
|
||||
-DPython3_FIND_UNVERSIONED_NAMES:STRING=FIRST
|
||||
llvm-targets-to-build=host
|
||||
skip-build-curl
|
||||
skip-build-zlib
|
||||
wasmkit=0
|
||||
169
dev-lang/swift/files/swift-6.1/link-ncurses-tinfo.patch
Normal file
169
dev-lang/swift/files/swift-6.1/link-ncurses-tinfo.patch
Normal file
@@ -0,0 +1,169 @@
|
||||
# Various Swift components require linking against `curses`; Gentoo doesn't
|
||||
# `curses` as an alias for `ncurses`, so we have to link against `ncurses`
|
||||
# explicitly. `ncurses` on Gentoo also doesn't expose the `curses` terminfo
|
||||
# database interface (e.g., `set_curterm`, `del_curterm`, etc.), so we have to
|
||||
# also explicitly link against `tinfo`.
|
||||
|
||||
--- a/swift/utils/test-prefix-map/Makefile
|
||||
+++ b/swift/utils/test-prefix-map/Makefile
|
||||
@@ -11,7 +11,7 @@ CXXFLAGS = -std=c++11 \
|
||||
-I$(objroot)/tools/clang/include \
|
||||
-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
|
||||
|
||||
-LDFLAGS = -L$(objroot)/lib -lswiftBasic -lLLVMSupport -lcurses
|
||||
+LDFLAGS = -L$(objroot)/lib -lswiftBasic -lLLVMSupport -lncurses -ltinfo
|
||||
|
||||
main: main.cpp $(srcroot)/tools/swift/include/swift/Basic/PrefixMap.h
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o main main.cpp
|
||||
--- a/swift/utils/test-successor-map/Makefile
|
||||
+++ b/swift/utils/test-successor-map/Makefile
|
||||
@@ -11,7 +11,7 @@ CXXFLAGS = -std=c++11 \
|
||||
-I$(objroot)/tools/clang/include \
|
||||
-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
|
||||
|
||||
-LDFLAGS = -L$(objroot)/Debug+Asserts/lib -lLLVMSupport -lcurses
|
||||
+LDFLAGS = -L$(objroot)/Debug+Asserts/lib -lLLVMSupport -lncurses -ltinfo
|
||||
|
||||
main: main.cpp $(srcroot)/tools/swift/include/swift/Basic/SuccessorMap.h
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o main main.cpp
|
||||
--- a/llbuild/Package.swift
|
||||
+++ b/llbuild/Package.swift
|
||||
@@ -28,7 +28,10 @@ let terminfoLibraries: [LinkerSetting] = {
|
||||
if !useTerminfo {
|
||||
return []
|
||||
}
|
||||
- return [.linkedLibrary("ncurses", .when(platforms: [.linux, .macOS]))]
|
||||
+ return [
|
||||
+ .linkedLibrary("ncurses", .when(platforms: [.linux, .macOS])),
|
||||
+ .linkedLibrary("tinfo", .when(platforms: [.linux])),
|
||||
+ ]
|
||||
}()
|
||||
|
||||
let package = Package(
|
||||
--- a/llbuild/lib/llvm/Support/CMakeLists.txt
|
||||
+++ b/llbuild/lib/llvm/Support/CMakeLists.txt
|
||||
@@ -65,5 +65,5 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Android|Darwin|Linux")
|
||||
- target_link_libraries(llvmSupport PRIVATE curses)
|
||||
+ target_link_libraries(llvmSupport PRIVATE ncurses tinfo)
|
||||
endif()
|
||||
--- a/llbuild/perftests/Xcode/PerfTests/CMakeLists.txt
|
||||
+++ b/llbuild/perftests/Xcode/PerfTests/CMakeLists.txt
|
||||
@@ -33,7 +33,8 @@ target_link_libraries(XcodePerfTests PRIVATE
|
||||
llbuildNinja
|
||||
llbuildBuildSystem
|
||||
llbuildCommands
|
||||
- curses
|
||||
+ ncurses
|
||||
+ tinfo
|
||||
SQLite::SQLite3
|
||||
"${MACOSX_SDK_PATH}/System/Library/Frameworks/Foundation.framework"
|
||||
"${MACOSX_PLATFORM_PATH}/Developer/Library/Frameworks/XCTest.framework"
|
||||
--- a/llbuild/products/libllbuild/CMakeLists.txt
|
||||
+++ b/llbuild/products/libllbuild/CMakeLists.txt
|
||||
@@ -28,7 +28,7 @@ endif()
|
||||
|
||||
if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
|
||||
target_link_libraries(libllbuild PRIVATE
|
||||
- curses)
|
||||
+ ncurses tinfo)
|
||||
endif()
|
||||
|
||||
target_include_directories(libllbuild
|
||||
@@ -79,7 +79,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
llbuildNinja
|
||||
llvmSupport
|
||||
SQLite::SQLite3
|
||||
- curses)
|
||||
+ ncurses tinfo)
|
||||
|
||||
# Manually set up the remaining framework structure.
|
||||
set(LLBUILD_FW_INPUTS)
|
||||
--- a/llbuild/products/llbuild/CMakeLists.txt
|
||||
+++ b/llbuild/products/llbuild/CMakeLists.txt
|
||||
@@ -16,5 +16,5 @@ endif()
|
||||
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(llbuild PRIVATE
|
||||
- curses)
|
||||
+ ncurses tinfo)
|
||||
endif()
|
||||
--- a/llbuild/products/swift-build-tool/CMakeLists.txt
|
||||
+++ b/llbuild/products/swift-build-tool/CMakeLists.txt
|
||||
@@ -10,7 +10,7 @@ target_link_libraries(swift-build-tool PRIVATE
|
||||
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(swift-build-tool PRIVATE
|
||||
- curses)
|
||||
+ ncurses tinfo)
|
||||
endif()
|
||||
|
||||
install(TARGETS swift-build-tool
|
||||
--- a/llbuild/tests/lit.site.cfg.in
|
||||
+++ b/llbuild/tests/lit.site.cfg.in
|
||||
@@ -21,7 +21,7 @@ config.sqlite_library = "@SQLite3_LIBRARY@"
|
||||
if sys.platform == 'Windows':
|
||||
config.curses_library = ''
|
||||
else:
|
||||
- config.curses_library = '-lcurses'
|
||||
+ config.curses_library = '-lncurses -ltinfo'
|
||||
config.threads_library = "@CMAKE_THREAD_LIBS_INIT@"
|
||||
if "@CMAKE_DL_LIBS@":
|
||||
config.dl_library = "-l@CMAKE_DL_LIBS@"
|
||||
--- a/llbuild/unittests/Basic/CMakeLists.txt
|
||||
+++ b/llbuild/unittests/Basic/CMakeLists.txt
|
||||
@@ -14,5 +14,5 @@ target_link_libraries(BasicTests PRIVATE
|
||||
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(BasicTests PRIVATE
|
||||
- curses)
|
||||
+ ncurses tinfo)
|
||||
endif()
|
||||
--- a/llbuild/unittests/BuildSystem/CMakeLists.txt
|
||||
+++ b/llbuild/unittests/BuildSystem/CMakeLists.txt
|
||||
@@ -16,5 +16,5 @@ target_link_libraries(BuildSystemTests PRIVATE
|
||||
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(BuildSystemTests PRIVATE
|
||||
- curses)
|
||||
+ ncurses tinfo)
|
||||
endif()
|
||||
--- a/llbuild/unittests/CAPI/CMakeLists.txt
|
||||
+++ b/llbuild/unittests/CAPI/CMakeLists.txt
|
||||
@@ -15,5 +15,5 @@ target_link_libraries(CAPITests PRIVATE
|
||||
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(CAPITests PRIVATE
|
||||
- curses)
|
||||
+ ncurses tinfo)
|
||||
endif()
|
||||
--- a/llbuild/unittests/Core/CMakeLists.txt
|
||||
+++ b/llbuild/unittests/Core/CMakeLists.txt
|
||||
@@ -15,6 +15,6 @@ target_link_libraries(CoreTests PRIVATE
|
||||
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(CoreTests PRIVATE
|
||||
- curses)
|
||||
+ ncurses tinfo)
|
||||
endif()
|
||||
|
||||
--- a/llbuild/unittests/Ninja/CMakeLists.txt
|
||||
+++ b/llbuild/unittests/Ninja/CMakeLists.txt
|
||||
@@ -8,5 +8,5 @@ target_link_libraries(NinjaTests PRIVATE
|
||||
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(NinjaTests PRIVATE
|
||||
- curses)
|
||||
+ ncurses tinfo)
|
||||
endif()
|
||||
--- a/llbuild/utils/adjust-times/CMakeLists.txt
|
||||
+++ b/llbuild/utils/adjust-times/CMakeLists.txt
|
||||
@@ -7,5 +7,5 @@ target_link_libraries(adjust-times PRIVATE llvmSupport)
|
||||
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(adjust-times PRIVATE
|
||||
- curses)
|
||||
+ ncurses tinfo)
|
||||
endif()
|
||||
44
dev-lang/swift/files/swift-6.1/link-with-lld.patch
Normal file
44
dev-lang/swift/files/swift-6.1/link-with-lld.patch
Normal file
@@ -0,0 +1,44 @@
|
||||
# Swift defaults to building with `gold` on Linux because `bfd` can't correctly
|
||||
# handle Swift symbols; Gentoo no longer supports `gold`, so we have to make
|
||||
# sure that we build with `lld`.
|
||||
|
||||
--- a/swift/lib/Driver/UnixToolChains.cpp
|
||||
+++ b/swift/lib/Driver/UnixToolChains.cpp
|
||||
@@ -102,36 +102,7 @@ bool isAmazonLinux2023Host() {
|
||||
return false;
|
||||
}
|
||||
|
||||
-std::string toolchains::GenericUnix::getDefaultLinker() const {
|
||||
- if (getTriple().isAndroid() || isAmazonLinux2023Host()
|
||||
- || (getTriple().isMusl()
|
||||
- && getTriple().getVendor() == llvm::Triple::Swift))
|
||||
- return "lld";
|
||||
-
|
||||
- switch (getTriple().getArch()) {
|
||||
- case llvm::Triple::arm:
|
||||
- case llvm::Triple::aarch64:
|
||||
- case llvm::Triple::aarch64_32:
|
||||
- case llvm::Triple::armeb:
|
||||
- case llvm::Triple::thumb:
|
||||
- case llvm::Triple::thumbeb:
|
||||
- // BFD linker has issues wrt relocation of the protocol conformance
|
||||
- // section on these targets, it also generates COPY relocations for
|
||||
- // final executables, as such, unless specified, we default to gold
|
||||
- // linker.
|
||||
- return "gold";
|
||||
- case llvm::Triple::x86:
|
||||
- case llvm::Triple::x86_64:
|
||||
- case llvm::Triple::ppc64:
|
||||
- case llvm::Triple::ppc64le:
|
||||
- case llvm::Triple::systemz:
|
||||
- // BFD linker has issues wrt relocations against protected symbols.
|
||||
- return "gold";
|
||||
- default:
|
||||
- // Otherwise, use the default BFD linker.
|
||||
- return "";
|
||||
- }
|
||||
-}
|
||||
+std::string toolchains::GenericUnix::getDefaultLinker() const { return "lld"; }
|
||||
|
||||
bool toolchains::GenericUnix::addRuntimeRPath(const llvm::Triple &T,
|
||||
const llvm::opt::ArgList &Args) const {
|
||||
63
dev-lang/swift/files/swift-6.1/respect-c-cxx-flags.patch
Normal file
63
dev-lang/swift/files/swift-6.1/respect-c-cxx-flags.patch
Normal file
@@ -0,0 +1,63 @@
|
||||
# CMake automatically reads `CFLAGS`, `CXXFLAGS`, `LDFLAGS`, etc. from the
|
||||
# environment and uses them to populate its default flag variables -- but the
|
||||
# Swift build system blows away `CMAKE_C{XX}_FLAGS` without picking up the
|
||||
# environment. These need to be picked up again to not be ignored.
|
||||
|
||||
--- a/swift/utils/build-script-impl
|
||||
+++ b/swift/utils/build-script-impl
|
||||
@@ -1819,10 +1819,10 @@ for host in "${ALL_HOSTS[@]}"; do
|
||||
|
||||
cmake_options=(
|
||||
"${cmake_options[@]}"
|
||||
- -DCMAKE_C_FLAGS="$(swift_c_flags ${host})"
|
||||
- -DCMAKE_CXX_FLAGS="$(swift_c_flags ${host})"
|
||||
- -DCMAKE_C_FLAGS_RELWITHDEBINFO="-O2 -DNDEBUG"
|
||||
- -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -DNDEBUG"
|
||||
+ -DCMAKE_C_FLAGS="${CFLAGS} $(swift_c_flags ${host})"
|
||||
+ -DCMAKE_CXX_FLAGS="${CXXFLAGS} $(swift_c_flags ${host})"
|
||||
+ -DCMAKE_C_FLAGS_RELWITHDEBINFO="${CFLAGS} -O2 -DNDEBUG"
|
||||
+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="${CXXFLAGS} -O2 -DNDEBUG"
|
||||
-DCMAKE_BUILD_TYPE:STRING="${SWIFT_BUILD_TYPE}"
|
||||
-DLLVM_ENABLE_ASSERTIONS:BOOL=$(true_false "${SWIFT_ENABLE_ASSERTIONS}")
|
||||
-DSWIFT_ANALYZE_CODE_COVERAGE:STRING=$(toupper "${SWIFT_ANALYZE_CODE_COVERAGE}")
|
||||
@@ -2229,8 +2229,8 @@ for host in "${ALL_HOSTS[@]}"; do
|
||||
cmake_options=(
|
||||
"${cmake_options[@]}"
|
||||
-C${LLDB_SOURCE_DIR}/cmake/caches/${cmake_cache}
|
||||
- -DCMAKE_C_FLAGS="$(llvm_c_flags ${host})"
|
||||
- -DCMAKE_CXX_FLAGS="$(llvm_c_flags ${host})"
|
||||
+ -DCMAKE_C_FLAGS="${CFLAGS} $(llvm_c_flags ${host})"
|
||||
+ -DCMAKE_CXX_FLAGS="${CXXFLAGS} $(llvm_c_flags ${host})"
|
||||
-DCMAKE_BUILD_TYPE:STRING="${LLDB_BUILD_TYPE}"
|
||||
-DLLDB_SWIFTC:PATH=${SWIFTC_BIN}
|
||||
-DLLDB_SWIFT_LIBS:PATH="$(build_directory ${LOCAL_HOST} swift)/lib/swift"
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/products/llvm.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/products/llvm.py
|
||||
@@ -284,10 +284,10 @@ class LLVM(cmake_product.CMakeProduct):
|
||||
# llvm/tools, e.g. to build LLDB.
|
||||
|
||||
llvm_c_flags = ' '.join(self.llvm_c_flags(platform, arch))
|
||||
- llvm_cmake_options.define('CMAKE_C_FLAGS', llvm_c_flags)
|
||||
- llvm_cmake_options.define('CMAKE_CXX_FLAGS', llvm_c_flags)
|
||||
- llvm_cmake_options.define('CMAKE_C_FLAGS_RELWITHDEBINFO', '-O2 -DNDEBUG')
|
||||
- llvm_cmake_options.define('CMAKE_CXX_FLAGS_RELWITHDEBINFO', '-O2 -DNDEBUG')
|
||||
+ llvm_cmake_options.define('CMAKE_C_FLAGS', ' '.join([os.environ.get('CFLAGS', ''), llvm_c_flags]))
|
||||
+ llvm_cmake_options.define('CMAKE_CXX_FLAGS', ' '.join([os.environ.get('CXXFLAGS', ''), llvm_c_flags]))
|
||||
+ llvm_cmake_options.define('CMAKE_C_FLAGS_RELWITHDEBINFO', ' '.join([os.environ.get('CFLAGS', ''), '-O2 -DNDEBUG']))
|
||||
+ llvm_cmake_options.define('CMAKE_CXX_FLAGS_RELWITHDEBINFO', ' '.join([os.environ.get('CXXFLAGS', ''), '-O2 -DNDEBUG']))
|
||||
llvm_cmake_options.define('CMAKE_BUILD_TYPE:STRING',
|
||||
self.args.llvm_build_variant)
|
||||
llvm_cmake_options.define('LLVM_TOOL_SWIFT_BUILD:BOOL', 'FALSE')
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/products/product.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/products/product.py
|
||||
@@ -450,8 +450,8 @@ class Product(object):
|
||||
|
||||
(platform, arch) = host_target.split('-')
|
||||
common_c_flags = ' '.join(self.common_cross_c_flags(platform, arch))
|
||||
- self.cmake_options.define('CMAKE_C_FLAGS', common_c_flags)
|
||||
- self.cmake_options.define('CMAKE_CXX_FLAGS', common_c_flags)
|
||||
+ self.cmake_options.define('CMAKE_C_FLAGS', ' '.join([os.environ.get('CFLAGS', ''), common_c_flags]))
|
||||
+ self.cmake_options.define('CMAKE_CXX_FLAGS', ' '.join([os.environ.get('CXXFLAGS', ''), common_c_flags]))
|
||||
|
||||
toolchain_file = None
|
||||
if self.is_darwin_host(host_target):
|
||||
Reference in New Issue
Block a user