From 4ec0338fc623d3ea74f0edd611898764561f3385 Mon Sep 17 00:00:00 2001 From: Linus Karl Date: Sun, 11 Jan 2026 16:49:05 +0100 Subject: [PATCH] indi-3rdparty: fix build on darwin The autopatchelfhook does not work with Mach-O binaries so remove it on darwin --- .../astronomy/indilib/indi-3rdparty.nix | 162 +++++++++++++++--- 1 file changed, 137 insertions(+), 25 deletions(-) diff --git a/pkgs/development/libraries/science/astronomy/indilib/indi-3rdparty.nix b/pkgs/development/libraries/science/astronomy/indilib/indi-3rdparty.nix index 6d6d242b8225..c6b575f86d81 100644 --- a/pkgs/development/libraries/science/astronomy/indilib/indi-3rdparty.nix +++ b/pkgs/development/libraries/science/astronomy/indilib/indi-3rdparty.nix @@ -127,6 +127,11 @@ let libaltaircam = buildIndi3rdParty { pname = "libaltaircam"; + + postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt + ''; + meta = { license = lib.licenses.unfreeRedistributable; platforms = with lib.platforms; x86_64 ++ aarch64 ++ arm; @@ -140,7 +145,7 @@ let indilib libusb1 ]; - nativeBuildInputs = [ autoPatchelfHook ]; + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; cmakeFlags = [ "-DCONF_DIR=etc/" ]; meta = { license = lib.licenses.mpl20; @@ -152,6 +157,7 @@ let pname = "libasi"; postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt substituteInPlace 99-asi.rules \ --replace-fail "/bin/echo" "${lib.getBin coreutils}/bin/echo" \ --replace-fail "/bin/sh" "${lib.getExe bash}" \ @@ -162,32 +168,55 @@ let libusb1 (lib.getLib stdenv.cc.cc) ]; - nativeBuildInputs = [ autoPatchelfHook ]; + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; - platforms = with lib.platforms; x86_64 ++ aarch64 ++ i686 ++ arm; + platforms = [ + "i686-linux" + "x86_64-linux" + "armv6l-linux" + "armv7l-linux" + "aarch64-linux" + "x86_64-darwin" + ]; }; }; libastroasis = buildIndi3rdParty { pname = "libastroasis"; + + postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt + ''; + buildInputs = [ (lib.getLib stdenv.cc.cc) ]; - nativeBuildInputs = [ autoPatchelfHook ]; + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; - platforms = with lib.platforms; x86_64 ++ aarch64 ++ arm; + platforms = [ + "i686-linux" + "x86_64-linux" + "armv6l-linux" + "armv7l-linux" + "x86_64-darwin" + ]; }; }; libatik = buildIndi3rdParty { pname = "libatik"; + + postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt + ''; + buildInputs = [ (lib.getLib stdenv.cc.cc) libusb1 systemd libdc1394 ]; - nativeBuildInputs = [ autoPatchelfHook ]; + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; platforms = with lib.platforms; x86_64 ++ aarch64 ++ i686 ++ arm; @@ -196,7 +225,12 @@ let libbressercam = buildIndi3rdParty { pname = "libbressercam"; - nativeBuildInputs = [ autoPatchelfHook ]; + + postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt + ''; + + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; platforms = with lib.platforms; x86_64 ++ aarch64 ++ arm; @@ -242,13 +276,24 @@ let nativeBuildInputs = [ autoPatchelfHook ]; meta = { license = lib.licenses.unfreeRedistributable; - platforms = with lib.platforms; x86_64 ++ aarch64 ++ arm ++ i686; + platforms = [ + "i686-linux" + "x86_64-linux" + "armv6l-linux" + "armv7l-linux" + "aarch64-linux" + ]; }; }; libmallincam = buildIndi3rdParty { pname = "libmallincam"; - nativeBuildInputs = [ autoPatchelfHook ]; + + postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt + ''; + + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; platforms = with lib.platforms; x86_64 ++ aarch64 ++ arm; @@ -257,6 +302,11 @@ let libmeadecam = buildIndi3rdParty { pname = "libmeadecam"; + + postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt + ''; + buildInputs = [ libusb1 ]; meta = { license = lib.licenses.lgpl21Only; @@ -266,8 +316,13 @@ let libmicam = buildIndi3rdParty { pname = "libmicam"; + + postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt + ''; + buildInputs = [ libusb1 ]; - nativeBuildInputs = [ autoPatchelfHook ]; + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; platforms = with lib.platforms; x86_64 ++ aarch64 ++ arm ++ i686; @@ -276,7 +331,12 @@ let libnncam = buildIndi3rdParty { pname = "libnncam"; - nativeBuildInputs = [ autoPatchelfHook ]; + + postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt + ''; + + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; platforms = with lib.platforms; x86_64 ++ aarch64 ++ arm; @@ -285,7 +345,12 @@ let libogmacam = buildIndi3rdParty { pname = "libogmacam"; - nativeBuildInputs = [ autoPatchelfHook ]; + + postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt + ''; + + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; platforms = with lib.platforms; x86_64 ++ aarch64 ++ arm; @@ -294,7 +359,12 @@ let libomegonprocam = buildIndi3rdParty { pname = "libomegonprocam"; - nativeBuildInputs = [ autoPatchelfHook ]; + + postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt + ''; + + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; platforms = with lib.platforms; x86_64 ++ aarch64 ++ arm; @@ -330,7 +400,9 @@ let libplayerone = buildIndi3rdParty { pname = "libplayerone"; + postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt substituteInPlace 99-player_one_astronomy.rules \ --replace-fail "/bin/echo" "${lib.getBin coreutils}/bin/echo" \ --replace-fail "/bin/sh" "${lib.getExe bash}" @@ -341,7 +413,7 @@ let libusb1 systemd ]; - nativeBuildInputs = [ autoPatchelfHook ]; + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; platforms = with lib.platforms; x86_64 ++ aarch64 ++ arm; @@ -352,6 +424,7 @@ let pname = "libqhy"; postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt substituteInPlace CMakeLists.txt \ --replace-fail "/lib/firmware" "lib/firmware" @@ -369,11 +442,17 @@ let (lib.getLib stdenv.cc.cc) libusb1 ]; - nativeBuildInputs = [ autoPatchelfHook ]; + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; - platforms = with lib.platforms; x86_64 ++ aarch64 ++ arm; + platforms = [ + "x86_64-linux" + "armv6l-linux" + "armv7l-linux" + "aarch64-linux" + "x86_64-darwin" + ]; }; }; @@ -383,7 +462,7 @@ let libftdi1 indilib ]; - nativeBuildInputs = [ autoPatchelfHook ]; + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; platforms = lib.platforms.linux; @@ -396,7 +475,7 @@ let (lib.getLib stdenv.cc.cc) libusb1 ]; - nativeBuildInputs = [ autoPatchelfHook ]; + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; platforms = with lib.platforms; x86_64 ++ i686 ++ arm; @@ -407,6 +486,7 @@ let pname = "libsbig"; postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt substituteInPlace CMakeLists.txt --replace-fail "/lib/firmware" "lib/firmware" substituteInPlace 51-sbig-debian.rules \ --replace-fail "/sbin/fxload" "${fxload}/sbin/fxload" \ @@ -416,7 +496,7 @@ let ''; buildInputs = [ libusb1 ]; - nativeBuildInputs = [ autoPatchelfHook ]; + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; @@ -426,7 +506,12 @@ let libstarshootg = buildIndi3rdParty { pname = "libstarshootg"; - nativeBuildInputs = [ autoPatchelfHook ]; + + postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt + ''; + + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; platforms = with lib.platforms; x86_64 ++ aarch64 ++ arm; @@ -435,20 +520,37 @@ let libsvbony = buildIndi3rdParty { pname = "libsvbony"; + + postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt + ''; + buildInputs = [ (lib.getLib stdenv.cc.cc) libusb1 ]; - nativeBuildInputs = [ autoPatchelfHook ]; + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; - platforms = with lib.platforms; x86_64 ++ aarch64 ++ arm ++ i686; + platforms = [ + "i686-linux" + "x86_64-linux" + "armv6l-linux" + "armv7l-linux" + "aarch64-linux" + "x86_64-darwin" + ]; }; }; libsvbonycam = buildIndi3rdParty { pname = "libsvbonycam"; - nativeBuildInputs = [ autoPatchelfHook ]; + + postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt + ''; + + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; platforms = with lib.platforms; x86_64 ++ aarch64 ++ arm; @@ -457,7 +559,12 @@ let libtoupcam = buildIndi3rdParty { pname = "libtoupcam"; - nativeBuildInputs = [ autoPatchelfHook ]; + + postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt + ''; + + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; platforms = with lib.platforms; x86_64 ++ aarch64 ++ arm; @@ -466,7 +573,12 @@ let libtscam = buildIndi3rdParty { pname = "libtscam"; - nativeBuildInputs = [ autoPatchelfHook ]; + + postPatch = '' + sed -i '/FIX_MACOS_LIBRARIES/d' CMakeLists.txt + ''; + + nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; meta = { license = lib.licenses.unfreeRedistributable; platforms = with lib.platforms; x86_64 ++ aarch64 ++ arm;