mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
Merge pull request #251662 from OPNA2608/update/box64-0.2.4-adjustments
This commit is contained in:
commit
768e973f39
1 changed files with 34 additions and 15 deletions
|
@ -1,29 +1,39 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, fetchpatch
|
||||
, gitUpdater
|
||||
, cmake
|
||||
, python3
|
||||
, withDynarec ? stdenv.hostPlatform.isAarch64
|
||||
, withDynarec ? (stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isRiscV64)
|
||||
, runCommand
|
||||
, hello-x86_64
|
||||
, box64
|
||||
}:
|
||||
|
||||
# Currently only supported on ARM
|
||||
assert withDynarec -> stdenv.hostPlatform.isAarch64;
|
||||
# Currently only supported on ARM & RISC-V
|
||||
assert withDynarec -> (stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isRiscV64);
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "box64";
|
||||
version = "0.2.4";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ptitSeb";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
repo = "box64";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-iCZv/WvqZkH6i23fSLA/p0nG5/CgzjyU5glVgje4c3w=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Fix crash due to regression in SDL1 AudioCallback signature in 0.2.4
|
||||
# Remove when version > 0.2.4
|
||||
(fetchpatch {
|
||||
name = "0001-box64-Fixed_signature_of_SDL1_AudioCallback.patch";
|
||||
url = "https://github.com/ptitSeb/box64/commit/5fabd602aea1937e3c5ce58843504c2492b8c0ec.patch";
|
||||
hash = "sha256-dBdKijTljCFtSJ2smHrbjH/ok0puGw4YEy/kluLl4AQ=";
|
||||
})
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
python3
|
||||
|
@ -31,12 +41,20 @@ stdenv.mkDerivation rec {
|
|||
|
||||
cmakeFlags = [
|
||||
"-DNOGIT=ON"
|
||||
"-DARM_DYNAREC=${if withDynarec then "ON" else "OFF"}"
|
||||
"-DRV64=${if stdenv.hostPlatform.isRiscV64 then "ON" else "OFF"}"
|
||||
"-DPPC64LE=${if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then "ON" else "OFF"}"
|
||||
|
||||
# Arch mega-option
|
||||
"-DARM64=${lib.boolToString stdenv.hostPlatform.isAarch64}"
|
||||
"-DRV64=${lib.boolToString stdenv.hostPlatform.isRiscV64}"
|
||||
"-DPPC64LE=${lib.boolToString (stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian)}"
|
||||
"-DLARCH64=${lib.boolToString stdenv.hostPlatform.isLoongArch64}"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isx86_64 [
|
||||
# x86_64 has no arch-specific mega-option, manually enable the options that apply to it
|
||||
"-DLD80BITS=ON"
|
||||
"-DNOALIGN=ON"
|
||||
] ++ [
|
||||
# Arch dynarec
|
||||
"-DARM_DYNAREC=${lib.boolToString (withDynarec && stdenv.hostPlatform.isAarch64)}"
|
||||
"-DRV64_DYNAREC=${lib.boolToString (withDynarec && stdenv.hostPlatform.isRiscV64)}"
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
|
@ -47,9 +65,9 @@ stdenv.mkDerivation rec {
|
|||
runHook postInstall
|
||||
'';
|
||||
|
||||
doCheck = true;
|
||||
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
|
||||
|
||||
doInstallCheck = true;
|
||||
doInstallCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
|
||||
|
||||
installCheckPhase = ''
|
||||
runHook preInstallCheck
|
||||
|
@ -68,7 +86,7 @@ stdenv.mkDerivation rec {
|
|||
rev-prefix = "v";
|
||||
};
|
||||
tests.hello = runCommand "box64-test-hello" {
|
||||
nativeBuildInputs = [ box64 hello-x86_64 ];
|
||||
nativeBuildInputs = [ finalAttrs.finalPackage ];
|
||||
} ''
|
||||
# There is no actual "Hello, world!" with any of the logging enabled, and with all logging disabled it's hard to
|
||||
# tell what problems the emulator has run into.
|
||||
|
@ -81,6 +99,7 @@ stdenv.mkDerivation rec {
|
|||
description = "Lets you run x86_64 Linux programs on non-x86_64 Linux systems";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ gador OPNA2608 ];
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" "riscv64-linux" "powerpc64le-linux" ];
|
||||
mainProgram = "box64";
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" "riscv64-linux" "powerpc64le-linux" "loongarch64-linux" "mips64el-linux" ];
|
||||
};
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue