From ef6c66560175e4b5a798bd09caa31cd5ebad8127 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 13 Sep 2017 05:06:32 +0200 Subject: pkgs/games: Add a new buildGame function The main functionality for this function is to gather missing dependencies in ELF executables and shared libraries and using patchelf to set the right RPATH. All of the dependencies are searched based on what we have in one of the buildInputs variables, so all we need to do is list them in there. One thing that's still left to solve is adding libraries to the RPATH which are only required at runtime. An example for this would be the pulseaudio library. Signed-off-by: aszlig --- pkgs/games/build-support/build-game.nix | 42 +++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 pkgs/games/build-support/build-game.nix (limited to 'pkgs/games/build-support/build-game.nix') 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" +]) -- cgit 1.4.1