libvgm: Modernise
- nixfmt - Make enableShared default to result of (!stdenv.hostPlatform.isStatic) - Get rid of file-wise "inherit (lib) ..." - Use lib.cmake* for constructing cmakeFlags - Drop explicit url argument to unstableGitUpdater, default works fine - Get rid of meta-wise "with lib" - Fix order of meta attributes abit - Add meta.pkgConfigModules - Add passthru.tests.pkg-config
This commit is contained in:
parent
f18df6b1e9
commit
e07c407e6b
@ -1,46 +1,44 @@
|
|||||||
{ stdenv
|
{
|
||||||
, lib
|
stdenv,
|
||||||
, fetchFromGitHub
|
lib,
|
||||||
, unstableGitUpdater
|
fetchFromGitHub,
|
||||||
, cmake
|
unstableGitUpdater,
|
||||||
, libiconv
|
testers,
|
||||||
, zlib
|
cmake,
|
||||||
, enableShared ? true
|
libiconv,
|
||||||
|
zlib,
|
||||||
|
enableShared ? (!stdenv.hostPlatform.isStatic),
|
||||||
|
|
||||||
, enableAudio ? true
|
enableAudio ? true,
|
||||||
, withWaveWrite ? true
|
withWaveWrite ? true,
|
||||||
, withWinMM ? stdenv.hostPlatform.isWindows
|
withWinMM ? stdenv.hostPlatform.isWindows,
|
||||||
, withDirectSound ? stdenv.hostPlatform.isWindows
|
withDirectSound ? stdenv.hostPlatform.isWindows,
|
||||||
, withXAudio2 ? stdenv.hostPlatform.isWindows
|
withXAudio2 ? stdenv.hostPlatform.isWindows,
|
||||||
, withWASAPI ? stdenv.hostPlatform.isWindows
|
withWASAPI ? stdenv.hostPlatform.isWindows,
|
||||||
, withOSS ? stdenv.hostPlatform.isFreeBSD
|
withOSS ? stdenv.hostPlatform.isFreeBSD,
|
||||||
, withSADA ? stdenv.hostPlatform.isSunOS
|
withSADA ? stdenv.hostPlatform.isSunOS,
|
||||||
, withALSA ? stdenv.hostPlatform.isLinux
|
withALSA ? stdenv.hostPlatform.isLinux,
|
||||||
, alsa-lib
|
alsa-lib,
|
||||||
, withPulseAudio ? stdenv.hostPlatform.isLinux
|
withPulseAudio ? stdenv.hostPlatform.isLinux,
|
||||||
, libpulseaudio
|
libpulseaudio,
|
||||||
, withCoreAudio ? stdenv.hostPlatform.isDarwin
|
withCoreAudio ? stdenv.hostPlatform.isDarwin,
|
||||||
, CoreAudio
|
CoreAudio,
|
||||||
, AudioToolbox
|
AudioToolbox,
|
||||||
, withLibao ? true
|
withLibao ? true,
|
||||||
, libao
|
libao,
|
||||||
|
|
||||||
, enableEmulation ? true
|
enableEmulation ? true,
|
||||||
, withAllEmulators ? true
|
withAllEmulators ? true,
|
||||||
, emulators ? [ ]
|
emulators ? [ ],
|
||||||
|
|
||||||
, enableLibplayer ? true
|
enableLibplayer ? true,
|
||||||
|
|
||||||
, enableTools ? false
|
enableTools ? false,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert enableTools -> enableAudio && enableEmulation && enableLibplayer;
|
assert enableTools -> enableAudio && enableEmulation && enableLibplayer;
|
||||||
|
|
||||||
let
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
inherit (lib) optional optionals;
|
|
||||||
onOff = val: if val then "ON" else "OFF";
|
|
||||||
in
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
pname = "libvgm";
|
pname = "libvgm";
|
||||||
version = "0-unstable-2024-10-17";
|
version = "0-unstable-2024-10-17";
|
||||||
|
|
||||||
@ -54,69 +52,79 @@ stdenv.mkDerivation {
|
|||||||
outputs = [
|
outputs = [
|
||||||
"out"
|
"out"
|
||||||
"dev"
|
"dev"
|
||||||
] ++ optional enableTools "bin";
|
] ++ lib.optionals enableTools [ "bin" ];
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [ cmake ];
|
||||||
cmake
|
|
||||||
];
|
|
||||||
|
|
||||||
propagatedBuildInputs = [
|
propagatedBuildInputs =
|
||||||
libiconv
|
[
|
||||||
zlib
|
libiconv
|
||||||
] ++ optionals withALSA [
|
zlib
|
||||||
alsa-lib
|
]
|
||||||
] ++ optionals withPulseAudio [
|
++ lib.optionals withALSA [ alsa-lib ]
|
||||||
libpulseaudio
|
++ lib.optionals withPulseAudio [ libpulseaudio ]
|
||||||
] ++ optionals withCoreAudio [
|
++ lib.optionals withCoreAudio [
|
||||||
CoreAudio
|
CoreAudio
|
||||||
AudioToolbox
|
AudioToolbox
|
||||||
] ++ optionals withLibao [
|
]
|
||||||
libao
|
++ lib.optionals withLibao [ libao ];
|
||||||
];
|
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags =
|
||||||
"-DBUILD_LIBAUDIO=${onOff enableAudio}"
|
[
|
||||||
"-DBUILD_LIBEMU=${onOff enableEmulation}"
|
(lib.cmakeBool "BUILD_LIBAUDIO" enableAudio)
|
||||||
"-DBUILD_LIBPLAYER=${onOff enableLibplayer}"
|
(lib.cmakeBool "BUILD_LIBEMU" enableEmulation)
|
||||||
"-DBUILD_TESTS=${onOff enableTools}"
|
(lib.cmakeBool "BUILD_LIBPLAYER" enableLibplayer)
|
||||||
"-DBUILD_PLAYER=${onOff enableTools}"
|
(lib.cmakeBool "BUILD_TESTS" enableTools)
|
||||||
"-DBUILD_VGM2WAV=${onOff enableTools}"
|
(lib.cmakeBool "BUILD_PLAYER" enableTools)
|
||||||
"-DLIBRARY_TYPE=${if enableShared then "SHARED" else "STATIC"}"
|
(lib.cmakeBool "BUILD_VGM2WAV" enableTools)
|
||||||
"-DUSE_SANITIZERS=ON"
|
(lib.cmakeFeature "LIBRARY_TYPE" (if enableShared then "SHARED" else "STATIC"))
|
||||||
] ++ optionals enableAudio [
|
(lib.cmakeBool "USE_SANITIZERS" true)
|
||||||
"-DAUDIODRV_WAVEWRITE=${onOff withWaveWrite}"
|
]
|
||||||
"-DAUDIODRV_WINMM=${onOff withWinMM}"
|
++ lib.optionals enableAudio [
|
||||||
"-DAUDIODRV_DSOUND=${onOff withDirectSound}"
|
(lib.cmakeBool "AUDIODRV_WAVEWRITE" withWaveWrite)
|
||||||
"-DAUDIODRV_XAUDIO2=${onOff withXAudio2}"
|
(lib.cmakeBool "AUDIODRV_WINMM" withWinMM)
|
||||||
"-DAUDIODRV_WASAPI=${onOff withWASAPI}"
|
(lib.cmakeBool "AUDIODRV_DSOUND" withDirectSound)
|
||||||
"-DAUDIODRV_OSS=${onOff withOSS}"
|
(lib.cmakeBool "AUDIODRV_XAUDIO2" withXAudio2)
|
||||||
"-DAUDIODRV_SADA=${onOff withSADA}"
|
(lib.cmakeBool "AUDIODRV_WASAPI" withWASAPI)
|
||||||
"-DAUDIODRV_ALSA=${onOff withALSA}"
|
(lib.cmakeBool "AUDIODRV_OSS" withOSS)
|
||||||
"-DAUDIODRV_PULSE=${onOff withPulseAudio}"
|
(lib.cmakeBool "AUDIODRV_SADA" withSADA)
|
||||||
"-DAUDIODRV_APPLE=${onOff withCoreAudio}"
|
(lib.cmakeBool "AUDIODRV_ALSA" withALSA)
|
||||||
"-DAUDIODRV_LIBAO=${onOff withLibao}"
|
(lib.cmakeBool "AUDIODRV_PULSE" withPulseAudio)
|
||||||
] ++ optionals enableEmulation ([
|
(lib.cmakeBool "AUDIODRV_APPLE" withCoreAudio)
|
||||||
"-DSNDEMU__ALL=${onOff withAllEmulators}"
|
(lib.cmakeBool "AUDIODRV_LIBAO" withLibao)
|
||||||
] ++ optionals (!withAllEmulators)
|
]
|
||||||
(lib.lists.forEach emulators (x: "-DSNDEMU_${x}=ON"))
|
++ lib.optionals enableEmulation (
|
||||||
) ++ optionals enableTools [
|
[ (lib.cmakeBool "SNDEMU__ALL" withAllEmulators) ]
|
||||||
"-DUTIL_CHARCNV_ICONV=ON"
|
++ lib.optionals (!withAllEmulators) (
|
||||||
"-DUTIL_CHARCNV_WINAPI=${onOff stdenv.hostPlatform.isWindows}"
|
lib.lists.forEach emulators (x: (lib.cmakeBool "SNDEMU_${x}" true))
|
||||||
];
|
)
|
||||||
|
)
|
||||||
|
++ lib.optionals enableTools [
|
||||||
|
(lib.cmakeBool "UTIL_CHARCNV_ICONV" true)
|
||||||
|
(lib.cmakeBool "UTIL_CHARCNV_WINAPI" stdenv.hostPlatform.isWindows)
|
||||||
|
];
|
||||||
|
|
||||||
passthru.updateScript = unstableGitUpdater {
|
passthru = {
|
||||||
url = "https://github.com/ValleyBell/libvgm.git";
|
tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
||||||
|
updateScript = unstableGitUpdater { };
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = {
|
||||||
homepage = "https://github.com/ValleyBell/libvgm";
|
|
||||||
description = "More modular rewrite of most components from VGMPlay";
|
description = "More modular rewrite of most components from VGMPlay";
|
||||||
|
homepage = "https://github.com/ValleyBell/libvgm";
|
||||||
license =
|
license =
|
||||||
if (enableEmulation && (withAllEmulators || (lib.lists.any (core: core == "WSWAN_ALL") emulators))) then
|
if
|
||||||
licenses.unfree # https://github.com/ValleyBell/libvgm/issues/43
|
(enableEmulation && (withAllEmulators || (lib.lists.any (core: core == "WSWAN_ALL") emulators)))
|
||||||
|
then
|
||||||
|
lib.licenses.unfree # https://github.com/ValleyBell/libvgm/issues/43
|
||||||
else
|
else
|
||||||
licenses.gpl2Only;
|
lib.licenses.gpl2Only;
|
||||||
maintainers = with maintainers; [ OPNA2608 ];
|
maintainers = with lib.maintainers; [ OPNA2608 ];
|
||||||
platforms = platforms.all;
|
platforms = lib.platforms.all;
|
||||||
|
pkgConfigModules =
|
||||||
|
[ "vgm-utils" ]
|
||||||
|
++ lib.optionals enableAudio [ "vgm-audio" ]
|
||||||
|
++ lib.optionals enableEmulation [ "vgm-emu" ]
|
||||||
|
++ lib.optionals enableLibplayer [ "vgm-player" ];
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user