diff options
Diffstat (limited to 'pkgs/games/build-support/build-game.nix')
-rw-r--r-- | pkgs/games/build-support/build-game.nix | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/pkgs/games/build-support/build-game.nix b/pkgs/games/build-support/build-game.nix new file mode 100644 index 00000000..2ada5eb7 --- /dev/null +++ b/pkgs/games/build-support/build-game.nix @@ -0,0 +1,42 @@ +{ stdenv, lib, file }: + +{ buildInputs ? [] +, nativeBuildInputs ? [] +, installCheckPhase ? "" +, ... +}@attrs: + +stdenv.mkDerivation ({ + buildInputs = [ stdenv.cc.cc ] ++ buildInputs; + + nativeBuildInputs = [ + file ./setup-hooks/auto-patchelf.sh + ] ++ nativeBuildInputs; + + doInstallCheck = true; + + installCheckPhase = '' + runHook preInstallCheck + + echo "checking dependencies for libraries and executables" >&2 + + local errors="$( + IFS=$'\n' + for elf in $(findElfs "$prefix"); do checkElfDep "$elf"; done + )" + + if [ -n "$errors" ]; then + echo "$errors" >&2 + exit 1 + fi + + ${installCheckPhase} + + runHook postInstallCheck + ''; + + dontStrip = true; + dontPatchELF = true; +} // removeAttrs attrs [ + "buildInputs" "nativeBuildInputs" "installCheckPhase" +]) |