about summary refs log tree commit diff
path: root/pkgs/applications/emulators/box64/default.nix
blob: 404ece153b1c083c8060d2ad941de8cee653913f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, gitUpdater
, cmake
, python3
}:

stdenv.mkDerivation rec {
  pname = "box64";
  version = "0.2.0";

  src = fetchFromGitHub {
    owner = "ptitSeb";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-eMp2eSWMRJQvLRQKUirBua6Kt7ZtyebfUnKIlibkNFU=";
  };

  patches = [
    # Fix mmx & cppThreads tests on x86_64
    # Remove when version > 0.2.0
    (fetchpatch {
      url = "https://github.com/ptitSeb/box64/commit/3819aecf078fcf47b2bc73713531361406a51895.patch";
      hash = "sha256-11hy5Ol5FSE/kNJmXAIwNLbapldhlZGKtOLIoL6pYrg=";
    })
  ];

  nativeBuildInputs = [
    cmake
    python3
  ];

  cmakeFlags = [
    "-DNOGIT=1"
  ] ++ (
    if stdenv.hostPlatform.system == "aarch64-linux" then
      [
        "-DARM_DYNAREC=ON"
      ]
    else [
      "-DLD80BITS=1"
      "-DNOALIGN=1"
    ]
  );

  installPhase = ''
    runHook preInstall
    install -Dm 0755 box64 "$out/bin/box64"
    runHook postInstall
  '';

  doCheck = true;

  checkPhase = ''
    runHook preCheck
    ctest
    runHook postCheck
  '';

  doInstallCheck = true;

  installCheckPhase = ''
    runHook preInstallCheck
    $out/bin/box64 -v
    runHook postInstallCheck
  '';

  passthru.updateScript = gitUpdater {
    rev-prefix = "v";
  };

  meta = with lib; {
    homepage = "https://box86.org/";
    description = "Lets you run x86_64 Linux programs on non-x86_64 Linux systems";
    license = licenses.mit;
    maintainers = with maintainers; [ gador ];
    platforms = [ "x86_64-linux" "aarch64-linux" ];
  };
}