nixpkgs/doc
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
..
languages-frameworks Merge pull request #33306 from bgamari/patch-2 2018-02-06 21:34:10 +00:00
old
coding-conventions.xml
configuration.xml
contributing.xml
cross-compilation.xml doc: Cross chapter: Add note on why use example platforms 2018-01-26 12:38:34 -05:00
default.nix
functions.xml
introduction.md
manual.xml
meta.xml
multiple-output.xml
overlays.xml
package-notes.xml Merge pull request #31312 from binarin/emacs-package-set-overrides 2018-02-06 21:22:23 +00:00
platform-notes.xml
quick-start.xml
release-notes.xml
reviewing-contributions.xml
shell.md
stdenv.xml setup-hooks: Add autoPatchelfHook 2018-02-10 00:27:24 +05:30
style.css
submitting-changes.xml