about summary refs log tree commit diff
path: root/pkgs/applications/audio/vgmstream/default.nix
blob: 99802872ef036cf3138da659d8ccbd3bd39e7218 (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
{ stdenv, lib, fetchFromGitHub, cmake, pkg-config, gtk3
, audacious, mpg123, ffmpeg, libvorbis, libao, jansson, speex
, nix-update-script
, buildAudaciousPlugin ? false  # only build cli by default, pkgs.audacious-plugins sets this to enable plugin support
}:

stdenv.mkDerivation rec {
  pname = "vgmstream";
  version = "1917";

  src = fetchFromGitHub {
    owner = "vgmstream";
    repo = "vgmstream";
    rev = "refs/tags/r${version}";
    sha256 = "sha256-9HIa5/whdLouUWNFml7tPfXStIkO76dxUl5S4yiat64=";
  };

  passthru.updateScript = nix-update-script {
    attrPath = "vgmstream";
    extraArgs = [ "--version-regex" "r(.*)" ];
  };

  nativeBuildInputs = [
    cmake
    pkg-config
  ] ++ lib.optional buildAudaciousPlugin gtk3;

  buildInputs = [
    mpg123
    ffmpeg
    libvorbis
    libao
    jansson
    speex
  ] ++ lib.optional buildAudaciousPlugin (audacious.override { audacious-plugins = null; });

  preConfigure = ''
    substituteInPlace cmake/dependencies/audacious.cmake \
      --replace "pkg_get_variable(AUDACIOUS_PLUGIN_DIR audacious plugin_dir)" "set(AUDACIOUS_PLUGIN_DIR \"$out/lib/audacious\")"
  '';

  cmakeFlags = [
    # It always tries to download it, no option to use the system one
    "-DUSE_CELT=OFF"
  ] ++ lib.optional (! buildAudaciousPlugin) "-DBUILD_AUDACIOUS=OFF";

  meta = with lib; {
    description = "A library for playback of various streamed audio formats used in video games";
    homepage    = "https://vgmstream.org";
    maintainers = with maintainers; [ zane ];
    license     = with licenses; isc;
    platforms   = with platforms; unix;
  };
}