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