From 948d8289559e1097873a5fe9d8c398874bc4cd09 Mon Sep 17 00:00:00 2001 From: aszlig Date: Fri, 18 Sep 2020 12:09:42 +0200 Subject: [PATCH] uqm: Fix purity checking error during config phase Since commit fb777be7d2925ec0e97783ce5e3a0136361dc0a8, linking programs in /tmp will no longer work, since with this commit (hardcoded) /tmp will no longer be treated a valid temporary directory by the purity checking logic. Essentially what that logic does is checking whether the link target is either relative, in some temporary directory or in the Nix store and if that's not the case, an error is thrown like in this case: gcc -c /tmp/build.24.tmp.c -o /tmp/build.24.tmp.c.o gcc /tmp/build.24.tmp.c.o -o /tmp/build.24.tmp.out impure path `/tmp/build.24.tmp.out' used in link collect2: error: ld returned 1 exit status Note here, that $TMP and $TMPDIR point to /build while the output here still refers to /tmp. This is because the custom build system of uqm simply hardcodes /tmp and doesn't honor any of these variables. To fix this, all we need to do is the latter and we're now using $TMPDIR instead of /tmp for these compile-tests during configure. While the pull request[1] introducing said commit has a few comments regarding other issues and it could still be either reverted or changed, using $TMPDIR in the uqm build script is entirely backwards-compatible and shouldn't hurt in any case. [1]: https://github.com/NixOS/nixpkgs/pull/93560 Signed-off-by: aszlig --- pkgs/games/uqm/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/games/uqm/default.nix b/pkgs/games/uqm/default.nix index 523ae354b760..bce8fde3acd6 100644 --- a/pkgs/games/uqm/default.nix +++ b/pkgs/games/uqm/default.nix @@ -65,9 +65,11 @@ in stdenv.mkDerivation rec { ln -s "${videos}" "uqm-${version}/content/addons/3dovideo" ''; - # Using _STRINGS_H as include guard conflicts with glibc. postPatch = '' + # Using _STRINGS_H as include guard conflicts with glibc. sed -i -e '/^#/s/_STRINGS_H/_UQM_STRINGS_H/g' src/uqm/comm/*/strings.h + # See https://github.com/NixOS/nixpkgs/pull/93560 + sed -i -e 's,/tmp/,$TMPDIR/,' build/unix/config_functions ''; # uqm has a 'unique' build system with a root script incidentally called