2024-04-21 15:54:59 +00:00
|
|
|
{
|
|
|
|
stdenv,
|
2024-09-19 14:19:46 +00:00
|
|
|
darwin,
|
2024-04-21 15:54:59 +00:00
|
|
|
lib,
|
|
|
|
fetchFromGitHub,
|
|
|
|
cmake,
|
2024-07-27 06:49:29 +00:00
|
|
|
extra-cmake-modules,
|
2024-04-21 15:54:59 +00:00
|
|
|
pkg-config,
|
|
|
|
makeWrapper,
|
|
|
|
freetype,
|
|
|
|
SDL2,
|
|
|
|
glib,
|
|
|
|
pcre2,
|
|
|
|
openal,
|
|
|
|
rtmidi,
|
|
|
|
fluidsynth,
|
|
|
|
jack2,
|
|
|
|
alsa-lib,
|
|
|
|
qt5,
|
|
|
|
libvncserver,
|
|
|
|
discord-gamesdk,
|
|
|
|
libpcap,
|
|
|
|
libslirp,
|
2024-07-27 06:49:29 +00:00
|
|
|
wayland,
|
|
|
|
wayland-scanner,
|
2024-09-19 14:19:46 +00:00
|
|
|
libsndfile,
|
|
|
|
flac,
|
|
|
|
libogg,
|
|
|
|
libvorbis,
|
|
|
|
libopus,
|
|
|
|
libmpg123,
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
enableDynarec ? with stdenv.hostPlatform; isx86 || isAarch,
|
|
|
|
enableNewDynarec ? enableDynarec && stdenv.hostPlatform.isAarch,
|
|
|
|
enableVncRenderer ? false,
|
2024-09-26 11:04:55 +00:00
|
|
|
enableWayland ? stdenv.hostPlatform.isLinux,
|
2024-04-21 15:54:59 +00:00
|
|
|
unfreeEnableDiscord ? false,
|
|
|
|
unfreeEnableRoms ? false,
|
2023-05-24 13:37:59 +00:00
|
|
|
}:
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2023-05-24 13:37:59 +00:00
|
|
|
pname = "86Box";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "4.2.1";
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "86Box";
|
|
|
|
repo = "86Box";
|
2024-04-21 15:54:59 +00:00
|
|
|
rev = "v${finalAttrs.version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-ue5Coy2MpP7Iwl81KJPQPC7eD53/Db5a0PGIR+DdPYI=";
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
patches = [ ./darwin.patch ];
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteAllInPlace src/qt/qt_platform.cpp
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs =
|
|
|
|
[
|
|
|
|
cmake
|
|
|
|
pkg-config
|
|
|
|
makeWrapper
|
|
|
|
qt5.wrapQtAppsHook
|
|
|
|
]
|
|
|
|
++ lib.optionals enableWayland [
|
|
|
|
extra-cmake-modules
|
|
|
|
wayland-scanner
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs =
|
|
|
|
[
|
|
|
|
freetype
|
|
|
|
fluidsynth
|
|
|
|
SDL2
|
|
|
|
glib
|
|
|
|
openal
|
|
|
|
rtmidi
|
|
|
|
pcre2
|
|
|
|
jack2
|
|
|
|
libpcap
|
|
|
|
libslirp
|
|
|
|
qt5.qtbase
|
|
|
|
qt5.qttools
|
|
|
|
libsndfile
|
|
|
|
flac.dev
|
|
|
|
libogg.dev
|
|
|
|
libvorbis.dev
|
|
|
|
libopus.dev
|
|
|
|
libmpg123.dev
|
|
|
|
]
|
2024-09-26 11:04:55 +00:00
|
|
|
++ lib.optional stdenv.hostPlatform.isLinux alsa-lib
|
2024-07-27 06:49:29 +00:00
|
|
|
++ lib.optional enableWayland wayland
|
2024-09-19 14:19:46 +00:00
|
|
|
++ lib.optional enableVncRenderer libvncserver
|
2024-09-26 11:04:55 +00:00
|
|
|
++ lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk_11_0.libs.xpc;
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
cmakeFlags =
|
2024-09-26 11:04:55 +00:00
|
|
|
lib.optional stdenv.hostPlatform.isDarwin "-DCMAKE_MACOSX_BUNDLE=OFF"
|
2023-05-24 13:37:59 +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-21 15:54:59 +00:00
|
|
|
postInstall =
|
2024-09-26 11:04:55 +00:00
|
|
|
lib.optionalString stdenv.hostPlatform.isLinux ''
|
2024-04-21 15:54:59 +00:00
|
|
|
install -Dm644 -t $out/share/applications $src/src/unix/assets/net.86box.86Box.desktop
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2024-04-21 15:54:59 +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
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
roms = fetchFromGitHub {
|
|
|
|
owner = "86Box";
|
|
|
|
repo = "roms";
|
|
|
|
rev = "v${finalAttrs.version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-p3djn950mTUIchFCEg56JbJtIsUuxmqRdYFRl50kI5Y=";
|
2024-04-21 15:54:59 +00:00
|
|
|
};
|
2024-06-05 15:53:02 +00:00
|
|
|
updateScript = ./update.sh;
|
2024-04-21 15:54:59 +00:00
|
|
|
};
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
# Some libraries are loaded dynamically, but QLibrary doesn't seem to search
|
|
|
|
# the runpath, so use a wrapper instead.
|
2024-04-21 15:54:59 +00:00
|
|
|
preFixup =
|
|
|
|
let
|
|
|
|
libPath = lib.makeLibraryPath ([ libpcap ] ++ lib.optional unfreeEnableDiscord discord-gamesdk);
|
2024-09-26 11:04:55 +00:00
|
|
|
libPathVar = if stdenv.hostPlatform.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH";
|
2024-04-21 15:54:59 +00:00
|
|
|
in
|
|
|
|
''
|
|
|
|
makeWrapperArgs+=(--prefix ${libPathVar} : "${libPath}")
|
|
|
|
'';
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
meta = {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Emulator of x86-based machines based on PCem";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "86Box";
|
2023-05-24 13:37:59 +00:00
|
|
|
homepage = "https://86box.net/";
|
2024-09-19 14:19:46 +00:00
|
|
|
license =
|
|
|
|
with lib.licenses;
|
|
|
|
[ gpl2Only ] ++ lib.optional (unfreeEnableDiscord || unfreeEnableRoms) unfree;
|
|
|
|
maintainers = with lib.maintainers; [
|
|
|
|
jchw
|
|
|
|
matteopacini
|
|
|
|
];
|
|
|
|
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
2024-04-21 15:54:59 +00:00
|
|
|
})
|