10 enableShared ? (!stdenv.hostPlatform.isStatic),
14 withWinMM ? stdenv.hostPlatform.isWindows,
15 withDirectSound ? stdenv.hostPlatform.isWindows,
16 withXAudio2 ? stdenv.hostPlatform.isWindows,
17 withWASAPI ? stdenv.hostPlatform.isWindows,
18 withOSS ? stdenv.hostPlatform.isFreeBSD,
19 withSADA ? stdenv.hostPlatform.isSunOS,
20 withALSA ? stdenv.hostPlatform.isLinux,
22 withPulseAudio ? stdenv.hostPlatform.isLinux,
24 withCoreAudio ? stdenv.hostPlatform.isDarwin,
30 enableEmulation ? true,
31 withAllEmulators ? true,
34 enableLibplayer ? true,
39 assert enableTools -> enableAudio && enableEmulation && enableLibplayer;
41 stdenv.mkDerivation (finalAttrs: {
43 version = "0-unstable-2024-10-17";
45 src = fetchFromGitHub {
48 rev = "7b694e53e42a75ce48b846c53d08e4a33f627842";
49 hash = "sha256-u+mBzmEixJT3rwuipITktFI4iVswnXftfF7syBw4t/w=";
55 ] ++ lib.optionals enableTools [ "bin" ];
57 nativeBuildInputs = [ cmake ];
59 propagatedBuildInputs =
64 ++ lib.optionals withALSA [ alsa-lib ]
65 ++ lib.optionals withPulseAudio [ libpulseaudio ]
66 ++ lib.optionals withCoreAudio [
70 ++ lib.optionals withLibao [ libao ];
74 (lib.cmakeBool "BUILD_LIBAUDIO" enableAudio)
75 (lib.cmakeBool "BUILD_LIBEMU" enableEmulation)
76 (lib.cmakeBool "BUILD_LIBPLAYER" enableLibplayer)
77 (lib.cmakeBool "BUILD_TESTS" enableTools)
78 (lib.cmakeBool "BUILD_PLAYER" enableTools)
79 (lib.cmakeBool "BUILD_VGM2WAV" enableTools)
80 (lib.cmakeFeature "LIBRARY_TYPE" (if enableShared then "SHARED" else "STATIC"))
81 (lib.cmakeBool "USE_SANITIZERS" true)
83 ++ lib.optionals enableAudio [
84 (lib.cmakeBool "AUDIODRV_WAVEWRITE" withWaveWrite)
85 (lib.cmakeBool "AUDIODRV_WINMM" withWinMM)
86 (lib.cmakeBool "AUDIODRV_DSOUND" withDirectSound)
87 (lib.cmakeBool "AUDIODRV_XAUDIO2" withXAudio2)
88 (lib.cmakeBool "AUDIODRV_WASAPI" withWASAPI)
89 (lib.cmakeBool "AUDIODRV_OSS" withOSS)
90 (lib.cmakeBool "AUDIODRV_SADA" withSADA)
91 (lib.cmakeBool "AUDIODRV_ALSA" withALSA)
92 (lib.cmakeBool "AUDIODRV_PULSE" withPulseAudio)
93 (lib.cmakeBool "AUDIODRV_APPLE" withCoreAudio)
94 (lib.cmakeBool "AUDIODRV_LIBAO" withLibao)
96 ++ lib.optionals enableEmulation (
97 [ (lib.cmakeBool "SNDEMU__ALL" withAllEmulators) ]
98 ++ lib.optionals (!withAllEmulators) (
99 lib.lists.forEach emulators (x: (lib.cmakeBool "SNDEMU_${x}" true))
102 ++ lib.optionals enableTools [
103 (lib.cmakeBool "UTIL_CHARCNV_ICONV" true)
104 (lib.cmakeBool "UTIL_CHARCNV_WINAPI" stdenv.hostPlatform.isWindows)
108 tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
109 updateScript = unstableGitUpdater { };
113 description = "More modular rewrite of most components from VGMPlay";
114 homepage = "https://github.com/ValleyBell/libvgm";
117 (enableEmulation && (withAllEmulators || (lib.lists.any (core: core == "WSWAN_ALL") emulators)))
119 lib.licenses.unfree # https://github.com/ValleyBell/libvgm/issues/43
121 lib.licenses.gpl2Only;
122 maintainers = with lib.maintainers; [ OPNA2608 ];
123 platforms = lib.platforms.all;
126 ++ lib.optionals enableAudio [ "vgm-audio" ]
127 ++ lib.optionals enableEmulation [ "vgm-emu" ]
128 ++ lib.optionals enableLibplayer [ "vgm-player" ];