Commit Graph

521 Commits

Author SHA1 Message Date
Lily Ballard
43dade238f
installShellFiles: init (#65211)
This is a new package that provides a shell hook to make it easy to
declare manpages and shell completions in a manner that doesn't require
remembering where to actually install them. Basic usage looks like

  { stdenv, installShellFiles, ... }:
  stdenv.mkDerivation {
    # ...
    nativeBuildInputs = [ installShellFiles ];
    postInstall = ''
      installManPage doc/foobar.1
      installShellCompletion --bash share/completions/foobar.bash
      installShellCompletion --fish share/completions/foobar.fish
      installShellCompletion --zsh share/completions/_foobar
    '';
    # ...
  }

See source comments for more details on the functions.
2019-09-04 23:19:17 +02:00
Benjamin Esham
3a9b0bd634 add shortenPerlShebang function
This setup hook modifies a Perl script so that any "-I" flags in its shebang
line are rewritten into a "use lib ..." statement on the next line. This gets
around a limitation in Darwin, which will not properly handle a script whose
shebang line exceeds 511 characters.
2019-08-18 16:22:23 -07:00
Daniel Schaefer
7c3d7521f0 patchShebangs: Exit if no arguments were given
Commit "patchShebangs: Allow for multiple arguments" 4a1e51f957
removed the check. We don't want to break existing usages so this
introduces it again with a successful exit code.
2019-05-26 16:05:06 +02:00
Daniel Schaefer
4a1e51f957 patchShebangs: Allow for multiple arguments
It's tempting to think patchShebangs supports multiple arguments.
Without this patch it just silently ignores all but the first. Now it
patches the shebangs in all of its arguments.

Fixes: #57695
2019-05-25 16:15:54 +02:00
Daniel Schaefer
81d3bd60a4 patchShebangs: Explain that script must be executable 2019-05-25 16:15:54 +02:00
Matthew Bauer
87944c3125
Merge pull request #56744 from matthewbauer/macos-10-12
Update macOS to 10.12
2019-04-26 22:20:03 -04:00
Matthew Bauer
a1533dfc41 patch-shebangs: fix dev detection
$output = $outputDev is the right condition. ${!outputDev} is only
useful if you want a path.
2019-04-26 21:54:48 -04:00
Matthew Bauer
61bc03c017 Revert "Revert "patch-shebangs: respect cross compilation""
This reverts commit 9c4b11e9a0.
2019-04-26 21:54:48 -04:00
Graham Christensen
a682d720c7
Merge pull request #60215 from nmattia/nm-tmp-timestamp
patchShebangs: create timestamp in tmp dir
2019-04-25 12:50:16 -04:00
Nicolas Mattia
cc9b4029bc patchShebangs: create timestamp in tmp dir
Creating the timestamp in the patched script's directory has a few
drawbacks:

* if "foo.timestamp" already exists, it will be overwritten
* it requires the directory to be writable
2019-04-25 17:07:58 +02:00
Wael M. Nasreddine
5af0780492
Merge remote-tracking branch 'origin/master' into staging
* origin/master: (693 commits)
  buildGoModule: use go_1_12 instead of go_1_11 (#58103)
  gitAndTools.lab: 0.15.2 -> 0.15.3 (#58091)
  signal-desktop: 1.22.0 -> 1.23.0
  added missing semicolon to documentation
  terminus_font_ttf: 4.46.0 -> 4.47.0
  buildGoModule: remove SSL env vars in favor of cacert in buildInputs (#58071)
  dav1d: init at 0.2.1
  dropbox-cli: 2018.11.28 -> 2019.02.14
  atlassian-confluence: 6.14.1 -> 6.14.2
  maintainers: update email for dywedir
  python.pkgs.hglib: use patch to specify hg path (#57926)
  chkrootkit: 0.52 -> 0.53
  radare2-cutter: 1.7.2 -> 1.8.0
  autorandr: 1.7 -> 1.8
  pythonPackages.pyhepmc: fix build
  llvm-polly/clang-polly: use latest llvm
  apulse: 0.1.11.1 -> 0.1.12, cleanup
  factorio: experimental 0.17.14 → 0.17.16 (#58000)
  sequeler: 0.6.7 -> 0.6.8
  nasc: 0.5.1 -> 0.5.2
  ...
2019-03-21 21:01:25 -07:00
Danylo Hlynskyi
de0612c46c
auto-patchelf: don't use grep -q, as it causes Broken pipe (#56958)
This rare sitation was caught when building zoom-us package:
```
automatically fixing dependencies for ELF files
/nix/store/71d65fplq44y9yn2fvkpn2d3hrszracd-auto-patchelf-hook/nix-support/setup-hook: line 213: echo: write error: Broken pipe
/nix/store/71d65fplq44y9yn2fvkpn2d3hrszracd-auto-patchelf-hook/nix-support/setup-hook: line 210: echo: write error: Broken pipe
```

The worst is that derivation continued and resulted into broken package:
https://github.com/NixOS/nixpkgs/pull/55566#issuecomment-470065690

I hope, replacing `grep -q` with `grep` will remove this race condition.
2019-03-20 14:57:59 +02:00
Jan Tojnar
0ea220b9bd
wrapGAppsHook: add package’s own modules to GIO_EXTRA_MODULES
When a package provides both executables and gio modules, it is quite
probable the executables will need those modules. wrapGAppsHook wraps
executables with GIO_EXTRA_MODULES picked up from dependencies
but forgets about the package being built. Let’s add to consideration.

Closes: https://github.com/NixOS/nixpkgs/issues/50254
2019-03-13 23:03:53 +01:00
Frederik Rietdijk
7257dedd7c Merge master into staging-next 2019-02-13 12:33:29 +01:00
deliciouslytyped
ca1062ea24
Document undocumented argument to makeWrapper() 2019-02-11 21:45:02 +01:00
Alyssa Ross
21d991b1fd
Merge pull request #54578 from alyssais/gcj-darwin
gcj: fix build on Darwin
2019-02-08 16:54:35 +00:00
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
Alyssa Ross
b9b83748f3
gcj: fix build on Darwin
Partially addresses https://github.com/NixOS/nixpkgs/issues/29715.
2019-01-30 18:19:17 +00:00
Piotr Bogdan
93545a8910 pruneLibtoolFiles: check if prefix exists 2018-12-09 22:44:29 +00:00
Piotr Bogdan
9cd155f1e2 pruneLibtoolFiles: more permissive regex for detecting libtool files 2018-12-09 00:13:04 +00:00
Bjørn Forsman
ad28261ad2 audit-tmpdir hook: clean up whitespace 2018-12-02 11:45:34 +01:00
Bjørn Forsman
ed0cee645f audit-tmpdir hook: use abspath matching on RPATH entries
This ensures that RPATH entries like "/foo/build/bar" doesn't trigger a
match when TMPDIR is "/build/bar". (I've had this problem with a
prebuilt package.)
2018-12-02 11:45:18 +01:00
John Ericson
ed71691a81
Merge pull request #51217 from mayflower/source-date-epoch-fix-warning
set-source-date-epoch-to-latest: fix warning
2018-11-29 15:20:22 -05:00
Robin Gloster
34faed5bb0
set-source-date-epoch-to-latest: fix warning
If there was no older file than $NIX_BUILD_TOP this would result in a
warning, e.g. with nix-info.

```
/nix/store/15kgcm8hnd99p7plqzx7p4lcr2jni4df-set-source-date-epoch-to-latest.sh: line 13: [: : integer expression expected
```
2018-11-29 09:49:08 +01:00
Frederik Rietdijk
9db2421d1f Merge master into staging-next 2018-11-29 08:12:56 +01:00
aszlig
4a6e3e4185
autoPatchelfHook: Skip on missing segment headers
If the file in question is not a shared object file but an ELF, we
really want to skip the file, because we won't have anything to patch
there.

For example if the file is created via "gcc -c -o foo.o foo.c", we don't
get a segment header and so far autoPatchelf was trying to patch such a
file.

By checking for missing segment headers, we're now no longer going to
attempt patching such a file.

Signed-off-by: aszlig <aszlig@nix.build>
Reported-by: Sander van der Burg <svanderburg@gmail.com>
2018-11-26 01:58:36 +01:00
aszlig
9f23a63f79
autoPatchelfHook: Fix type of norecurse variable
While declaring it as an array doesn't do any harm in our usage, it
might be a bit confusing when reading the code.

Signed-off-by: aszlig <aszlig@nix.build>
2018-11-26 01:13:59 +01:00
aszlig
2faf905f98
autoPatchelfHook: Add addAutoPatchelfSearchPath
This function is useful if autoPatchelf is invoked during some of the
phases of a build and allows to add arbitrary shared objects to the
search path.

So far the same functionality was in autoPatchelf itself, but not
available as a separate function, so when adding shared objects to the
dependency cache one would have to do so manually.

The function also has the --no-recurse flag, which prevents recursing
into subdirectories.

Signed-off-by: aszlig <aszlig@nix.build>
2018-11-25 16:22:32 +01:00
aszlig
3ca35ce0b2
autoPatchelfHook: Add --no-recurse flag
This is to be used with the autoPatchelf command and allows to only
patch a specific file or directory without recursing into
subdirectories.

Apart from being able to run the command in a standalone way, as
detailled in the previous commit this is also needed for the Android SDK
emulator, because according to @svanderburg there are subdirectories we
don't want to patch.

The reason why I didn't use GNU getopt is that it might not be available
on all operating systems and the getopts bash builtin doesn't support
long arguments. Apart from that, the implementation for recognizing the
flag is pretty trivial and it's also using bash builtins only, so if we
want to do something really fancy someday, we can still change it.

Signed-off-by: aszlig <aszlig@nix.build>
2018-11-20 00:11:29 +01:00
aszlig
e4fbb244ee
autoPatchelfHook: Allow to prevent automatic run
If you want to only run autoPatchelf on a specific path and leave
everything else alone, we now have a $dontAutoPatchelf environment
variable, which causes the postFixup hook to not run at all.

The name "dontAutoPatchelf" probably is a bit weird in conjunction with
putting "autoPatchelfHook" in nativeBuildInputs, but unless someone
comes up with a better name I keep it that way because it's consistent
with all the other dontStrip, dontPatchShebangs, dontPatchELF and
whatnot.

A specific example where this is needed is when building the Android SDK
emulator, which contains a few ARM binaries in subdirectories that
should not be patched. If we were to run autoPatchelf on all outputs
unconditionally we'd run into errors because some ARM libraries couldn't
be found.

Signed-off-by: aszlig <aszlig@nix.build>
2018-11-20 00:07:38 +01:00
aszlig
d03e4ffdbf
autoPatchelfHook: Make easier to run autoPatchelf
The autoPatchelf main function which is run against all of the outputs
was pretty much tailored towards this specific setup-hook and was
relying on $prefix to be set globally.

So if you wanted to run autoPatchelf manually - let's say during
buildPhase - you would have needed to run it like this:

  prefix=/some/directory autoPatchelf

This is now more intuitive and all you need to do is run the following:

  autoPatchelf /some/directory

Signed-off-by: aszlig <aszlig@nix.build>
2018-11-19 17:18:27 +01:00
zimbatm
551aecfa83
tmpdir audit: only fail with files referenced below (#35068)
On Linux the `$TMPDIR` is `/build`. The TMPDIR audit looks for `$TMPDIR`
in the build output, which will then fail with packages like
/buildkite-agent.

This fixes the heuristic to look for `$TMPDIR/` instead.
2018-11-16 22:35:56 +01:00
Daiderd Jordan
bdec3ed049
Revert "Revert "Revert "patch-shebangs: respect cross compilation"""
Completely breaks darwin. Every package in the stdenv that has shebangs
in the output will end up with references to bootstrap-tools.

This reverts commit bde99096a8.
2018-11-14 23:37:32 +01:00
Daiderd Jordan
c9223a17bc
Revert "patch-shebangs: use --build for auto patch shebangs"
Completely breaks darwin. Every package in the stdenv that has shebangs
in the output will end up with references to bootstrap-tools.

This reverts commit eb7c50a993.
2018-11-14 23:37:31 +01:00
Matthew Bauer
f9a6963d9a
Merge pull request #50244 from tathougies/travis/wrap-correctly
make-wrapper should use runtimeShell, not $SHELL, for cross-compilation
2018-11-13 13:55:26 -06:00
Travis Athougies
9531a32b60 make-wrapper should use runtimeShell, not bash, for cross-compilation 2018-11-11 10:25:05 -08:00
Matthew Bauer
c8aff96110
Merge pull request #49608 from matthewbauer/cross-patch-shebangs-2
Restore cross-patch-shebangs branch
2018-11-07 13:37:02 -06:00
aszlig
c64624b843
autoPatchelfHook: Correctly detect PIE binaries
I originally thought it would just be enough to just check for an INTERP
section in isExecutable, however this would mean that we don't detect
statically linked ELF files, which would break our recent improvement to
gracefully handle those.

In theory, we are only interested in ELF files that have an INTERP
section, so checking for INTERP would be enough. Unfortunately the
isExecutable function is already used outside of autoPatchelfHook, so we
can't easily get rid of it now, so let's actually strive for more
correctness and make isExecutable actually match ELF files that are
executable.

So what we're doing instead now is to check whether either the ELF type
is EXEC *or* we have an INTERP section and if one of them is true we
should have an ELF executable, even if it's statically linked.

Along the way I also set LANG=C for the invocations of readelf, just to
be sure we don't get locale-dependent output.

Tested this with the following command (which contains almost[1] all the
packages using autoPatchelfHook), checking whether we run into any
library-related errors:

  nix-build -E 'with import ./. { config.allowUnfree = true; };
    runCommand "test-executables" {
      drvs = [
        anydesk cups-kyodialog3 elasticsearch franz gurobi
        masterpdfeditor oracle-instantclient powershell reaper
        sourcetrail teamviewer unixODBCDrivers.msodbcsql17 virtlyst
        vk-messenger wavebox zoom-us
      ];
    } ("for i in $drvs; do for b in $i/bin/*; do " +
       "[ -x \"$b\" ] && timeout 10 \"$b\" || :; done; done")
  '

Apart from testing against library-related errors I also compared the
resulting store paths against the ones prior to this commit. Only
anydesk and virtlyst had the same as they didn't have self-references,
everything else differed only because of self-references, except
elasticsearch, which had the following PIE binaries:

  * modules/x-pack/x-pack-ml/platform/linux-x86_64/bin/autoconfig
  * modules/x-pack/x-pack-ml/platform/linux-x86_64/bin/autodetect
  * modules/x-pack/x-pack-ml/platform/linux-x86_64/bin/categorize
  * modules/x-pack/x-pack-ml/platform/linux-x86_64/bin/controller
  * modules/x-pack/x-pack-ml/platform/linux-x86_64/bin/normalize

These binaries were now patched, which is what this commit is all about.

[1]: I didn't include the "maxx" package (MaXX Interactive Desktop)
     because the upstream URLs are no longer existing and I couldn't
     find them elsewhere on the web.

Signed-off-by: aszlig <aszlig@nix.build>
Fixes: https://github.com/NixOS/nixpkgs/issues/48330
Cc: @gnidorah (for MaXX Interactive Desktop)
2018-11-03 08:07:42 +01:00
Matthew Bauer
eb7c50a993 patch-shebangs: use --build for auto patch shebangs
In strictDeps=false, autoPatchshebangs should use
--build (corresponding to PATH) to lookup commands. This restores the
previous behavior of patchshebangs so that we don’t break stuff that
isn’t careful in the buildInputs vs. nativeBuildInputs distinction.
Unfortunately this won’t work under cross compilation.
2018-11-02 00:27:14 -05:00
Matthew Bauer
bde99096a8 Revert "Revert "patch-shebangs: respect cross compilation""
This reverts commit 9c4b11e9a0.
2018-11-02 00:27:14 -05:00
Jörg Thalheim
f10b935f84
breakpointHook: add for debugging failing builds
Usuage: Add breakpointHook to your `buildInputs` like this:

  stdenv.mkDerivation rec {
    # ...
    buildInputs = [ breakpointHook ];
  });

When the build fails as show in this example:

  pkgs.hello.overrideAttrs (old: {
    buildInputs = [ breakpointHook ];
    postPatch = ''
      false
    '';
  });

It will halt execution printing the following message:

build failed in patchPhase with exit code 1
To attach to this build run the following command as root:

   cntr attach -t command cntr-/nix/store/ynyb4n82x2r7sldd58pbb405jdqh5f00-hello-2.10

Installing cntr and running the command will provide shell access to the
build sandbox of failed build:

sudo cntr attach -t command cntr-/nix/store/ynyb4n82x2r7sldd58pbb405jdqh5f00-hello-2.10
WARNING: bad ownership on /nix/var/nix/profiles/per-user/root, should be 1000
[nixbld@localhost:/var/lib/cntr]$

At /var/lib/cntr the sandbox filesystem is mounted. All commands and
files of the system are still accessible within the shell.
To execute commands from the sandbox use the `cntr exec` subcommand.
2018-10-25 10:19:41 +01:00
Will Dietz
f7db287960 patch-shebangs.sh: use more robust 'for each file' loop, check for dir
The latter is to avoid warnings printed by find if it doesn't exist.
2018-09-28 11:21:51 -05:00
Will Dietz
286381f072 patch-shebangs: simplify a bit per reviewer suggestion 2018-09-28 11:17:33 -05:00
Will Dietz
830f9fabd4 patch-shebangs: use isScript to safely check for shebang start
Fixes commonly encountered errors about broken pipes or null-bytes in
command-substitution.
2018-09-28 11:15:36 -05:00
Daiderd Jordan
9c4b11e9a0
Revert "patch-shebangs: respect cross compilation"
This causes problems for packages built using a bootstrap stdenv,
resulting in references to /bin/sh or even bootstrap-tools. The darwin
stdenv is much stricter about what requisites/references are allowed but
using /bin/sh on linux is also undesirable.

eg. https://hydra.nixos.org/build/81754896

    $ nix-build -A xz
    $ head -n1 result-bin/bin/xzdiff
    #!/nix/store/yvc7kmw98kq547bnqn1afgyxm8mxdwhp-bootstrap-tools/bin/sh

This reverts commit f06942327a.
2018-09-25 21:11:54 +02:00
John Ericson
c701d6cb21 Merge remote-tracking branch 'upstream/master' into staging 2018-09-25 14:20:27 -04:00
aszlig
b4526040a2
autoPatchelfHook: Silence errors in isExecutable
The "maxx" package recursively runs isExecutable on a bunch of files and
since the change to use "readelf" instead of "file" a lot of errors like
this one are printed during build:

  readelf: Error: Not an ELF file - it has the wrong magic bytes at the
  start

While the isExecutable was never meant to be used outside of the
autoPatchelfHook, it's still a good idea to silence the errors because
whenever readelf fails, it clearly indicates that the file in question
is not a valid ELF file.

Signed-off-by: aszlig <aszlig@nix.build>
2018-09-25 04:48:12 +02:00
aszlig
9920215d00
autoPatchelfHook: Only check PT_INTERP on execs
If the ELF file is not an executable, we do not get a PT_INTERP section,
because after all, it's a *shared* library.

So instead of checking for PT_INTERP (to avoid statically linked
executables) for all ELF files, we add another check to see if it's an
executable and *only* skip it when it is and there's no PT_INTERP.

Signed-off-by: aszlig <aszlig@nix.build>
2018-09-25 04:42:34 +02:00
Jörg Thalheim
58a97dfb49 autoPatchelfHook: do not patch statically linked files
Also speed up quite significantly due less forking.
2018-09-23 21:33:43 +01:00
Matthew Bauer
e258c8d8dd
Merge pull request #45698 from kamilchm/filename-in-usnupported-shebang-error
Show the filename on unsupported shebang error
2018-09-10 14:52:38 -05:00
Matthew Bauer
a6877783f6
Merge pull request #43833 from matthewbauer/cross-patch-shebangs
patch-shebangs: respect cross compilation
2018-09-05 14:52:43 -05:00
Kamil Chmielewski
383de74f88 patch-shebangs: filename on unsupported shebang
Show the filename on unsupported shebang error.
Simplifies debugging packages with large set of scripts.
2018-08-29 21:47:27 +02:00
Alyssa Ross
f4745bef6c makeWrapper: document --set-default 2018-08-24 19:46:16 +02:00
Will Dietz
79a86ca11c audit-tmpdir: fix processing of files with spaces, quote variables 2018-08-20 13:08:32 -05:00
Matthew Bauer
f06942327a patch-shebangs: respect cross compilation
This hopefully makes patchShebangs respect cross compilation. It
introduces the concept of the HOST_PATH. Nothing is ever executed on
it but instead used as a way to get the proper path using ‘command
-v’. Needs more testing.

/cc @ericson2314 @dtzwill

Fixes #33956
Fixes #21138
2018-07-31 15:38:35 -04:00
Frederik Rietdijk
dfeeac7f7c remove file that was accidentally added 2018-07-29 17:19:23 +02:00
Frederik Rietdijk
ae9932e431 php: get rid of composableDerivation
Some bugs may have creeped in during the conversion.
One flag I had trouble with and so removed was:

    "--enable-embedded-mysqli"
2018-07-26 11:49:56 +02:00
aszlig
f1fbf818c4
autoPatchelfHook: Run after patchelf's setup hook
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
2018-07-16 01:52:28 +02:00
Orivej Desh
fd97db43bc
pruneLibtoolFiles: init setup hook (#41819)
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] 2a79d296d3
[2] c83a530985
[3] 9e0dcf3bd9
[4] 01134e698f
[5] f6c73f1e37
[6] https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Handling_Libtool_Archives
[7] https://github.com/gentoo/gentoo/blob/fb1f2435/eclass/ltprune.eclass
2018-06-11 18:11:02 +00:00
aszlig
ff5cecf821
autoPatchelfHook: Patch PIC exes/libs as well
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>
2018-06-08 00:27:31 +02:00
John Ericson
2110c0bd30 treewide: Use pkgs/build-support/roles.bash to remove copy pasta
Also fix some setup hooks that unnecessarily used environment hooks,
which revolted in the same variable being modified too many times.
2018-05-07 15:10:37 -04:00
Peter Hoeg
8016f9b4c9
Merge pull request #34611 from peterhoeg/p/descent
descent 1 & 2: use assets from gog.com with the dxx-rebirth project
2018-02-12 22:31:41 +08:00
Peter Hoeg
126cc690ac build-support gogUnpackHook: support for unpacking games from gog.com 2018-02-12 22:28:06 +08:00
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
Yegor Timoshenko
4b1b6ee6d1
patchShebangs: preserve times, resolves #33084
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
2018-01-21 12:09:07 +01:00
John Ericson
046f091e0d treewide: Don't use envHook anymore
This commits needs a MAJOR audit as I oftentimes just guessed which of
`$hostOffset`, `$targetOffset`, or a fixed offset should be used.
2017-12-30 22:04:22 -05:00
John Ericson
a1cdc2011e strip setup hook: Learn about only stripping host/target binaries alone
`dontStrip` is still a catch-all, but `dontStripHost` and
`dontStripTarget` are also now available for finer-grained disabling.
2017-12-30 22:04:22 -05:00
Orivej Desh
e2c8655405 ld-is-cc-hook: init
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.
2017-12-19 01:45:42 +00:00
John Ericson
b8a21aa918 misc setup-hooks: Use env vars to refer to binutils programs
This is more robust for cross-compilation
2017-12-13 16:08:18 -05:00
Orivej Desh
29b2984b0c
Merge pull request #31987 from jtojnar/devhelp-devdoc
stdenv: Move devhelp books to outputDevdoc
2017-11-25 23:14:47 +00:00
Jan Tojnar
70a0580e38
stdenv: Move devhelp books to outputDevdoc 2017-11-24 02:09:44 +01:00
John Ericson
405412dfd9
Merge pull request #31775 from obsidiansystems/stdenv-both-propagated-files
stdenv setup: Always use both propagated files
2017-11-22 15:23:37 -05:00
John Ericson
da19c34d0f stdenv setup: Always use both propagated files
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.
2017-11-21 10:44:44 -05:00
Orivej Desh
fbdc74c761 makeWrapper: delete --set-eval
because --run is good enough.
2017-11-17 12:53:54 +00:00
Orivej Desh
4199892768 makeWrapper: add --set-default and --set-eval
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`.
2017-11-17 10:11:01 +00:00
Nikolay Amiantov
29c0591dc1 makeWrapper: quote values properly
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!
2017-11-11 16:08:52 +03:00
Vladimír Čunát
4ca45f229b
set-source-date-epoch-to-latest.sh: shut up a warning
> bash: warning: command substitution: ignored null byte in input
/cc #28227.  Also break the overlong line.
2017-09-17 10:35:44 +02:00
John Ericson
d242978671 autoreconfHook: Simplify by avoiding findInputs
`findInputs` is a stdenv/setup helper we should strive not to call
elsewhere. Using normal deps is more idiomatic anyways.
2017-09-14 13:16:12 -04:00
Vladimír Čunát
51d6d27e90
Merge #28227: set-source-date-epoch-to-latest.sh: ignore generated files 2017-09-02 21:36:34 +02:00
Daiderd Jordan
5a28fd660a
darwin-frameworks: move fixup setup-hook 2017-08-28 23:25:11 +02:00
volth
4ebeb7d782 use \0 instead of \n 2017-08-13 14:03:05 +00:00
volth
b971f8de8e set-source-date-epoch-to-latest.sh: ignore generated files
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).
2017-08-13 09:33:09 +00:00
Tuomas Tynkkynen
58834f727f makeWrapper: use consistent style
All the other plain variable references (before e1d46c0c4) are without
braces.
2017-08-11 21:32:55 +03:00
Tuomas Tynkkynen
aeeb23853a stdenv: Don't move info pages to the 'man' output
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.
2017-08-11 21:32:55 +03:00
Tuomas Tynkkynen
e4876d6e43 stdenv: Don't move man or info pages to $doc
Because .doc is normally not installed to user environments, these
manpages are unaccessible by default otherwise.
2017-08-11 21:32:54 +03:00
Domen Kožar
486e1c3c16 Merge pull request #27998 from davidak/macOS
replace "Mac OS X" and "OS X" with "macOS"
2017-08-11 13:01:36 +02:00
Frederik Rietdijk
0ff782e141 makeWrapper: fix regression introduced in #24944
In some cases wrappers could not be made. See e.g.
https://github.com/NixOS/nixpkgs/pull/24944#issuecomment-321175692
2017-08-09 12:18:47 +02:00
Peter Simons
67f37b70e8 Merge pull request #24944 from ahmedtd/make-makewrapper-picky
makeWrapper: Fail loudly when misused
2017-08-08 17:26:38 +02:00
Taahir Ahmed
e1d46c0c4d makeWrapper: Only wrap normal executable files
`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.
2017-08-08 03:46:47 -05:00
Peter Simons
b196230e71 Merge pull request #25185 from ahmedtd/fix-makewrapper-unsupported-args
Fix makewrapper unsupported args
2017-08-08 08:33:56 +02:00
Taahir Ahmed
ece5387b09 makeWrapper: Die on unsupported arguments
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.
2017-08-08 00:18:12 -05:00
Taahir Ahmed
12354b8eb5 dieHook: Add die utility function
Calling `die "Error message"` causes the current script to exit with
an error, printing a backtrace
2017-08-08 00:17:56 -05:00
davidak
3270aa896b replace "Mac OS X" and "OS X" with "macOS"
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 [...]"
2017-08-07 21:41:30 +02:00
Frederik Rietdijk
8fcb070363 Merge pull request #27320 from jtojnar/fix/unbreak-polari
polari: unbreak
2017-08-05 17:49:47 +02:00
Jan Tojnar
0a142d3112
wrap-gapps-hook: also wrap symlinks to executables
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.
2017-08-05 13:23:05 +02:00
Eelco Dolstra
5c5b71df5e
Add a setup hook to fill NIX_DEBUG_INFO_DIRS
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.
2017-07-28 16:38:26 +02:00
John Ericson
b087618ac0 Revert "stdenv: Store one package per line in nix-support/propagated-*"
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 3cb745d5a6.

[1]: https://github.com/NixOS/nixpkgs/pull/27427#issuecomment-317293040
2017-07-24 01:05:30 -04:00
John Ericson
3cb745d5a6 stdenv: Store one package per line in nix-support/propagated-*
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.
2017-07-10 13:32:13 -04:00
David McFarland
dd8d0e3000 cygwin: force native symlinks for libraries
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.
2017-06-26 09:26:10 -03:00
Eelco Dolstra
94d164dd7f
Add a setup hook for detecting $TMPDIR references in RPATHs and wrapper scripts 2017-05-04 20:23:57 +02:00
Linus Heckemann
33962a4420 stdenv: fix "grep: invalid range" 2017-05-04 16:54:01 +01:00
Peter Simons
d1008a9a5f Merge pull request #25299 from ahmedtd/fix-wrap-gapps-hook
wrapGAppsHook: Correct `wrapProgram` invocations
2017-04-29 10:33:52 +02:00
Taahir Ahmed
2cd342cfb3 wrapGAppsHook: Correct wrapProgram invocations
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.
2017-04-28 15:24:50 -05:00
Peter Simons
5c25c33a05 wrapGAppsHook: Revert "Correct wrapProgram invocations"
This reverts commit 8b9f153bb9 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.
2017-04-28 20:01:33 +02:00
Peter Simons
edcff000d4 Merge pull request #25183 from ahmedtd/fix-wrap-gapps-hook
wrapGAppsHook: Correct `wrapProgram` invocations
2017-04-28 11:13:12 +02:00
Taahir Ahmed
8b9f153bb9 wrapGAppsHook: Correct wrapProgram invocations
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.
2017-04-24 10:56:53 -05:00
Nikolay Amiantov
e7c76d3c25 makeWrapper: search for free unwrapped file name 2017-04-12 18:12:16 +03:00
Nikolay Amiantov
7ff6eec5fd makeWrapper: quote paths
Fixes https://github.com/NixOS/nixpkgs/pull/22962#commitcomment-21144939

Also run ShellCheck.
2017-03-16 15:16:33 +01:00
Vladimír Čunát
e99bc64552
Merge branch 'master' into staging
More larger rebuilds from master, unfortunately.
2017-03-15 19:09:56 +01:00
Daiderd Jordan
04fa8e006c
darwin: add setup-hook to fix CF references 2017-03-12 15:19:03 +01:00
Shea Levy
d39be63a10 stripDirs: Silence annoying 'File format not recognized' errors 2017-03-08 14:25:06 -05:00
Vladimír Čunát
20ffc3cd73
compress-man-pages: skip compressed manpages
Because of bash 4.4 the semantics GLOBIGNORE changed.
This resulted in already compressed manpages to be compressed twice.
Also be careful about symlinks to fix #21777, e.g. the ledger example.
2017-02-27 20:03:45 +01:00
Tuomas Tynkkynen
00c80a247d updateAutotoolsGnuConfigScriptsHook: Only fix files
Some package had a broken symlink named config.sub, and the script would
fail.
2017-02-11 12:24:49 +02:00
Vladimír Čunát
3b583d943e
Merge #19328: mkWrapper fix and docs 2017-02-05 14:09:22 +01:00
Tuomas Tynkkynen
c909f1b18e stdenv: Add updateAutoconfGnuConfigScriptsHook for aarch64
This is required for Aarch64 since a lot of source tarballs ship with
outdated configure scripts that don't recognize aarch64. Simply
replacing the config.guess and config.sub with new versions from
upstream makes them build again.

This same approach is used by at least Buildroot and Fedora. In
principle this could be enabled for all architectures but
conditionalizing this on aarch64 avoids a mass rebuild on x86.
2017-01-25 00:01:52 +02:00
Tomas Hlavaty
59134519ee fix win-dll-link.sh setup hook (#20925)
if a dll is symlink then dll files from the symlinked
directory need to be taken
2016-12-07 17:58:36 +01:00
Vladimír Čunát
97853c07d7
stdenv moveToOutput: move even broken symlinks
I believe this reduces surprises and is actually simpler semantically.
This is important e.g. for relative symlinks when moving both source
and target - now the order of moving won't matter.

Fixes #20723 (a particular instance of the surprise).
2016-11-26 12:32:15 +01:00
Profpatsch
5ae18574fc stdenv/makeWrapper: make extraFlagsArray local
extraFlagsArray should not be exposed outside of `makeWrapper`, it
should only be possible to set it inside a script supplied via the
`--run` argument.
2016-10-08 23:36:49 +02:00
Profpatsch
dd58d24fa6 stdenv: document makeWrapper
Add function documentation to `makeWrapper`.
Also add user documentation to the nixpkgs manual.
2016-10-08 23:36:40 +02:00
Eelco Dolstra
5f8a330d40 outputDocdev -> outputDevdoc
For consistency with the devdoc output.
2016-09-20 17:44:48 +02:00
Eelco Dolstra
594c47e5eb Don't nuke section 3 manpages by default
They now go to devman, devdoc, or $outputMan, in that order. This is
to prevent cases such as the man-pages package quietly losing its
section 3 pages.
2016-09-20 17:42:43 +02:00
Eelco Dolstra
8172cd734c docdev -> devdoc
It's "developer documentation", not "documentation developer" after
all.
2016-09-01 11:07:23 +02:00
Tuomas Tynkkynen
5d55ae5d50 stdenv/multiple-outputs.sh: Change output propagation logic
Because 'dev' will most often not be the default output after my changes.
2016-08-29 14:49:51 +03:00
Nikolay Amiantov
d43bde5f2b patchShebangs: quote variable assignment 2016-07-09 03:05:11 +03:00
Cireo
ff3e7d2b4b patchShebangs: strip trailing whitespace
Prior to this commit, trailing whitespace would be introduced when
modifying '#!' lines with no arguments.  For example (whitespace added):

    /nix/store/.../foo: interpreter directive changed
        from "/bin/bash"
          to "/nix/store/...-bash-4.3-p42/bin/bash  "

    /nix/store/.../bar: interpreter directive changed
        from "/bin/baz wef"
          to "/nix/store/...-baz wef "

We add a sed command to strip trailing whitespace, so the above commands
would drop the two spaces after "bash", or the one space after "baz wef".

abbradar: fixed commit title

Closes #16785.
2016-07-09 03:00:27 +03:00
Vladimír Čunát
61b8d27b4c make-wrapper: fixup #14753 changes to make tests work
The tests need to expand passed variable and very carefully.
I could see no other easy way than to change single-quoting in
makeWrapper to double-quoting.
The tests now fail with the same problem as on master...
2016-06-19 13:38:46 +02:00
Vladimír Čunát
cec03a8ecd Merge #14753: makeWrapper: allow spaces in variables 2016-06-09 13:09:43 +02:00
Guillaume Maudoux
bfd522da63 setup-hooks: do not pass missing dirs to find (close #15405)
find fails when called with an inexistent search path.
That situation may arise when the output is created after by a postFixup hook.
vcunat amended the PR by clarifying one more `return` to `return 0`.
2016-05-22 12:08:01 +02:00
Vladimír Čunát
7a005601d4 Merge branch 'master' to resolve conflicts 2016-05-05 08:25:38 +02:00
Maxim Ivanov
dea920bfdc Remove obsolete scatter output hook
There are no users of it in main tree and recent merge
of multiple outputs branch makes it obsolete for private trees
too.

At the time hook was created, recently merged multiple output
branch was relying on passing flags to autotools to split
outputs, which obviously wasn't working for other build systems

Scatter output was taking different approach where files were
moved out from a build tree based on known  paths, which is more
or less what current multiple-outputs.sh hook is able to do too.
2016-04-30 22:05:33 +01:00
Vladimír Čunát
6e7787e666 stdenv for windows: auto-link dependency DLLs
For every *.{exe,dll} in $output/bin/ we try to find all (potential)
transitive dependencies and symlink those DLLs into $output/bin
so they are found on invocation.
(DLLs are first searched in the directory of the running exe file.)

The links are relative, so relocating whole /nix/store won't break them.
The hook is activated on cygwin and when cross-compiling to mingw.
2016-04-23 10:52:00 +02:00
Vladimír Čunát
f6dfbb692c stdenv multiple-outputs: fix cross-build propagation
Fixes #14817. The outputs weren't propagated correctly when
cross-building.
2016-04-20 16:37:23 +02:00
Vladimír Čunát
9f8751528c stdenv multiple-outputs: fix #14782 --docdir location
- the default --docdir is typically DATAROOTDIR/doc/pkgName
- I saw no other way than to employ some magic to guess this `pkgName`
- user can override it by setting $shareDocName
2016-04-20 16:36:10 +02:00
Marius Bakke
d534e38d58 makeWrapper: allow special characters in variable contents 2016-04-16 02:58:02 +01:00
Vladimír Čunát
30f14243c3 Merge branch 'master' into closure-size
Comparison to master evaluations on Hydra:
  - 1255515 for nixos
  - 1255502 for nixpkgs
2016-04-10 11:17:52 +02:00
Eelco Dolstra
13a1c7b8c1 useOldCXXAbi: Change into a setup hook
Stdenv adapters considered weird.
2016-04-01 13:36:59 +02:00
Vladimír Čunát
ab15a62c68 Merge branch 'master' into closure-size
Beware that stdenv doesn't build. It seems something more will be needed
than just resolution of merge conflicts.
2016-04-01 10:06:01 +02:00
Domen Kožar
b07e7bfc7b Merge remote-tracking branch 'origin/staging' 2016-03-27 13:19:04 +01:00
Peter Simons
af81505c00 wrap-gapps-hook.sh: fix double inclusion guard
The simple "return" would not override the non-zero error code set by the
preceding test command, therefore aborting scripts running with "set -e".
2016-03-18 07:52:36 +01:00
Eelco Dolstra
2af1cb3aa6 Merge remote-tracking branch 'origin/binutils-2.26' into staging
This still breaks a few packages, but nothing really major:

  http://hydra.nixos.org/eval/1241850?filter=x86_64-linux&compare=1237919&full=#tabs-now-fail
2016-03-11 11:58:49 +01:00
Vladimír Čunát
09af15654f Merge master into closure-size
The kde-5 stuff still didn't merge well.
I hand-fixed what I saw, but there may be more problems.
2016-03-08 09:58:19 +01:00
zimbatm
5e5494a852 make-wrapper.sh: add an --unset argument
`--set FOO ""` is not strictly equivalent to `--unset FOO`. In the former case
the environment variable still exists with an empty string as a value.
2016-03-06 22:48:14 +00:00
Eelco Dolstra
d5bb6a1f9c glibc: Enable separate debug symbols
The importance of glibc makes it worthwhile to provide debug
symbols. However, this revealed an issue with separateDebugInfo: it
was indiscriminately adding --build-id to all ld invocations, while in
fact it should only do that for final links. Glibc also uses non-final
("relocatable") links, leading to subsequent failure to apply a build
ID ("Cannot create .note.gnu.build-id section, --build-id
ignored"). So now ld-wrapper.sh only passes --build-id for final
links.
2016-02-28 02:57:37 +01:00
Eelco Dolstra
69a337edae separateDebugInfo: Compress debug sections at compile/link time 2016-02-28 01:54:55 +01:00
Eelco Dolstra
d71a4851e8 Don't try to apply patchelf to non-ELF binaries 2016-02-18 22:54:11 +01:00
Eelco Dolstra
bf63de1613 separateDebugInfo: Handle weird filenames properly 2016-02-18 22:54:11 +01:00
Eelco Dolstra
076de98c94 separateDebugInfo: Restore ELF check 2016-02-18 21:37:26 +01:00
Vladimír Čunát
ae74c356d9 Merge recent 'staging' into closure-size
Let's get rid of those merge conflicts.
2016-02-03 16:57:19 +01:00
zimbatm
48a5bb703d stdenv: fix set-source-date-epoch-to-latest (close #12602)
In some cases the $sourceRoot is missing. Skip the hook instead
of showing the following cryptic error:

    find: cannot search `': No such file or directory
    /nix/store/0p1afvl8jcpi6dvsq2n58i90w9c59vz1-set-source-date-epoch-to-latest.sh: line 12: [: : integer expression expected

vcunat removed the warning; the hook will just skip silently in these cases.
Perhaps someone can improve on it some time.
2016-01-29 12:03:48 +01:00
Vladimír Čunát
716aac2519 Merge branch 'staging' into closure-size 2016-01-19 09:55:31 +01:00
Vladimír Čunát
620c147cce Merge branch 'master' into staging 2016-01-18 09:48:49 +01:00
Eelco Dolstra
2fcee55e5f separateDebugInfo: Create symlinks matching original binaries
For instance, a binary like libfoo.so will cause a symlink
lib/debug/libfoo.so.debug -> .build-id/<build-ID>.debug to be
created. This is primarily useful for use with eu-addr2line, if you
know the name of a binary and the relative address, but not the build
ID.
2016-01-15 16:16:11 +01:00
Vladimír Čunát
19d22184d3 stdenv/multiple-outputs.sh: small tweaks
- fix in silencing some moveToOutput messages
- allow removing (developer) documentation even without defining outputs
  (note: some paths are auto-removed by default, e.g. gtk-doc and man3)
2016-01-12 23:57:47 +01:00
Eelco Dolstra
38460cfe72 set-source-date-epoch-to-latest.sh: Support Darwin 2016-01-06 00:31:27 +01:00
Eelco Dolstra
81e530a749 Set SOURCE_DATE_EPOCH to latest source file
This provides a timestamp that's more useful than 1970-01-01 yet still
deterministic.
2016-01-05 17:21:48 +01:00
Luca Bruno
5b0352a6a4 Merge branch 'master' into closure-size 2015-12-11 18:31:00 +01:00
Luca Bruno
e289717414 rename moveToOutput and propagatedBuildInputs 2015-12-02 10:05:36 +01:00
Vladimír Čunát
333d69a5f0 Merge staging into closure-size
The most complex problems were from dealing with switches reverted in
the meantime (gcc5, gmp6, ncurses6).
It's likely that darwin is (still) broken nontrivially.
2015-11-20 14:32:58 +01:00
Danny Wilson
f9134ca9df Fix patchShebangs on SmartOS
Tail is very picky about the space after -c
 when compiled by Nix on Illumos (no idea why).
2015-11-16 17:20:14 +01:00
Vladimír Čunát
d10b9108f2 wrapGAppsHook: fix $gappsWrapperArgs as intended
i.e. define it even if $dontWrapGApps is set, and document the intention.
2015-11-09 15:40:20 +01:00
Vladimír Čunát
3f074b8a1e wrapGAppsHook: avoid running multiple times
/cc #10351 and @lethalman.
2015-11-09 15:19:41 +01:00
Vladimír Čunát
64cdc48d1d stdenv/multiple-outputs: add REMOVE target, use for docdev
Now any developer docs are removed by default, unless "docdev"
is in $outputs or $outputDocdev is defined.
Currently devdoc consists of just man3 and gtk-doc.
2015-10-28 10:15:54 +01:00
Vladimír Čunát
689d9757c5 stdenv/multiple-outputs: autoremove empty directories
i.e. remove chains of empty dirs after moving contents out of them.
2015-10-28 10:15:53 +01:00
Vladimír Čunát
b95f266638 stdenv/multiple-outputs: mainly add $docdev
Packages often provide some developer documentation
which is useless to typical users (e.g. man3 and gtk-doc).
2015-10-28 10:09:32 +01:00
Tuomas Tynkkynen
d844a1002f stdenv/multiple-outputs: Fix checking of propagatedOutputs
'[[ ! -v "$propagatedOutputs" ]]' is incorrect and always evaluates to
true. The correct form using double brackets would be
'[[ ! -v propagatedOutputs ]]', but I strongly dislike '[[ ]]' due to
the totally different quoting rules compared to everything else in bash.
2015-10-03 14:08:48 +02:00
Tuomas Tynkkynen
52c4337356 stdenv/multiple-outputs: Guard greps with 'set +/-o pipefail'
This is required since #7524 is fixed ("stdenv: Errors in hooks (such as
postUnpack) get ignored")
2015-10-03 14:08:48 +02:00
Vladimír Čunát
5227fb1dd5 Merge commit staging+systemd into closure-size
Many non-conflict problems weren't (fully) resolved in this commit yet.
2015-10-03 13:33:37 +02:00
William A. Kennington III
5cfe893cc4 Merge commit '2d464f75ed46869b5942c4b479772a0367b30608' into master.upstream
This is a partial commit from staging in an attempt to make merges
smaller.
2015-09-23 14:35:36 -07:00
Vladimír Čunát
6b0add86b9 separateDebugInfo: one more comment 2015-09-23 10:35:40 +02:00
Vladimír Čunát
22521f3b90 separateDebugInfo: fix typo in comment 2015-09-22 22:07:58 +02:00
Vladimír Čunát
b3658bc01b separateDebugInfo: compress it by default
Using zlib should be cheap enough and save lots of HDD space.
Case study (glib): 11 MB -> 4 MB.
2015-09-22 22:05:44 +02:00
Eelco Dolstra
2a28bc6691 separateDebugInfo: Assert Linux
Also remove some unintended setting of separateDebugInfo.
2015-09-22 20:21:10 +02:00
Vladimír Čunát
a418096d6a Merge branch 'master' into staging 2015-09-17 20:07:20 +02:00
Eelco Dolstra
276e38a1bb patchShebangs: Ignore outputs that don't exist yet 2015-09-17 16:54:07 +02:00
Eelco Dolstra
ec5b66eb4a Enable separate debug info
You can now pass

  separateDebugInfo = true;

to mkDerivation. This causes debug info to be separated from ELF
binaries and stored in the "debug" output. The advantage is that it
enables installing lean binaries, while still having the ability to
make sense of core dumps, etc.
2015-09-17 15:56:33 +02:00
Vladimír Čunát
8f33b8cc93 mass rewrite of find parameters to cross-platform style
Fixes #9044, close #9667. Thanks to @taku0 for suggesting this solution.
Now we have no modes starting with `/` or `+`.

Rewrite the `-perm` parameters of find:
 - completely safe: rewrite `/0100` and `+100` to `-0100`,
 - slightly semantics-changing: rewrite `+111` to `-0100`.
I cross-verified the `find` manual pages for Linux, Darwin, FreeBSD.
2015-09-06 10:26:30 +02:00
Thomas Tuegel
61cad61ebf makeWrapper: accept --argv0 flag (/cc #9562)
By default `makeWrapper` will not set argv[0] (this is a reversion to
the old default behavior). Based on the breakage we have seen from
changing the default, this is what most people want. The `wrapProgram`
function will send `--argv0 '"$0"'` to `makeWrapper`, i.e. it will
continue to pass-through the argv[0] that the wrapper is called with.
2015-09-01 13:27:12 +02:00
Thomas Tuegel
c234f37b59 makeWrapper: child process inherits argv[0] 2015-08-23 10:30:00 -05:00
William A. Kennington III
952def0e3c Merge branch 'master.upstream' into staging.upstream 2015-08-13 11:55:02 -07:00
Vladimír Čunát
c55e634f9a wrapGAppsHook: fix a typo
It would only matter in (some) multiple-output derivations.
/cc @lethalman.
2015-08-12 05:37:36 +02:00
William A. Kennington III
7ebe164ae0 Merge branch 'master.upstream' into staging.upstream 2015-07-30 15:03:10 -07:00
Eelco Dolstra
068f8abaa5 releaseTools.coverageAnalysis: Emit hydra-metrics 2015-07-30 18:06:33 +02:00
Luca Bruno
a8f6086708 wrapGAppsHook: populate GIO_EXTRA_MODULES 2015-07-30 10:45:04 +00:00
Vladimír Čunát
862900e42e mass-replace deprecated usage of find -perm (Fixes #9044)
sed 's|-perm +0|-perm /0|g'
It's a mass-rebuild due to usage in stdenv's default setup hooks.
2015-07-30 10:30:17 +02:00
William A. Kennington III
aaef42ab8c Merge branch 'master.upstream' into staging.upstream 2015-07-29 10:23:08 -07:00
Luca Bruno
763fda70f0 wrapGAppsHook: build hook for wrapping GTK/GNOME apps 2015-07-29 11:14:56 +00:00
Eelco Dolstra
2d9c63633e move-docs.sh: Handle share/gtk-doc 2015-07-26 13:35:49 +02:00
Vladimír Čunát
d484c392aa stdenv multiple-outputs: change propagation rules
Now development stuff is propagated from the first output,
and userEnvPkgs from the one with binaries.

Also don't move *.la files (yet). It causes problems, and they're small.
2015-04-18 19:30:28 +02:00
Vladimír Čunát
bf414c9d4f Merge 'staging' into closure-size
- there were many easy merge conflicts
- cc-wrapper needed nontrivial changes

Many other problems might've been created by interaction of the branches,
but stdenv and a few other packages build fine now.
2015-04-18 11:22:20 +02:00
Eelco Dolstra
9c579f691f fix-darwin-dylib-names: Fix all outputs
This fixes the install names of the Boost dylibs on Darwin.
2015-03-24 16:28:20 +01:00
Domen Kožar
9b7b2ce8eb Revert "Introduce patchShebangsPhase ran in preConfigurePhases"
This reverts commit 512fbb280f.

See #5368
2015-01-08 10:26:49 +01:00
Domen Kožar
512fbb280f Introduce patchShebangsPhase ran in preConfigurePhases
(cherry picked from commit 91c7e8747af1fdc2a70cd98594ccbb12a5c6902d)
Signed-off-by: Domen Kožar <domen@dev.si>
2015-01-02 02:58:32 +01:00
Igor Pashev
d57927748a autoreconf may need gettext
E. g. for AC_LIB_PREFIX
2014-12-22 20:20:00 +00:00
Eelco Dolstra
e611215f5c Move finding XML catalogs into a separate setup hook
This is because libxml/libxslt are not the only implementations that
respect $XML_CATALOG_FILES.

Also, look in share/xml for catalogs (in addition to the
now-deprecated xml/dtd and xml/xsl).
2014-11-25 16:23:48 +01:00
Vladimír Čunát
8e44ae5bd4 stdenv lib64-moving: fail instead of overwriting
Silent overwriting is dangerous and it bit us straightaway on gcc_multi.
https://github.com/NixOS/nixpkgs/commit/51f1b4ec48d5
2014-11-17 11:27:38 +01:00
Eelco Dolstra
811de3bfaa Merge remote-tracking branch 'origin/staging' into darwin-clang-stdenv
Conflicts:
	pkgs/tools/security/gnupg/default.nix
2014-10-09 10:57:57 +02:00
Eelco Dolstra
51f1b4ec48 Automatically move stuff in lib64 to lib 2014-10-07 15:04:13 +02:00
Eelco Dolstra
ab04b7d0bb Automatically move programs in sbin to bin
This should fix the OpenJDK build, which was failing because paxctl is
in sbin and therefore not automatically added to $PATH.

http://hydra.nixos.org/build/15658346
2014-10-07 14:43:56 +02:00
Eelco Dolstra
ae18038c6d fixDarwinDylibNames: Use new hook mechanism 2014-09-24 16:12:49 +02:00
Vladimír Čunát
d25cc03f21 multi-out: auto-correct include dirs in *.pc 2014-08-30 23:29:23 +02:00
Vladimír Čunát
38ba4eb693 multiple-outputs.sh: fixup when it's always sourced now 2014-08-30 15:53:24 +02:00
Vladimír Čunát
2f92199183 multiout: resolve general ToDos 2014-08-30 08:54:27 +02:00
Vladimír Čunát
fb59f27a43 WIP: getting good 2014-08-27 01:14:09 +02:00
Vladimír Čunát
4dccb224c5 WIP2 2014-08-26 01:10:56 +02:00
Vladimír Čunát
3ec413cece WIP 2014-08-25 15:30:46 +02:00
Vladimír Čunát
def75f0282 stdenv: add first iteration of the multiout hook
Now it should contain *all* information from stdenv/setup.sh of
the original mutiple-output branch.
However, the configurability of the output paths is much greater.
2014-08-24 19:07:47 +02:00
Eelco Dolstra
a8fc68a5c0 Move share/{man,info,doc} to the corresponding output 2014-08-09 12:47:05 +02:00
Eelco Dolstra
9e31c66d1b stdenv: Put moving docs to $out/share in a separate setup hook 2014-08-09 12:47:05 +02:00
Eelco Dolstra
e3f7dbbac8 Cleanup: Use += to append to envHooks 2014-08-09 12:47:05 +02:00
Eelco Dolstra
2def8e7499 Remove addHook
Just use bash arrays directly. I.e.

  addHook preConfigure myPreConfigure

is now

  preConfigureHooks+=(myPreConfigure)
2014-08-09 12:45:53 +02:00
Eelco Dolstra
5e82aab5d4 Drop redundant space 2014-08-09 12:44:49 +02:00
Eelco Dolstra
daa66b8b1c Factor out fixup phase stuff into separate setup hooks 2014-08-09 12:44:49 +02:00
Maxim Ivanov
e7d5e1cdbc Don't hardcode shell, use $SHELL instead 2014-05-26 14:48:39 +01:00
Maxim Ivanov
e2e77950f3 Scatter output hook
This hook allows to scatter files in $out to multiple outputs.
For "bin" and "doc" outputs there are prefefined default masks, but
they can be overriden by setting files_<outname>, for example:

files_bin = [ "/bin/*" "/lib/libexec/" ];

To make an effect hook must be specified in buildInputs.
2014-05-06 22:47:45 +01:00
Eelco Dolstra
497997cc38 Move generation of coverage reports from nixos/lib/testing to releaseTools
Also, turn some stdenv adapters into setup hooks.
2014-03-03 13:57:08 +01:00
Eelco Dolstra
a123a2675b lcov: Filter out /nix/store/* by default 2014-02-05 19:18:33 +01:00
Eelco Dolstra
80647127a3 Turn the coverage analysis stdenv adapters into setup hooks
Stdenv adapters are kinda weird and un-idiomatic (especially when they
don't actually change stdenv).  It's more idiomatic to say

  buildInputs = [ makeCoverageAnalysisReport ];
2014-02-05 19:18:33 +01:00
Eelco Dolstra
8622548160 Add a setup hook for fixing dylib install names on Darwin
Install names need to be absolute paths, otherwise programs that link
against the dylib won't work without setting $DYLD_LIBRARY_PATH.  Most
packages do this correctly, but some (like Boost and ICU) do not.
This setup hook absolutizes all install names.
2014-01-15 13:41:09 +01:00
Eelco Dolstra
5d6259a973 Add a setup hook that automatically sets up $CLASSPATH
All JARs in $pkg/share/java (for each $pkg in the build inputs) are
added to $CLASSPATH.  Thus, you can say

  buildInputs = [ setJavaClassPath someJavaDependency ];

and the JARs in someJavaDependency will be found automatically by
tools like javac or ant.

Note that the manual used to say that JARs should be installed in
lib/java; this is now share/java, following the Debian policy:

  http://www.debian.org/doc/packaging-manuals/java-policy/x110.html

The directory share/java makes more sense because JARs are
architecture-independent.  (Also, a quick grep shows that we were not
exactly consistent about this in Nixpkgs.)
2014-01-06 14:36:14 +01:00
Eelco Dolstra
ab3eeabfed Rename buildNativeInputs -> nativeBuildInputs
Likewise for propagatedBuildNativeInputs, etc.  "buildNativeInputs"
sounds like an imperative rather than a noun phrase.
2012-12-28 19:20:09 +01:00
Eelco Dolstra
41840af689 * Add a setup hook ‘autoreconfHook’ to simplify packages that need to
run autoreconf:

    buildInputs = [ autoreconfHook ];

  is essentially equivalent to

    buildInputs = [ autoconf automake libtool ];
    preConfigure = "autoreconf -i";

svn path=/nixpkgs/branches/x-updates/; revision=34181
2012-05-19 02:52:36 +00:00