nixpkgs/pkgs/build-support
Bruce Toll bbb2f93cee wrap-gapps-hook.sh: only wrap links when required
Unless dontWrapGapps is set, the wrap-gapps-hook.sh will currently
wrap all executables (and symbolic links to executables) found under
the target directories: bin and libexec.

As a result, if a symbolic link in a target directory points to an
executable in a target directory, both will get wrapped.  This
causes an extra shell/exec when following the symbolic link,
as well as increasing the size of the final executable's environment.

To avoid wrapping a link to an already wrapped executable, this
commit splits the determination of what gets wrapped into two phases:

1. All binaries under the target directories are wrapped and logged
   with "Wrapping program ..."

2. All links to executables under the target directories are
   identified and checked to see if they reference an executable
   under one of the target directories.

   If yes, the required wrapping has already been performed on
   the associated binary (in phase 1), so no wrapping is done
   and "Not wrapping link: ... (already wrapped)" is logged.

   If no, the link points at an executable that hasn't been
   wrapped, so the link is wrapped and "Wrapping link: ..." is logged.

As an example, the yelp package has a bin directory that contains
an executable "yelp" and a symbolic link "gnome-help" -> "yelp".

Prior to this commit, the bin directory would contain these files
after wrapping:

  gnome-help          -- wrapper to exec .gnome-help-wrapped
  .gnome-help-wrapped -- a symbolic link to yelp
  yelp                -- wrapper to exec .yelp-wrapped
  .yelp-wrapped       -- the original yelp binary

After this commit, the bin directory will instead contain:

  gnome-help          -- a symbolic link to yelp
  yelp                -- wrapper to exec .yelp-wrapped
  .yelp-wrapped       -- the original yelp binary

NOTE: The primary motivation for this commit is to avoid obscuring
the fact that two or more paths are simple aliases and expected to
behave identically. It also reduces the likelihood of hitting
limits related to environment variable size.

