Commit graph

148 commits

Author SHA1 Message Date
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 e3875297fa stdenv: Don't use sed to build the setup script 2014-08-09 12:45:52 +02:00
Eelco Dolstra 15103e5e5f stdenv: Remove the special handling of gcc
Now gcc is just another build input, making it possible in the future
to have a stdenv that doesn't depend on a C compiler. This is very
useful on NixOS, since it would allow trivial builders like
writeTextFile to work without pulling in the C compiler.
2014-08-09 12:44:50 +02:00
Eelco Dolstra 9f822e5477 stdenv: Move paxmark function to paxctl's setup hook 2014-08-09 12:44:50 +02:00
Eelco Dolstra d7b356f73b stdenv: Move unzip support to unzip's setup hook 2014-08-09 12:44:50 +02:00
Eelco Dolstra 3e33c975fb stdenv: Make unpackFile extensible via the hook mechanism
unpackCmd is now a regular hook, so there can be multiple functions
hooking into it.
2014-08-09 12:44:49 +02:00
Eelco Dolstra 1a44dbbbb9 unpackFile: Always copy directories
If $src refers to a directory, then always copy it. Previously, we
checked the extension first, so if the directory had an extension like
.tar, unpackPhase would fail.
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
Eelco Dolstra 83a41771ab Move RPATH shrinking from stdenv to a setup hook provided by patchelf 2014-08-09 12:44:49 +02:00
Eelco Dolstra b23dbb1a5d Allow buildInputs to be regular files
If a build input is a regular file, use it as a setup hook. This makes
setup hooks more efficient to create: you don't need a derivation that
copies them to $out/nix-support/setup-hook, instead you can use the
file as is.
2014-08-09 12:44:49 +02:00
Eelco Dolstra 37889e2b5e Provide a hook for per-output fixup 2014-08-09 12:44:48 +02:00
Eelco Dolstra b0f2d3419c Allow multiple hooks with the same name
You can now register multiple values per named hook, e.g.

  addHook preConfigure "echo foo"
  addHook preConfigure "echo bar"

will cause ‘runHook preConfigure’ to run both ‘echo foo’ and ‘echo
bar’ (in that order). It will also call the shell function
preConfigure() or eval the shell variable $preConfigure, if
defined. Thus, if you don't call addHook, it works like the old hook
mechanism.

Allowing multiple hooks makes stdenv more modular and extensible. For
instance, multiple setup hooks can define a preFixup hook, and all of
these will be executed.
2014-08-09 12:44:48 +02:00
Michael Raskin 0769fc5b77 Set CONFIG_SHELL to stdenv.shell in the default builder, just like SHELL 2014-07-30 16:44:28 +02:00
Eelco Dolstra b3b9c51b34 Add a deprecation warning to ensureDir 2014-06-30 14:57:12 +02:00
Ricardo M. Correia 8d5ce245a2 grsecurity: Add paxctl, paxmark and stdenv.needsPax to stdenv 2014-05-15 13:25:46 +02:00
Vladimír Čunát c4371afd06 stdenv/setup.sh: make substitute* not drop EOF newline
This should solve #1982.
2014-04-02 19:07:59 +02:00
Vladimír Čunát 1f6a15d7de Merge #1901: add preFixupPhases to stdenv; for gsettings
Without this stdenv change it seems difficult to fix some glib's gsettings issues,
as the folders in question may (not) be created in installPhase.
2014-04-02 19:06:41 +02:00
Vladimír Čunát 204ec0cd43 stdenv/setup.sh: add .gz extension to links to .gz man pages
The links weren't broken since 0a44a09, but man showed garbage.
Tested on several packages (sudo, dosfstools, xz).
2014-01-20 22:11:14 +01:00
Eelco Dolstra 48f87d5d2a fixupPhase: Handle the case where $prefix doesn't exist
http://hydra.nixos.org/build/8149154
2014-01-17 12:41:08 +01:00
Eelco Dolstra 5ad0728dfc stdenv: In the fixupPhase, make the output writable first
Cherry-picked from 1d11c1dc48 in the
multiple-outputs branch.
2014-01-14 14:21:27 +01:00
Thomas Tuegel e15fc83fc9 Don't split paths with spaces
setup.sh uses the anti-pattern `for f in $(find ...); do` in several
places. `find` returns one path per line, but `for` splits its arguments
by words, so paths which contain spaces are incorrectly split! The
correct way is `find ... | while read f; do`
2014-01-11 07:54:35 -06:00
Eelco Dolstra 10ab227126 stdenv: Prepend SHELL=... to makeFlags
If it's appended, the user cannot override SHELL.
2014-01-07 17:45:55 +01:00
Eelco Dolstra 320209a618 Merge deterministicStdenv into the default stdenv
This means that (on Linux) strip uses
"--enable-deterministic-archives" and ld uses the
BFD_DETERMINISTIC_OUTPUT flag.
2014-01-07 13:57:42 +01:00
Eelco Dolstra 2a0047bbef stdenv: Fix indentation 2014-01-07 09:49:45 +01:00
Eelco Dolstra 890461d8af stdenv: Update comment 2014-01-07 09:48:23 +01:00
Eelco Dolstra 369185288a stdenv: Revert special-casing of fixupPhase
Treating fixupPhase specially is really ugly.  Also, it collides with
the work in the multiple-outputs branch (which already has support for
fixing up all outputs).

