about summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorCoutinho de Souza <dev@onemoresuza.mailer.me>2024-03-01 16:24:37 -0300
committerCoutinho de Souza <dev@onemoresuza.mailer.me>2024-03-04 15:22:29 -0300
commit1d5d897eb9eefc91f964a52bdf29686e57c15dec (patch)
tree802dd295b7db0693692afefd4866496bfd575662 /pkgs/development/compilers
parent65ab3a44b6f002f822395cc20da51cc3cb2a4356 (diff)
downloadnixlib-1d5d897eb9eefc91f964a52bdf29686e57c15dec.tar
nixlib-1d5d897eb9eefc91f964a52bdf29686e57c15dec.tar.gz
nixlib-1d5d897eb9eefc91f964a52bdf29686e57c15dec.tar.bz2
nixlib-1d5d897eb9eefc91f964a52bdf29686e57c15dec.tar.lz
nixlib-1d5d897eb9eefc91f964a52bdf29686e57c15dec.tar.xz
nixlib-1d5d897eb9eefc91f964a52bdf29686e57c15dec.tar.zst
nixlib-1d5d897eb9eefc91f964a52bdf29686e57c15dec.zip
qbe: patch /tmp to ${TMPDIR:-/tmp} on tests and enable parallel building
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/qbe/001-dont-hardcode-tmp.patch43
-rw-r--r--pkgs/development/compilers/qbe/default.nix8
2 files changed, 51 insertions, 0 deletions
diff --git a/pkgs/development/compilers/qbe/001-dont-hardcode-tmp.patch b/pkgs/development/compilers/qbe/001-dont-hardcode-tmp.patch
new file mode 100644
index 000000000000..556dc5aab2a6
--- /dev/null
+++ b/pkgs/development/compilers/qbe/001-dont-hardcode-tmp.patch
@@ -0,0 +1,43 @@
+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
index d9694c9b4bce..aeb739bb84d0 100644
--- a/pkgs/development/compilers/qbe/default.nix
+++ b/pkgs/development/compilers/qbe/default.nix
@@ -16,6 +16,14 @@ stdenv.mkDerivation (finalAttrs: {
 
   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 { };
   };