treewide: Remove use of apple_sdk framework stub paths (#399040)

This commit is contained in:
Emily 2025-04-19 16:47:19 +01:00 committed by GitHub
commit bd79acabab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 97 additions and 228 deletions

View File

@ -12,7 +12,6 @@
perl,
groff,
which,
darwin,
ncurses,
}:
@ -49,17 +48,13 @@ stdenv.mkDerivation rec {
which
];
buildInputs =
[
gtk2-x11
lesstif
cfitsio
python3Env
ncurses
]
++ lib.optionals stdenv.hostPlatform.isDarwin (
with darwin.apple_sdk.frameworks; [ CoreFoundation ]
);
buildInputs = [
gtk2-x11
lesstif
cfitsio
python3Env
ncurses
];
patches =
[ ./wrapper.patch ]
@ -73,10 +68,6 @@ stdenv.mkDerivation rec {
# Workaround for https://github.com/NixOS/nixpkgs/issues/304528
env.GAG_CPP = lib.optionalString stdenv.hostPlatform.isDarwin "${gfortran.outPath}/bin/cpp";
NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin (
with darwin.apple_sdk.frameworks; "-F${CoreFoundation}/Library/Frameworks"
);
configurePhase = ''
substituteInPlace admin/wrapper.sh --replace '%%OUT%%' $out
substituteInPlace admin/wrapper.sh --replace '%%PYTHONHOME%%' ${python3Env}

View File

@ -0,0 +1,23 @@
diff --git a/src/linker.cpp b/src/linker.cpp
index ec165ef7d..91a28b8fc 100644
--- a/src/linker.cpp
+++ b/src/linker.cpp
@@ -769,18 +769,6 @@ try_cross_linking:;
gbString platform_lib_str = gb_string_make(heap_allocator(), "");
defer (gb_string_free(platform_lib_str));
if (build_context.metrics.os == TargetOs_darwin) {
- platform_lib_str = gb_string_appendc(platform_lib_str, "-Wl,-syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/usr/local/lib ");
-
- // Homebrew's default library path, checking if it exists to avoid linking warnings.
- if (gb_file_exists("/opt/homebrew/lib")) {
- platform_lib_str = gb_string_appendc(platform_lib_str, "-L/opt/homebrew/lib ");
- }
-
- // MacPort's default library path, checking if it exists to avoid linking warnings.
- if (gb_file_exists("/opt/local/lib")) {
- platform_lib_str = gb_string_appendc(platform_lib_str, "-L/opt/local/lib ");
- }
-
// Only specify this flag if the user has given a minimum version to target.
// This will cause warnings to show up for mismatched libraries.
if (build_context.minimum_os_version_string_given) {

View File

@ -1,12 +1,9 @@
{
fetchFromGitHub,
lib,
libiconv,
llvmPackages,
MacOSX-SDK,
makeBinaryWrapper,
nix-update-script,
Security,
which,
}:
@ -24,16 +21,9 @@ stdenv.mkDerivation {
hash = "sha256-GXea4+OIFyAhTqmDh2q+ewTUqI92ikOsa2s83UH2r58=";
};
postPatch =
lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace src/linker.cpp \
--replace-fail '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' ${MacOSX-SDK}
''
+ ''
substituteInPlace build_odin.sh \
--replace-fail '-framework System' '-lSystem'
patchShebangs build_odin.sh
'';
patches = [
./darwin-remove-impure-links.patch
];
LLVM_CONFIG = "${llvmPackages.llvm.dev}/bin/llvm-config";
@ -46,11 +36,6 @@ stdenv.mkDerivation {
which
];
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
libiconv
Security
];
installPhase = ''
runHook preInstall

View File

@ -14,9 +14,7 @@
docbook_xsl,
libxslt,
docbook_xml_dtd_412,
darwin,
nix-update-script,
withApplePCSC ? stdenv.hostPlatform.isDarwin,
}:
stdenv.mkDerivation rec {
@ -35,46 +33,33 @@ stdenv.mkDerivation rec {
autoreconfHook
libxslt # xsltproc
];
buildInputs =
[
zlib
readline
openssl
libassuan
libXt
libiconv
docbook_xml_dtd_412
]
++ lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.frameworks.Carbon
++ (if withApplePCSC then [ darwin.apple_sdk.frameworks.PCSC ] else [ pcsclite ]);
buildInputs = [
zlib
readline
openssl
libassuan
libXt
libiconv
docbook_xml_dtd_412
] ++ lib.optional (!stdenv.hostPlatform.isDarwin) pcsclite;
env.NIX_CFLAGS_COMPILE = "-Wno-error";
configureFlags = [
"--enable-zlib"
"--enable-readline"
"--enable-openssl"
"--enable-pcsc"
"--enable-sm"
"--enable-man"
"--enable-doc"
"--localstatedir=/var"
"--sysconfdir=/etc"
"--with-xsl-stylesheetsdir=${docbook_xsl}/xml/xsl/docbook"
"--with-pcsc-provider=${
if withApplePCSC then
"${darwin.apple_sdk.frameworks.PCSC}/Library/Frameworks/PCSC.framework/PCSC"
else
"${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}"
}"
];
PCSC_CFLAGS = lib.concatStringsSep " " (
lib.optionals withApplePCSC [
"-I${darwin.apple_sdk.frameworks.PCSC}/Library/Frameworks/PCSC.framework/Headers"
"-I${lib.getDev pcsclite}/include/PCSC"
configureFlags =
[
"--enable-zlib"
"--enable-readline"
"--enable-openssl"
"--enable-pcsc"
"--enable-sm"
"--enable-man"
"--enable-doc"
"--localstatedir=/var"
"--sysconfdir=/etc"
"--with-xsl-stylesheetsdir=${docbook_xsl}/xml/xsl/docbook"
]
);
++ lib.optional (!stdenv.hostPlatform.isDarwin)
"--with-pcsc-provider=${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}";
installFlags = [
"sysconfdir=$(out)/etc"

View File

@ -6,8 +6,6 @@
libGLU,
libGL,
libglut,
Cocoa,
OpenGL,
}:
stdenv.mkDerivation rec {
@ -22,26 +20,16 @@ stdenv.mkDerivation rec {
};
nativeBuildInputs = [ cmake ];
buildInputs =
lib.optionals stdenv.hostPlatform.isLinux [
libGLU
libGL
libglut
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
Cocoa
OpenGL
];
buildInputs = [
libGLU
libGL
libglut
];
postPatch =
''
substituteInPlace examples/ThirdPartyLibs/Gwen/CMakeLists.txt \
--replace "-DGLEW_STATIC" "-DGLEW_STATIC -Wno-narrowing"
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
sed -i 's/FIND_PACKAGE(OpenGL)//' CMakeLists.txt
sed -i 's/FIND_LIBRARY(COCOA_LIBRARY Cocoa)//' CMakeLists.txt
'';
postPatch = ''
substituteInPlace examples/ThirdPartyLibs/Gwen/CMakeLists.txt \
--replace "-DGLEW_STATIC" "-DGLEW_STATIC -Wno-narrowing"
'';
cmakeFlags =
[
@ -50,11 +38,6 @@ stdenv.mkDerivation rec {
"-DINSTALL_EXTRA_LIBS=ON"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
"-DOPENGL_FOUND=true"
"-DOPENGL_LIBRARIES=${OpenGL}/Library/Frameworks/OpenGL.framework"
"-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks/OpenGL.framework"
"-DOPENGL_gl_LIBRARY=${OpenGL}/Library/Frameworks/OpenGL.framework"
"-DCOCOA_LIBRARY=${Cocoa}/Library/Frameworks/Cocoa.framework"
"-DBUILD_BULLET2_DEMOS=OFF"
"-DBUILD_UNIT_TESTS=OFF"
"-DBUILD_BULLET_ROBOTICS_GUI_EXTRA=OFF"

View File

@ -6,8 +6,6 @@
libGLU,
libGL,
libglut,
Cocoa,
OpenGL,
}:
stdenv.mkDerivation {
@ -26,24 +24,14 @@ stdenv.mkDerivation {
};
nativeBuildInputs = [ cmake ];
buildInputs =
lib.optionals stdenv.hostPlatform.isLinux [
libGLU
libGL
libglut
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
Cocoa
OpenGL
];
buildInputs = [
libGLU
libGL
libglut
];
patches = [ ./gwen-narrowing.patch ];
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
sed -i 's/FIND_PACKAGE(OpenGL)//' CMakeLists.txt
sed -i 's/FIND_LIBRARY(COCOA_LIBRARY Cocoa)//' CMakeLists.txt
'';
cmakeFlags =
[
"-DBUILD_SHARED_LIBS=ON"
@ -51,11 +39,6 @@ stdenv.mkDerivation {
"-DINSTALL_EXTRA_LIBS=ON"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
"-DOPENGL_FOUND=true"
"-DOPENGL_LIBRARIES=${OpenGL}/Library/Frameworks/OpenGL.framework"
"-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks/OpenGL.framework"
"-DOPENGL_gl_LIBRARY=${OpenGL}/Library/Frameworks/OpenGL.framework"
"-DCOCOA_LIBRARY=${Cocoa}/Library/Frameworks/Cocoa.framework"
"-DBUILD_BULLET2_DEMOS=OFF"
"-DBUILD_UNIT_TESTS=OFF"
];

View File

@ -4,15 +4,8 @@
fetchurl,
pkg-config,
libsndfile,
ApplicationServices,
Carbon,
CoreServices,
}:
let
inherit (lib) optionals optionalString;
in
stdenv.mkDerivation rec {
pname = "libsamplerate";
version = "0.2.2";
@ -23,12 +16,7 @@ stdenv.mkDerivation rec {
};
nativeBuildInputs = [ pkg-config ];
buildInputs =
[ libsndfile ]
++ optionals stdenv.hostPlatform.isDarwin [
ApplicationServices
CoreServices
];
buildInputs = [ libsndfile ];
configureFlags = [ "--disable-fftw" ];
@ -37,12 +25,6 @@ stdenv.mkDerivation rec {
"out"
];
postConfigure = optionalString stdenv.hostPlatform.isDarwin ''
# need headers from the Carbon.framework in /System/Library/Frameworks to
# compile this on darwin -- not sure how to handle
NIX_CFLAGS_COMPILE+=" -I${Carbon}/Library/Frameworks/Carbon.framework/Headers"
'';
meta = with lib; {
description = "Sample Rate Converter for audio";
homepage = "https://libsndfile.github.io/libsamplerate/";

View File

@ -6,9 +6,6 @@
hdf5,
curl,
gfortran,
CoreFoundation,
CoreServices,
SystemConfiguration,
}:
stdenv.mkDerivation rec {
pname = "netcdf-fortran";
@ -22,23 +19,12 @@ stdenv.mkDerivation rec {
};
nativeBuildInputs = [ gfortran ];
buildInputs =
[
netcdf
hdf5
curl
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
CoreFoundation
CoreServices
SystemConfiguration
];
env.NIX_LDFLAGS = toString (
lib.optionals stdenv.hostPlatform.isDarwin [
"-F${CoreServices}/Library/Frameworks"
"-F${SystemConfiguration}/Library/Frameworks"
]
);
buildInputs = [
netcdf
hdf5
curl
];
doCheck = true;
FFLAGS = [ "-std=legacy" ];

View File

@ -15,7 +15,6 @@
cython,
fetchFromGitHub,
git,
darwin,
jsoncpp,
nsync,
openssl,
@ -409,10 +408,8 @@ let
);
# Note: we cannot do most of this patching at `patch` phase as the deps
# are not available yet. Framework search paths aren't added by bintools
# hook. See https://github.com/NixOS/nixpkgs/pull/41914.
# are not available yet.
preBuild = lib.optionalString effectiveStdenv.hostPlatform.isDarwin ''
export NIX_LDFLAGS+=" -F${darwin.apple_sdk.frameworks.IOKit}/Library/Frameworks"
substituteInPlace ../output/external/rules_cc/cc/private/toolchain/osx_cc_wrapper.sh.tpl \
--replace "/usr/bin/install_name_tool" "${cctools}/bin/install_name_tool"
substituteInPlace ../output/external/rules_cc/cc/private/toolchain/unix_cc_configure.bzl \

View File

@ -2,7 +2,6 @@
lib,
buildPythonPackage,
fetchFromGitHub,
PCSC,
pcsclite,
pkg-config,
pytestCheckHook,
@ -11,11 +10,6 @@
swig,
}:
let
# Package does not support configuring the pcsc library.
withApplePCSC = stdenv.hostPlatform.isDarwin;
in
buildPythonPackage rec {
pname = "pyscard";
version = "2.2.1";
@ -30,9 +24,9 @@ buildPythonPackage rec {
build-system = [ setuptools ];
nativeBuildInputs = [ swig ] ++ lib.optionals (!withApplePCSC) [ pkg-config ];
nativeBuildInputs = [ swig ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ pkg-config ];
buildInputs = if withApplePCSC then [ PCSC ] else [ pcsclite ];
buildInputs = lib.optionals (!stdenv.hostPlatform.isDarwin) [ pcsclite ];
nativeCheckInputs = [ pytestCheckHook ];
@ -41,21 +35,12 @@ buildPythonPackage rec {
substituteInPlace pyproject.toml \
--replace-fail 'requires = ["setuptools","swig"]' 'requires = ["setuptools"]'
''
+ (
if withApplePCSC then
''
substituteInPlace src/smartcard/scard/winscarddll.c \
--replace-fail "/System/Library/Frameworks/PCSC.framework/PCSC" \
"${PCSC}/Library/Frameworks/PCSC.framework/PCSC"
''
else
''
substituteInPlace setup.py --replace-fail "pkg-config" "$PKG_CONFIG"
substituteInPlace src/smartcard/scard/winscarddll.c \
--replace-fail "libpcsclite.so.1" \
"${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}"
''
);
+ lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
substituteInPlace setup.py --replace-fail "pkg-config" "$PKG_CONFIG"
substituteInPlace src/smartcard/scard/winscarddll.c \
--replace-fail "libpcsclite.so.1" \
"${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}"
'';
meta = {
description = "Smartcard library for python";

View File

@ -10,9 +10,7 @@
runLocal,
runtimeShell,
writeScript,
writeText,
distDir,
Foundation ? null,
}:
let
@ -58,10 +56,6 @@ let
+ lib.optionalString (stdenv.hostPlatform.isDarwin) ''
--cxxopt=-x --cxxopt=c++ --host_cxxopt=-x --host_cxxopt=c++ \
--linkopt=-stdlib=libc++ --host_linkopt=-stdlib=libc++ \
''
+ lib.optionalString (stdenv.hostPlatform.isDarwin && Foundation != null) ''
--linkopt=-Wl,-F${Foundation}/Library/Frameworks \
--linkopt=-L${darwin.libobjc}/lib \
'';
};

View File

@ -48,10 +48,6 @@
libxslt,
libxcrypt,
hwdata,
ApplicationServices,
Carbon,
Cocoa,
Xplugin,
xorg,
windows,
libgbm,
@ -1220,9 +1216,6 @@ self: super:
bootstrap_cmds
automake
autoconf
Xplugin
Carbon
Cocoa
mesa
];
propagatedBuildInputs = commonPropagatedBuildInputs ++ [
@ -1281,7 +1274,6 @@ self: super:
preConfigure = ''
mkdir -p $out/Applications
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -Wno-error"
substituteInPlace hw/xquartz/pbproxy/Makefile.in --replace -F/System -F${ApplicationServices}
'';
postInstall = ''
rm -fr $out/share/X11/xkb/compiled
@ -1322,15 +1314,12 @@ self: super:
"--without-dtrace"
];
buildInputs =
old.buildInputs
++ [
xorg.pixman
xorg.libXfont2
xorg.xtrans
xorg.libxcvt
]
++ lib.optional stdenv.hostPlatform.isDarwin [ Xplugin ];
buildInputs = old.buildInputs ++ [
xorg.pixman
xorg.libXfont2
xorg.xtrans
xorg.libxcvt
];
});
lndir = super.lndir.overrideAttrs (attrs: {

View File

@ -4455,9 +4455,7 @@ with pkgs;
hdf5 = hdf5-mpi.override { usev110Api = true; };
};
netcdffortran = callPackage ../development/libraries/netcdf-fortran {
inherit (darwin.apple_sdk.frameworks) CoreFoundation CoreServices SystemConfiguration;
};
netcdffortran = callPackage ../development/libraries/netcdf-fortran { };
inherit (callPackage ../servers/web-apps/netbox { }) netbox_3_7;
@ -10155,9 +10153,7 @@ with pkgs;
memHierarchy = "L3:16/64/8192K,L2:16/64/2048K,L1:8/64/16K";
};
libsamplerate = callPackage ../development/libraries/libsamplerate {
inherit (darwin.apple_sdk.frameworks) ApplicationServices Carbon CoreServices;
};
libsamplerate = callPackage ../development/libraries/libsamplerate { };
# GNU libc provides libiconv so systems with glibc don't need to
# build libiconv separately. Additionally, Apple forked/repackaged
@ -12602,8 +12598,6 @@ with pkgs;
# so as not to have the newly bound xorg items already in scope, which would
# have created a cycle.
overrides = lib.callPackageWith __splicedPackages ../servers/x11/xorg/overrides.nix {
inherit (darwin.apple_sdk.frameworks) ApplicationServices Carbon Cocoa;
inherit (darwin.apple_sdk.libs) Xplugin;
inherit (buildPackages.darwin) bootstrap_cmds;
udev = if stdenv.hostPlatform.isLinux then udev else null;
libdrm = if stdenv.hostPlatform.isLinux then libdrm else null;
@ -13043,8 +13037,6 @@ with pkgs;
};
odin = callPackage ../by-name/od/odin/package.nix {
inherit (pkgs.darwin.apple_sdk_11_0) MacOSX-SDK;
inherit (pkgs.darwin.apple_sdk_11_0.frameworks) Security;
llvmPackages = llvmPackages_18;
};
@ -19208,13 +19200,9 @@ with pkgs;
zncModules = recurseIntoAttrs (callPackage ../applications/networking/znc/modules.nix { });
bullet = callPackage ../development/libraries/bullet {
inherit (darwin.apple_sdk.frameworks) Cocoa OpenGL;
};
bullet = callPackage ../development/libraries/bullet { };
bullet-roboschool = callPackage ../development/libraries/bullet/roboschool-fork.nix {
inherit (darwin.apple_sdk.frameworks) Cocoa OpenGL;
};
bullet-roboschool = callPackage ../development/libraries/bullet/roboschool-fork.nix { };
dart = callPackage ../development/compilers/dart { };

View File

@ -13208,9 +13208,7 @@ self: super: with self; {
pyscaffoldext-travis = callPackage ../development/python-modules/pyscaffoldext-travis { };
pyscard = callPackage ../development/python-modules/pyscard {
inherit (pkgs.darwin.apple_sdk.frameworks) PCSC;
};
pyscard = callPackage ../development/python-modules/pyscard { };
pyscf = callPackage ../development/python-modules/pyscf { };