about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/audio/libbass/default.nix
blob: 0e1445ca9ee1f801d75746c94c70c4afe30f62fe (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
{ stdenv, unzip, fetchurl }:

let
  version = "24";

  allBass = {
    bass = {
      h = "bass.h";
      so = {
        i686_linux = "libbass.so";
        x86_64-linux = "x64/libbass.so";
      };
      urlpath = "bass${version}-linux.zip";
      sha256 = "1hjxp1akj8367qlglv5rqpwq2dimfz3bkllwq39abavz4sp8smjz";
    };

    bass_fx = {
      h = "C/bass_fx.h";
      so = {
        i686_linux = "libbass_fx.so";
        x86_64-linux = "x64/libbass_fx.so";
      };
      urlpath = "z/0/bass_fx${version}-linux.zip";
      sha256 = "1q0g74z7iyhxqps5b3gnnbic8v2jji1r0mkvais57lsx8y21sbin";
    };
  };

  dropBass = name: bass: stdenv.mkDerivation {
    name = "lib${name}-${version}";

    src = fetchurl {
      url = "https://www.un4seen.com/files/${bass.urlpath}";
      inherit (bass) sha256;
    };
    unpackCmd = ''
      mkdir out
      ${unzip}/bin/unzip $curSrc -d out
    '';

    lpropagatedBuildInputs = [ unzip ];
    dontBuild = true;
    installPhase =
      let so =
            if bass.so ? ${stdenv.hostPlatform.system} then bass.so.${stdenv.hostPlatform.system}
            else throw "${name} not packaged for ${stdenv.hostPlatform.system} (yet).";
      in ''
        mkdir -p $out/{lib,include}
        install -m644 -t $out/lib/ ${so}
        install -m644 -t $out/include/ ${bass.h}
      '';

    meta = with stdenv.lib; {
      description = "Shareware audio library";
      homepage = https://www.un4seen.com/;
      license = licenses.unfreeRedistributable;
      platforms = builtins.attrNames bass.so;
    };
  };

in stdenv.lib.mapAttrs dropBass allBass