summary refs log tree commit diff
path: root/pkgs/build-support/setup-hooks
Commit message (Collapse)AuthorAge
* autoPatchelfHook: Run after patchelf's setup hookaszlig2018-07-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far the runtimeDependencies variable has been rather useless unless you also set dontPatchelf, because the patchelf setup hook ran *after* the autoPatchelfHook and thus stripped off the additional RPATHs added using runtimeDependencies. I did this by moving the autoPatchelfHook to be run in postFixup instead of fixupOutput, however I needed to replicate the for loop that runs the hook on all outputs. Until we have a way to influence order of execution for hooks I've marked this with an XXX so that we can use fixupOutput again. Tested this against all packages that use autoPatchelfHook using the following and checking whether the output contains any errors concerning shared libraries: nix-build -E 'with import ./. { config.allowUnfree = true; }; runCommand "test-executables" { drvs = [ masterpdfeditor franz zoom-us anydesk teamviewer maxx oracle-instantclient cups-kyodialog3 virtlyst powershell ]; } "for i in $drvs; do for b in $i/bin/*; do \"$b\" || :; done; done" ' Signed-off-by: aszlig <aszlig@nix.build> Fixes: https://github.com/NixOS/nixpkgs/issues/43082 Cc: @Ericson2314
* pruneLibtoolFiles: init setup hook (#41819)Orivej Desh2018-06-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | A .la file specifies linker flags to link with the library it describes. Its "dependency_libs" field lists the libraries that this library depends upon. This list often contains "-l" flags without corresponding "-L" flags. Many packages in Nixpkgs deal with this in one of these ways: - delete .la file [1] - clear dependency_libs [2] - add -L flags to dependency_libs [3] - propagate dependencies [4] Sometimes "dependency_libs" contain wrong "-L" flags pointing to the "dev" output with headers rather than to the main output with libraries. They have to be edited or deleted to reduce closure size [5]. Deleting .la files is often but not always safe [6]. Atomatically deleting as many of them as possible is complex [7]. Deleting .la files that describe shared rather than static libraries is probably safe; but clearing their "dependency_libs" field achieves the same effect with less potential for unintended consequences. This is the approach that may be enabled for all Nixpkgs. [1] https://github.com/NixOS/nixpkgs/commit/2a79d296d3de74da77b49ca8dc9d356b1a7a1c8d [2] https://github.com/NixOS/nixpkgs/commit/c83a53098599c49ec57823bf655ce8b45f6aea10 [3] https://github.com/NixOS/nixpkgs/commit/9e0dcf3bd9fcfeed576132b9101b866aa3cb76ff [4] https://github.com/NixOS/nixpkgs/commit/01134e698fdfb3b61f8ab8ec3bf13e0718f63955 [5] https://github.com/NixOS/nixpkgs/commit/f6c73f1e37c735abb686d07449f349b796c54cf8 [6] https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Handling_Libtool_Archives [7] https://github.com/gentoo/gentoo/blob/fb1f2435/eclass/ltprune.eclass
* autoPatchelfHook: Patch PIC exes/libs as wellaszlig2018-06-08
| | | | | | | | | | | If there is a shared object or executable that's using position-independent code, the file's mime type is "application/x-pie-executable", so until this change its dependencies wouldn't be patched. This simply adds the mime type to the search loop. Signed-off-by: aszlig <aszlig@nix.build>
* treewide: Use pkgs/build-support/roles.bash to remove copy pastaJohn Ericson2018-05-07
| | | | | Also fix some setup hooks that unnecessarily used environment hooks, which revolted in the same variable being modified too many times.
* Merge pull request #34611 from peterhoeg/p/descentPeter Hoeg2018-02-12
|\ | | | | descent 1 & 2: use assets from gog.com with the dxx-rebirth project
| * build-support gogUnpackHook: support for unpacking games from gog.comPeter Hoeg2018-02-12
| |
* | setup-hooks: Add autoPatchelfHookaszlig2018-02-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | patchShebangs: preserve times, resolves #33084Yegor Timoshenko2018-01-21
|/ | | | | | Close #33281. Edits by vcunat: - use Eelco's idea: empty file instead of full copy - use longer name suffix to decrease the likelihood of collision
* treewide: Don't use envHook anymoreJohn Ericson2017-12-30
| | | | | This commits needs a MAJOR audit as I oftentimes just guessed which of `$hostOffset`, `$targetOffset`, or a fixed offset should be used.
* strip setup hook: Learn about only stripping host/target binaries aloneJohn Ericson2017-12-30
| | | | | `dontStrip` is still a catch-all, but `dontStripHost` and `dontStripTarget` are also now available for finer-grained disabling.
* ld-is-cc-hook: initOrivej Desh2017-12-19
| | | | | This hook sets LD to CC, for use with software that works as if LD=$CC when LD is unset, and does not work when LD=ld.
* misc setup-hooks: Use env vars to refer to binutils programsJohn Ericson2017-12-13
| | | | This is more robust for cross-compilation
* Merge pull request #31987 from jtojnar/devhelp-devdocOrivej Desh2017-11-25
|\ | | | | stdenv: Move devhelp books to outputDevdoc
| * stdenv: Move devhelp books to outputDevdocJan Tojnar2017-11-24
| |
* | Merge pull request #31775 from obsidiansystems/stdenv-both-propagated-filesJohn Ericson2017-11-22
|\ \ | | | | | | stdenv setup: Always use both propagated files
| * | stdenv setup: Always use both propagated filesJohn Ericson2017-11-21
| |/ | | | | | | | | | | | | | | | | | | | | This continues #23374, which always kept around both attributes, by always including both propagated files: `propgated-native-build-inputs` and `propagated-build-inputs`. `nativePkgs` and `crossPkgs` are still defined as before, however, so this change should only barely observable. This is an incremental step to fully keeping the dependencies separate in all cases.
* | makeWrapper: delete --set-evalOrivej Desh2017-11-17
| | | | | | | | because --run is good enough.
* | makeWrapper: add --set-default and --set-evalOrivej Desh2017-11-17
| | | | | | | | | | | | | | | | | | | | | | After #31497 starter quoting all values, there arouse the need to left some values evaluated. `--set-default var value` expands to `export var=${var-value}`, where value is not evaluated and literally assigned to var unless it is already set. `--set-eval var value` expands to `export var=$(eval echo value)`, where value is evaluated by `eval`.
* | makeWrapper: quote values properlyNikolay Amiantov2017-11-11
|/ | | | | | | This uses Bash ${foo@Q} feature to quote values properly, which allows us to handle values containing spaces, dollars etc. Thanks orivej for the idea!
* set-source-date-epoch-to-latest.sh: shut up a warningVladimír Čunát2017-09-17
| | | | | > bash: warning: command substitution: ignored null byte in input /cc #28227. Also break the overlong line.
* autoreconfHook: Simplify by avoiding `findInputs`John Ericson2017-09-14
| | | | | `findInputs` is a stdenv/setup helper we should strive not to call elsewhere. Using normal deps is more idiomatic anyways.
* Merge #28227: set-source-date-epoch-to-latest.sh: ignore generated filesVladimír Čunát2017-09-02
|\
| * use \0 instead of \nvolth2017-08-13
| |
| * set-source-date-epoch-to-latest.sh: ignore generated filesvolth2017-08-13
| | | | | | | | set-source-date-epoch-to-latest.sh to ignore files newer than "$NIX_BUILD_TOP/.." (unlike "$NIX_BUILD_TOP" it is root-owned and cannot be touched by nixbld1).
* | darwin-frameworks: move fixup setup-hookDaiderd Jordan2017-08-28
| |
* | makeWrapper: use consistent styleTuomas Tynkkynen2017-08-11
| | | | | | | | | | All the other plain variable references (before e1d46c0c4) are without braces.
* | stdenv: Don't move info pages to the 'man' outputTuomas Tynkkynen2017-08-11
| | | | | | | | | | | | Because if you were to disable man pages via 'programs.man.enable', the "man" output wouldn't be installed and the info pages would go missing.
* | stdenv: Don't move man or info pages to $docTuomas Tynkkynen2017-08-11
| | | | | | | | | | Because .doc is normally not installed to user environments, these manpages are unaccessible by default otherwise.
* | Merge pull request #27998 from davidak/macOSDomen Kožar2017-08-11
|\ \ | |/ |/| replace "Mac OS X" and "OS X" with "macOS"
| * replace "Mac OS X" and "OS X" with "macOS"davidak2017-08-07
| | | | | | | | | | | | | | | | | | | | as it is the official name since 2016 https://en.wikipedia.org/wiki/Macintosh_operating_systems#Desktop exception are parts refering to older versions of macOS like "GUI support for Mac OS X 10.6 - 10.12. Note that Emacs 23 and later [...]"
* | makeWrapper: fix regression introduced in #24944Frederik Rietdijk2017-08-09
| | | | | | | | | | In some cases wrappers could not be made. See e.g. https://github.com/NixOS/nixpkgs/pull/24944#issuecomment-321175692
* | Merge pull request #24944 from ahmedtd/make-makewrapper-pickyPeter Simons2017-08-08
|\ \ | | | | | | makeWrapper: Fail loudly when misused
| * | makeWrapper: Only wrap normal executable filesTaahir Ahmed2017-08-08
| |/ | | | | | | | | | | | | | | | | | | | | | | | | `makeWrapper` and `wrapProgram` are being invoked on all kinds of wacky things (usually with the help of bash globs or other machine assistance). So far, I have come across `wrapProgram` being invoked on a directory, as well as on the empty string. As far as I can tell, it's only valid to invoke these utilities on a normal (non-directory, non-device) executable file. This commit enforces that precondition.
* | Merge pull request #25185 from ahmedtd/fix-makewrapper-unsupported-argsPeter Simons2017-08-08
|\ \ | | | | | | Fix makewrapper unsupported args
| * | makeWrapper: Die on unsupported argumentsTaahir Ahmed2017-08-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, makeWrapper would accept arguments it didn't recognize, potentially allowing argument misspellings or broken callers. Now, makeWrapper dies with a backtrace if it is called incorrectly. Also changes `wrapProgram` so that it doesn't pass through the first argument twice --- this was tripping up the argument checking.
| * | dieHook: Add `die` utility functionTaahir Ahmed2017-08-08
| |/ | | | | | | | | Calling `die "Error message"` causes the current script to exit with an error, printing a backtrace
* | Merge pull request #27320 from jtojnar/fix/unbreak-polariFrederik Rietdijk2017-08-05
|\ \ | |/ |/| polari: unbreak
| * wrap-gapps-hook: also wrap symlinks to executablesJan Tojnar2017-08-05
| | | | | | | | | | | | | | | | | | | | Some programs store the executable in a different place and link it from the `bin` directory. For example, Polari links `$out/bin/polari` to `$out/share/polari/org.gnome.Polari`. `wrapGAppsHook` did not follow symlinks so it was not able to wrap Polari, making it unable to access GObject introspection definitions required for running the program. I made the wrapping script follow symlinks to fix this corner case.
* | Add a setup hook to fill NIX_DEBUG_INFO_DIRSEelco Dolstra2017-07-28
|/ | | | | | | | This setup hook is propagated by gdb. Thus, a typical use is: $ nix-shell -p gdb nix nix.debug sqlite.debug ... and gdb will be able find the debug symbols of nix etc. automatically.
* Revert "stdenv: Store one package per line in nix-support/propagated-*"John Ericson2017-07-24
| | | | | | | | | | As @oxij points out in [1], this breakage is especially serious because it changes the contents of built environments without a corresonding change in their hashes. Also, the revert is easier than I thought. This reverts commit 3cb745d5a69018829ac15f7d5a508135f6bda123. [1]: https://github.com/NixOS/nixpkgs/pull/27427#issuecomment-317293040
* stdenv: Store one package per line in nix-support/propagated-*John Ericson2017-07-10
| | | | | | | | | | | | | | | | | This makes those files a bit easier to read. Also, for what it's worth, it brings us one baby step closer to handling spaces in store paths. Also, I optimized handling of many transitive deps with read. Probably, not very beneficial, but nice to enforce the pkg-per-line structure. Doing so let me find much dubious code and fix it. Two misc notes: - `propagated-user-env-packages` also needed to be adjusted as sometimes it is copied to/from the propagated input files. - `local fd` should ensure that file descriptors aren't clobbered during recursion.
* cygwin: force native symlinks for librariesDavid McFarland2017-06-26
| | | | | | | | | | This will override the existing winsymlinks setting. nativestrict will cause ln to fail if it's unable to create a native symlink. Native symlinks are required for the windows dll loader to find the libraries. This script is also used for cross-mingw, but setting CYGWIN shouldn't cause a problem.
* Add a setup hook for detecting $TMPDIR references in RPATHs and wrapper scriptsEelco Dolstra2017-05-04
|
* stdenv: fix "grep: invalid range"Linus Heckemann2017-05-04
|
* Merge pull request #25299 from ahmedtd/fix-wrap-gapps-hookPeter Simons2017-04-29
|\ | | | | wrapGAppsHook: Correct `wrapProgram` invocations
| * wrapGAppsHook: Correct `wrapProgram` invocationsTaahir Ahmed2017-04-28
| | | | | | | | | | | | | | | | | | | | | | | | This change fixes several defects in the way `wrapGAppsHook` selected the executable to wrap. Previously, it would wrap any top-level files in the target `/bin` and `/libexec` directories, including directories and non-executable files. In addition, it failed to wrap files in subdirectories. Now, it uses `find` to iterate over these directory hierarchies, selecting only executable files for wrapping.
* | wrapGAppsHook: Revert "Correct `wrapProgram` invocations"Peter Simons2017-04-28
| | | | | | | | | | | | | | | | This reverts commit 8b9f153bb9c8156ec4f3d56d61845e432d19dcd6 of https://github.com/NixOS/nixpkgs/pull/25183 because it breaks builds of packages that don't install both a "bin" and a "libexec" directory. See https://github.com/NixOS/nixpkgs/pull/25183#issuecomment-298064769 for more details.
* | Merge pull request #25183 from ahmedtd/fix-wrap-gapps-hookPeter Simons2017-04-28
|\ \ | | | | | | wrapGAppsHook: Correct `wrapProgram` invocations
| * | wrapGAppsHook: Correct `wrapProgram` invocationsTaahir Ahmed2017-04-24
| |/ | | | | | | | | | | | | | | | | | | | | | | This change fixes several defects in the way `wrapGAppsHook` selected the executable to wrap. Previously, it would wrap any top-level files in the target `/bin` and `/libexec` directories, including directories and non-executable files. In addition, it failed to wrap files in subdirectories. Now, it uses `find` to iterate over these directory hierarchies, selecting only executable files for wrapping.
* / makeWrapper: search for free unwrapped file nameNikolay Amiantov2017-04-12
|/