git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #127674 from fgaz/qbe/2021-06-17
d514b8dSandro
pkgs/development/compilers/qbe/default.nix+10−4
@@ -1,21 +1,27 @@
1{ lib, stdenv
1{ lib, stdenv
2, fetchgit
2, fetchgit
3, unstableGitUpdater
3, unstableGitUpdater
4+, callPackage
4}:
5}:
5
6
6stdenv.mkDerivation rec {
7stdenv.mkDerivation rec {
7 pname = "qbe";
8 pname = "qbe";
8− version = "unstable-2020-10-05";
9+ version = "unstable-2021-06-17";
9
10
10 src = fetchgit {
11 src = fetchgit {
11 url = "git://c9x.me/qbe.git";
12 url = "git://c9x.me/qbe.git";
12− rev = "496c069405cd79aed968f59dd5a5f92d1f96809f";
13+ rev = "6d9ee1389572ae985f6a39bb99dbd10cdf42c123";
13− sha256 = "1vpszl77j9mnw8r0p9l23k8nxbnz31lgii7v3mai130nbpjsjsdf";
14+ sha256 = "NaURS5Eu8NBd92wGQcyFEXCALU9Z93nNQeZ8afq4KMw=";
14 };
15 };
15
16
16 makeFlags = [ "PREFIX=$(out)" ];
17 makeFlags = [ "PREFIX=$(out)" ];
17
18
19+ doCheck = true;
20+
21+ passthru = {
22+ tests.can-run-hello-world = callPackage ./test-can-run-hello-world.nix {};
18− passthru.updateScript = unstableGitUpdater { };
23+ updateScript = unstableGitUpdater { };
24+ };
19
25
20 meta = with lib; {
26 meta = with lib; {
21 homepage = "https://c9x.me/compile/";
27 homepage = "https://c9x.me/compile/";
pkgs/development/compilers/qbe/test-can-run-hello-world.nixnew file+32
@@ -0,0 +1,32 @@
1+{ stdenv
2+, writeText
3+, qbe
4+}:
5+
6+# The hello world program available at https://c9x.me/compile/
7+let helloWorld = writeText "hello-world.ssa" ''
8+ function w $add(w %a, w %b) { # Define a function add
9+ @start
10+ %c =w add %a, %b # Adds the 2 arguments
11+ ret %c # Return the result
12+ }
13+ export function w $main() { # Main function
14+ @start
15+ %r =w call $add(w 1, w 1) # Call add(1, 1)
16+ call $printf(l $fmt, w %r, ...) # Show the result
17+ ret 0
18+ }
19+ data $fmt = { b "One and one make %d!\n", b 0 }
20+'';
21+
22+in stdenv.mkDerivation {
23+ name = "qbe-test-can-run-hello-world";
24+ meta.timeout = 10;
25+ buildCommand = ''
26+ ${qbe}/bin/qbe -o asm.s ${helloWorld}
27+ cc -o out asm.s
28+ ./out | grep 'One and one make 2!'
29+ touch $out
30+ '';
31+}
32+