about summary refs log tree commit diff
path: root/pkgs/development/compilers/qbe/default.nix
blob: 00c91e2671ecde7174d130d27549ce87eb7f18df (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
{ lib
, stdenv
, fetchzip
, callPackage
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "qbe";
  version = "1.2";

  src = fetchzip {
    url = "https://c9x.me/compile/release/qbe-${finalAttrs.version}.tar.xz";
    hash = "sha256-UgtJnZF/YtD54OBy9HzGRAEHx5tC9Wo2YcUidGwrv+s=";
  };

  makeFlags = [
    "PREFIX=$(out)"
    "CC=${stdenv.cc.targetPrefix}cc"
  ];

  doCheck = true;

  enableParallelBuilding = true;

  patches = [
    # Use "${TMPDIR:-/tmp}" instead of the latter directly
    # see <https://lists.sr.ht/~mpu/qbe/patches/49613>
    ./001-dont-hardcode-tmp.patch
  ];

  passthru = {
    tests.can-run-hello-world = callPackage ./test-can-run-hello-world.nix { };
  };

  meta = with lib; {
    homepage = "https://c9x.me/compile/";
    description = "A small compiler backend written in C";
    maintainers = with maintainers; [ fgaz ];
    license = licenses.mit;
    platforms = platforms.all;
    mainProgram = "qbe";
  };
})