Unverified Commit f771eb40 authored by Peder Bergebakken Sundt's avatar Peder Bergebakken Sundt Committed by GitHub
Browse files

vgmstream: disable CELT support on non-x86_64 (#399984)

parents bd910af1 27115548
Loading
Loading
Loading
Loading
+31 −23
Original line number Diff line number Diff line
@@ -15,17 +15,7 @@
  nix-update-script,
}:

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

  src = fetchFromGitHub {
    owner = "vgmstream";
    repo = "vgmstream";
    tag = "r${version}";
    hash = "sha256-TmaWC04XbtFfBYhmTO4ouh3NoByio1BCpDJGJy3r0NY=";
  };

let
  # https://github.com/vgmstream/vgmstream/blob/1b6a7915bf98ca14a71a0d44bef7a2c6a75c686d/cmake/dependencies/atrac9.cmake
  atrac9-src = fetchFromGitHub {
    owner = "Thealexbarney";
@@ -43,6 +33,18 @@ stdenv.mkDerivation rec {
    url = "https://downloads.xiph.org/releases/celt/celt-0.11.0.tar.gz";
    hash = "sha256-JI3b44iCxQ29bqJGNH/L18pEuWiTFZ2132ceaqe8U0E=";
  };
in

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

  src = fetchFromGitHub {
    owner = "vgmstream";
    repo = "vgmstream";
    tag = "r${version}";
    hash = "sha256-TmaWC04XbtFfBYhmTO4ouh3NoByio1BCpDJGJy3r0NY=";
  };

  passthru.updateScript = nix-update-script {
    attrPath = "vgmstream";
@@ -80,14 +82,18 @@ stdenv.mkDerivation rec {
    +
      # cmake/dependencies/celt.cmake uses configure_file to modify ${CELT_0110_PATH}/libcelt/ecintrin.h.
      # Therefore, CELT_0110_PATH needs to point to a mutable directory.
      ''
      lib.optionalString (stdenv.system == "x86_64-linux") ''
        mkdir -p dependencies/celt-0.11.0/
        cp -r ${celt-0_11_0-src}/* dependencies/celt-0.11.0/
        chmod -R +w dependencies/celt-0.11.0/
      '';

  cmakeFlags = [
  cmakeFlags =
    [
      "-DATRAC9_PATH=${atrac9-src}"
    ]
    # Only supported on x86_64-linux
    ++ lib.optionals (stdenv.system == "x86_64-linux") [
      "-DCELT_0061_PATH=${celt-0_6_1-src}"
      "-DCELT_0110_PATH=../dependencies/celt-0.11.0"
      # libg719_decode omitted because it doesn't have a free software license
@@ -97,11 +103,13 @@ stdenv.mkDerivation rec {
    description = "Library for playback of various streamed audio formats used in video games";
    homepage = "https://vgmstream.org";
    maintainers = with maintainers; [ zane ];
    license = with licenses; [
    license =
      with licenses;
      [
        isc # vgmstream itself
        mit # atrac9
      bsd2 # celt
    ];
      ]
      ++ optional (stdenv.system == "x86_64-linux") bsd2;
    platforms = with platforms; unix;
  };
}