Skip to content

Commit

Permalink
Merge pull request #225197 from stephank/feat/swift58
Browse files Browse the repository at this point in the history
swift: 5.7.3 -> 5.8
  • Loading branch information
domenkozar authored May 5, 2023
2 parents cf9ada3 + f85d121 commit 6cf7bb9
Show file tree
Hide file tree
Showing 32 changed files with 1,914 additions and 210 deletions.
2 changes: 0 additions & 2 deletions pkgs/development/compilers/llvm/15/compiler-rt/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ stdenv.mkDerivation {
substituteInPlace cmake/builtin-config-ix.cmake \
--replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
'' + lib.optionalString stdenv.isDarwin ''
substituteInPlace cmake/builtin-config-ix.cmake \
--replace 'set(ARM64 arm64 arm64e)' 'set(ARM64)'
substituteInPlace cmake/config-ix.cmake \
--replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
'' + lib.optionalString (useLLVM) ''
Expand Down
20 changes: 12 additions & 8 deletions pkgs/development/compilers/swift/compiler/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ let
# "clang-builtin-headers"
"stdlib"
"sdk-overlay"
"parser-lib"
"static-mirror-lib"
"editor-integration"
# "tools"
Expand Down Expand Up @@ -257,6 +256,7 @@ in stdenv.mkDerivation {
${copySource "llvm-project"}
${copySource "swift"}
${copySource "swift-experimental-string-processing"}
${copySource "swift-syntax"}
${lib.optionalString
(!stdenv.isDarwin)
(copySource "swift-corelibs-libdispatch")}
Expand All @@ -276,9 +276,13 @@ in stdenv.mkDerivation {
-e 's|/bin/cp|${coreutils}/bin/cp|g' \
-e 's|/usr/bin/file|${file}/bin/file|g'
patch -p1 -d swift -i ${./patches/swift-cmake-3.25-compat.patch}
patch -p1 -d swift -i ${./patches/swift-wrap.patch}
patch -p1 -d swift -i ${./patches/swift-nix-resource-root.patch}
patch -p1 -d swift -i ${./patches/swift-linux-fix-libc-paths.patch}
patch -p1 -d swift -i ${./patches/swift-linux-fix-linking.patch}
patch -p1 -d swift -i ${./patches/swift-darwin-libcxx-flags.patch}
patch -p1 -d swift -i ${./patches/swift-darwin-link-cxxabi.patch}
patch -p1 -d swift -i ${substituteAll {
src = ./patches/swift-darwin-plistbuddy-workaround.patch;
inherit swiftArch;
Expand All @@ -287,8 +291,6 @@ in stdenv.mkDerivation {
src = ./patches/swift-prevent-sdk-dirs-warning.patch;
inherit (builtins) storeDir;
}}
substituteInPlace swift/cmake/modules/SwiftConfigureSDK.cmake \
--replace '/usr/include' "${stdenv.cc.libc_dev}/include"
# This patch needs to know the lib output location, so must be substituted
# in the same derivation as the compiler.
Expand Down Expand Up @@ -321,8 +323,8 @@ in stdenv.mkDerivation {
''}
# Remove tests for cross compilation, which we don't currently support.
rm swift/test/Interop/Cxx/class/constructors-copy-irgen.swift
rm swift/test/Interop/Cxx/class/constructors-irgen.swift
rm swift/test/Interop/Cxx/class/constructors-copy-irgen-*.swift
rm swift/test/Interop/Cxx/class/constructors-irgen-*.swift
# TODO: consider fixing and re-adding. This test fails due to a non-standard "install_prefix".
rm swift/validation-test/Python/build_swift.swift
Expand All @@ -342,7 +344,7 @@ in stdenv.mkDerivation {
rm swift/test/Serialization/restrict-swiftmodule-to-revision.swift
# This test was flaky in ofborg, see #186476
rm swift/test/AutoDiff/compiler_crashers_fixed/sr14290-missing-debug-scopes-in-pullback-trampoline.swift
rm swift/test/AutoDiff/compiler_crashers_fixed/issue-56649-missing-debug-scopes-in-pullback-trampoline.swift
patchShebangs .
Expand Down Expand Up @@ -446,7 +448,8 @@ in stdenv.mkDerivation {
-DSWIFT_PATH_TO_CMARK_SOURCE=$SWIFT_SOURCE_ROOT/swift-cmark
-DSWIFT_PATH_TO_CMARK_BUILD=$SWIFT_BUILD_ROOT/swift-cmark
-DSWIFT_PATH_TO_LIBDISPATCH_SOURCE=$SWIFT_SOURCE_ROOT/swift-corelibs-libdispatch
-DEXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR=$SWIFT_SOURCE_ROOT/swift-experimental-string-processing
-DSWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE=$SWIFT_SOURCE_ROOT/swift-syntax
-DSWIFT_PATH_TO_STRING_PROCESSING_SOURCE=$SWIFT_SOURCE_ROOT/swift-experimental-string-processing
-DSWIFT_INSTALL_COMPONENTS=${lib.concatStringsSep ";" swiftInstallComponents}
-DSWIFT_STDLIB_ENABLE_OBJC_INTEROP=${if stdenv.isDarwin then "ON" else "OFF"}
"
Expand Down Expand Up @@ -501,6 +504,7 @@ in stdenv.mkDerivation {
cmakeFlags="
-GNinja
-DCMAKE_Swift_COMPILER=$SWIFT_BUILD_ROOT/swift/bin/swiftc
-DSWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE=$SWIFT_SOURCE_ROOT/swift-syntax
-DTOOLCHAIN_DIR=/var/empty
-DSWIFT_NATIVE_LLVM_TOOLS_PATH=${stdenv.cc}/bin
Expand Down Expand Up @@ -579,7 +583,7 @@ in stdenv.mkDerivation {
# Undo the clang and swift wrapping we did for the build.
# (This happened via patches to cmake files.)
cd $SWIFT_BUILD_ROOT
mv llvm/bin/clang-14{-unwrapped,}
mv llvm/bin/clang-15{-unwrapped,}
mv swift/bin/swift-frontend{-unwrapped,}
mkdir $out $lib
Expand Down
Loading

0 comments on commit 6cf7bb9

Please sign in to comment.