nixpkgs-suyu/pkgs
aszlig 1cba74dfc1
setup-hooks: Add autoPatchelfHook
I originally wrote this for packaging proprietary games in Vuizvui[1]
but I thought it would be generally useful as we have a fair amount of
proprietary software lurking around in nixpkgs, which are a bit tedious
to maintain, especially when the library dependencies change after an
update.

So this setup hook searches for all ELF executables and libraries in the
resulting output paths after install phase and uses patchelf to set the
RPATH and interpreter according to what dependencies are available
inside the builder.

For example consider something like this:

stdenv.mkDerivation {
  ...
  nativeBuildInputs = [ autoPatchelfHook ];
  buildInputs = [ mesa zlib ];
  ...
}

Whenever for example an executable requires mesa or zlib, the RPATH will
automatically be set to the lib dir of the corresponding dependency.

If the library dependency is required at runtime, an attribute called
runtimeDependencies can be used to list dependencies that are added to
all executables that are discovered unconditionally.

Beside this, it also makes initial packaging of proprietary software
easier, because one no longer has to manually figure out the
dependencies in the first place.

[1]: https://github.com/openlab-aux/vuizvui

Signed-off-by: aszlig <aszlig@nix.build>
Closes: #34506
2018-02-10 00:27:24 +05:30
..
applications flexget: mark as broken 2018-02-09 17:08:28 +00:00
build-support setup-hooks: Add autoPatchelfHook 2018-02-10 00:27:24 +05:30
common-updater
data Merge remote-tracking branch 'upstream/master' into staging 2018-02-03 02:50:21 +02:00
desktops Merge pull request #34526 from ttuegel/bugfix/plasma-integration/font-style 2018-02-04 17:41:50 -06:00
development haskell-generic-builder: revert "set LD_LIBRARY_PATH in shellHook" 2018-02-09 19:56:20 +01:00
games treewide: s/pkgs.fedoraproject.org/src.fedoraproject.org/ 2018-02-08 16:38:08 -05:00
misc Merge pull request #34739 from ryantm/ataripp 2018-02-09 08:27:38 +00:00
os-specific treewide: s/pkgs.fedoraproject.org/src.fedoraproject.org/ 2018-02-08 16:38:08 -05:00
servers polipo: mark as vulnerable (close #33709) 2018-02-08 18:50:41 +01:00
shells Merge pull request #34689 from dtzWill/fix/zsh-modern 2018-02-09 09:29:32 +00:00
stdenv unpackPhase: Handle sources starting with a hyphen 2018-01-24 21:58:57 -08:00
test
tools Merge pull request #34763 from zimbatm/asciidoctor-pdf-fix 2018-02-09 15:59:09 +00:00
top-level setup-hooks: Add autoPatchelfHook 2018-02-10 00:27:24 +05:30