LIMITATION: The method used above is intended to be conservative
and will still wrap symbolic links to other symbolic links when
the ultimate target is outside of bin or libexec.
2019-01-31 20:14:30 -05:00
..
agda agda: use exec in agdaWrapper 2018-12-07 21:37:19 -05:00
bintools-wrapper add generic x86_32 support (#52634) 2019-01-06 12:57:36 -06:00
build-bazel-package bazel-watcher: init at 0.5.0 2018-09-29 13:33:00 -07:00
build-dotnet-package treewide: Manual fix more pkg-config build-inputs 2017-09-21 15:49:54 -04:00
build-fhs-userenv fix FHSUserEnv blacklists 2018-11-11 10:32:09 -05:00
build-setupcfg Revert "buildSetupcfg: Include unzip for zip sources." 2018-04-14 20:12:22 -04:00
buildenv Merge pull request #27780 from tilpner/overridable-buildenv 2017-09-14 17:26:33 +02:00
cc-wrapper cc-wrapper: add libcxx for libcxxClang 2019-01-26 22:45:15 -05:00
docker Merge branch 'master' into staging 2019-01-22 15:59:42 +01:00
dotnetbuildhelpers Replace hard coded /bin/bash occurrences 2016-10-04 20:15:37 +02:00
dotnetenv [bot]: remove unreferenced code 2018-07-20 18:48:37 +00:00
emacs melpaBuild: Get package-build from melpa/package-build 2018-11-27 09:36:28 -06:00
expand-response-params expand-response-params: Build more normally 2017-08-25 15:10:02 -04:00
fetchbower Merge remote-tracking branch 'upstream/master' into staging 2018-01-14 21:18:27 +02:00
fetchbzr treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchcvs bsd: init netbsd & openbsd userland 2018-04-24 14:16:35 -05:00
fetchdarcs pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchdocker Merge branch 'no-toPath' 2018-09-06 08:09:53 -04:00
fetchfossil treewide: Fixed output fetch* derivations should use nativeBuildInputs 2018-01-09 20:14:46 -05:00
fetchgit prefer-fetch-remote: an overlay to fetch on remote builders 2019-01-18 14:41:10 +00:00
fetchgitlocal pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchgx Merge remote-tracking branch 'upstream/master' into staging 2018-01-14 21:18:27 +02:00
fetchhg prefer-fetch-remote: an overlay to fetch on remote builders 2019-01-18 14:41:10 +00:00
fetchipfs prefer-fetch-remote: an overlay to fetch on remote builders 2019-01-18 14:41:10 +00:00
fetchmavenartifact fetchMavenArtifact: prevent leaking nix hash to jar name 2017-06-25 12:25:16 +00:00
fetchmtn treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchnuget pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchpatch fetchpatch: patchutils -> buildPackages.patchutils 2018-08-21 17:21:25 -04:00
fetchrepoproject treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchs3 pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchsvn prefer-fetch-remote: an overlay to fetch on remote builders 2019-01-18 14:41:10 +00:00
fetchsvnrevision
fetchsvnssh treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchurl prefer-fetch-remote: an overlay to fetch on remote builders 2019-01-18 14:41:10 +00:00
fetchzip fetchzip: Use unzip from buildPackages 2018-09-21 12:55:32 -04:00
icon-conv-tools treewide: Add lots of meta.platforms 2016-08-02 21:42:43 +03:00
kernel treewide: Remove usage of remaining redundant platform compatability stuff 2018-08-30 17:20:32 -04:00
libredirect libredirect: set install_name on Darwin 2018-11-14 00:05:26 +01:00
make-desktopitem make-desktopitem: make genericName optional 2017-06-05 21:55:23 -05:00
make-startupitem make-autostartitem: Use the right path for storing the desktop files 2017-07-06 00:44:41 +02:00
make-symlinks
mkshell mkShell: add builder (#30975) 2017-12-20 23:42:07 +00:00
mono-dll-fixer treewide: Some EOF-whitespace fixes 2016-08-02 21:17:44 +03:00
nix-prefetch-github nix-prefetch-github: init -> 1.3 2018-05-22 20:55:07 +02:00
nuke-references
ocaml ocamlPackages.buildDunePackage: fix meta.platforms 2018-11-30 16:19:03 +00:00
prefer-remote-fetch prefer-fetch-remote: an overlay to fetch on remote builders 2019-01-18 14:41:10 +00:00
references-by-popularity referencesByPopularity: init to sort packages by a cachability heuristic 2018-09-26 15:50:10 -04:00
release reewide: Purge all uses stdenv.system and top-level system 2018-08-30 17:20:32 -04:00
remove-references-to Add removeReferencesTo for removing specific refs 2017-03-09 12:01:55 +00:00
rust toml2nix: init at 0.1.1 (#53883) 2019-01-15 23:36:36 +02:00
setup-hooks wrap-gapps-hook.sh: only wrap links when required 2019-01-31 20:14:30 -05:00
singularity-tools Merge pull request #30479 from obsidiansystems/singularity-tools 2019-01-09 19:39:08 -05:00
skaware skaware: switch from git repos to tarballs 2018-09-06 11:53:22 +02:00
src-only
substitute Add stdenvNoCC 2016-09-29 13:06:41 +02:00
substitute-files
templaterpm Compare to None using identity is operator 2018-10-30 21:30:56 +01:00
upstream-updater Fix #4210: Remove builderDefs 2016-08-31 11:34:46 +02:00
vm treewide: use ${stdenv.shell} instead of /bin/sh where possible 2019-01-16 20:37:15 +01:00
wrapper-common {bintools,cc}-wrapper: Factor out role accumulation logic 2018-05-07 15:10:45 -04:00
writers lib.makePerlPath -> perlPackages.makePerlPath 2018-12-15 03:50:31 +00:00
build-maven.nix buildMaven: Support metadata-only dependencies 2018-11-29 17:29:59 +00:00
build-pecl.nix Revert "fix phpPackages memcache,memcached,xdebug" 2017-12-10 12:12:43 +01:00
closure-info.nix make-closure needs build system mkdir and jq 2018-06-29 23:22:24 +00:00
dhall-to-nix.nix Add a pkgs.dhallToNix utility 2017-01-26 20:11:49 -08:00
plugins.nix Ultrastar (#26524) 2017-06-14 11:29:31 +02:00
replace-dependency.nix replaceDependency: fix syntax error 2016-10-28 01:00:04 +02:00
setup-systemd-units.nix Add setupSystemdUnits function. 2017-03-24 15:47:51 -04:00
source-from-head-fun.nix
trivial-builders.nix trivial builders: adding usage documentation for functions 2018-10-02 22:09:09 +02:00