swiftPackages.*: 5.8 -> 5.10.1 (#447292)

This commit is contained in:
Emily
2025-10-11 22:22:48 +00:00
committed by GitHub
36 changed files with 556 additions and 1993 deletions

View File

@@ -1243,6 +1243,7 @@ with lib.maintainers;
swift = {
members = [
dduan
samasaur
stephank
trepetti
trundle

View File

@@ -35,12 +35,12 @@
cctools, # libtool
sigtool,
DarwinTools,
apple-sdk_13,
apple-sdk_14,
darwinMinVersionHook,
}:
let
apple-sdk_swift = apple-sdk_13; # Use the SDK that was available when Swift shipped.
apple-sdk_swift = apple-sdk_14; # Use the SDK that was available when Swift shipped.
deploymentVersion =
if lib.versionOlder (targetPlatform.darwinMinVersion or "0") "10.15" then
@@ -312,152 +312,127 @@ stdenv.mkDerivation {
'';
patchPhase = ''
# Just patch all the things for now, we can focus this later.
# TODO: eliminate use of env.
find -type f -print0 | xargs -0 sed -i \
${lib.optionalString stdenv.hostPlatform.isDarwin "-e 's|/usr/libexec/PlistBuddy|${xcbuild}/bin/PlistBuddy|g'"} \
-e 's|/usr/bin/env|${coreutils}/bin/env|g' \
-e 's|/usr/bin/make|${gnumake}/bin/make|g' \
-e 's|/bin/mkdir|${coreutils}/bin/mkdir|g' \
-e 's|/bin/cp|${coreutils}/bin/cp|g' \
-e 's|/usr/bin/file|${file}/bin/file|g'
# Just patch all the things for now, we can focus this later.
# TODO: eliminate use of env.
find -type f -print0 | xargs -0 sed -i \
${lib.optionalString stdenv.hostPlatform.isDarwin "-e 's|/usr/libexec/PlistBuddy|${xcbuild}/bin/PlistBuddy|g'"} \
-e 's|/usr/bin/env|${coreutils}/bin/env|g' \
-e 's|/usr/bin/make|${gnumake}/bin/make|g' \
-e 's|/bin/mkdir|${coreutils}/bin/mkdir|g' \
-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-linux-fix-libc-paths.patch}
patch -p1 -d swift -i ${
replaceVars ./patches/swift-linux-fix-linking.patch {
inherit clang;
}
}
patch -p1 -d swift -i ${
replaceVars ./patches/swift-darwin-plistbuddy-workaround.patch {
inherit swiftArch;
}
}
patch -p1 -d swift -i ${
replaceVars ./patches/swift-prevent-sdk-dirs-warning.patch {
inherit (builtins) storeDir;
}
}
patch -p1 -d swift -i ${./patches/swift-wrap.patch}
patch -p1 -d swift -i ${./patches/swift-linux-fix-libc-paths.patch}
patch -p1 -d swift -i ${
replaceVars ./patches/swift-linux-fix-linking.patch {
inherit clang;
}
}
patch -p1 -d swift -i ${
replaceVars ./patches/swift-darwin-plistbuddy-workaround.patch {
inherit swiftArch;
}
}
patch -p1 -d swift -i ${
replaceVars ./patches/swift-prevent-sdk-dirs-warning.patch {
inherit (builtins) storeDir;
}
}
# This patch needs to know the lib output location, so must be substituted
# in the same derivation as the compiler.
storeDir="${builtins.storeDir}" \
substituteAll ${./patches/swift-separate-lib.patch} $TMPDIR/swift-separate-lib.patch
patch -p1 -d swift -i $TMPDIR/swift-separate-lib.patch
# This patch needs to know the lib output location, so must be substituted
# in the same derivation as the compiler.
storeDir="${builtins.storeDir}" \
substituteAll ${./patches/swift-separate-lib.patch} $TMPDIR/swift-separate-lib.patch
patch -p1 -d swift -i $TMPDIR/swift-separate-lib.patch
patch -p1 -d llvm-project/llvm -i ${./patches/llvm-module-cache.patch}
patch -p1 -d llvm-project/llvm -i ${./patches/llvm-module-cache.patch}
for lldbPatch in ${
lib.escapeShellArgs [
# Fixes for SWIG 4
(fetchpatch2 {
url = "https://github.com/llvm/llvm-project/commit/81fc5f7909a4ef5a8d4b5da2a10f77f7cb01ba63.patch?full_index=1";
stripLen = 1;
hash = "sha256-Znw+C0uEw7lGETQLKPBZV/Ymo2UigZS+Hv/j1mUo7p0=";
})
(fetchpatch2 {
url = "https://github.com/llvm/llvm-project/commit/f0a25fe0b746f56295d5c02116ba28d2f965c175.patch?full_index=1";
stripLen = 1;
hash = "sha256-QzVeZzmc99xIMiO7n//b+RNAvmxghISKQD93U2zOgFI=";
})
(fetchpatch2 {
url = "https://github.com/llvm/llvm-project/commit/ba35c27ec9aa9807f5b4be2a0c33ca9b045accc7.patch?full_index=1";
stripLen = 1;
hash = "sha256-LXl+WbpmWZww5xMDrle3BM2Tw56v8k9LO1f1Z1/wDTs=";
})
(fetchpatch2 {
url = "https://github.com/llvm/llvm-project/commit/9ec115978ea2bdfc60800cd3c21264341cdc8b0a.patch?full_index=1";
stripLen = 1;
hash = "sha256-u0zSejEjfrH3ZoMFm1j+NVv2t5AP9cE5yhsrdTS1dG4=";
})
for lldbPatch in ${
lib.escapeShellArgs [
# Fix the build with modern libc++.
(fetchpatch {
name = "add-cstdio.patch";
url = "https://github.com/llvm/llvm-project/commit/73e15b5edb4fa4a77e68c299a6e3b21e610d351f.patch";
stripLen = 1;
hash = "sha256-eFcvxZaAuBsY/bda1h9212QevrXyvCHw8Cr9ngetDr0=";
})
(fetchpatch {
url = "https://github.com/llvm/llvm-project/commit/68744ffbdd7daac41da274eef9ac0d191e11c16d.patch";
stripLen = 1;
hash = "sha256-QCGhsL/mi7610ZNb5SqxjRGjwJeK2rwtsFVGeG3PUGc=";
})
]
}; do
patch -p1 -d llvm-project/lldb -i $lldbPatch
done
# Fix the build with modern libc++.
(fetchpatch {
name = "add-cstdio.patch";
url = "https://github.com/llvm/llvm-project/commit/73e15b5edb4fa4a77e68c299a6e3b21e610d351f.patch";
stripLen = 1;
hash = "sha256-eFcvxZaAuBsY/bda1h9212QevrXyvCHw8Cr9ngetDr0=";
})
(fetchpatch {
url = "https://github.com/llvm/llvm-project/commit/68744ffbdd7daac41da274eef9ac0d191e11c16d.patch";
stripLen = 1;
hash = "sha256-QCGhsL/mi7610ZNb5SqxjRGjwJeK2rwtsFVGeG3PUGc=";
})
]
}; do
patch -p1 -d llvm-project/lldb -i $lldbPatch
done
patch -p1 -d llvm-project/clang -i ${./patches/clang-toolchain-dir.patch}
patch -p1 -d llvm-project/clang -i ${./patches/clang-wrap.patch}
patch -p1 -d llvm-project/clang -i ${./patches/clang-purity.patch}
patch -p1 -d llvm-project/clang -i ${./patches/clang-toolchain-dir.patch}
patch -p1 -d llvm-project/clang -i ${./patches/clang-wrap.patch}
patch -p1 -d llvm-project/clang -i ${./patches/clang-purity.patch}
patch -p2 -d llvm-project/clang -i ${
fetchpatch {
name = "clang-cmake-fix-interpreter.patch";
url = "https://github.com/llvm/llvm-project/commit/b5eaf500f2441eff2277ea2973878fb1f171fd0a.patch";
sha256 = "1rma1al0rbm3s3ql6bnvbcighp74lri1lcrwbyacgdqp80fgw1b6";
}
}
patch -p1 -d llvm-project/cmake -i ${
fetchpatch2 {
name = "cmake-fix.patch";
url = "https://github.com/llvm/llvm-project/commit/3676a86a4322e8c2b9c541f057b5d3704146b8f3.patch?full_index=1";
stripLen = 1;
hash = "sha256-zP9dQOmWs7qrxkBRj70DyQBbRjH78B6tNJVy6ilA1xM=";
}
}
# gcc-13 build fixes
patch -p2 -d llvm-project/llvm -i ${
fetchpatch {
name = "gcc-13.patch";
url = "https://github.com/llvm/llvm-project/commit/ff1681ddb303223973653f7f5f3f3435b48a1983.patch";
hash = "sha256-nkRPWx8gNvYr7mlvEUiOAb1rTrf+skCZjAydJVUHrcI=";
}
}
${lib.optionalString stdenv.hostPlatform.isLinux ''
substituteInPlace llvm-project/clang/lib/Driver/ToolChains/Linux.cpp \
--replace-fail 'LibDir = "lib";' 'LibDir = "${glibc}/lib";' \
--replace-fail 'LibDir = "lib64";' 'LibDir = "${glibc}/lib";' \
--replace-fail 'LibDir = X32 ? "libx32" : "lib64";' 'LibDir = "${glibc}/lib";'
${lib.optionalString stdenv.hostPlatform.isLinux ''
substituteInPlace llvm-project/clang/lib/Driver/ToolChains/Linux.cpp \
--replace 'SysRoot + "/lib' '"${glibc}/lib" "' \
--replace 'SysRoot + "/usr/lib' '"${glibc}/lib" "' \
--replace 'LibDir = "lib";' 'LibDir = "${glibc}/lib";' \
--replace 'LibDir = "lib64";' 'LibDir = "${glibc}/lib";' \
--replace 'LibDir = X32 ? "libx32" : "lib64";' 'LibDir = "${glibc}/lib";'
# uuid.h is not part of glibc, but of libuuid.
sed -i 's|''${GLIBC_INCLUDE_PATH}/uuid/uuid.h|${libuuid.dev}/include/uuid/uuid.h|' \
swift/stdlib/public/Platform/glibc.modulemap.gyb
''}
# uuid.h is not part of glibc, but of libuuid.
sed -i 's|''${GLIBC_INCLUDE_PATH}/uuid/uuid.h|${libuuid.dev}/include/uuid/uuid.h|' \
swift/stdlib/public/Platform/glibc.modulemap.gyb
''}
# 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
# 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
# TODO: consider fixing and re-adding. This test fails due to a non-standard "install_prefix".
rm swift/validation-test/Python/build_swift.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
# We cannot handle the SDK location being in "Weird Location" due to Nix isolation.
rm swift/test/DebugInfo/compiler-flags.swift
# We cannot handle the SDK location being in "Weird Location" due to Nix isolation.
rm swift/test/DebugInfo/compiler-flags.swift
# TODO: Fix issue with ld.gold invoked from script finding crtbeginS.o and crtendS.o.
rm swift/test/IRGen/ELF-remove-autolink-section.swift
# TODO: Fix issue with ld.gold invoked from script finding crtbeginS.o and crtendS.o.
rm swift/test/IRGen/ELF-remove-autolink-section.swift
# The following two tests fail because we use don't use the bundled libicu:
# [SOURCE_DIR/utils/build-script] ERROR: can't find source directory for libicu (tried /build/src/icu)
rm swift/validation-test/BuildSystem/default_build_still_performs_epilogue_opts_after_split.test
rm swift/validation-test/BuildSystem/test_early_swift_driver_and_infer.swift
# The following two tests fail because we use don't use the bundled libicu:
# [SOURCE_DIR/utils/build-script] ERROR: can't find source directory for libicu (tried /build/src/icu)
rm swift/validation-test/BuildSystem/default_build_still_performs_epilogue_opts_after_split.test
rm swift/validation-test/BuildSystem/test_early_swift_driver_and_infer.swift
# TODO: This test fails for some unknown reason
rm swift/test/Serialization/restrict-swiftmodule-to-revision.swift
# TODO: This test fails for some unknown reason
rm swift/test/Serialization/restrict-swiftmodule-to-revision.swift
# This test was flaky in ofborg, see #186476
rm swift/test/AutoDiff/compiler_crashers_fixed/issue-56649-missing-debug-scopes-in-pullback-trampoline.swift
# This test was flaky in ofborg, see #186476
rm swift/test/AutoDiff/compiler_crashers_fixed/issue-56649-missing-debug-scopes-in-pullback-trampoline.swift
patchShebangs .
patchShebangs .
${lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
patch -p1 -d swift-corelibs-libdispatch -i ${
# Fix the build with modern Clang.
fetchpatch {
url = "https://github.com/swiftlang/swift-corelibs-libdispatch/commit/30bb8019ba79cdae0eb1dc0c967c17996dd5cc0a.patch";
hash = "sha256-wPZQ4wtEWk8HaKMfzjamlU6p/IW5EFiTssY63rGM+ZA=";
}
}
''}
${lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
patch -p1 -d swift-corelibs-libdispatch -i ${
# Fix the build with modern Clang.
fetchpatch {
url = "https://github.com/swiftlang/swift-corelibs-libdispatch/commit/30bb8019ba79cdae0eb1dc0c967c17996dd5cc0a.patch";
hash = "sha256-wPZQ4wtEWk8HaKMfzjamlU6p/IW5EFiTssY63rGM+ZA=";
}
}
patch -p1 -d swift-corelibs-libdispatch -i ${
# Fix the build with modern Clang.
fetchpatch {
url = "https://github.com/swiftlang/swift-corelibs-libdispatch/commit/38872e2d44d66d2fb94186988509defc734888a5.patch";
hash = "sha256-GABwDeTjciV36Sa0FS10mCfFCqRoBBstgW/OiKdPahA=";
}
}
''}
'';
# > clang-15-unwrapped: error: unsupported option '-fzero-call-used-regs=used-gpr' for target 'arm64-apple-macosx10.9.0'
@@ -541,7 +516,7 @@ stdenv.mkDerivation {
# Ensure that the built Clang can find the runtime libraries by
# copying the symlinks from the main wrapper.
cp -P ${clang}/resource-root/{lib,share} $SWIFT_BUILD_ROOT/llvm/lib/clang/15.0.0/
cp -P ${clang}/resource-root/{lib,share} $SWIFT_BUILD_ROOT/llvm/lib/clang/16.0.0/
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
@@ -570,8 +545,11 @@ stdenv.mkDerivation {
-DBOOTSTRAPPING_MODE=BOOTSTRAPPING${lib.optionalString stdenv.hostPlatform.isDarwin "-WITH-HOSTLIBS"}
-DSWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING=ON
-DSWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY=ON
-DSWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP=ON
-DSWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED=ON
-DSWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING=ON
-DSWIFT_ENABLE_BACKTRACING=ON
-DSWIFT_ENABLE_EXPERIMENTAL_OBSERVATION=ON
-DLLVM_DIR=$SWIFT_BUILD_ROOT/llvm/lib/cmake/llvm
-DClang_DIR=$SWIFT_BUILD_ROOT/llvm/lib/cmake/clang
-DSWIFT_PATH_TO_CMARK_SOURCE=$SWIFT_SOURCE_ROOT/swift-cmark
@@ -712,7 +690,7 @@ 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-15{-unwrapped,}
mv llvm/bin/clang-16{-unwrapped,}
mv swift/bin/swift-frontend{-unwrapped,}
mkdir $lib
@@ -751,7 +729,7 @@ stdenv.mkDerivation {
# Swift has a separate resource root from Clang, but locates the Clang
# resource root via subdir or symlink.
mv $SWIFT_BUILD_ROOT/llvm/lib/clang/15.0.0 $lib/lib/swift/clang
mv $SWIFT_BUILD_ROOT/llvm/lib/clang/16.0.0 $lib/lib/swift/clang
'';
preFixup = lib.optionalString stdenv.hostPlatform.isLinux ''

View File

@@ -3,20 +3,15 @@ From: Will Dietz <w@wdtz.org>
Date: Thu, 18 May 2017 11:56:12 -0500
Subject: [PATCH] "purity" patch for 5.0
---
lib/Driver/ToolChains/Gnu.cpp | 7 -------
1 file changed, 7 deletions(-)
diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
index fe3c0191bb..c6a482bece 100644
--- a/lib/Driver/ToolChains/Gnu.cpp
+++ b/lib/Driver/ToolChains/Gnu.cpp
@@ -487,12 +487,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
if (!IsStatic) {
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -480,13 +480,6 @@
} else {
if (Args.hasArg(options::OPT_rdynamic))
CmdArgs.push_back("-export-dynamic");
-
- if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE) {
- if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE &&
- !Args.hasArg(options::OPT_r)) {
- CmdArgs.push_back("-dynamic-linker");
- CmdArgs.push_back(Args.MakeArgString(Twine(D.DyldPrefix) +
- ToolChain.getDynamicLinker(Args)));
@@ -24,5 +19,3 @@ index fe3c0191bb..c6a482bece 100644
}
CmdArgs.push_back("-o");
--
2.11.0

View File

@@ -5,15 +5,15 @@ patch it to also consider `-idirafter` and `-isystem` as added by cc-wrapper.
--- a/lib/ClangImporter/ClangIncludePaths.cpp
+++ b/lib/ClangImporter/ClangIncludePaths.cpp
@@ -120,6 +120,7 @@ static clang::driver::Driver createClangDriver(const ASTContext &ctx) {
@@ -142,6 +142,7 @@
/// \return a path without dots (`../`, './').
static llvm::Optional<Path>
findFirstIncludeDir(const llvm::opt::InputArgList &args,
+ const llvm::opt::ArgList &DriverArgs,
const ArrayRef<const char *> expectedFileNames) {
static llvm::Optional<Path> findFirstIncludeDir(
const llvm::opt::InputArgList &args,
+ const llvm::opt::ArgList &DriverArgs,
const ArrayRef<const char *> expectedFileNames,
const llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> &vfs) {
// C++ stdlib paths are added as `-internal-isystem`.
std::vector<std::string> includeDirs =
@@ -128,6 +129,14 @@ findFirstIncludeDir(const llvm::opt::InputArgList &args,
@@ -151,6 +152,14 @@
llvm::append_range(includeDirs,
args.getAllArgValues(
clang::driver::options::OPT_internal_externc_isystem));
@@ -28,21 +28,21 @@ patch it to also consider `-idirafter` and `-isystem` as added by cc-wrapper.
for (const auto &includeDir : includeDirs) {
Path dir(includeDir);
@@ -193,7 +202,7 @@ getGlibcFileMapping(ASTContext &ctx) {
// Ideally we would check that all of the headers referenced from the
@@ -218,7 +227,7 @@
// modulemap are present.
Path glibcDir;
- if (auto dir = findFirstIncludeDir(parsedIncludeArgs,
+ if (auto dir = findFirstIncludeDir(parsedIncludeArgs, clangDriverArgs,
{"inttypes.h", "unistd.h", "stdint.h"})) {
if (auto dir = findFirstIncludeDir(
- parsedIncludeArgs, {"inttypes.h", "unistd.h", "stdint.h"}, vfs)) {
+ parsedIncludeArgs, clangDriverArgs, {"inttypes.h", "unistd.h", "stdint.h"}, vfs)) {
glibcDir = dir.value();
} else {
@@ -251,7 +260,7 @@ getLibStdCxxFileMapping(ASTContext &ctx) {
ctx.Diags.diagnose(SourceLoc(), diag::glibc_not_found, triple.str());
@@ -276,7 +285,7 @@
auto parsedStdlibArgs = parseClangDriverArgs(clangDriver, stdlibArgStrings);
Path cxxStdlibDir;
- if (auto dir = findFirstIncludeDir(parsedStdlibArgs,
+ if (auto dir = findFirstIncludeDir(parsedStdlibArgs, clangDriverArgs,
{"cstdlib", "string", "vector"})) {
{"cstdlib", "string", "vector"}, vfs)) {
cxxStdlibDir = dir.value();
} else {

View File

@@ -1,4 +1,4 @@
// swift-tools-version: 5.8
// swift-tools-version: 5.10
import PackageDescription
@@ -9,7 +9,7 @@ let package = Package(
name: "CxxInteropTest",
path: "Sources",
swiftSettings: [
.unsafeFlags(["-enable-experimental-cxx-interop"])
.interoperabilityMode(.Cxx)
]
)
]

View File

@@ -1,3 +1,3 @@
import CxxStdlib
print(String(cxxString: std.string("Hello, world!")))
print(String(std.string("Hello, world!")))

View File

@@ -21,25 +21,6 @@ stdenv.mkDerivation {
inherit (sources) version;
src = sources.swift-corelibs-foundation;
patches = [
# from https://github.com/apple/swift-corelibs-foundation/pull/4811
# fix build with glibc >=2.38
(fetchpatch {
url = "https://github.com/apple/swift-corelibs-foundation/commit/47260803a108c6e0d639adcebeed3ac6a76e8bcd.patch";
hash = "sha256-1JUSQW86IHKkBZqxvpk0P8zcSKntzOTNlMoGBfgeT4c=";
})
# Fix the build with modern Clang.
(fetchpatch {
url = "https://github.com/swiftlang/swift-corelibs-foundation/commit/76058114e5f5b47e02dd4441a6389858bb599bd6.patch";
hash = "sha256-N/hdTGCWMz092xh3AI28v3b+zjQHRmsb1F/2Q2u/jik=";
})
(fetchpatch {
url = "https://github.com/swiftlang/swift-corelibs-foundation/commit/5f3e896e522ff364780e6330df867e20e26269b4.patch";
hash = "sha256-AaBWSysNpZ7NV10RGD4TehZqE0k8Sn+TlhlGw1PiRdI=";
})
];
outputs = [
"out"
"dev"

View File

@@ -38,6 +38,10 @@ stdenv.mkDerivation {
url = "https://github.com/swiftlang/swift-corelibs-libdispatch/commit/30bb8019ba79cdae0eb1dc0c967c17996dd5cc0a.patch";
hash = "sha256-wPZQ4wtEWk8HaKMfzjamlU6p/IW5EFiTssY63rGM+ZA=";
})
(fetchpatch {
url = "https://github.com/swiftlang/swift-corelibs-libdispatch/commit/38872e2d44d66d2fb94186988509defc734888a5.patch";
hash = "sha256-GABwDeTjciV36Sa0FS10mCfFCqRoBBstgW/OiKdPahA=";
})
./disable-swift-overlay.patch
];

View File

@@ -7,6 +7,7 @@
swift,
swiftpm,
swiftpm2nix,
Dispatch,
Foundation,
XCTest,
sqlite,
@@ -40,6 +41,10 @@ stdenv.mkDerivation {
ncursesInput
];
env.LD_LIBRARY_PATH = lib.optionalString stdenv.hostPlatform.isLinux (
lib.makeLibraryPath [ Dispatch ]
);
configurePhase = generated.configure + ''
swiftpmMakeMutable indexstore-db
patch -p1 -d .build/checkouts/indexstore-db -i ${./patches/indexstore-db-macos-target.patch}
@@ -51,19 +56,10 @@ stdenv.mkDerivation {
}
}
swiftpmMakeMutable swift-tools-support-core
patch -p1 -d .build/checkouts/swift-tools-support-core -i ${
fetchpatch {
url = "https://github.com/apple/swift-tools-support-core/commit/990afca47e75cce136d2f59e464577e68a164035.patch";
hash = "sha256-PLzWsp+syiUBHhEFS8+WyUcSae5p0Lhk7SSRdNvfouE=";
includes = [ "Sources/TSCBasic/FileSystem.swift" ];
}
}
# This toggles a section specific to Xcode XCTest, which doesn't work on
# Darwin, where we also use swift-corelibs-xctest.
substituteInPlace Sources/LSPTestSupport/PerfTestCase.swift \
--replace '#if os(macOS)' '#if false'
--replace-fail '#if os(macOS)' '#if false'
# Required to link with swift-corelibs-xctest on Darwin.
export SWIFTTSC_MACOS_DEPLOYMENT_TARGET=10.12

View File

@@ -2,16 +2,18 @@
{
workspaceStateFile = ./workspace-state.json;
hashes = {
"indexstore-db" = "0lf96m82s8f6lv67wbcnm9ii01fgw4bsr4vn2xp07ydfj1iqy8il";
"swift-argument-parser" = "1jph9w7lk9nr20fsv2c8p4hisx3dda817fh7pybd0r0j1jwa9nmw";
"swift-collections" = "1k6sjx5rqmp3gklny77b480hyzy6gkhpi23r0s8ljfbrcwawgnan";
"swift-crypto" = "0kllp7j0hd8k67l9b9zr2c3ddc5bvshldchzivhcz3q31qvq9ag8";
"swift-driver" = "0cbvddj54k3sbw0vzlmzhccs7h43hi5kq6i3n2i0mysz3bf0c6zg";
"swift-llbuild" = "106vnssh6pgy5s9dnq1hi1c9v2wkfydqgncg5dy7c9n23iisjy3s";
"swift-package-manager" = "1d1ngh7da42dm0rwkw7jzxa63a1rpc88wimm85w2j59cm446pk9k";
"swift-syntax" = "05394mzznmcrw246lyzsjsn1fmilj98jgkjyyxr2ynhnbgzp2jl2";
"swift-system" = "0402hkx2q2dv27gccnn8ma79ngvwiwzkhcv4zlcdldmy6cgi0px7";
"swift-tools-support-core" = "1qvblyiazv58qwyxgyk2dh5ymbab3y70vm2q81qs6rmv43hs8ciz";
"Yams" = "0b4lprxl4f6yqq0djnp394mxgmsxm2pljr7fh4f6ihdhnpwfsfvl";
"indexstore-db" = "sha256-2EIzEaVLHZ5vwO8skTaq9HoAaLuT9WFVLMgcgGYuVAk=";
"swift-argument-parser" = "sha256-qEJ329hqQyQVxtHScD7qPmWW9ZDf9bX+4xgpDlX0w5A=";
"swift-asn1" = "sha256-aN6BJOBvUCFn62mPv0nT4Z3edD1bQZ2zT5GubzdXZDw=";
"swift-certificates" = "sha256-34FcJfZgdufFehgjxgo8UbbFPnWnYsS6qR8SIba/WZg=";
"swift-collections" = "sha256-+f9Azcl+NbDvxlMsX0UbT3n87aYaBR1Kjp3rDqoLgkA=";
"swift-crypto" = "sha256-lcB497b/T1bHShPrjNjHthrs76pDFpU+4uN0uW4tz+4=";
"swift-driver" = "sha256-Xaz9gZuOspDb+PB67d6tXfpcs+kkDCPSkhu+eIfrb0A=";
"swift-llbuild" = "sha256-kUm8/+DWDBhuqU/kJBleqSl8/Vz478pMhx5QK2g7k0o=";
"swift-package-manager" = "sha256-7jkAum4nJj9ofVRF3RZDXAR6PyAjORPMnftTNnUrA+U=";
"swift-syntax" = "sha256-8XV2dlB3Vio5O+wFnS5EQeHyPCIgFyCjEYFGCWzOPwE=";
"swift-system" = "sha256-NpTzyppbOQR0Bg/0jrwdphZgbxyRrXy/4dnYcjFvY6w=";
"swift-tools-support-core" = "sha256-Pqy01AyDg7ZTyDM6lV69e6nhfhxwFTOhGFTfhcA1e9E=";
"Yams" = "sha256-AY/fIvB7THrl9GWzGJL8eDBbkcLw27tSRTGtUqmYw8k=";
};
}

View File

@@ -12,8 +12,8 @@
},
"state": {
"checkoutState": {
"branch": "release/5.8",
"revision": "6caa12ab3bb6245eee4e09dce7677e64720c6545"
"branch": "release/5.10",
"revision": "89ec16c2ac1bb271614e734a2ee792224809eb20"
},
"name": "sourceControlCheckout"
},
@@ -29,13 +29,47 @@
},
"state": {
"checkoutState": {
"revision": "e394bf350e38cb100b6bc4172834770ede1b7232",
"version": "1.0.3"
"revision": "8f4d2753f0e4778c76d5f05ad16c74f707390531",
"version": "1.2.3"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-argument-parser"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-asn1",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-asn1.git",
"name": "swift-asn1"
},
"state": {
"checkoutState": {
"revision": "df5d2fcd22e3f480e3ef85bf23e277a4a0ef524d",
"version": "1.2.0"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-asn1"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-certificates",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-certificates.git",
"name": "swift-certificates"
},
"state": {
"checkoutState": {
"revision": "83640c8097acaec17c9835a083e89678cb0f2b66",
"version": "1.3.0"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-certificates"
},
{
"basedOn": null,
"packageRef": {
@@ -46,8 +80,8 @@
},
"state": {
"checkoutState": {
"revision": "937e904258d22af6e447a0b72c0bc67583ef64a2",
"version": "1.0.4"
"revision": "c11818f3cae0780656baa430b49e7f163f08dffd",
"version": "1.1.6"
},
"name": "sourceControlCheckout"
},
@@ -63,8 +97,8 @@
},
"state": {
"checkoutState": {
"revision": "75ec60b8b4cc0f085c3ac414f3dca5625fa3588e",
"version": "2.2.4"
"revision": "629f0b679d0fd0a6ae823d7f750b9ab032c00b80",
"version": "3.0.0"
},
"name": "sourceControlCheckout"
},
@@ -80,8 +114,8 @@
},
"state": {
"checkoutState": {
"branch": "release/5.8",
"revision": "7cfe0c0b6e6297efe88a3ce34e6138ee7eda969e"
"branch": "release/5.10",
"revision": "b461fd4fc51be8e1f2a3f4a2184b664b8846b46f"
},
"name": "sourceControlCheckout"
},
@@ -97,8 +131,8 @@
},
"state": {
"checkoutState": {
"branch": "release/5.8",
"revision": "dccfc2e127a34b89a849407594cf2d604b598ba9"
"branch": "release/5.10",
"revision": "fd7c2e0d9279edd023ced6b0a590f8407f5472f9"
},
"name": "sourceControlCheckout"
},
@@ -114,8 +148,8 @@
},
"state": {
"checkoutState": {
"branch": "release/5.8",
"revision": "6651d98a4ce3c6faa82768256ca286412bf4a04d"
"branch": "release/5.10",
"revision": "b5f8ad931b7a40b81f64765fa08c2751164759b4"
},
"name": "sourceControlCheckout"
},
@@ -127,12 +161,12 @@
"identity": "swift-syntax",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-syntax.git",
"name": "SwiftSyntax"
"name": "swift-syntax"
},
"state": {
"checkoutState": {
"branch": "release/5.8",
"revision": "cd793adf5680e138bf2bcbaacc292490175d0dcd"
"branch": "release/5.10",
"revision": "cdd571f366a4298bb863a9dcfe1295bb595041d5"
},
"name": "sourceControlCheckout"
},
@@ -148,8 +182,8 @@
},
"state": {
"checkoutState": {
"revision": "836bc4557b74fe6d2660218d56e3ce96aff76574",
"version": "1.1.1"
"revision": "d2ba781702a1d8285419c15ee62fd734a9437ff5",
"version": "1.3.2"
},
"name": "sourceControlCheckout"
},
@@ -165,8 +199,8 @@
},
"state": {
"checkoutState": {
"branch": "release/5.8",
"revision": "ac4871e01ef338cb95b5d28328cab0ec1dfae935"
"branch": "release/5.10",
"revision": "90bdc2a157ebacc5d3de0c83e085d05d22ca5fa0"
},
"name": "sourceControlCheckout"
},
@@ -182,8 +216,8 @@
},
"state": {
"checkoutState": {
"revision": "f47ba4838c30dbd59998a4e4c87ab620ff959e8a",
"version": "5.0.5"
"revision": "0d9ee7ea8c4ebd4a489ad7a73d5c6cad55d6fed3",
"version": "5.0.6"
},
"name": "sourceControlCheckout"
},

View File

@@ -5,22 +5,22 @@ let
# These packages are all part of the Swift toolchain, and have a single
# upstream version that should match. We also list the hashes here so a basic
# version upgrade touches only this file.
version = "5.8";
version = "5.10.1";
hashes = {
llvm-project = "sha256-0xwSAwwkzFgYO3mY1rHqV8TCeH2NpM7m3VUkCDqjcdE=";
sourcekit-lsp = "sha256-XDGq64LbpgBrRy3IvZNgsoLUePXECK5p10vQ8cUKeGE=";
swift = "sha256-EY2IImBCVLiUutvDQjNUiInwCNxZsCu1mZzYSjNd4+A=";
swift-cmark = "sha256-6xkO9kN6eXMAigjk+KyIgVhTyC50BxmkZmD4+9z6nz8=";
swift-corelibs-foundation = "sha256-yRjjxJRy1eTM9VG7/Fn60UMghPavsaoueH0V8cjaIyM=";
swift-corelibs-libdispatch = "sha256-XOAWuaGqWJtxhGIPXYT3PIvk5OK0rkY4g1IOybJUlm4=";
swift-corelibs-xctest = "sha256-uwxQhKUQ1xp5ao6kfkdlYOvMr6yAb5IaBIdOfoyf+n8=";
swift-docc = "sha256-k1ygYDZwF4Jo7iOkHxc/3NzfgN+8XNCks5aizxBgPjM=";
swift-docc-render-artifact = "sha256-vdSyICXOjlNSjZXzPRxa/5305pg6PG4xww9GYEV9m10=";
swift-driver = "sha256-7xsG3Bpf+wqisCMaPEuEg8CjGYO/0r8BX3pMUmRrezE=";
swift-experimental-string-processing = "sha256-ioXG6pQKjlAc2oF38Z7TGighyZN8w2ZAAtFUq83Ow6Q=";
swift-format = "sha256-uKhIcbJb0DDHKACfVrhQ4fSyXVUkAj090eUZsOrtEqw=";
swift-package-manager = "sha256-xd6ZpeXfMoHyVrJxz6XcDLPKBvc2nl1lgWXuLrJdq+E=";
swift-syntax = "sha256-gkpx/1sWWi9y917OJ1GSNFYXrJb6e2qI4JlV+38laRQ=";
llvm-project = "sha256-D+zZjLgnAFy6zBuUQwRI0VmDrgr2TQeNUnDbDtvtRZ4=";
sourcekit-lsp = "sha256-mMZ8zPkyoht0aSSnStIULWbLjowahdza9DQXboT1D0o=";
swift = "sha256-UK8yPwHu/sCvcuKKmBMCP9rGRJCZE3ct0ckdNw2BVbE=";
swift-cmark = "sha256-GK2tFu49Sw8jJWJpxQerVFqsuUJwkAhRloa2/aUTYB8=";
swift-corelibs-foundation = "sha256-izYpdCZaf3ktgz/k3pjmHJHH5BebdG7nj8l6vbuk+o0=";
swift-corelibs-libdispatch = "sha256-pta3wJj2LJ/lsYAWQpw0wSGLDMO41mN8Zbl78LUCaQo=";
swift-corelibs-xctest = "sha256-HgnVFYUuefCZKsOjXgt98ebMsLdMl0oXFXy2Pb2iUdw=";
swift-docc = "sha256-zgGahAanYI95nQZ+3zAYrs0h4APNamPrZfwF81k1si0=";
swift-docc-render-artifact = "sha256-Ky9l6tzAxQOpcPFq2FeGnFUl8i59TifRBSHNaZg8wfw=";
swift-driver = "sha256-Xaz9gZuOspDb+PB67d6tXfpcs+kkDCPSkhu+eIfrb0A=";
swift-experimental-string-processing = "sha256-gv3xY9s6gdv0lpXH8RGfiLAvZWM7xVsUSLcqyb4rSeQ=";
swift-format = "sha256-oYf9Qt0b/6G3+uQaoExQRKzgpi1RPYSSpZLfwhuRmF8=";
swift-package-manager = "sha256-yL/cPCt7pZ0XqbbxEnrbzM2X3EkU9klon7SzO2Z13SA=";
swift-syntax = "sha256-OcrOdlnLYpMxH5CGWNGbs5XW3gJaGgKWQqB9YtwmZeY=";
};
# Create fetch derivations.

View File

@@ -2,13 +2,15 @@
{
workspaceStateFile = ./workspace-state.json;
hashes = {
"swift-argument-parser" = "1jph9w7lk9nr20fsv2c8p4hisx3dda817fh7pybd0r0j1jwa9nmw";
"swift-cmark" = "1qswlh6j9mlfq8qj7xfqspla7w7rrzvplgcs4mgllgi012yfgwnp";
"swift-crypto" = "020b8q4ss2k7a65r5dgh59z40i6sn7ij1allxkh8c8a9d0jzn313";
"swift-docc-plugin" = "11d6nhi139yzk1lxxrixsbgyj1bnvmh40wj30y725q83nqq49ljh";
"swift-docc-symbolkit" = "14w37wzbx1mygfwm4iv0ypj120n1axhk627rg5a7v8j0ln511r7s";
"swift-lmdb" = "0azmc24mnxn4pbda8w8v7hy3h0gqqm4br43pnr7lc4sfj3dcv43m";
"swift-markdown" = "1l4ydc0xyv88gnyc33p61qavdh8cv98c548n1icphrfd6i78yygw";
"swift-nio" = "04bvay94b34ynmlvgyl9a7f431l3cf8k2zr483spv8mvyh1hxiqn";
"swift-argument-parser" = "sha256-G4Tz/AdL5WbRq93aJnQhMjHLH7dEuhmXL3PPn+0H6vM=";
"swift-atomics" = "sha256-fjRGySMI7Mv52sCYejWI5YA+IcehOdz5XxK3p+hxwmU=";
"swift-cmark" = "sha256-1/LnvAggPkpfJZo9evfP+fCj6NXY9SMxwo7WJA2kXOM=";
"swift-collections" = "sha256-VtnHFWd5OUmRBnmIeOF8xn8PASLrHG/pfONWnEuX2sw=";
"swift-crypto" = "sha256-vBDjXtynl3HMq1RK/hMOu36b+0hX2SRRnwhPNjPUOsU=";
"swift-docc-plugin" = "sha256-r+cFtDTK6rRWDOOsgJNF6J2mfm/oKxoK7HIv6fpFW4o=";
"swift-docc-symbolkit" = "sha256-hAcoe57wE9gkPc1E/lXY41W+Eh3a7cUWfRv3Xi4rO2M=";
"swift-lmdb" = "sha256-dZDN2pBOE0ZPtneQvEjF+AE4PDwbcaTausR2W4lg9Ss=";
"swift-markdown" = "sha256-qb+mSS1A3WzLQdCB9lIz+UhSG9tf0hknitTfh6VIrHs=";
"swift-nio" = "sha256-KOvnE5VF6lw9hfTLHIlG+6EV/7kl8hL4IOIVoP2om3Q=";
};
}

View File

@@ -12,13 +12,30 @@
},
"state": {
"checkoutState": {
"revision": "e394bf350e38cb100b6bc4172834770ede1b7232",
"version": "1.0.3"
"revision": "fee6933f37fde9a5e12a1e4aeaa93fe60116ff2a",
"version": "1.2.2"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-argument-parser"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-atomics",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-atomics.git",
"name": "swift-atomics"
},
"state": {
"checkoutState": {
"revision": "6c89474e62719ddcc1e9614989fff2f68208fe10",
"version": "1.1.0"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-atomics"
},
{
"basedOn": null,
"packageRef": {
@@ -36,6 +53,23 @@
},
"subpath": "swift-cmark"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-collections",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-collections.git",
"name": "swift-collections"
},
"state": {
"checkoutState": {
"revision": "937e904258d22af6e447a0b72c0bc67583ef64a2",
"version": "1.0.4"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-collections"
},
{
"basedOn": null,
"packageRef": {
@@ -46,8 +80,8 @@
},
"state": {
"checkoutState": {
"revision": "ddb07e896a2a8af79512543b1c7eb9797f8898a5",
"version": "1.1.7"
"revision": "33a20e650c33f6d72d822d558333f2085effa3dc",
"version": "2.5.0"
},
"name": "sourceControlCheckout"
},
@@ -63,8 +97,8 @@
},
"state": {
"checkoutState": {
"revision": "3303b164430d9a7055ba484c8ead67a52f7b74f6",
"version": "1.0.0"
"revision": "9b1258905c21fc1b97bf03d1b4ca12c4ec4e5fda",
"version": "1.2.0"
},
"name": "sourceControlCheckout"
},
@@ -80,8 +114,8 @@
},
"state": {
"checkoutState": {
"branch": "main",
"revision": "b45d1f2ed151d057b54504d653e0da5552844e34"
"branch": "release/5.10",
"revision": "1d5aba8186fc648e17b30631b34043110ca8dd19"
},
"name": "sourceControlCheckout"
},
@@ -97,7 +131,7 @@
},
"state": {
"checkoutState": {
"branch": "main",
"branch": "release/5.10",
"revision": "584941b1236b15bad74d8163785d389c028b1ad8"
},
"name": "sourceControlCheckout"
@@ -114,8 +148,8 @@
},
"state": {
"checkoutState": {
"branch": "main",
"revision": "d491147940587dbadfb3472354f4d0c6e063e061"
"branch": "release/5.10",
"revision": "636291555b65bd59b2b3279abc7d03a622aa7c55"
},
"name": "sourceControlCheckout"
},
@@ -131,8 +165,8 @@
},
"state": {
"checkoutState": {
"revision": "1d425b0851ffa2695d488cce1d68df2539f42500",
"version": "2.31.2"
"revision": "2d8e6ca36fe3e8ed74b0883f593757a45463c34d",
"version": "2.53.0"
},
"name": "sourceControlCheckout"
},

View File

@@ -57,16 +57,7 @@ stdenv.mkDerivation {
})
];
configurePhase = generated.configure + ''
swiftpmMakeMutable swift-tools-support-core
patch -p1 -d .build/checkouts/swift-tools-support-core -i ${
fetchpatch {
url = "https://github.com/apple/swift-tools-support-core/commit/990afca47e75cce136d2f59e464577e68a164035.patch";
hash = "sha256-PLzWsp+syiUBHhEFS8+WyUcSae5p0Lhk7SSRdNvfouE=";
includes = [ "Sources/TSCBasic/FileSystem.swift" ];
}
}
'';
configurePhase = generated.configure;
# TODO: Tests depend on indexstore-db being provided by an existing Swift
# toolchain. (ie. looks for `../lib/libIndexStore.so` relative to swiftc.

View File

@@ -2,10 +2,10 @@
{
workspaceStateFile = ./workspace-state.json;
hashes = {
"swift-argument-parser" = "1jph9w7lk9nr20fsv2c8p4hisx3dda817fh7pybd0r0j1jwa9nmw";
"swift-llbuild" = "106vnssh6pgy5s9dnq1hi1c9v2wkfydqgncg5dy7c9n23iisjy3s";
"swift-system" = "0402hkx2q2dv27gccnn8ma79ngvwiwzkhcv4zlcdldmy6cgi0px7";
"swift-tools-support-core" = "1qvblyiazv58qwyxgyk2dh5ymbab3y70vm2q81qs6rmv43hs8ciz";
"Yams" = "11abhcfkmqm3cmh7vp7rqzvxd1zj02j2866a2pp6v9m89456xb76";
"swift-argument-parser" = "sha256-G4Tz/AdL5WbRq93aJnQhMjHLH7dEuhmXL3PPn+0H6vM=";
"swift-llbuild" = "sha256-kUm8/+DWDBhuqU/kJBleqSl8/Vz478pMhx5QK2g7k0o=";
"swift-system" = "sha256-p18QHzO+NtoY/WQzOD+PfD+bjqrIWsbeEbsJLPqEAhA=";
"swift-tools-support-core" = "sha256-Pqy01AyDg7ZTyDM6lV69e6nhfhxwFTOhGFTfhcA1e9E=";
"Yams" = "sha256-5qxuCkmopm3uFcoYJKQA8ofW98f53H1gZaPiOh2DS4U=";
};
}

View File

@@ -12,8 +12,8 @@
},
"state": {
"checkoutState": {
"revision": "e394bf350e38cb100b6bc4172834770ede1b7232",
"version": "1.0.3"
"revision": "fee6933f37fde9a5e12a1e4aeaa93fe60116ff2a",
"version": "1.2.2"
},
"name": "sourceControlCheckout"
},
@@ -29,8 +29,8 @@
},
"state": {
"checkoutState": {
"branch": "release/5.8",
"revision": "dccfc2e127a34b89a849407594cf2d604b598ba9"
"branch": "release/5.10",
"revision": "fd7c2e0d9279edd023ced6b0a590f8407f5472f9"
},
"name": "sourceControlCheckout"
},
@@ -63,8 +63,8 @@
},
"state": {
"checkoutState": {
"branch": "release/5.8",
"revision": "ac4871e01ef338cb95b5d28328cab0ec1dfae935"
"branch": "release/5.10",
"revision": "90bdc2a157ebacc5d3de0c83e085d05d22ca5fa0"
},
"name": "sourceControlCheckout"
},

View File

@@ -10,10 +10,10 @@ index a4a735f498..381522cc1f 100644
import SwiftOptions
import func TSCBasic.lookupExecutablePath
@@ -120,7 +121,18 @@
// just using `clang` and avoid a dependency on the C++ runtime.
let clangTool: Tool =
parsedOptions.hasArgument(.enableExperimentalCxxInterop) ? .clangxx : .clang
@@ -130,7 +131,18 @@
}
let clangTool: Tool = cxxCompatEnabled ? .clangxx : .clang
- var clangPath = try getToolPath(clangTool)
+
+ // For Nix, prefer linking using the wrapped Nixpkgs clang, instead of using
@@ -21,7 +21,7 @@ index a4a735f498..381522cc1f 100644
+ // we still want to use it for other purposes (clang importer).
+ var clangPath: AbsolutePath
+ if let binPath = try? AbsolutePath(validating: "@clang@/bin"),
+ let tool = lookupExecutablePath(filename: parsedOptions.hasArgument(.enableExperimentalCxxInterop)
+ let tool = lookupExecutablePath(filename: cxxCompatEnabled
+ ? "clang++" : "clang",
+ searchPaths: [binPath]) {
+ clangPath = tool
@@ -30,7 +30,7 @@ index a4a735f498..381522cc1f 100644
if let toolsDirPath = parsedOptions.getLastArgument(.toolsDirectory) {
// FIXME: What if this isn't an absolute path?
let toolsDir = try AbsolutePath(validating: toolsDirPath.asSingle)
@@ -136,6 +148,7 @@
@@ -146,6 +158,7 @@
commandLine.appendFlag("-B")
commandLine.appendPath(toolsDir)
}

View File

@@ -6,6 +6,7 @@
swift,
swiftpm,
swiftpm2nix,
Dispatch,
Foundation,
}:
let
@@ -24,16 +25,11 @@ stdenv.mkDerivation {
];
buildInputs = [ Foundation ];
configurePhase = generated.configure + ''
swiftpmMakeMutable swift-tools-support-core
patch -p1 -d .build/checkouts/swift-tools-support-core -i ${
fetchpatch {
url = "https://github.com/apple/swift-tools-support-core/commit/990afca47e75cce136d2f59e464577e68a164035.patch";
hash = "sha256-PLzWsp+syiUBHhEFS8+WyUcSae5p0Lhk7SSRdNvfouE=";
includes = [ "Sources/TSCBasic/FileSystem.swift" ];
}
}
'';
env.LD_LIBRARY_PATH = lib.optionalString stdenv.hostPlatform.isLinux (
lib.makeLibraryPath [ Dispatch ]
);
configurePhase = generated.configure;
# We only install the swift-format binary, so don't need the other products.
swiftpmFlags = [ "--product swift-format" ];

View File

@@ -2,9 +2,9 @@
{
workspaceStateFile = ./workspace-state.json;
hashes = {
"swift-argument-parser" = "01p814snzlfpby2qj67a3dcnsa6038fbk8411npi28440w1hzpzx";
"swift-syntax" = "05394mzznmcrw246lyzsjsn1fmilj98jgkjyyxr2ynhnbgzp2jl2";
"swift-system" = "0402hkx2q2dv27gccnn8ma79ngvwiwzkhcv4zlcdldmy6cgi0px7";
"swift-tools-support-core" = "16kp0y1akr99v319j46x0zwc8kzh5klnqcvjhsb57ah5xr0l29bk";
"swift-argument-parser" = "sha256-JXNjFpLNaqzOGXlIgQtwzG2Yq1daOl4tmTAUcZL4thM=";
"swift-cmark" = "sha256-npLzvHtMmWZlqNIYOMAZfqyX2TOkICZNHCN1+laOBZA=";
"swift-markdown" = "sha256-F8xJYp8kf9IzLAe+HuKLFWJe3fdC2yewb+zaJgyeJ1U=";
"swift-syntax" = "sha256-8XV2dlB3Vio5O+wFnS5EQeHyPCIgFyCjEYFGCWzOPwE=";
};
}

View File

@@ -12,8 +12,8 @@
},
"state": {
"checkoutState": {
"branch": "main",
"revision": "c5050aa63ed5bb23209e7120b7ff6618ee06e0ee"
"revision": "309a47b2b1d9b5e991f36961c983ecec72275be3",
"version": "1.6.1"
},
"name": "sourceControlCheckout"
},
@@ -22,53 +22,53 @@
{
"basedOn": null,
"packageRef": {
"identity": "swift-syntax",
"identity": "swift-cmark",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-syntax.git",
"name": "SwiftSyntax"
"location": "https://github.com/swiftlang/swift-cmark.git",
"name": "cmark-gfm"
},
"state": {
"checkoutState": {
"branch": "main",
"revision": "cd793adf5680e138bf2bcbaacc292490175d0dcd"
"revision": "b97d09472e847a416629f026eceae0e2afcfad65",
"version": "0.7.0"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-cmark"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-markdown",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-markdown.git",
"name": "swift-markdown"
},
"state": {
"checkoutState": {
"revision": "d8cf111c276ed18cff82d3cad563d2ca5903b982",
"version": "0.7.1"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-markdown"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-syntax",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-syntax.git",
"name": "swift-syntax"
},
"state": {
"checkoutState": {
"branch": "release/5.10",
"revision": "cdd571f366a4298bb863a9dcfe1295bb595041d5"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-syntax"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-system",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-system.git",
"name": "swift-system"
},
"state": {
"checkoutState": {
"revision": "836bc4557b74fe6d2660218d56e3ce96aff76574",
"version": "1.1.1"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-system"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-tools-support-core",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-tools-support-core.git",
"name": "swift-tools-support-core"
},
"state": {
"checkoutState": {
"branch": "main",
"revision": "1296d2f11b0226c4b83540010936c7238d21c12b"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-tools-support-core"
}
]
},

View File

@@ -88,5 +88,20 @@ lib.mapAttrs mkInstallScript {
SwiftCrypto = ''
add_library(Crypto SHARED IMPORTED)
set_property(TARGET Crypto PROPERTY IMPORTED_LOCATION "@out@/lib/swift/@swiftOs@/libCrypto@sharedLibExt@")
add_library(_CryptoExtras SHARED IMPORTED)
# this can't possibly be right... I really think it should be `libCryptoExtras`
# swift-certificates did build with this though.....
set_property(TARGET _CryptoExtras PROPERTY IMPORTED_LOCATION "@out@/lib/swift/@swiftOs@/libCrypto@sharedLibExt@")
'';
SwiftASN1 = ''
add_library(SwiftASN1 SHARED IMPORTED)
set_property(TARGET SwiftASN1 PROPERTY IMPORTED_LOCATION "@out@/lib/swift/@swiftOs@/libSwiftASN1@sharedLibExt@")
'';
SwiftCertificates = ''
add_library(SwiftCertificates SHARED IMPORTED)
set_property(TARGET SwiftCertificates PROPERTY IMPORTED_LOCATION "@out@/lib/swift/@swiftOs@/libCertificates@sharedLibExt@")
'';
}

View File

@@ -2,7 +2,7 @@
lib,
stdenv,
callPackage,
fetchpatch,
fetchFromGitHub,
cmake,
ninja,
git,
@@ -23,7 +23,11 @@
let
inherit (swift) swiftOs swiftModuleSubdir swiftStaticModuleSubdir;
inherit (swift)
swiftOs
swiftModuleSubdir
swiftStaticModuleSubdir
;
sharedLibraryExt = stdenv.hostPlatform.extensions.sharedLibrary;
sources = callPackage ../sources.nix { };
@@ -39,7 +43,6 @@ let
propagatedBuildInputs = [ Foundation ];
patches = [
./patches/cmake-disable-rpath.patch
./patches/cmake-fix-quoting.patch
./patches/disable-index-store.patch
./patches/disable-sandbox.patch
./patches/disable-xctest.patch
@@ -56,24 +59,9 @@ let
# Patch the location where swiftpm looks for its API modules.
substituteInPlace Sources/PackageModel/UserToolchain.swift \
--replace \
--replace-fail \
'librariesPath = applicationPath.parentDirectory' \
"librariesPath = AbsolutePath(\"$out\")"
# Fix case-sensitivity issues.
# Upstream PR: https://github.com/apple/swift-package-manager/pull/6500
substituteInPlace Sources/CMakeLists.txt \
--replace \
'packageCollectionsSigning' \
'PackageCollectionsSigning'
substituteInPlace Sources/PackageCollectionsSigning/CMakeLists.txt \
--replace \
'SubjectPublickeyInfo' \
'SubjectPublicKeyInfo'
substituteInPlace Sources/PackageCollections/CMakeLists.txt \
--replace \
'FilepackageCollectionsSourcesStorage' \
'FilePackageCollectionsSourcesStorage'
"librariesPath = try AbsolutePath(validating: \"$out\")"
'';
};
@@ -117,6 +105,8 @@ let
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
# On Darwin only, Swift uses arm64 as cpu arch.
if [ -e cmake/modules/SwiftSupport.cmake ]; then
# At least in swift-asn1, this has been removed and the module uses the full target triple as the name
# (https://github.com/apple/swift-asn1/pull/103)
substituteInPlace cmake/modules/SwiftSupport.cmake \
--replace '"aarch64" PARENT_SCOPE' '"arm64" PARENT_SCOPE'
fi
@@ -201,24 +191,10 @@ let
'';
};
# Part of this patch fixes for glibc 2.39: glibc patch 64b1a44183a3094672ed304532bedb9acc707554
# marks the `FILE*` argument to a few functions including `ferror` & `fread` as non-null. However
# the code passes an `Optional<T>` to these functions.
# This patch uses a `guard` which effectively unwraps the type (or throws an exception).
swift-tools-support-core-glibc-fix = fetchpatch {
url = "https://github.com/apple/swift-tools-support-core/commit/990afca47e75cce136d2f59e464577e68a164035.patch";
hash = "sha256-PLzWsp+syiUBHhEFS8+WyUcSae5p0Lhk7SSRdNvfouE=";
includes = [ "Sources/TSCBasic/FileSystem.swift" ];
};
swift-tools-support-core = mkBootstrapDerivation {
name = "swift-tools-support-core";
src = generated.sources.swift-tools-support-core;
patches = [
swift-tools-support-core-glibc-fix
];
buildInputs = [
swift-system
sqlite
@@ -293,12 +269,12 @@ let
substituteInPlace \
products/libllbuild/CMakeLists.txt \
products/llbuildSwift/CMakeLists.txt \
--replace '@rpath' "$out/lib"
--replace-fail '@rpath' "$out/lib"
# This subdirectory is enabled for Darwin only, but requires ObjC XCTest
# (and only Swift XCTest is open source).
substituteInPlace perftests/CMakeLists.txt \
--replace 'add_subdirectory(Xcode/' '#add_subdirectory(Xcode/'
--replace-fail 'add_subdirectory(Xcode/' '#add_subdirectory(Xcode/'
'';
cmakeFlags = [
@@ -330,7 +306,7 @@ let
postPatch = ''
# Tries to link against CYaml, but that's private.
substituteInPlace Sources/SwiftDriver/CMakeLists.txt \
--replace CYaml ""
--replace-fail CYaml ""
'';
postInstall = cmakeGlue.SwiftDriver + ''
@@ -342,14 +318,28 @@ let
swift-crypto = mkBootstrapDerivation {
name = "swift-crypto";
src = generated.sources.swift-crypto;
src = fetchFromGitHub {
owner = "apple";
repo = "swift-crypto";
rev = "95ba0316a9b733e92bb6b071255ff46263bbe7dc"; # 3.15.1, as opposed to the pinned version of 3.0.0
sha256 = "sha256-RzoUBx4l12v0ZamSIAEpHHCRQXxJkXJCwVBEj7Qwg9I=";
fetchSubmodules = true;
};
buildInputs = [
swift-asn1
];
patches = [
./patches/install-crypto-extras.patch
];
postPatch = ''
# Fix use of hardcoded tool paths on Darwin.
substituteInPlace CMakeLists.txt \
--replace /usr/bin/ar $NIX_CC/bin/ar
--replace-fail /usr/bin/ar $NIX_CC/bin/ar
substituteInPlace CMakeLists.txt \
--replace /usr/bin/ranlib $NIX_CC/bin/ranlib
--replace-fail /usr/bin/ranlib $NIX_CC/bin/ranlib
'';
postInstall = cmakeGlue.SwiftCrypto + ''
@@ -358,9 +348,41 @@ let
# Headers are not installed.
cp -r ../Sources/CCryptoBoringSSL/include $out/include
# Swift modules are put in the wrong place by default (and not all are linked)
mkdir -p $out/${swiftModuleSubdir}
rm -rf $out/${swiftModuleSubdir}/*.swift{module,doc}
# I assume we don't care about .swiftsourceinfo
cp swift/*.swift{module,doc} $out/${swiftModuleSubdir}/
'';
};
swift-asn1 = mkBootstrapDerivation {
name = "swift-asn1";
src = generated.sources.swift-asn1;
postInstall =
cmakeGlue.SwiftASN1
+ lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
# SwiftASN1 uses the full target triple as the name of the swiftmodule
# (https://github.com/apple/swift-asn1/pull/103)
mkdir -p $out/${swiftModuleSubdir}
cp swift/*.swift{module,doc} $out/${swiftModuleSubdir}/
'';
};
swift-certificates = mkBootstrapDerivation {
name = "swift-certificates";
src = generated.sources.swift-certificates;
buildInputs = [
swift-asn1
swift-crypto
];
postInstall = cmakeGlue.SwiftCertificates;
};
# Build a bootrapping swiftpm using CMake.
swiftpm-bootstrap = mkBootstrapDerivation (
commonAttrs
@@ -371,6 +393,8 @@ let
llbuild
sqlite
swift-argument-parser
swift-asn1
swift-certificates
swift-collections
swift-crypto
swift-driver
@@ -413,8 +437,7 @@ stdenv.mkDerivation (
# swift-corelibs-xctest.
swiftpmMakeMutable swift-tools-support-core
substituteInPlace .build/checkouts/swift-tools-support-core/Sources/TSCTestSupport/XCTestCasePerf.swift \
--replace 'canImport(Darwin)' 'false'
patch -p1 -d .build/checkouts/swift-tools-support-core -i ${swift-tools-support-core-glibc-fix}
--replace-fail 'canImport(Darwin)' 'false'
# Prevent a warning about SDK directories we don't have.
swiftpmMakeMutable swift-driver

View File

@@ -2,13 +2,15 @@
{
workspaceStateFile = ./workspace-state.json;
hashes = {
"swift-argument-parser" = "1jph9w7lk9nr20fsv2c8p4hisx3dda817fh7pybd0r0j1jwa9nmw";
"swift-collections" = "1k6sjx5rqmp3gklny77b480hyzy6gkhpi23r0s8ljfbrcwawgnan";
"swift-crypto" = "0kllp7j0hd8k67l9b9zr2c3ddc5bvshldchzivhcz3q31qvq9ag8";
"swift-driver" = "0cbvddj54k3sbw0vzlmzhccs7h43hi5kq6i3n2i0mysz3bf0c6zg";
"swift-llbuild" = "106vnssh6pgy5s9dnq1hi1c9v2wkfydqgncg5dy7c9n23iisjy3s";
"swift-system" = "0402hkx2q2dv27gccnn8ma79ngvwiwzkhcv4zlcdldmy6cgi0px7";
"swift-tools-support-core" = "1qvblyiazv58qwyxgyk2dh5ymbab3y70vm2q81qs6rmv43hs8ciz";
"Yams" = "0b4lprxl4f6yqq0djnp394mxgmsxm2pljr7fh4f6ihdhnpwfsfvl";
"swift-argument-parser" = "sha256-qEJ329hqQyQVxtHScD7qPmWW9ZDf9bX+4xgpDlX0w5A=";
"swift-asn1" = "sha256-6NqPGUuM55YOXCMqNsqPm/3smKhSC2UIYHJSwtIiuoc=";
"swift-certificates" = "sha256-n5dE5J8f7PAVoJkIpiKrrDvB0xIil5VwtzC2mx6vz80=";
"swift-collections" = "sha256-WNj19mRvDSZNcDzZvmtS+jZxngBooiHekh3IsPZnKUQ=";
"swift-crypto" = "sha256-lcB497b/T1bHShPrjNjHthrs76pDFpU+4uN0uW4tz+4=";
"swift-driver" = "sha256-Xaz9gZuOspDb+PB67d6tXfpcs+kkDCPSkhu+eIfrb0A=";
"swift-llbuild" = "sha256-kUm8/+DWDBhuqU/kJBleqSl8/Vz478pMhx5QK2g7k0o=";
"swift-system" = "sha256-p18QHzO+NtoY/WQzOD+PfD+bjqrIWsbeEbsJLPqEAhA=";
"swift-tools-support-core" = "sha256-Pqy01AyDg7ZTyDM6lV69e6nhfhxwFTOhGFTfhcA1e9E=";
"Yams" = "sha256-AY/fIvB7THrl9GWzGJL8eDBbkcLw27tSRTGtUqmYw8k=";
};
}

View File

@@ -12,13 +12,47 @@
},
"state": {
"checkoutState": {
"revision": "e394bf350e38cb100b6bc4172834770ede1b7232",
"version": "1.0.3"
"revision": "8f4d2753f0e4778c76d5f05ad16c74f707390531",
"version": "1.2.3"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-argument-parser"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-asn1",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-asn1.git",
"name": "swift-asn1"
},
"state": {
"checkoutState": {
"revision": "f70225981241859eb4aa1a18a75531d26637c8cc",
"version": "1.4.0"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-asn1"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-certificates",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-certificates.git",
"name": "swift-certificates"
},
"state": {
"checkoutState": {
"revision": "01d7664523af5c169f26038f1e5d444ce47ae5ff",
"version": "1.0.1"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-certificates"
},
{
"basedOn": null,
"packageRef": {
@@ -29,8 +63,8 @@
},
"state": {
"checkoutState": {
"revision": "937e904258d22af6e447a0b72c0bc67583ef64a2",
"version": "1.0.4"
"revision": "d029d9d39c87bed85b1c50adee7c41795261a192",
"version": "1.0.6"
},
"name": "sourceControlCheckout"
},
@@ -46,8 +80,8 @@
},
"state": {
"checkoutState": {
"revision": "75ec60b8b4cc0f085c3ac414f3dca5625fa3588e",
"version": "2.2.4"
"revision": "629f0b679d0fd0a6ae823d7f750b9ab032c00b80",
"version": "3.0.0"
},
"name": "sourceControlCheckout"
},
@@ -63,8 +97,8 @@
},
"state": {
"checkoutState": {
"branch": "release/5.8",
"revision": "7cfe0c0b6e6297efe88a3ce34e6138ee7eda969e"
"branch": "release/5.10",
"revision": "b461fd4fc51be8e1f2a3f4a2184b664b8846b46f"
},
"name": "sourceControlCheckout"
},
@@ -80,8 +114,8 @@
},
"state": {
"checkoutState": {
"branch": "release/5.8",
"revision": "dccfc2e127a34b89a849407594cf2d604b598ba9"
"branch": "release/5.10",
"revision": "fd7c2e0d9279edd023ced6b0a590f8407f5472f9"
},
"name": "sourceControlCheckout"
},
@@ -114,8 +148,8 @@
},
"state": {
"checkoutState": {
"branch": "release/5.8",
"revision": "ac4871e01ef338cb95b5d28328cab0ec1dfae935"
"branch": "release/5.10",
"revision": "90bdc2a157ebacc5d3de0c83e085d05d22ca5fa0"
},
"name": "sourceControlCheckout"
},
@@ -131,8 +165,8 @@
},
"state": {
"checkoutState": {
"revision": "f47ba4838c30dbd59998a4e4c87ab620ff959e8a",
"version": "5.0.5"
"revision": "0d9ee7ea8c4ebd4a489ad7a73d5c6cad55d6fed3",
"version": "5.0.6"
},
"name": "sourceControlCheckout"
},

View File

@@ -2,10 +2,10 @@ Disable rpath for the bootstrap build with CMake.
--- a/Sources/PackageDescription/CMakeLists.txt
+++ b/Sources/PackageDescription/CMakeLists.txt
@@ -31,14 +31,11 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
set(SWIFT_INTERFACE_PATH ${CMAKE_BINARY_DIR}/pm/ManifestAPI/PackageDescription.swiftinterface)
target_compile_options(PackageDescription PUBLIC
$<$<COMPILE_LANGUAGE:Swift>:-emit-module-interface-path$<SEMICOLON>${SWIFT_INTERFACE_PATH}>)
@@ -27,14 +27,11 @@
$<$<COMPILE_LANGUAGE:Swift>:-package-description-version$<SEMICOLON>999.0>)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
- target_link_options(PackageDescription PRIVATE
- "SHELL:-Xlinker -install_name -Xlinker @rpath/libPackageDescription.dylib")
endif()

View File

@@ -1,12 +0,0 @@
--- a/Sources/PackageCollectionsSigning/CMakeLists.txt
+++ b/Sources/PackageCollectionsSigning/CMakeLists.txt
@@ -43,6 +43,7 @@ target_link_libraries(PackageCollectionsSigning PUBLIC
PackageCollectionsModel
TSCBasic)
target_link_libraries(PackageCollectionsSigning PRIVATE
- PackageCollectionsSigningLibc
- $<$<PLATFORM_ID:Darwin>:SHELL:-Xlinker -framework -Xlinker Security>)
+ PackageCollectionsSigningLibc)
+target_link_options(PackageCollectionsSigning PRIVATE
+ "$<$<PLATFORM_ID:Darwin>:SHELL:-Xlinker -framework -Xlinker Security>")

View File

@@ -4,9 +4,9 @@ Clang. Make it opt-in by default.
(It is assumed the `target.type == test` check is for Xcode support, because
there is no evidence of it in swift-corelibs-xctest.)
--- a/Sources/Build/BuildPlan.swift
+++ b/Sources/Build/BuildPlan.swift
@@ -103,14 +103,7 @@ extension BuildParameters {
--- a/Sources/Build/BuildPlan/BuildPlan.swift
+++ b/Sources/Build/BuildPlan/BuildPlan.swift
@@ -111,14 +111,7 @@
case .off:
addIndexStoreArguments = false
case .auto:

View File

@@ -2,13 +2,18 @@ Nix may already sandbox the build, in which case sandbox_apply will fail.
--- a/Sources/Basics/Sandbox.swift
+++ b/Sources/Basics/Sandbox.swift
@@ -33,12 +33,14 @@ public enum Sandbox {
readOnlyDirectories: [AbsolutePath] = []
@@ -57,6 +57,8 @@
allowNetworkConnections: [SandboxNetworkPermission] = []
) throws -> [String] {
#if os(macOS)
+ let env = ProcessInfo.processInfo.environment
+ if env["NIX_BUILD_TOP"] == nil || env["IN_NIX_SHELL"] != nil {
let profile = try macOSSandboxProfile(strictness: strictness, writableDirectories: writableDirectories, readOnlyDirectories: readOnlyDirectories)
let profile = try macOSSandboxProfile(
fileSystem: fileSystem,
strictness: strictness,
@@ -65,10 +67,10 @@
allowNetworkConnections: allowNetworkConnections
)
return ["/usr/bin/sandbox-exec", "-p", profile] + command
- #else
+ }
@@ -19,3 +24,4 @@ Nix may already sandbox the build, in which case sandbox_apply will fail.
}
/// Basic strictness level of a sandbox applied to a command line.

View File

@@ -3,35 +3,12 @@ command-line runner available, so disable support.
--- a/Sources/Commands/Utilities/TestingSupport.swift
+++ b/Sources/Commands/Utilities/TestingSupport.swift
@@ -72,7 +72,7 @@ enum TestingSupport {
/// - Returns: Array of TestSuite
static func getTestSuites(fromTestAt path: AbsolutePath, swiftTool: SwiftTool, enableCodeCoverage: Bool, sanitizers: [Sanitizer]) throws -> [TestSuite] {
@@ -105,7 +105,7 @@
) throws -> [TestSuite] {
// Run the correct tool.
var args = [String]()
- #if os(macOS)
+ #if false
let data: String = try withTemporaryFile { tempFile in
let args = [try Self.xctestHelperPath(swiftTool: swiftTool).pathString, path.pathString, tempFile.path.pathString]
args = [try Self.xctestHelperPath(swiftTool: swiftTool).pathString, path.pathString, tempFile.path.pathString]
var env = try Self.constructTestEnvironment(
--- a/Sources/swiftpm-xctest-helper/main.swift
+++ b/Sources/swiftpm-xctest-helper/main.swift
@@ -11,8 +11,11 @@
//===----------------------------------------------------------------------===//
#if os(macOS)
-import XCTest
import func Darwin.C.exit
+print("Not supported in Nix.")
+exit(1)
+#if false
+import XCTest
/// A helper tool to get list of tests from a XCTest Bundle on macOS.
///
@@ -134,6 +137,7 @@ do {
exit(1)
}
+#endif // nix
#else
#if os(Windows)

View File

@@ -2,20 +2,20 @@ Swiftpm may invoke clang, not clang++, to compile C++. Our cc-wrapper also
doesn't pick up the arguments that enable C++ compilation in this case. Patch
swiftpm to properly invoke clang++.
--- a/Sources/Build/BuildPlan.swift
+++ b/Sources/Build/BuildPlan.swift
@@ -2089,7 +2089,7 @@ public class BuildPlan: SPMBuildCore.BuildPlan {
--- a/Sources/Build/BuildPlan/BuildPlan+Product.swift
+++ b/Sources/Build/BuildPlan/BuildPlan+Product.swift
@@ -53,7 +53,7 @@
for target in dependencies.staticTargets {
if case let target as ClangTarget = target.underlyingTarget, target.isCXX {
if buildParameters.hostTriple.isDarwin() {
if buildParameters.targetTriple.isDarwin() {
- buildProduct.additionalFlags += ["-lc++"]
+ buildProduct.additionalFlags += ["-lc++", "-lc++abi"]
} else if buildParameters.hostTriple.isWindows() {
} else if buildParameters.targetTriple.isWindows() {
// Don't link any C++ library.
} else {
--- a/Sources/Build/LLBuildManifestBuilder.swift
+++ b/Sources/Build/LLBuildManifestBuilder.swift
@@ -786,7 +786,7 @@ extension LLBuildManifestBuilder {
--- a/Sources/Build/BuildManifest/LLBuildManifestBuilder+Clang.swift
+++ b/Sources/Build/BuildManifest/LLBuildManifestBuilder+Clang.swift
@@ -97,7 +97,7 @@
args += ["-c", path.source.pathString, "-o", path.object.pathString]
@@ -46,7 +46,7 @@ swiftpm to properly invoke clang++.
private let environment: EnvironmentVariables
@@ -196,29 +196,31 @@ public final class UserToolchain: Toolchain {
@@ -262,33 +262,35 @@
}
/// Returns the path to clang compiler tool.
@@ -59,20 +59,24 @@ swiftpm to properly invoke clang++.
}
// Check in the environment variable first.
- if let toolPath = UserToolchain.lookup(variable: "CC", searchPaths: self.envSearchPaths, environment: environment) {
+ let envVar = isCXX ? "CXX" : "CC"
if let toolPath = UserToolchain.lookup(
- variable: "CC",
+ variable: envVar,
searchPaths: self.envSearchPaths,
environment: environment
) {
- self._clangCompiler = toolPath
+ let envVar = isCXX ? "CXX" : "CC";
+ if let toolPath = UserToolchain.lookup(variable: envVar, searchPaths: self.envSearchPaths, environment: environment) {
+ self._clangCompiler[isCXX] = toolPath
return toolPath
}
// Then, check the toolchain.
+ let tool = isCXX ? "clang++" : "clang";
+ let tool = isCXX ? "clang++" : "clang"
do {
- if let toolPath = try? UserToolchain.getTool("clang", binDir: self.destination.toolchainBinDir) {
- if let toolPath = try? UserToolchain.getTool("clang", binDirectories: self.swiftSDK.toolset.rootPaths) {
- self._clangCompiler = toolPath
+ if let toolPath = try? UserToolchain.getTool(tool, binDir: self.destination.binDir) {
+ if let toolPath = try? UserToolchain.getTool(tool, binDirectories: self.swiftSDK.toolset.rootPaths) {
+ self._clangCompiler[isCXX] = toolPath
return toolPath
}
@@ -86,8 +90,9 @@ swiftpm to properly invoke clang++.
return toolPath
}
--- a/Sources/SPMBuildCore/BuildParameters.swift
+++ b/Sources/SPMBuildCore/BuildParameters.swift
--- a/Sources/SPMBuildCore/BuildParameters/BuildParameters.swift
+++ b/Sources/SPMBuildCore/BuildParameters/BuildParameters.swift
@@ -394,7 +394,7 @@ private struct _Toolchain: Encodable {
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
@@ -110,12 +115,12 @@ swiftpm to properly invoke clang++.
settings["LIBRARY_SEARCH_PATHS"] = "$(inherited) \(try buildParameters.toolchain.toolchainLibDir.pathString)"
--- a/Tests/BuildTests/MockBuildTestHelper.swift
+++ b/Tests/BuildTests/MockBuildTestHelper.swift
@@ -23,7 +23,7 @@ struct MockToolchain: PackageModel.Toolchain {
#else
let extraFlags = BuildFlags(cxxCompilerFlags: ["-lstdc++"])
#endif
@@ -36,7 +36,7 @@
let extraFlags = PackageModel.BuildFlags()
let installedSwiftPMConfiguration = InstalledSwiftPMConfiguration.default
- func getClangCompiler() throws -> AbsolutePath {
+ func getClangCompiler(isCXX: Bool) throws -> AbsolutePath {
return AbsolutePath(path: "/fake/path/to/clang")
return "/fake/path/to/clang"
}

View File

@@ -9,7 +9,7 @@ necessary for back-deployment of some features.
public var macosSwiftStdlib: AbsolutePath {
get throws {
+ if swiftCompilerPath.pathString.starts(with: "@storeDir@") {
+ return AbsolutePath("@swiftLib@/lib/swift/macosx")
+ return try AbsolutePath(validating: "@swiftLib@/lib/swift/macosx")
+ }
return try AbsolutePath(validating: "../../lib/swift/macosx", relativeTo: resolveSymlinks(swiftCompilerPath))
}
@@ -18,7 +18,7 @@ necessary for back-deployment of some features.
public var toolchainLibDir: AbsolutePath {
get throws {
+ if swiftCompilerPath.pathString.starts(with: "@storeDir@") {
+ return AbsolutePath("@swiftLib@/lib")
+ return try AbsolutePath(validating: "@swiftLib@/lib")
+ }
// FIXME: Not sure if it's better to base this off of Swift compiler or our own binary.
return try AbsolutePath(validating: "../../lib", relativeTo: resolveSymlinks(swiftCompilerPath))

View File

@@ -0,0 +1,10 @@
Install _CryptoExtras target when building with CMake
--- a/Sources/_CryptoExtras/CMakeLists.txt
+++ b/Sources/_CryptoExtras/CMakeLists.txt
@@ -42,4 +42,5 @@ target_link_options(_CryptoExtras PRIVATE
set_target_properties(_CryptoExtras PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
+_install_target(_CryptoExtras)
set_property(GLOBAL APPEND PROPERTY SWIFT_CRYPTO_EXPORTS _CryptoExtras)

View File

@@ -107,7 +107,7 @@ dontLink=$isFrontend
for p in "${params[@]}"; do
case "$p" in
-enable-cxx-interop | -enable-experimental-cxx-interop)
-cxx-interoperability-mode=default | -enable-cxx-interop | -enable-experimental-cxx-interop)
isCxx=1 ;;
esac
done

View File

@@ -31,7 +31,7 @@ stdenv.mkDerivation {
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
# On Darwin only, Swift uses arm64 as cpu arch.
substituteInPlace cmake/modules/SwiftSupport.cmake \
--replace '"aarch64" PARENT_SCOPE' '"arm64" PARENT_SCOPE'
--replace-fail '"aarch64" PARENT_SCOPE' '"arm64" PARENT_SCOPE'
'';
preConfigure = ''