Partial revert of 0a44a09121.
2014-01-07 09:48:01 +01:00
Bjørn Forsman f4f0d2ecb9 stdenv/setup.sh: fix breakage when shebang contains '\'
Some programs, e.g. guile-config, has a shebang that ends in '\':

  #!/usr/bin/guile-1.8 \
  -e main -s
  !#
  ;;;; guile-config --- utility for linking programs with Guile
  ;;;; Jim Blandy <jim@red-bean.com> --- September 1997

This currently breaks patchShebangs:

  $ read oldPath arg0 args <<< 'shebang \'; echo $?
  1
  $ echo $oldPath
  shebang
  $ echo $arg0

  $ echo $args

(And setup.sh/patchShebangs is run with 'set -e' so any command that
return non-zero aborts the build.)

Fix by telling 'read' to not interpret backslashes (with the -r flag):

  $ read -r oldPath arg0 args <<< 'shebang \'; echo $?
  0
  $ echo $oldPath
  shebang
  $ echo $arg0
  \
  $ echo $args

Also needed: escape the escape characters so that sed doesn't interpret
them.
2014-01-03 14:47:39 +01:00
Vladimír Čunát d978c35ff9 stdenv/setup.sh: fix previous change...
for the case that there is no makefile. CC #1354
2013-12-28 10:43:34 +01:00
Vladimír Čunát 3f4b14d793 stdenv/setup.sh: add SHELL to makeFlags (close #1354) 2013-12-27 21:03:16 +01:00
Bjørn Forsman 4e385fcda7 stdenv/patchShebangs: fix shebang check
patchShebangs has a bug that shows itself on files that have the
executable bit set but have no shebang (i.e. a blank/empty first line).
The shell would then evaluate this:

if [ != '#!' ]; then
  # not evaluated
fi

With proper quoting we get the correct behaviour:

if [ "" != '#!' ]; then
  # this will be evaluated
fi
2013-12-07 21:13:06 +01:00
Bjørn Forsman 88c7b4c7fe Fix bug introduced in previous commit
When building e.g. perl for the first time there is no perl in PATH yet,
so command -v perl will fail.

This brings back the previous behaviour of silently not patching
shebangs for which there is no available command in PATH.
2013-12-03 16:58:49 +01:00
Bjørn Forsman 7bf209db50 patchShebangs: rewrite ".../bin/env python" to /nix/store/.../python
Currently "/usr/bin/env python" is rewritten to "/nix/store/.../env
python". That doesn't really improve anything because the interpreter
still have to be located in $PATH at runtime. The result is that many
nix package expressions do .../bin/env fixup themselves.

Instead of everyone having to do this patching locally, add the
functionality to the standard environment patchShebangs function so that
everyone can benefit.
2013-12-02 13:02:42 +01:00
Eelco Dolstra 70edf15997 patchPhase: Handle xz compression 2013-08-07 15:46:25 +02:00
Vladimír Čunát 0a44a09121 stdenv: default builder fixes (merge #554)
With a minor fix.
I did some huge rebuilds with this on x86_64-linux, found no problems.
2013-06-30 09:00:12 +02:00
Vladimír Čunát 173c9cbb63 builder: fail if patch is missing or fails to unpack 2013-06-27 16:34:31 +02:00
Vladimír Čunát 7f1e09c35d Re-Revert "Merge pull request #567 from MarcWeber/submit/cmake-improvement"
This reverts commit b08e12b37a.
2013-06-27 15:14:32 +02:00
Peter Simons b08e12b37a Revert "Merge pull request #567 from MarcWeber/submit/cmake-improvement"
This reverts commit abc7591aaf, reversing changes
made to 6b1ebeccf2, because they broke half the
packages in stdenv-updates: http://hydra.nixos.org/eval/927013 has further
details.
2013-06-17 10:19:15 +02:00
Marc Weber f7ef08e5cd experimental/cmake-improvement
set CMAKE_LIBRARY_PATH, CMAKE_INCLUDE_PATH based on NIX_CFLAGS_COMPILE and
NIX_LDFLAGS so that cmake's find_library like functions find all the libraries
gcc knows about thanks to the gcc wrapper

This is particular useful with myEnvFun which then also sets those CMAKE_* env
variables.`

Because setup.sh has to change this causes many rebuilds - thus it should be
included in a stdenv-update like branch

Also cmake builds in parallel perfectly fine

update cmake to latest minor number, I didn't change the patches,
just reapplied them manually recordin a new patch
2013-05-28 16:22:45 +02:00
aszlig 82f94df719 stdenv/setup.sh: Always run postPatch hook.
I'm not sure whether this was by intention, but so far postPatch hooks were
silently skipped whenever the patches list was empty. This change could possibly
change the build results of the following packages:

 * gcc
 * cmake (264)
 * systemtap
 * quemu-kvm

These packages all have in common that they have a postPatch hook and the
patches list can be empty when certain conditions are met.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2013-02-27 15:26:18 +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 5be0a9acd7 Rename hostDrv -> crossDrv, buildDrv -> nativeDrv
This is for consistency with terminology in stdenv (and the terms
"hostDrv" and "buildDrv" are not very intuitive, even if they're
consistent with GNU terminology).
2012-12-28 19:08:19 +01:00
Eelco Dolstra f4ed8a3b91 Remove trailing whitespace 2012-12-28 16:41:56 +01:00
Eelco Dolstra cf8daf6312 Add an option ‘stdenv.userHook’ to set a global stdenv setup hook
This allows various applications.  It allows users to set global
optimisation flags, e.g.

  stdenv.userHook = ''NIX_CFLAGS_COMPILE+=" -funroll-loops"'';

But the impetus is as an alternative to issue #229, allowing impure
stdenv setup for people who want to use distcc:

  stdenv.userHook = "source /my/impure/setup-script.sh";

This is probably a bad idea, but at least now it's a bad idea in
people's configuration and not in Nixpkgs. :-)
2012-12-28 16:36:09 +01:00
Eelco Dolstra 6fd4f63530 Revert "Merge pull request #229 from viric/niximpure2-stdenv-updates"
This reverts commit e04b17bfba, reversing
changes made to 1af2ada7d4.
2012-12-28 15:46:45 +01:00
Lluís Batlle i Rossell 095db9fe3f stdenv: Stripping out/lib32 too
If not, in mips64/n32, lib32/libiberty.a was left without stripping, and
it contained (debug) references to bootstrap-tools.
2012-12-27 23:36:01 +01:00
Lluís Batlle i Rossell 635880a17a 2nd approach at getting a check for /niximpure in stdenv-updates 2012-12-26 21:38:58 +01:00
Shea Levy 6d928ab684 Don't preserve timestamps when copying sources to the temporary build directory.
This should fix issues like "ZIP does not support timestamps before 1980"
2012-12-14 13:36:04 -05:00
Eelco Dolstra 0008138201 checkPhase: Pass VERBOSE=y so that failing tests show something useful 2012-10-16 15:00:51 -04:00
Eelco Dolstra b3d20690a1 For consistency, don't use the -v flag when copying a directory $src 2012-09-25 21:31:16 -04:00
Eelco Dolstra be901fa8be * Add an installCheckPhase.
svn path=/nixpkgs/branches/stdenv-updates/; revision=33967
2012-05-01 21:00:30 +00:00