Merge pull request #302256 from jchw-forks/86box-update

_86Box: reformat according to RFC166, 4.1 -> 4.1.1
This commit is contained in:
Weijia Wang 2024-04-08 10:07:15 +02:00 committed by GitHub
commit 1c1ba4c20b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 53 additions and 35 deletions

View File

@ -1,23 +1,41 @@
{ stdenv, lib, fetchFromGitHub, cmake, pkg-config, makeWrapper, freetype, SDL2
, glib, pcre2, openal, rtmidi, fluidsynth, jack2, alsa-lib, qt5, libvncserver
, discord-gamesdk, libpcap, libslirp
{
stdenv,
lib,
fetchFromGitHub,
cmake,
pkg-config,
makeWrapper,
freetype,
SDL2,
glib,
pcre2,
openal,
rtmidi,
fluidsynth,
jack2,
alsa-lib,
qt5,
libvncserver,
discord-gamesdk,
libpcap,
libslirp,
, enableDynarec ? with stdenv.hostPlatform; isx86 || isAarch
, enableNewDynarec ? enableDynarec && stdenv.hostPlatform.isAarch
, enableVncRenderer ? false
, unfreeEnableDiscord ? false
, unfreeEnableRoms ? false
enableDynarec ? with stdenv.hostPlatform; isx86 || isAarch,
enableNewDynarec ? enableDynarec && stdenv.hostPlatform.isAarch,
enableVncRenderer ? false,
unfreeEnableDiscord ? false,
unfreeEnableRoms ? false,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "86Box";
version = "4.1";
version = "4.1.1";
src = fetchFromGitHub {
owner = "86Box";
repo = "86Box";
rev = "v${finalAttrs.version}";
hash = "sha256-JYOJFXiUTLRs6AEMYNx88PwcVw13ChQzV1ZE5OtX6Ds=";
hash = "sha256-ioE0EVIXv/biXXvLqwhmtZ/RJM0nLqcE+i+CU+WXBY4=";
};
nativeBuildInputs = [
@ -40,54 +58,54 @@ stdenv.mkDerivation (finalAttrs: {
libslirp
qt5.qtbase
qt5.qttools
] ++ lib.optional stdenv.isLinux alsa-lib
++ lib.optional enableVncRenderer libvncserver;
] ++ lib.optional stdenv.isLinux alsa-lib ++ lib.optional enableVncRenderer libvncserver;
cmakeFlags = lib.optional stdenv.isDarwin "-DCMAKE_MACOSX_BUNDLE=OFF"
cmakeFlags =
lib.optional stdenv.isDarwin "-DCMAKE_MACOSX_BUNDLE=OFF"
++ lib.optional enableNewDynarec "-DNEW_DYNAREC=ON"
++ lib.optional enableVncRenderer "-DVNC=ON"
++ lib.optional (!enableDynarec) "-DDYNAREC=OFF"
++ lib.optional (!unfreeEnableDiscord) "-DDISCORD=OFF";
postInstall = lib.optionalString stdenv.isLinux ''
install -Dm644 -t $out/share/applications $src/src/unix/assets/net.86box.86Box.desktop
postInstall =
lib.optionalString stdenv.isLinux ''
install -Dm644 -t $out/share/applications $src/src/unix/assets/net.86box.86Box.desktop
for size in 48 64 72 96 128 192 256 512; do
install -Dm644 -t $out/share/icons/hicolor/"$size"x"$size"/apps \
$src/src/unix/assets/"$size"x"$size"/net.86box.86Box.png
done;
''
+ lib.optionalString unfreeEnableRoms ''
mkdir -p $out/share/86Box
ln -s ${finalAttrs.passthru.roms} $out/share/86Box/roms
'';
for size in 48 64 72 96 128 192 256 512; do
install -Dm644 -t $out/share/icons/hicolor/"$size"x"$size"/apps \
$src/src/unix/assets/"$size"x"$size"/net.86box.86Box.png
done;
''
+ lib.optionalString unfreeEnableRoms ''
mkdir -p $out/share/86Box
ln -s ${finalAttrs.passthru.roms} $out/share/86Box/roms
'';
passthru = {
roms = fetchFromGitHub {
owner = "86Box";
repo = "roms";
rev = "v${finalAttrs.version}";
hash = "sha256-1HtoizO0QIGNjQTW0clzRp40h1ulw55+iTYz12UJSms=";
hash = "sha256-58nNTOLund/KeDlNwzwwihjFVigs/P0K8SN07zExE2c=";
};
};
# Some libraries are loaded dynamically, but QLibrary doesn't seem to search
# the runpath, so use a wrapper instead.
preFixup = let
libPath = lib.makeLibraryPath ([
libpcap
] ++ lib.optional unfreeEnableDiscord discord-gamesdk);
libPathVar = if stdenv.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH";
in ''
makeWrapperArgs+=(--prefix ${libPathVar} : "${libPath}")
'';
preFixup =
let
libPath = lib.makeLibraryPath ([ libpcap ] ++ lib.optional unfreeEnableDiscord discord-gamesdk);
libPathVar = if stdenv.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH";
in
''
makeWrapperArgs+=(--prefix ${libPathVar} : "${libPath}")
'';
meta = with lib; {
description = "Emulator of x86-based machines based on PCem.";
mainProgram = "86Box";
homepage = "https://86box.net/";
license = with licenses; [ gpl2Only ]
++ optional (unfreeEnableDiscord || unfreeEnableRoms) unfree;
license = with licenses; [ gpl2Only ] ++ optional (unfreeEnableDiscord || unfreeEnableRoms) unfree;
maintainers = [ maintainers.jchw ];
platforms = platforms.linux;
};