summary refs log tree commit diff
path: root/pkgs/applications/audio/aacgain/default.nix
blob: 517a53a5fecccceec2aa4ebe119f38d448a62451 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{ lib, stdenv, fetchFromGitLab, fetchpatch }:

stdenv.mkDerivation rec {
  pname = "aacgain";
  version = "1.9.0";

  src = fetchFromGitLab {
    owner = "mulx";
    repo = "aacgain";
    rev = "7c29dccd878ade1301710959aeebe87a8f0828f5";
    sha256 = "07hl432vsscqg01b6wr99qmsj4gbx0i02x4k565432y6zpfmaxm0";
  };

  hardeningDisable = [ "format" ];

  # -Wnarrowing is enabled by default in recent GCC versions,
  # causing compilation to fail.
  NIX_CFLAGS_COMPILE = "-Wno-narrowing";

  postPatch = ''
    (
      cd mp4v2
      patch -p0 < ${fetchpatch {
        name = "fix_missing_ptr_deref.patch";
        url = "https://aur.archlinux.org/cgit/aur.git/plain/fix_missing_ptr_deref.patch?h=aacgain-cvs&id=e1a19c920f57063e64bab75cb0d8624731f6e3d7";
        sha256 = "1cq7r005nvmwdjb25z80grcam7jv6k57jnl2bh349mg3ajmslbq9";
      }}
    )
  '';

  configurePhase = ''
    runHook preConfigure
    cd mp4v2
    ./configure

    cd ../faad2
    ./configure

    cd ..
    ./configure
    runHook postConfigure
  '';

  buildPhase = ''
    runHook preBuild
    cd mp4v2
    make libmp4v2.la

    cd ../faad2
    make LDFLAGS=-static

    cd ..
    make
    runHook postBuild
  '';

  installPhase = ''
    install -D aacgain/aacgain "$out/bin/aacgain"
  '';

  meta = with lib; {
    description = "ReplayGain for AAC files";
    homepage = "https://aacgain.altosdesign.com";
    license = licenses.gpl2;
    platforms = platforms.linux;
    maintainers = [ maintainers.robbinch ];
  };
}