diff options
Diffstat (limited to 'pkgs/development/compilers/qbe')
-rw-r--r-- | pkgs/development/compilers/qbe/001-dont-hardcode-tmp.patch | 43 | ||||
-rw-r--r-- | pkgs/development/compilers/qbe/default.nix | 42 | ||||
-rw-r--r-- | pkgs/development/compilers/qbe/test-can-run-hello-world.nix | 32 |
3 files changed, 0 insertions, 117 deletions
diff --git a/pkgs/development/compilers/qbe/001-dont-hardcode-tmp.patch b/pkgs/development/compilers/qbe/001-dont-hardcode-tmp.patch deleted file mode 100644 index 556dc5aab2a6..000000000000 --- a/pkgs/development/compilers/qbe/001-dont-hardcode-tmp.patch +++ /dev/null @@ -1,43 +0,0 @@ -diff --git a/minic/mcc b/minic/mcc -index 492947e..5258aac 100755 ---- a/minic/mcc -+++ b/minic/mcc -@@ -31,9 +31,9 @@ then - fi - - --$DIR/minic < $file > /tmp/minic.ssa && --$QBE < /tmp/minic.ssa > /tmp/minic.s && --cc /tmp/minic.s $flags -+$DIR/minic < $file > ${TMPDIR:-/tmp}/minic.ssa && -+$QBE < ${TMPDIR:-/tmp}/minic.ssa > ${TMPDIR:-/tmp}/minic.s && -+cc ${TMPDIR:-/tmp}/minic.s $flags - - if test $? -ne 0 - then -diff --git a/tools/cra.sh b/tools/cra.sh -index 5988267..57a4b34 100755 ---- a/tools/cra.sh -+++ b/tools/cra.sh -@@ -2,7 +2,7 @@ - - DIR=`cd $(dirname "$0"); pwd` - QBE=$DIR/../qbe --BUGF=/tmp/bug.id -+BUGF=${TMPDIR:-/tmp}/bug.id - FIND=$1 - FIND=${FIND:-afl-find} - -diff --git a/tools/test.sh b/tools/test.sh -index 23c6663..fb36222 100755 ---- a/tools/test.sh -+++ b/tools/test.sh -@@ -4,7 +4,7 @@ dir=`dirname "$0"` - bin=$dir/../qbe - binref=$dir/../qbe.ref - --tmp=/tmp/qbe.zzzz -+tmp=${TMPDIR:-/tmp}/qbe.zzzz - - drv=$tmp.c - asm=$tmp.s diff --git a/pkgs/development/compilers/qbe/default.nix b/pkgs/development/compilers/qbe/default.nix deleted file mode 100644 index f37de57b535e..000000000000 --- a/pkgs/development/compilers/qbe/default.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ 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 = "Small compiler backend written in C"; - maintainers = with maintainers; [ fgaz ]; - license = licenses.mit; - platforms = platforms.all; - mainProgram = "qbe"; - }; -}) diff --git a/pkgs/development/compilers/qbe/test-can-run-hello-world.nix b/pkgs/development/compilers/qbe/test-can-run-hello-world.nix deleted file mode 100644 index 5192bb881f34..000000000000 --- a/pkgs/development/compilers/qbe/test-can-run-hello-world.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ stdenv -, writeText -, qbe -}: - -# The hello world program available at https://c9x.me/compile/ -let helloWorld = writeText "hello-world.ssa" '' - function w $add(w %a, w %b) { # Define a function add - @start - %c =w add %a, %b # Adds the 2 arguments - ret %c # Return the result - } - export function w $main() { # Main function - @start - %r =w call $add(w 1, w 1) # Call add(1, 1) - call $printf(l $fmt, w %r, ...) # Show the result - ret 0 - } - data $fmt = { b "One and one make %d!\n", b 0 } -''; - -in stdenv.mkDerivation { - name = "qbe-test-can-run-hello-world"; - meta.timeout = 10; - buildCommand = '' - ${qbe}/bin/qbe -o asm.s ${helloWorld} - cc -o out asm.s - ./out | grep 'One and one make 2!' - touch $out - ''; -} - |