about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMario Rodas <marsam@users.noreply.github.com>2022-05-20 06:31:04 -0500
committerGitHub <noreply@github.com>2022-05-20 06:31:04 -0500
commitc4998c7bf6c84e3f5d7abe63a6ea8d110c2dbd95 (patch)
tree7dc90bcf1c3377b01b6dbd8cae2a3d1cb654ca7f
parenta503ec66157ff77317c37bb9cab956da511adf79 (diff)
parent152765ca8b05c79c6a87683b1b6ce8589d82dd9e (diff)
Merge pull request #173689 from marsam/fix-libfreeaptx-darwin
libfreeaptx: fix build on darwin
-rw-r--r--pkgs/development/libraries/libfreeaptx/default.nix15
1 files changed, 14 insertions, 1 deletions
diff --git a/pkgs/development/libraries/libfreeaptx/default.nix b/pkgs/development/libraries/libfreeaptx/default.nix
index 9e30973f199eb..648b6fac0dfc2 100644
--- a/pkgs/development/libraries/libfreeaptx/default.nix
+++ b/pkgs/development/libraries/libfreeaptx/default.nix
@@ -11,6 +11,12 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-eEUhOrKqb2hHWanY+knpY9FBEnjkkFTB+x6BZgMBpbo=";
   };
 
+  postPatch = lib.optionalString stdenv.isDarwin ''
+    substituteInPlace Makefile \
+      --replace '-soname' '-install_name' \
+      --replace 'lib$(NAME).so' 'lib$(NAME).dylib'
+  '';
+
   makeFlags = [
     "PREFIX=${placeholder "out"}"
     # disable static builds
@@ -21,11 +27,18 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  postInstall = lib.optionalString stdenv.isDarwin ''
+    install_name_tool -change libfreeaptx.dylib.0 $out/lib/libfreeaptx.dylib.0 $out/bin/freeaptxdec
+    install_name_tool -change libfreeaptx.dylib.0 $out/lib/libfreeaptx.dylib.0 $out/bin/freeaptxenc
+    install_name_tool -id $out/lib/libfreeaptx.dylib $out/lib/libfreeaptx.dylib
+    install_name_tool -id $out/lib/libfreeaptx.dylib.0 $out/lib/libfreeaptx.dylib.0
+  '';
+
   meta = with lib; {
     description = "Free Implementation of Audio Processing Technology codec (aptX)";
     license = licenses.lgpl21Plus;
     homepage = "https://github.com/iamthehorker/libfreeaptx";
-    platforms = platforms.linux;
+    platforms = platforms.unix;
     maintainers = with maintainers; [ kranzes ];
   };
 }