2023-04-03 21:09:23 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, cmake, pkg-config, makeWrapper, freetype, SDL2
|
|
|
|
, glib, pcre2, openal, rtmidi, fluidsynth, jack2, alsa-lib, qt5, libvncserver
|
2023-09-02 03:01:37 +00:00
|
|
|
, discord-gamesdk, libpcap, libslirp
|
2023-04-03 21:09:23 +00:00
|
|
|
|
|
|
|
, enableDynarec ? with stdenv.hostPlatform; isx86 || isAarch
|
|
|
|
, enableNewDynarec ? enableDynarec && stdenv.hostPlatform.isAarch
|
|
|
|
, enableVncRenderer ? false
|
|
|
|
, unfreeEnableDiscord ? false
|
|
|
|
}:
|
|
|
|
|
2024-03-24 14:08:30 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2023-04-03 21:09:23 +00:00
|
|
|
pname = "86Box";
|
2024-02-22 15:56:25 +00:00
|
|
|
version = "4.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-02-22 15:56:25 +00:00
|
|
|
hash = "sha256-JYOJFXiUTLRs6AEMYNx88PwcVw13ChQzV1ZE5OtX6Ds=";
|
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
|
|
|
|
] ++ lib.optional stdenv.isLinux alsa-lib
|
|
|
|
++ lib.optional enableVncRenderer libvncserver;
|
|
|
|
|
|
|
|
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";
|
|
|
|
|
2023-05-23 22:12:55 +00:00
|
|
|
postInstall = lib.optional 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;
|
|
|
|
'';
|
|
|
|
|
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-03-24 14:12:18 +00:00
|
|
|
preFixup = let
|
2023-04-03 21:09:23 +00:00
|
|
|
libPath = lib.makeLibraryPath ([
|
|
|
|
libpcap
|
|
|
|
] ++ lib.optional unfreeEnableDiscord discord-gamesdk);
|
|
|
|
libPathVar = if stdenv.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH";
|
2024-03-24 14:12:18 +00:00
|
|
|
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/";
|
|
|
|
license = with licenses; [ gpl2Only ] ++ optional unfreeEnableDiscord unfree;
|
|
|
|
maintainers = [ maintainers.jchw ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
2024-03-24 14:08:30 +00:00
|
|
|
})
|