diff options
author | Alyssa Ross <hi@alyssa.is> | 2022-12-06 19:57:55 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-02-08 13:48:30 +0000 |
commit | bf3aadfdd39aa197e18bade671fab6726349ffa4 (patch) | |
tree | 698567af766ed441d757b57a7b21e68d4a342a2b /nixpkgs/pkgs/development/libraries/libvgm | |
parent | f4afc5a01d9539ce09e47494e679c51f80723d07 (diff) | |
parent | 99665eb45f58d959d2cb9e49ddb960c79d596f33 (diff) | |
download | nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.gz nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.bz2 nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.lz nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.xz nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.zst nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.zip |
Merge commit '99665eb45f58d959d2cb9e49ddb960c79d596f33'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libvgm')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/libvgm/default.nix | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libvgm/default.nix b/nixpkgs/pkgs/development/libraries/libvgm/default.nix new file mode 100644 index 000000000000..43b145be62bf --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/libvgm/default.nix @@ -0,0 +1,122 @@ +{ stdenv +, lib +, fetchFromGitHub +, unstableGitUpdater +, cmake +, libiconv +, zlib +, enableShared ? true + +, enableAudio ? true +, withWaveWrite ? true +, withWinMM ? stdenv.hostPlatform.isWindows +, withDirectSound ? stdenv.hostPlatform.isWindows +, withXAudio2 ? stdenv.hostPlatform.isWindows +, withWASAPI ? stdenv.hostPlatform.isWindows +, withOSS ? stdenv.hostPlatform.isFreeBSD +, withSADA ? stdenv.hostPlatform.isSunOS +, withALSA ? stdenv.hostPlatform.isLinux +, alsa-lib +, withPulseAudio ? stdenv.hostPlatform.isLinux +, libpulseaudio +, withCoreAudio ? stdenv.hostPlatform.isDarwin +, CoreAudio +, AudioToolbox +, withLibao ? true +, libao + +, enableEmulation ? true +, withAllEmulators ? true +, emulators ? [ ] + +, enableLibplayer ? true + +, enableTools ? false +}: + +assert enableTools -> enableAudio && enableEmulation && enableLibplayer; + +let + inherit (lib) optional optionals; + onOff = val: if val then "ON" else "OFF"; +in +stdenv.mkDerivation rec { + pname = "libvgm"; + version = "unstable-2022-06-18"; + + src = fetchFromGitHub { + owner = "ValleyBell"; + repo = "libvgm"; + rev = "001ca758538ca3f82403dff654d82342730b215d"; + sha256 = "O3jvEEW1M0cwZoG6j2ndmuQW4jP0dvt6gGp2BS4VD5s="; + }; + + outputs = [ + "out" + "dev" + ] ++ optional enableTools "bin"; + + nativeBuildInputs = [ + cmake + ]; + + propagatedBuildInputs = [ + libiconv + zlib + ] ++ optionals withALSA [ + alsa-lib + ] ++ optionals withPulseAudio [ + libpulseaudio + ] ++ optionals withCoreAudio [ + CoreAudio + AudioToolbox + ] ++ optionals withLibao [ + libao + ]; + + cmakeFlags = [ + "-DBUILD_LIBAUDIO=${onOff enableAudio}" + "-DBUILD_LIBEMU=${onOff enableEmulation}" + "-DBUILD_LIBPLAYER=${onOff enableLibplayer}" + "-DBUILD_TESTS=${onOff enableTools}" + "-DBUILD_PLAYER=${onOff enableTools}" + "-DBUILD_VGM2WAV=${onOff enableTools}" + "-DLIBRARY_TYPE=${if enableShared then "SHARED" else "STATIC"}" + "-DUSE_SANITIZERS=ON" + ] ++ optionals enableAudio [ + "-DAUDIODRV_WAVEWRITE=${onOff withWaveWrite}" + "-DAUDIODRV_WINMM=${onOff withWinMM}" + "-DAUDIODRV_DSOUND=${onOff withDirectSound}" + "-DAUDIODRV_XAUDIO2=${onOff withXAudio2}" + "-DAUDIODRV_WASAPI=${onOff withWASAPI}" + "-DAUDIODRV_OSS=${onOff withOSS}" + "-DAUDIODRV_SADA=${onOff withSADA}" + "-DAUDIODRV_ALSA=${onOff withALSA}" + "-DAUDIODRV_PULSE=${onOff withPulseAudio}" + "-DAUDIODRV_APPLE=${onOff withCoreAudio}" + "-DAUDIODRV_LIBAO=${onOff withLibao}" + ] ++ optionals enableEmulation ([ + "-DSNDEMU__ALL=${onOff withAllEmulators}" + ] ++ optionals (!withAllEmulators) + (lib.lists.forEach emulators (x: "-DSNDEMU_${x}=ON")) + ) ++ optionals enableTools [ + "-DUTIL_CHARCNV_ICONV=ON" + "-DUTIL_CHARCNV_WINAPI=${onOff stdenv.hostPlatform.isWindows}" + ]; + + passthru.updateScript = unstableGitUpdater { + url = "https://github.com/ValleyBell/libvgm.git"; + }; + + meta = with lib; { + homepage = "https://github.com/ValleyBell/libvgm"; + description = "More modular rewrite of most components from VGMPlay"; + license = + if (enableEmulation && (withAllEmulators || (lib.lists.any (core: core == "WSWAN_ALL") emulators))) then + licenses.unfree # https://github.com/ValleyBell/libvgm/issues/43 + else + licenses.gpl2Only; + maintainers = with maintainers; [ OPNA2608 ]; + platforms = platforms.all; + }; +} |