lol
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 postPatch = lib.optionalString stdenv.isDarwin ''
15 substituteInPlace Makefile \
16 --replace '-soname' '-install_name' \
17 --replace 'lib$(NAME).so' 'lib$(NAME).dylib'
18 '';
19
20 makeFlags = [
21 "PREFIX=${placeholder "out"}"
22 # disable static builds
23 "ANAME="
24 "AOBJECTS="
25 "STATIC_UTILITIES="
26 ];
27
28 enableParallelBuilding = true;
29
30 postInstall = lib.optionalString stdenv.isDarwin ''
31 install_name_tool -change libfreeaptx.dylib.0 $out/lib/libfreeaptx.dylib.0 $out/bin/freeaptxdec
32 install_name_tool -change libfreeaptx.dylib.0 $out/lib/libfreeaptx.dylib.0 $out/bin/freeaptxenc
33 install_name_tool -id $out/lib/libfreeaptx.dylib $out/lib/libfreeaptx.dylib
34 install_name_tool -id $out/lib/libfreeaptx.dylib.0 $out/lib/libfreeaptx.dylib.0
35 '';
36
37 meta = with lib; {
38 description = "Free Implementation of Audio Processing Technology codec (aptX)";
39 license = licenses.lgpl21Plus;
40 homepage = "https://github.com/iamthehorker/libfreeaptx";
41 platforms = platforms.unix;
42 maintainers = with maintainers; [ kranzes ];
43 };
44}