about summary refs log tree commit diff
path: root/pkgs/applications/audio/aacgain/default.nix
blob: 3f1c67a2a6187b25a3bb854f5d848276a0404786 (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
69
70
71
72
73
{ stdenv, fetchFromGitHub, unzip, m4, libtool, automake, autoconf, mp3gain, mp4v2, faad2 }:

stdenv.mkDerivation {
  name = "aacgain-1.9";
  srcs = [
    (fetchFromGitHub {
      owner = "mecke";
      repo = "aacgain";
      rev = "4a7d59d78eadbbd5413e905af8f91fe9184ce7a8";
      sha256 = "0y25avgmm1xpbggvkhby1a7v9wmhsp3wmp74q06sf8ph8xsfajw4";
    })
    mp3gain.src
    mp4v2.src
    faad2.src
  ];

  buildInputs = [ unzip m4 libtool automake autoconf ];

  setSourceRoot = "sourceRoot=`pwd`";

  postUnpack = ''
    cd $sourceRoot
    # mp3gain does not unzip to its own directory, so move files accordingly.
    mkdir mp3gain
    find . -type f -maxdepth 1 -exec mv {} mp3gain/ \;
    mv mpglibDBL mp3gain/

    mv aacgain-* aacgain
    mv faad2-* faad2
    mv mp4v2-* mp4v2
  '';

  patchPhase = ''
    cd $sourceRoot
    patch -p2 -N < aacgain/linux/mp3gain.patch
  '';

  configurePhase = ''
    cd $sourceRoot/mp4v2
    ./configure

    cd $sourceRoot/faad2
    ./configure
  '';

  buildPhase = ''
    cd $sourceRoot/mp4v2
    make libmp4v2.la

    cd $sourceRoot/faad2/libfaad
    make

    cd $sourceRoot/aacgain/linux
    sh prepare.sh
    mkdir build
    cd build
    ../../../configure
    make
  '';

  installPhase = ''
    strip -s aacgain/aacgain
    install -vD aacgain/aacgain "$out/bin/aacgain"
  '';

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