mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-02 02:03:21 +00:00
swift-wrapper: set up Darwin SDK paths for Swift
This commit is contained in:
parent
e694240f77
commit
7d5f19a354
@ -18,6 +18,10 @@ stdenv.mkDerivation (swift._wrapperParams // {
|
|||||||
swiftStaticModuleSubdir swiftStaticLibSubdir;
|
swiftStaticModuleSubdir swiftStaticLibSubdir;
|
||||||
swiftDriver = lib.optionalString useSwiftDriver "${swift-driver}/bin/swift-driver";
|
swiftDriver = lib.optionalString useSwiftDriver "${swift-driver}/bin/swift-driver";
|
||||||
|
|
||||||
|
env.darwinMinVersion = lib.optionalString stdenv.targetPlatform.isDarwin (
|
||||||
|
stdenv.targetPlatform.darwinMinVersion
|
||||||
|
);
|
||||||
|
|
||||||
passAsFile = [ "buildCommand" ];
|
passAsFile = [ "buildCommand" ];
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
mkdir -p $out/bin $out/nix-support
|
mkdir -p $out/bin $out/nix-support
|
||||||
@ -48,6 +52,13 @@ stdenv.mkDerivation (swift._wrapperParams // {
|
|||||||
ln -s ${swift.lib}/lib $out/lib
|
ln -s ${swift.lib}/lib $out/lib
|
||||||
|
|
||||||
substituteAll ${./setup-hook.sh} $out/nix-support/setup-hook
|
substituteAll ${./setup-hook.sh} $out/nix-support/setup-hook
|
||||||
|
|
||||||
|
# Propagate any propagated inputs from the unwrapped Swift compiler, if any.
|
||||||
|
if [ -e "$swift/nix-support" ]; then
|
||||||
|
for input in "$swift/nix-support/"*propagated*; do
|
||||||
|
cp "$input" "$out/nix-support/$(basename "$input")"
|
||||||
|
done
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
|
@ -156,6 +156,14 @@ if [ -z "${NIX_CC_WRAPPER_FLAGS_SET_@suffixSalt@:-}" ]; then
|
|||||||
source $cc_wrapper/nix-support/add-flags.sh
|
source $cc_wrapper/nix-support/add-flags.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Only add darwin min version flag and set up `DEVELOPER_DIR` if a default darwin min version is set,
|
||||||
|
# which is a signal that we're targeting darwin. (Copied from add-flags in libc but tailored for Swift).
|
||||||
|
if [ "@darwinMinVersion@" ]; then
|
||||||
|
# Make sure the wrapped Swift compiler can find the overlays in the SDK.
|
||||||
|
NIX_SWIFTFLAGS_COMPILE+=" -I $SDKROOT/usr/lib/swift"
|
||||||
|
NIX_LDFLAGS_@suffixSalt@+=" -L $SDKROOT/usr/lib/swift"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$isCxx" = 1 ]]; then
|
if [[ "$isCxx" = 1 ]]; then
|
||||||
if [[ "$cxxInclude" = 1 ]]; then
|
if [[ "$cxxInclude" = 1 ]]; then
|
||||||
NIX_CFLAGS_COMPILE_@suffixSalt@+=" $NIX_CXXSTDLIB_COMPILE_@suffixSalt@"
|
NIX_CFLAGS_COMPILE_@suffixSalt@+=" $NIX_CXXSTDLIB_COMPILE_@suffixSalt@"
|
||||||
|
Loading…
Reference in New Issue
Block a user