2024-04-07 02:52:24 +00:00
|
|
|
{
|
|
|
|
stdenv,
|
|
|
|
lib,
|
|
|
|
fetchFromGitHub,
|
|
|
|
cmake,
|
|
|
|
pkg-config,
|
|
|
|
makeWrapper,
|
|
|
|
freetype,
|
|
|
|
SDL2,
|
|
|
|
glib,
|
|
|
|
pcre2,
|
|
|
|
openal,
|
|
|
|
rtmidi,
|
|
|
|
fluidsynth,
|
|
|
|
jack2,
|
|
|
|
alsa-lib,
|
|
|
|
qt5,
|
|
|
|
libvncserver,
|
|
|
|
discord-gamesdk,
|
|
|
|
libpcap,
|
|
|
|
libslirp,
|
2023-04-03 21:09:23 +00:00
|
|
|
|
2024-04-07 02:52:24 +00:00
|
|
|
enableDynarec ? with stdenv.hostPlatform; isx86 || isAarch,
|
|
|
|
enableNewDynarec ? enableDynarec && stdenv.hostPlatform.isAarch,
|
|
|
|
enableVncRenderer ? false,
|
|
|
|
unfreeEnableDiscord ? false,
|
|
|
|
unfreeEnableRoms ? false,
|
2023-04-03 21:09:23 +00:00
|
|
|
}:
|
|
|
|
|
2024-03-24 14:08:30 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2023-04-03 21:09:23 +00:00
|
|
|
pname = "86Box";
|
2024-04-07 02:53:44 +00:00
|
|
|
version = "4.1.1";
|
2023-04-03 21:09:23 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "86Box";
|
|
|
|
repo = "86Box";
|
2024-03-24 14:08:30 +00:00
|
|
|
rev = "v${finalAttrs.version}";
|
2024-04-07 02:53:44 +00:00
|
|
|
hash = "sha256-ioE0EVIXv/biXXvLqwhmtZ/RJM0nLqcE+i+CU+WXBY4=";
|
2023-04-03 21:09:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
pkg-config
|
|
|
|
makeWrapper
|
|
|
|
qt5.wrapQtAppsHook
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
freetype
|
2023-09-02 03:01:37 +00:00
|
|
|
fluidsynth
|
2023-04-03 21:09:23 +00:00
|
|
|
SDL2
|
|
|
|
glib
|
|
|
|
openal
|
|
|
|
rtmidi
|
|
|
|
pcre2
|
|
|
|
jack2
|
|
|
|
libpcap
|
2023-09-02 03:01:37 +00:00
|
|
|
libslirp
|
2023-04-03 21:09:23 +00:00
|
|
|
qt5.qtbase
|
|
|
|
qt5.qttools
|
2024-04-07 02:52:24 +00:00
|
|
|
] ++ lib.optional stdenv.isLinux alsa-lib ++ lib.optional enableVncRenderer libvncserver;
|
2023-04-03 21:09:23 +00:00
|
|
|
|
2024-04-07 02:52:24 +00:00
|
|
|
cmakeFlags =
|
|
|
|
lib.optional stdenv.isDarwin "-DCMAKE_MACOSX_BUNDLE=OFF"
|
2023-04-03 21:09:23 +00:00
|
|
|
++ lib.optional enableNewDynarec "-DNEW_DYNAREC=ON"
|
|
|
|
++ lib.optional enableVncRenderer "-DVNC=ON"
|
|
|
|
++ lib.optional (!enableDynarec) "-DDYNAREC=OFF"
|
|
|
|
++ lib.optional (!unfreeEnableDiscord) "-DDISCORD=OFF";
|
|
|
|
|
2024-04-07 02:52:24 +00:00
|
|
|
postInstall =
|
|
|
|
lib.optionalString stdenv.isLinux ''
|
|
|
|
install -Dm644 -t $out/share/applications $src/src/unix/assets/net.86box.86Box.desktop
|
2023-05-23 22:12:55 +00:00
|
|
|
|
2024-04-07 02:52:24 +00:00
|
|
|
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
|
|
|
|
'';
|
2023-05-23 22:12:55 +00:00
|
|
|
|
2024-03-24 14:13:47 +00:00
|
|
|
passthru = {
|
|
|
|
roms = fetchFromGitHub {
|
|
|
|
owner = "86Box";
|
|
|
|
repo = "roms";
|
|
|
|
rev = "v${finalAttrs.version}";
|
2024-04-07 02:53:44 +00:00
|
|
|
hash = "sha256-58nNTOLund/KeDlNwzwwihjFVigs/P0K8SN07zExE2c=";
|
2024-03-24 14:13:47 +00:00
|
|
|
};
|
2024-04-11 11:41:56 +00:00
|
|
|
updateScript = ./update.sh;
|
2024-03-24 14:13:47 +00:00
|
|
|
};
|
|
|
|
|
2023-04-03 21:09:23 +00:00
|
|
|
# Some libraries are loaded dynamically, but QLibrary doesn't seem to search
|
|
|
|
# the runpath, so use a wrapper instead.
|
2024-04-07 02:52:24 +00:00
|
|
|
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}")
|
|
|
|
'';
|
2023-04-03 21:09:23 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Emulator of x86-based machines based on PCem.";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "86Box";
|
2023-04-03 21:09:23 +00:00
|
|
|
homepage = "https://86box.net/";
|
2024-04-07 02:52:24 +00:00
|
|
|
license = with licenses; [ gpl2Only ] ++ optional (unfreeEnableDiscord || unfreeEnableRoms) unfree;
|
2023-04-03 21:09:23 +00:00
|
|
|
maintainers = [ maintainers.jchw ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
2024-03-24 14:08:30 +00:00
|
|
|
})
|