3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #206790 from OPNA2608/add/box64_more_targets

This commit is contained in:
Sandro 2023-01-31 20:58:28 +01:00 committed by GitHub
commit 59e9ca3ae6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 22 deletions

View file

@ -5,8 +5,15 @@
, gitUpdater , gitUpdater
, cmake , cmake
, python3 , python3
, withDynarec ? stdenv.hostPlatform.isAarch64
, runCommand
, hello-x86_64
, box64
}: }:
# Currently only supported on ARM
assert withDynarec -> stdenv.hostPlatform.isAarch64;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "box64"; pname = "box64";
version = "0.2.0"; version = "0.2.0";
@ -33,49 +40,57 @@ stdenv.mkDerivation rec {
]; ];
cmakeFlags = [ cmakeFlags = [
"-DNOGIT=1" "-DNOGIT=ON"
] ++ ( "-DARM_DYNAREC=${if withDynarec then "ON" else "OFF"}"
if stdenv.hostPlatform.system == "aarch64-linux" then "-DRV64=${if stdenv.hostPlatform.isRiscV64 then "ON" else "OFF"}"
[ "-DPPC64LE=${if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then "ON" else "OFF"}"
"-DARM_DYNAREC=ON" ] ++ lib.optionals stdenv.hostPlatform.isx86_64 [
] "-DLD80BITS=ON"
else [ "-DNOALIGN=ON"
"-DLD80BITS=1" ];
"-DNOALIGN=1"
]
);
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
install -Dm 0755 box64 "$out/bin/box64" install -Dm 0755 box64 "$out/bin/box64"
runHook postInstall runHook postInstall
''; '';
doCheck = true; doCheck = true;
checkPhase = ''
runHook preCheck
ctest
runHook postCheck
'';
doInstallCheck = true; doInstallCheck = true;
installCheckPhase = '' installCheckPhase = ''
runHook preInstallCheck runHook preInstallCheck
echo Checking if it works
$out/bin/box64 -v $out/bin/box64 -v
echo Checking if Dynarec option was respected
$out/bin/box64 -v | grep ${lib.optionalString (!withDynarec) "-v"} Dynarec
runHook postInstallCheck runHook postInstallCheck
''; '';
passthru.updateScript = gitUpdater { passthru = {
rev-prefix = "v"; updateScript = gitUpdater {
rev-prefix = "v";
};
tests.hello = runCommand "box64-test-hello" {
nativeBuildInputs = [ box64 hello-x86_64 ];
} ''
# 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.
BOX64_NOBANNER=0 BOX64_LOG=1 box64 ${hello-x86_64}/bin/hello --version | tee $out
'';
}; };
meta = with lib; { meta = with lib; {
homepage = "https://box86.org/"; homepage = "https://box86.org/";
description = "Lets you run x86_64 Linux programs on non-x86_64 Linux systems"; description = "Lets you run x86_64 Linux programs on non-x86_64 Linux systems";
license = licenses.mit; license = licenses.mit;
maintainers = with maintainers; [ gador ]; maintainers = with maintainers; [ gador OPNA2608 ];
platforms = [ "x86_64-linux" "aarch64-linux" ]; platforms = [ "x86_64-linux" "aarch64-linux" "riscv64-linux" "powerpc64le-linux" ];
}; };
} }

View file

@ -2028,7 +2028,12 @@ with pkgs;
wxGTK = wxGTK32; wxGTK = wxGTK32;
}; };
box64 = callPackage ../applications/emulators/box64 { }; box64 = callPackage ../applications/emulators/box64 {
hello-x86_64 = if stdenv.hostPlatform.isx86_64 then
hello
else
pkgsCross.gnu64.hello;
};
caprice32 = callPackage ../applications/emulators/caprice32 { }; caprice32 = callPackage ../applications/emulators/caprice32 { };