Merge pull request #251662 from OPNA2608/update/box64-0.2.4-adjustments

authored by

Franz Pletz and committed by
GitHub
768e973f 79d0b86c

+34 -15
+34 -15
pkgs/applications/emulators/box64/default.nix
··· 1 { lib 2 , stdenv 3 , fetchFromGitHub 4 , gitUpdater 5 , cmake 6 , python3 7 - , withDynarec ? stdenv.hostPlatform.isAarch64 8 , runCommand 9 , hello-x86_64 10 - , box64 11 }: 12 13 - # Currently only supported on ARM 14 - assert withDynarec -> stdenv.hostPlatform.isAarch64; 15 16 - stdenv.mkDerivation rec { 17 pname = "box64"; 18 version = "0.2.4"; 19 20 src = fetchFromGitHub { 21 owner = "ptitSeb"; 22 - repo = pname; 23 - rev = "v${version}"; 24 hash = "sha256-iCZv/WvqZkH6i23fSLA/p0nG5/CgzjyU5glVgje4c3w="; 25 }; 26 27 nativeBuildInputs = [ 28 cmake 29 python3 ··· 31 32 cmakeFlags = [ 33 "-DNOGIT=ON" 34 - "-DARM_DYNAREC=${if withDynarec then "ON" else "OFF"}" 35 - "-DRV64=${if stdenv.hostPlatform.isRiscV64 then "ON" else "OFF"}" 36 - "-DPPC64LE=${if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then "ON" else "OFF"}" 37 ] ++ lib.optionals stdenv.hostPlatform.isx86_64 [ 38 "-DLD80BITS=ON" 39 "-DNOALIGN=ON" 40 ]; 41 42 installPhase = '' ··· 47 runHook postInstall 48 ''; 49 50 - doCheck = true; 51 52 - doInstallCheck = true; 53 54 installCheckPhase = '' 55 runHook preInstallCheck ··· 68 rev-prefix = "v"; 69 }; 70 tests.hello = runCommand "box64-test-hello" { 71 - nativeBuildInputs = [ box64 hello-x86_64 ]; 72 } '' 73 # There is no actual "Hello, world!" with any of the logging enabled, and with all logging disabled it's hard to 74 # tell what problems the emulator has run into. ··· 81 description = "Lets you run x86_64 Linux programs on non-x86_64 Linux systems"; 82 license = licenses.mit; 83 maintainers = with maintainers; [ gador OPNA2608 ]; 84 - platforms = [ "x86_64-linux" "aarch64-linux" "riscv64-linux" "powerpc64le-linux" ]; 85 }; 86 - }
··· 1 { lib 2 , stdenv 3 , fetchFromGitHub 4 + , fetchpatch 5 , gitUpdater 6 , cmake 7 , python3 8 + , withDynarec ? (stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isRiscV64) 9 , runCommand 10 , hello-x86_64 11 }: 12 13 + # Currently only supported on ARM & RISC-V 14 + assert withDynarec -> (stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isRiscV64); 15 16 + stdenv.mkDerivation (finalAttrs: { 17 pname = "box64"; 18 version = "0.2.4"; 19 20 src = fetchFromGitHub { 21 owner = "ptitSeb"; 22 + repo = "box64"; 23 + rev = "v${finalAttrs.version}"; 24 hash = "sha256-iCZv/WvqZkH6i23fSLA/p0nG5/CgzjyU5glVgje4c3w="; 25 }; 26 27 + patches = [ 28 + # Fix crash due to regression in SDL1 AudioCallback signature in 0.2.4 29 + # Remove when version > 0.2.4 30 + (fetchpatch { 31 + name = "0001-box64-Fixed_signature_of_SDL1_AudioCallback.patch"; 32 + url = "https://github.com/ptitSeb/box64/commit/5fabd602aea1937e3c5ce58843504c2492b8c0ec.patch"; 33 + hash = "sha256-dBdKijTljCFtSJ2smHrbjH/ok0puGw4YEy/kluLl4AQ="; 34 + }) 35 + ]; 36 + 37 nativeBuildInputs = [ 38 cmake 39 python3 ··· 41 42 cmakeFlags = [ 43 "-DNOGIT=ON" 44 + 45 + # Arch mega-option 46 + "-DARM64=${lib.boolToString stdenv.hostPlatform.isAarch64}" 47 + "-DRV64=${lib.boolToString stdenv.hostPlatform.isRiscV64}" 48 + "-DPPC64LE=${lib.boolToString (stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian)}" 49 + "-DLARCH64=${lib.boolToString stdenv.hostPlatform.isLoongArch64}" 50 ] ++ lib.optionals stdenv.hostPlatform.isx86_64 [ 51 + # x86_64 has no arch-specific mega-option, manually enable the options that apply to it 52 "-DLD80BITS=ON" 53 "-DNOALIGN=ON" 54 + ] ++ [ 55 + # Arch dynarec 56 + "-DARM_DYNAREC=${lib.boolToString (withDynarec && stdenv.hostPlatform.isAarch64)}" 57 + "-DRV64_DYNAREC=${lib.boolToString (withDynarec && stdenv.hostPlatform.isRiscV64)}" 58 ]; 59 60 installPhase = '' ··· 65 runHook postInstall 66 ''; 67 68 + doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; 69 70 + doInstallCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; 71 72 installCheckPhase = '' 73 runHook preInstallCheck ··· 86 rev-prefix = "v"; 87 }; 88 tests.hello = runCommand "box64-test-hello" { 89 + nativeBuildInputs = [ finalAttrs.finalPackage ]; 90 } '' 91 # There is no actual "Hello, world!" with any of the logging enabled, and with all logging disabled it's hard to 92 # tell what problems the emulator has run into. ··· 99 description = "Lets you run x86_64 Linux programs on non-x86_64 Linux systems"; 100 license = licenses.mit; 101 maintainers = with maintainers; [ gador OPNA2608 ]; 102 + mainProgram = "box64"; 103 + platforms = [ "x86_64-linux" "aarch64-linux" "riscv64-linux" "powerpc64le-linux" "loongarch64-linux" "mips64el-linux" ]; 104 }; 105 + })