Skip to content
23 changes: 7 additions & 16 deletions pkgs/by-name/gi/gildas/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
perl,
groff,
which,
darwin,
ncurses,
}:

Expand Down Expand Up @@ -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 ]
Expand All @@ -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}
Expand Down
23 changes: 23 additions & 0 deletions pkgs/by-name/od/odin/darwin-remove-impure-links.patch
Original file line number Diff line number Diff line change
@@ -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) {
21 changes: 3 additions & 18 deletions pkgs/by-name/od/odin/package.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
{
fetchFromGitHub,
lib,
libiconv,
llvmPackages,
MacOSX-SDK,
makeBinaryWrapper,
nix-update-script,
Security,
which,
}:

Expand All @@ -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";

Expand All @@ -46,11 +36,6 @@ stdenv.mkDerivation {
which
];

buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
libiconv
Security
];

installPhase = ''
runHook preInstall

Expand Down
61 changes: 23 additions & 38 deletions pkgs/by-name/op/opensc/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
docbook_xsl,
libxslt,
docbook_xml_dtd_412,
darwin,
nix-update-script,
withApplePCSC ? stdenv.hostPlatform.isDarwin,
}:

stdenv.mkDerivation rec {
Expand All @@ -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"
Expand Down
35 changes: 9 additions & 26 deletions pkgs/development/libraries/bullet/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
libGLU,
libGL,
libglut,
Cocoa,
OpenGL,
}:

stdenv.mkDerivation rec {
Expand All @@ -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 =
[
Expand All @@ -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"
Expand Down
27 changes: 5 additions & 22 deletions pkgs/development/libraries/bullet/roboschool-fork.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
libGLU,
libGL,
libglut,
Cocoa,
OpenGL,
}:

stdenv.mkDerivation {
Expand All @@ -26,36 +24,21 @@ 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"
"-DBUILD_CPU_DEMOS=OFF"
"-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"
];
Expand Down
20 changes: 1 addition & 19 deletions pkgs/development/libraries/libsamplerate/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -23,12 +16,7 @@ stdenv.mkDerivation rec {
};

nativeBuildInputs = [ pkg-config ];
buildInputs =
[ libsndfile ]
++ optionals stdenv.hostPlatform.isDarwin [
ApplicationServices
CoreServices
];
buildInputs = [ libsndfile ];

configureFlags = [ "--disable-fftw" ];

Expand All @@ -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/";
Expand Down
26 changes: 6 additions & 20 deletions pkgs/development/libraries/netcdf-fortran/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
hdf5,
curl,
gfortran,
CoreFoundation,
CoreServices,
SystemConfiguration,
}:
stdenv.mkDerivation rec {
pname = "netcdf-fortran";
Expand All @@ -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" ];
Expand Down
Loading