1{ lib, stdenv, fetchFromGitHub }:
2
3stdenv.mkDerivation rec {
4 pname = "libfreeaptx";
5 version = "0.1.1";
6
7 src = fetchFromGitHub {
8 owner = "iamthehorker";
9 repo = pname;
10 rev = version;
11 sha256 = "sha256-eEUhOrKqb2hHWanY+knpY9FBEnjkkFTB+x6BZgMBpbo=";
12 };
13
14 outputs = [ "out" "dev" ];
15
16 postPatch = lib.optionalString stdenv.isDarwin ''
17 substituteInPlace Makefile \
18 --replace '-soname' '-install_name' \
19 --replace 'lib$(NAME).so' 'lib$(NAME).dylib'
20 '';
21
22 makeFlags = [
23 "PREFIX=${placeholder "out"}"
24 # disable static builds
25 "ANAME="
26 "AOBJECTS="
27 "STATIC_UTILITIES="
28 ];
29
30 enableParallelBuilding = true;
31
32 postInstall = lib.optionalString stdenv.isDarwin ''
33 install_name_tool -change libfreeaptx.dylib.0 $out/lib/libfreeaptx.dylib.0 $out/bin/freeaptxdec
34 install_name_tool -change libfreeaptx.dylib.0 $out/lib/libfreeaptx.dylib.0 $out/bin/freeaptxenc
35 install_name_tool -id $out/lib/libfreeaptx.dylib $out/lib/libfreeaptx.dylib
36 install_name_tool -id $out/lib/libfreeaptx.dylib.0 $out/lib/libfreeaptx.dylib.0
37 '';
38
39 meta = with lib; {
40 description = "Free Implementation of Audio Processing Technology codec (aptX)";
41 license = licenses.lgpl21Plus;
42 homepage = "https://github.com/iamthehorker/libfreeaptx";
43 platforms = platforms.unix;
44 maintainers = with maintainers; [ kranzes ];
45 };
46}