Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions pkgs/by-name/ov/ovftool/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ stdenv.mkDerivation {
glibc
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.Libsystem
libxml2
];

Expand Down Expand Up @@ -186,7 +185,6 @@ stdenv.mkDerivation {
done

# Patches for ovftool binary
change_args+=(-change /usr/lib/libSystem.B.dylib ${darwin.Libsystem}/lib/libSystem.B.dylib)
change_args+=(-change /usr/lib/libc++.1.dylib ${stdenv.cc.libcxx}/lib/libc++.1.dylib)
change_args+=(-change /usr/lib/libiconv.2.dylib ${libiconv}/lib/libiconv.2.dylib)
change_args+=(-change /usr/lib/libxml2.2.dylib ${libxml2}/lib/libxml2.2.dylib)
Expand All @@ -201,7 +199,7 @@ stdenv.mkDerivation {
install_name_tool "''${change_args[@]}" "$out/libexec/ovftool"

# Additional patches for ovftool dylibs
change_args+=(-change /usr/lib/libresolv.9.dylib ${darwin.Libsystem}/lib/libresolv.9.dylib)
change_args+=(-change /usr/lib/libresolv.9.dylib ${lib.getLib darwin.libresolv}/lib/libresolv.9.dylib)
change_args+=(-change @loader_path/libcares.2.dylib ${c-ares}/lib/libcares.2.dylib)
change_args+=(-change @loader_path/libexpat.dylib ${expat}/lib/libexpat.dylib)
change_args+=(-change @loader_path/libicudata.60.2.dylib ${icu60}/lib/libicudata.60.2.dylib)
Expand Down
4 changes: 0 additions & 4 deletions pkgs/by-name/po/powershell/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
libuuid,
libunwind,
openssl,
darwin,
lttng-ust,
pam,
testers,
Expand Down Expand Up @@ -59,9 +58,6 @@ stdenv.mkDerivation rec {
libunwind
openssl
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.Libsystem
]
++ lib.optionals stdenv.hostPlatform.isLinux [
lttng-ust
pam
Expand Down
2 changes: 0 additions & 2 deletions pkgs/by-name/ps/psc-package/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
gmp,
zlib,
libiconv,
darwin,
installShellFiles,
}:

Expand Down Expand Up @@ -52,7 +51,6 @@ stdenv.mkDerivation rec {
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
install_name_tool \
-change /usr/lib/libSystem.B.dylib ${darwin.Libsystem}/lib/libSystem.B.dylib \
-change /usr/lib/libiconv.2.dylib ${libiconv}/libiconv.2.dylib \
$PSC_PACKAGE
''
Expand Down
26 changes: 17 additions & 9 deletions pkgs/development/compilers/ponyc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
lib,
stdenv,
fetchFromGitHub,
apple-sdk_13,
cmake,
coreutils,
darwinMinVersionHook,
libxml2,
lto ? true,
makeWrapper,
Expand All @@ -17,7 +19,6 @@
which,
z3,
cctools,
darwin,
}:

stdenv.mkDerivation (rec {
Expand Down Expand Up @@ -48,13 +49,20 @@ stdenv.mkDerivation (rec {
hash = "sha256-W+OxRTVtemt2esw4P7IyGWXOonUN5ZuscjvzqkYvZbM=";
};

nativeBuildInputs = [
cmake
makeWrapper
which
python3
git
] ++ lib.optionals (stdenv.hostPlatform.isDarwin) [ cctools ];
nativeBuildInputs =
[
cmake
makeWrapper
which
python3
git
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# Keep in sync with `PONY_OSX_PLATFORM`.
apple-sdk_13
(darwinMinVersionHook "13.0")
cctools.libtool
];

buildInputs = [
libxml2
Expand All @@ -68,7 +76,7 @@ stdenv.mkDerivation (rec {
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
(replaceVars ./fix-darwin-build.patch {
libSystem = darwin.Libsystem;
apple-sdk = apple-sdk_13;
})
];

Expand Down
15 changes: 5 additions & 10 deletions pkgs/development/compilers/ponyc/fix-darwin-build.patch
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
diff --git a/src/libponyc/codegen/genexe.c b/src/libponyc/codegen/genexe.c
index 9ae3ff16..fdfe2bc5 100644
index 3f0348eaa1..76b03030bf 100644
--- a/src/libponyc/codegen/genexe.c
+++ b/src/libponyc/codegen/genexe.c
@@ -296,10 +296,10 @@ static bool link_exe(compile_t* c, ast_t* program,
char* ld_cmd = (char*)ponyint_pool_alloc_size(ld_len);

@@ -308,7 +308,7 @@
snprintf(ld_cmd, ld_len,
- "%s -execute -arch %.*s "
+ "%s -execute "
"%s -execute -arch %.*s "
"-o %s %s %s %s "
- "-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem %s -platform_version macos '" STR(PONY_OSX_PLATFORM) "' '0.0.0'",
- linker, (int)arch_len, c->opt->triple, file_exe, file_o,
+ "-L@libSystem@/lib -lSystem %s -platform_version macos '" STR(PONY_OSX_PLATFORM) "' '0.0.0'",
+ linker, file_exe, file_o,
+ "-L\"${SDKROOT:-${DEVELOPER_DIR:-@apple-sdk@}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk}/usr/lib\" -lSystem %s -platform_version macos '" STR(PONY_OSX_PLATFORM) "' '0.0.0'",
linker, (int)arch_len, c->opt->triple, file_exe, file_o,
lib_args, ponyrt, sanitizer_arg
);

15 changes: 4 additions & 11 deletions pkgs/development/compilers/smlnj/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
lib,
stdenv,
fetchurl,
Libsystem,
}:
let
version = "110.99.7.1";
Expand Down Expand Up @@ -62,16 +61,10 @@ stdenv.mkDerivation {
./config/unpack $TMP runtime
'';

patchPhase =
''
sed -i '/^PATH=/d' config/_arch-n-opsys base/runtime/config/gen-posix-names.sh
echo SRCARCHIVEURL="file:/$TMP" > config/srcarchiveurl
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
# Locate standard headers like <unistd.h>
substituteInPlace base/runtime/config/gen-posix-names.sh \
--replace "\$SDK_PATH/usr" "${Libsystem}"
'';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This substitution is definitely necessary on MacOS, are you able to replace Libsystem with darwin.Libsystem or whatever the non-deprecated value is?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think it is necessary. If you look at the source, it only applies to what they call x86-darwin, which to my understanding is the 32‐bit i686-darwin platform that we no longer support in Nixpkgs at all. The amd64-darwin path does XCODE_SDK_PATH=`xcrun --show-sdk-path`, which is exactly the correct thing to do, both with the native Apple toolchain and with the new Nixpkgs Darwin SDK pattern. I checked other parts of the build system too, and it seemed like they should all do the right thing on x86_64-darwin.

Note that darwin.Libsystem has been an empty stub package since 24.11, so insofar as this was necessary it would have been broken for an entire release cycle already.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You’re right — it does work without the patch.

patchPhase = ''
sed -i '/^PATH=/d' config/_arch-n-opsys base/runtime/config/gen-posix-names.sh
echo SRCARCHIVEURL="file:/$TMP" > config/srcarchiveurl
'';

buildPhase = ''
./config/install.sh -default ${arch}
Expand Down
4 changes: 1 addition & 3 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6560,9 +6560,7 @@ with pkgs;
};
# smlnjBootstrap should be redundant, now that smlnj works on Darwin natively
smlnjBootstrap = callPackage ../development/compilers/smlnj/bootstrap.nix { };
smlnj = callPackage ../development/compilers/smlnj {
inherit (darwin) Libsystem;
};
smlnj = callPackage ../development/compilers/smlnj { };

sqlx-cli = callPackage ../development/tools/rust/sqlx-cli { };

Expand Down