1{ lib
2, stdenv
3, fetchzip
4, callPackage
5}:
6stdenv.mkDerivation (finalAttrs: {
7 pname = "qbe";
8 version = "1.2";
9
10 src = fetchzip {
11 url = "https://c9x.me/compile/release/qbe-${finalAttrs.version}.tar.xz";
12 hash = "sha256-UgtJnZF/YtD54OBy9HzGRAEHx5tC9Wo2YcUidGwrv+s=";
13 };
14
15 makeFlags = [
16 "PREFIX=$(out)"
17 "CC=${stdenv.cc.targetPrefix}cc"
18 ];
19
20 doCheck = true;
21
22 enableParallelBuilding = true;
23
24 patches = [
25 # Use "${TMPDIR:-/tmp}" instead of the latter directly
26 # see <https://lists.sr.ht/~mpu/qbe/patches/49613>
27 ./001-dont-hardcode-tmp.patch
28 ];
29
30 passthru = {
31 tests.can-run-hello-world = callPackage ./test-can-run-hello-world.nix { };
32 };
33
34 meta = with lib; {
35 homepage = "https://c9x.me/compile/";
36 description = "Small compiler backend written in C";
37 maintainers = with maintainers; [ fgaz ];
38 license = licenses.mit;
39 platforms = platforms.all;
40 mainProgram = "qbe";
41 };
42})