mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-22 13:29:00 +02:00
Merge branch 'p/orig-modular-stdenv' of github.com:vcunat/nixpkgs into staging
This commit is contained in:
commit
88822dc23c
|
@ -2,4 +2,4 @@ addRLibPath () {
|
|||
addToSearchPath R_LIBS_SITE $1/library
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addRLibPath)
|
||||
envHooks+=(addRLibPath)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
export NIX_GCC=@out@
|
||||
|
||||
addCVars () {
|
||||
if test -d $1/include; then
|
||||
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem $1/include"
|
||||
|
@ -12,7 +14,7 @@ addCVars () {
|
|||
fi
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addCVars)
|
||||
envHooks+=(addCVars)
|
||||
|
||||
# Note: these come *after* $out in the PATH (see setup.sh).
|
||||
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
, ... } @ args:
|
||||
|
||||
fetchurl ({
|
||||
# Remove the extension, because otherwise unpackPhase will get
|
||||
# confused. FIXME: fix unpackPhase.
|
||||
name = args.name or lib.removeSuffix ".zip" (lib.removeSuffix ".tar.gz" (baseNameOf url));
|
||||
name = args.name or (baseNameOf url);
|
||||
|
||||
recursiveHash = true;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ crossAddCVars () {
|
|||
fi
|
||||
}
|
||||
|
||||
crossEnvHooks=(${crossEnvHooks[@]} crossAddCVars)
|
||||
crossEnvHooks+=(crossAddCVars)
|
||||
|
||||
crossStripDirs() {
|
||||
local dirs="$1"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
export NIX_GCC=@out@
|
||||
|
||||
addCVars () {
|
||||
if test -d $1/include; then
|
||||
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem $1/include"
|
||||
|
@ -12,7 +14,7 @@ addCVars () {
|
|||
fi
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addCVars)
|
||||
envHooks+=(addCVars)
|
||||
|
||||
# Note: these come *after* $out in the PATH (see setup.sh).
|
||||
|
||||
|
|
27
pkgs/build-support/setup-hooks/compress-man-pages.sh
Normal file
27
pkgs/build-support/setup-hooks/compress-man-pages.sh
Normal file
|
@ -0,0 +1,27 @@
|
|||
fixupOutputHooks+=('if [ -z "$dontGzipMan" ]; then compressManPages "$prefix"; fi')
|
||||
|
||||
compressManPages() {
|
||||
local dir="$1"
|
||||
|
||||
echo "gzipping man pages in $dir"
|
||||
|
||||
GLOBIGNORE=.:..:*.gz:*.bz2
|
||||
|
||||
for f in "$dir"/share/man/*/* "$dir"/share/man/*/*/*; do
|
||||
if [ -f "$f" -a ! -L "$f" ]; then
|
||||
if gzip -c -n "$f" > "$f".gz; then
|
||||
rm "$f"
|
||||
else
|
||||
rm "$f".gz
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
for f in "$dir"/share/man/*/* "$dir"/share/man/*/*/*; do
|
||||
if [ -L "$f" -a -f `readlink -f "$f"`.gz ]; then
|
||||
ln -sf `readlink "$f"`.gz "$f".gz && rm "$f"
|
||||
fi
|
||||
done
|
||||
|
||||
unset GLOBIGNORE
|
||||
}
|
50
pkgs/build-support/setup-hooks/move-docs.sh
Normal file
50
pkgs/build-support/setup-hooks/move-docs.sh
Normal file
|
@ -0,0 +1,50 @@
|
|||
# This setup hook moves $out/{man,doc,info} to $out/share; moves
|
||||
# $out/share/man to $man/share/man; and moves $out/share/doc to
|
||||
# $man/share/doc.
|
||||
|
||||
preFixupHooks+=(_moveDocs)
|
||||
|
||||
_moveToShare() {
|
||||
forceShare=${forceShare:=man doc info}
|
||||
if [ -z "$forceShare" -o -z "$out" ]; then return; fi
|
||||
|
||||
for d in $forceShare; do
|
||||
if [ -d "$out/$d" ]; then
|
||||
if [ -d "$out/share/$d" ]; then
|
||||
echo "both $d/ and share/$d/ exist!"
|
||||
else
|
||||
echo "moving $out/$d to $out/share/$d"
|
||||
mkdir -p $out/share
|
||||
mv $out/$d $out/share/
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
_moveToOutput() {
|
||||
local d="$1"
|
||||
local dst="$2"
|
||||
if [ -z "$dst" -a ! -e $dst/$d ]; then return; fi
|
||||
local output
|
||||
for output in $outputs; do
|
||||
if [ "${!output}" = "$dst" ]; then continue; fi
|
||||
if [ -d "${!output}/$d" ]; then
|
||||
echo "moving ${!output}/$d to $dst/$d"
|
||||
mkdir -p $dst/share
|
||||
mv ${!output}/$d $dst/$d
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
_moveDocs() {
|
||||
_moveToShare
|
||||
_moveToOutput share/man "$man"
|
||||
_moveToOutput share/info "$info"
|
||||
_moveToOutput share/doc "$doc"
|
||||
|
||||
# Remove empty share directory.
|
||||
if [ -d "$out/share" ]; then
|
||||
rmdir $out/share 2> /dev/null || true
|
||||
fi
|
||||
}
|
62
pkgs/build-support/setup-hooks/patch-shebangs.sh
Normal file
62
pkgs/build-support/setup-hooks/patch-shebangs.sh
Normal file
|
@ -0,0 +1,62 @@
|
|||
# This setup hook causes the fixup phase to rewrite all script
|
||||
# interpreter file names (`#! /path') to paths found in $PATH. E.g.,
|
||||
# /bin/sh will be rewritten to /nix/store/<hash>-some-bash/bin/sh.
|
||||
# /usr/bin/env gets special treatment so that ".../bin/env python" is
|
||||
# rewritten to /nix/store/<hash>/bin/python. Interpreters that are
|
||||
# already in the store are left untouched.
|
||||
|
||||
fixupOutputHooks+=('if [ -z "$dontPatchShebangs" ]; then patchShebangs "$prefix"; fi')
|
||||
|
||||
patchShebangs() {
|
||||
local dir="$1"
|
||||
header "patching script interpreter paths in $dir"
|
||||
local f
|
||||
local oldPath
|
||||
local newPath
|
||||
local arg0
|
||||
local args
|
||||
local oldInterpreterLine
|
||||
local newInterpreterLine
|
||||
|
||||
find "$dir" -type f -perm +0100 | while read f; do
|
||||
if [ "$(head -1 "$f" | head -c +2)" != '#!' ]; then
|
||||
# missing shebang => not a script
|
||||
continue
|
||||
fi
|
||||
|
||||
oldInterpreterLine=$(head -1 "$f" | tail -c +3)
|
||||
read -r oldPath arg0 args <<< "$oldInterpreterLine"
|
||||
|
||||
if $(echo "$oldPath" | grep -q "/bin/env$"); then
|
||||
# Check for unsupported 'env' functionality:
|
||||
# - options: something starting with a '-'
|
||||
# - environment variables: foo=bar
|
||||
if $(echo "$arg0" | grep -q -- "^-.*\|.*=.*"); then
|
||||
echo "unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)"
|
||||
exit 1
|
||||
fi
|
||||
newPath="$(command -v "$arg0" || true)"
|
||||
else
|
||||
if [ "$oldPath" = "" ]; then
|
||||
# If no interpreter is specified linux will use /bin/sh. Set
|
||||
# oldpath="/bin/sh" so that we get /nix/store/.../sh.
|
||||
oldPath="/bin/sh"
|
||||
fi
|
||||
newPath="$(command -v "$(basename "$oldPath")" || true)"
|
||||
args="$arg0 $args"
|
||||
fi
|
||||
|
||||
newInterpreterLine="$newPath $args"
|
||||
|
||||
if [ -n "$oldPath" -a "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]; then
|
||||
if [ -n "$newPath" -a "$newPath" != "$oldPath" ]; then
|
||||
echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""
|
||||
# escape the escape chars so that sed doesn't interpret them
|
||||
escapedInterpreterLine=$(echo "$newInterpreterLine" | sed 's|\\|\\\\|g')
|
||||
sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
stopNest
|
||||
}
|
|
@ -10,4 +10,4 @@ addPkgToClassPath () {
|
|||
done
|
||||
}
|
||||
|
||||
envHooks=(''${envHooks[@]} addPkgToClassPath)
|
||||
envHooks+=(addPkgToClassPath)
|
||||
|
|
36
pkgs/build-support/setup-hooks/strip.sh
Normal file
36
pkgs/build-support/setup-hooks/strip.sh
Normal file
|
@ -0,0 +1,36 @@
|
|||
# This setup hook strips libraries and executables in the fixup phase.
|
||||
|
||||
fixupOutputHooks+=(_doStrip)
|
||||
|
||||
_doStrip() {
|
||||
if [ -z "$dontStrip" ]; then
|
||||
stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}
|
||||
if [ -n "$stripDebugList" ]; then
|
||||
stripDirs "$stripDebugList" "${stripDebugFlags:--S}"
|
||||
fi
|
||||
|
||||
stripAllList=${stripAllList:-}
|
||||
if [ -n "$stripAllList" ]; then
|
||||
stripDirs "$stripAllList" "${stripAllFlags:--s}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
stripDirs() {
|
||||
local dirs="$1"
|
||||
local stripFlags="$2"
|
||||
local dirsNew=
|
||||
|
||||
for d in ${dirs}; do
|
||||
if [ -d "$prefix/$d" ]; then
|
||||
dirsNew="${dirsNew} $prefix/$d "
|
||||
fi
|
||||
done
|
||||
dirs=${dirsNew}
|
||||
|
||||
if [ -n "${dirs}" ]; then
|
||||
header "stripping (with flags $stripFlags) in$dirs"
|
||||
find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} strip $commonStripFlags $stripFlags || true
|
||||
stopNest
|
||||
fi
|
||||
}
|
|
@ -5,4 +5,4 @@ addDbusIncludePath () {
|
|||
fi
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addDbusIncludePath)
|
||||
envHooks+=(addDbusIncludePath)
|
||||
|
|
|
@ -10,4 +10,4 @@ addGuileLibPath () {
|
|||
fi
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addGuileLibPath)
|
||||
envHooks+=(addGuileLibPath)
|
||||
|
|
|
@ -5,4 +5,4 @@ addGuileLibPath () {
|
|||
fi
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addGuileLibPath)
|
||||
envHooks+=(addGuileLibPath)
|
||||
|
|
|
@ -2,4 +2,4 @@ addPerlLibPath () {
|
|||
addToSearchPath PERL5LIB $1/lib/perl5/site_perl
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addPerlLibPath)
|
||||
envHooks+=(addPerlLibPath)
|
||||
|
|
|
@ -2,4 +2,4 @@ addPerlLibPath () {
|
|||
addToSearchPath PERL5LIB $1/lib/perl5/site_perl
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addPerlLibPath)
|
||||
envHooks+=(addPerlLibPath)
|
||||
|
|
|
@ -2,4 +2,4 @@ addPerlLibPath () {
|
|||
addToSearchPath PERL5LIB $1/lib/perl5/site_perl
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addPerlLibPath)
|
||||
envHooks+=(addPerlLibPath)
|
||||
|
|
|
@ -2,4 +2,4 @@ addPerlLibPath () {
|
|||
addToSearchPath PERL5LIB $1/@libPrefix@
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addPerlLibPath)
|
||||
envHooks+=(addPerlLibPath)
|
||||
|
|
|
@ -12,4 +12,4 @@ toPythonPath() {
|
|||
echo $result
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addPythonPath)
|
||||
envHooks+=(addPythonPath)
|
||||
|
|
|
@ -12,4 +12,4 @@ toPythonPath() {
|
|||
echo $result
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addPythonPath)
|
||||
envHooks+=(addPythonPath)
|
||||
|
|
|
@ -12,4 +12,4 @@ toPythonPath() {
|
|||
echo $result
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addPythonPath)
|
||||
envHooks+=(addPythonPath)
|
||||
|
|
|
@ -12,4 +12,4 @@ toPythonPath() {
|
|||
echo $result
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addPythonPath)
|
||||
envHooks+=(addPythonPath)
|
||||
|
|
|
@ -12,4 +12,4 @@ toPythonPath() {
|
|||
echo $result
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addPythonPath)
|
||||
envHooks+=(addPythonPath)
|
||||
|
|
|
@ -12,4 +12,4 @@ toPythonPath() {
|
|||
echo $result
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addPythonPath)
|
||||
envHooks+=(addPythonPath)
|
||||
|
|
|
@ -5,5 +5,5 @@ addGstreamer1LibPath () {
|
|||
fi
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addGstreamer1LibPath)
|
||||
envHooks+=(addGstreamer1LibPath)
|
||||
|
||||
|
|
|
@ -5,4 +5,4 @@ addGstreamerLibPath () {
|
|||
fi
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addGstreamerLibPath)
|
||||
envHooks+=(addGstreamerLibPath)
|
||||
|
|
|
@ -23,5 +23,5 @@ if test -z "$libxmlHookDone"; then
|
|||
# xmllint and xsltproc from looking in /etc/xml/catalog.
|
||||
export XML_CATALOG_FILES
|
||||
if test -z "$XML_CATALOG_FILES"; then XML_CATALOG_FILES=" "; fi
|
||||
envHooks=(${envHooks[@]} addXMLCatalogs)
|
||||
envHooks+=(addXMLCatalogs)
|
||||
fi
|
||||
|
|
|
@ -10,4 +10,4 @@ addSlibPath () {
|
|||
fi
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addSlibPath)
|
||||
envHooks+=(addSlibPath)
|
||||
|
|
|
@ -33,7 +33,7 @@ collectNixLispLDLP () {
|
|||
|
||||
export NIX_LISP_COMMAND NIX_LISP CL_SOURCE_REGISTRY NIX_LISP_ASDF
|
||||
|
||||
envHooks=(envHooks[@] addASDFPaths setLisp collectNixLispLDLP)
|
||||
envHooks+=(addASDFPaths setLisp collectNixLispLDLP)
|
||||
|
||||
mkdir -p "$HOME"/.cache/common-lisp || HOME="$TMP/.temp-$USER-home"
|
||||
mkdir -p "$HOME"/.cache/common-lisp
|
||||
|
|
|
@ -2,4 +2,4 @@ addOcamlMakefile () {
|
|||
export OCAMLMAKEFILE="@out@/include/OCamlMakefile"
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addOcamlMakefile)
|
||||
envHooks+=(addOcamlMakefile)
|
||||
|
|
|
@ -2,4 +2,4 @@ addAclocals () {
|
|||
addToSearchPathWithCustomDelimiter : ACLOCAL_PATH $1/share/aclocal
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addAclocals)
|
||||
envHooks+=(addAclocals)
|
||||
|
|
|
@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
|
|||
sha256 = "c99f84d124347340c36707089ec8f70530abd56e7827c54d506eb4cc097a17e7";
|
||||
};
|
||||
|
||||
setupHook = [ ./setup-hook.sh ];
|
||||
|
||||
meta = {
|
||||
homepage = http://nixos.org/patchelf.html;
|
||||
license = "GPL";
|
||||
|
|
16
pkgs/development/tools/misc/patchelf/setup-hook.sh
Normal file
16
pkgs/development/tools/misc/patchelf/setup-hook.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
# This setup hook calls patchelf to automatically remove unneeded
|
||||
# directories from the RPATH of every library or executable in every
|
||||
# output.
|
||||
|
||||
fixupOutputHooks+=('if [ -z "$dontPatchELF" ]; then patchELF "$prefix"; fi')
|
||||
|
||||
patchELF() {
|
||||
header "patching ELF executables and libraries in $prefix"
|
||||
if [ -e "$prefix" ]; then
|
||||
find "$prefix" \( \
|
||||
\( -type f -a -name "*.so*" \) -o \
|
||||
\( -type f -a -perm +0100 \) \
|
||||
\) -print -exec patchelf --shrink-rpath '{}' \;
|
||||
fi
|
||||
stopNest
|
||||
}
|
|
@ -4,7 +4,7 @@ addPkgConfigPath () {
|
|||
}
|
||||
|
||||
if test -n "$crossConfig"; then
|
||||
crossEnvHooks=(${crossEnvHooks[@]} addPkgConfigPath)
|
||||
crossEnvHooks+=(addPkgConfigPath)
|
||||
else
|
||||
envHooks=(${envHooks[@]} addPkgConfigPath)
|
||||
envHooks+=(addPkgConfigPath)
|
||||
fi
|
||||
|
|
|
@ -43,7 +43,7 @@ stdenv.mkDerivation {
|
|||
fi
|
||||
}
|
||||
|
||||
envHooks=(''${envHooks[@]} addOCamlPath)
|
||||
envHooks+=(addOCamlPath)
|
||||
'';
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -2,4 +2,4 @@ addNodePath () {
|
|||
addToSearchPath NODE_PATH $1/lib/node_modules
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addNodePath)
|
||||
envHooks+=(addNodePath)
|
||||
|
|
|
@ -18,6 +18,8 @@ stdenv.mkDerivation rec {
|
|||
"MANDIR=share/man/man1"
|
||||
];
|
||||
|
||||
setupHook = ./setup-hook.sh;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "A tool for controlling PaX flags on a per binary basis";
|
||||
homepage = "https://pax.grsecurity.net";
|
||||
|
|
8
pkgs/os-specific/linux/paxctl/setup-hook.sh
Normal file
8
pkgs/os-specific/linux/paxctl/setup-hook.sh
Normal file
|
@ -0,0 +1,8 @@
|
|||
# PaX-mark binaries.
|
||||
paxmark() {
|
||||
local flags="$1"
|
||||
shift
|
||||
|
||||
paxctl -c "$@"
|
||||
paxctl -zex -${flags} "$@"
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
# Posix utilities, the GNU C compiler, and so on. On other systems,
|
||||
# we use the native C library.
|
||||
|
||||
{ system, allPackages ? import ../.., platform, config }:
|
||||
{ system, allPackages ? import ../.., platform, config, lib }:
|
||||
|
||||
|
||||
rec {
|
||||
|
@ -28,14 +28,14 @@ rec {
|
|||
|
||||
# The Nix build environment.
|
||||
stdenvNix = import ./nix {
|
||||
inherit config;
|
||||
inherit config lib;
|
||||
stdenv = stdenvNative;
|
||||
pkgs = stdenvNativePkgs;
|
||||
};
|
||||
|
||||
|
||||
# Linux standard environment.
|
||||
stdenvLinux = (import ./linux { inherit system allPackages platform config;}).stdenvLinux;
|
||||
stdenvLinux = (import ./linux { inherit system allPackages platform config lib; }).stdenvLinux;
|
||||
|
||||
|
||||
# Select the appropriate stdenv for the platform `system'.
|
||||
|
|
|
@ -6,16 +6,11 @@ done
|
|||
|
||||
mkdir $out
|
||||
|
||||
echo "$preHook" > $out/setup
|
||||
echo "export SHELL=$shell" > $out/setup
|
||||
echo "initialPath=\"$initialPath\"" >> $out/setup
|
||||
echo "$preHook" >> $out/setup
|
||||
cat "$setup" >> $out/setup
|
||||
|
||||
sed -e "s^@initialPath@^$initialPath^g" \
|
||||
-e "s^@gcc@^$gcc^g" \
|
||||
-e "s^@shell@^$shell^g" \
|
||||
-e "s^@needsPax@^$needsPax^g" \
|
||||
< $out/setup > $out/setup.tmp
|
||||
mv $out/setup.tmp $out/setup
|
||||
|
||||
# Allow the user to install stdenv using nix-env and get the packages
|
||||
# in stdenv.
|
||||
mkdir $out/nix-support
|
||||
|
|
|
@ -10,8 +10,6 @@ let lib = import ../../../lib; in lib.makeOverridable (
|
|||
, setupScript ? ./setup.sh
|
||||
|
||||
, extraBuildInputs ? []
|
||||
|
||||
, skipPaxMarking ? false
|
||||
}:
|
||||
|
||||
let
|
||||
|
@ -23,7 +21,7 @@ let
|
|||
# {pkgs, ...}:
|
||||
# {
|
||||
# allowUnfree = false;
|
||||
# allowUnfreePredicate = (x: pkgs.lib.hasPrefix "flashplayero-" x.name);
|
||||
# allowUnfreePredicate = (x: pkgs.lib.hasPrefix "flashplayer-" x.name);
|
||||
# }
|
||||
allowUnfreePredicate = config.allowUnfreePredicate or (x: false);
|
||||
|
||||
|
@ -41,37 +39,13 @@ let
|
|||
|
||||
unsafeGetAttrPos = builtins.unsafeGetAttrPos or (n: as: null);
|
||||
|
||||
# The stdenv that we are producing.
|
||||
result =
|
||||
|
||||
derivation {
|
||||
inherit system name;
|
||||
|
||||
builder = shell;
|
||||
|
||||
args = ["-e" ./builder.sh];
|
||||
/* TODO: special-cased @var@ substitutions are ugly.
|
||||
However, using substituteAll* from setup.sh seems difficult,
|
||||
as setup.sh can't be directly sourced.
|
||||
Suggestion: split similar utility functions into a separate script.
|
||||
*/
|
||||
|
||||
setup = setupScript;
|
||||
|
||||
inherit preHook initialPath gcc shell;
|
||||
|
||||
# Whether we should run paxctl to pax-mark binaries
|
||||
needsPax = result.isLinux && !skipPaxMarking;
|
||||
|
||||
propagatedUserEnvPkgs = [gcc] ++
|
||||
lib.filter lib.isDerivation initialPath;
|
||||
}
|
||||
|
||||
// rec {
|
||||
|
||||
meta = {
|
||||
description = "The default build environment for Unix packages in Nixpkgs";
|
||||
};
|
||||
extraBuildInputs' = extraBuildInputs ++
|
||||
[ ../../build-support/setup-hooks/move-docs.sh
|
||||
../../build-support/setup-hooks/compress-man-pages.sh
|
||||
../../build-support/setup-hooks/strip.sh
|
||||
../../build-support/setup-hooks/patch-shebangs.sh
|
||||
gcc
|
||||
];
|
||||
|
||||
# Add a utility function to produce derivations that use this
|
||||
# stdenv and its shell.
|
||||
|
@ -84,7 +58,9 @@ let
|
|||
unsafeGetAttrPos "name" attrs;
|
||||
pos' = if pos != null then "‘" + pos.file + ":" + toString pos.line + "’" else "«unknown-file»";
|
||||
in
|
||||
if !allowUnfree && (let l = lib.lists.toList attrs.meta.license or []; in lib.lists.elem "unfree" l || lib.lists.elem "unfree-redistributable" l) && !(allowUnfreePredicate attrs) then
|
||||
if !allowUnfree
|
||||
&& (let l = lib.lists.toList attrs.meta.license or []; in lib.lists.elem "unfree" l || lib.lists.elem "unfree-redistributable" l)
|
||||
&& !allowUnfreePredicate attrs then
|
||||
throw ''
|
||||
Package ‘${attrs.name}’ in ${pos'} has an unfree license, refusing to evaluate.
|
||||
${forceEvalHelp "Unfree"}''
|
||||
|
@ -115,10 +91,10 @@ let
|
|||
__ignoreNulls = true;
|
||||
|
||||
# Inputs built by the cross compiler.
|
||||
buildInputs = lib.optionals (crossConfig != null) (buildInputs ++ extraBuildInputs);
|
||||
buildInputs = lib.optionals (crossConfig != null) (buildInputs ++ extraBuildInputs');
|
||||
propagatedBuildInputs = lib.optionals (crossConfig != null) propagatedBuildInputs;
|
||||
# Inputs built by the usual native compiler.
|
||||
nativeBuildInputs = nativeBuildInputs ++ lib.optionals (crossConfig == null) (buildInputs ++ extraBuildInputs);
|
||||
nativeBuildInputs = nativeBuildInputs ++ lib.optionals (crossConfig == null) (buildInputs ++ extraBuildInputs');
|
||||
propagatedNativeBuildInputs = propagatedNativeBuildInputs ++
|
||||
lib.optionals (crossConfig == null) propagatedBuildInputs;
|
||||
}))) (
|
||||
|
@ -139,6 +115,28 @@ let
|
|||
# derivation (e.g., in assertions).
|
||||
(attrs.passthru or {}));
|
||||
|
||||
# The stdenv that we are producing.
|
||||
result =
|
||||
|
||||
derivation {
|
||||
inherit system name;
|
||||
|
||||
builder = shell;
|
||||
|
||||
args = ["-e" ./builder.sh];
|
||||
|
||||
setup = setupScript;
|
||||
|
||||
inherit preHook initialPath shell;
|
||||
|
||||
propagatedUserEnvPkgs = [gcc] ++
|
||||
lib.filter lib.isDerivation initialPath;
|
||||
}
|
||||
|
||||
// rec {
|
||||
|
||||
meta.description = "The default build environment for Unix packages in Nixpkgs";
|
||||
|
||||
# Utility flags to test the type of platform.
|
||||
isDarwin = system == "x86_64-darwin";
|
||||
isLinux = system == "i686-linux"
|
||||
|
@ -185,6 +183,11 @@ let
|
|||
|| system == "armv6l-linux"
|
||||
|| system == "armv7l-linux";
|
||||
|
||||
# Whether we should run paxctl to pax-mark binaries.
|
||||
needsPax = isLinux;
|
||||
|
||||
inherit mkDerivation;
|
||||
|
||||
# For convenience, bring in the library functions in lib/ so
|
||||
# packages don't have to do that themselves.
|
||||
inherit lib;
|
||||
|
@ -192,6 +195,8 @@ let
|
|||
inherit fetchurlBoot;
|
||||
|
||||
inherit overrides;
|
||||
|
||||
inherit gcc;
|
||||
}
|
||||
|
||||
# Propagate any extra attributes. For instance, we use this to
|
||||
|
|
|
@ -1,18 +1,79 @@
|
|||
set -e
|
||||
|
||||
: ${outputs:=out}
|
||||
|
||||
|
||||
######################################################################
|
||||
# Hook handling.
|
||||
|
||||
|
||||
# Run all hooks with the specified name in the order in which they
|
||||
# were added, stopping if any fails (returns a non-zero exit
|
||||
# code). The hooks for <hookName> are the shell function or variable
|
||||
# <hookName>, and the values of the shell array ‘<hookName>Hooks’.
|
||||
runHook() {
|
||||
local hookName="$1"
|
||||
shift
|
||||
local var="$hookName"
|
||||
if [[ "$hookName" =~ Hook$ ]]; then var+=s; else var+=Hooks; fi
|
||||
eval "local -a dummy=(\"\${$var[@]}\")"
|
||||
for hook in "_callImplicitHook 0 $hookName" "${dummy[@]}"; do
|
||||
if ! _eval "$hook" "$@"; then return 1; fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
# Run all hooks with the specified name, until one succeeds (returns a
|
||||
# zero exit code). If none succeed, return a non-zero exit code.
|
||||
runOneHook() {
|
||||
local hookName="$1"
|
||||
shift
|
||||
local var="$hookName"
|
||||
if [[ "$hookName" =~ Hook$ ]]; then var+=s; else var+=Hooks; fi
|
||||
eval "local -a dummy=(\"\${$var[@]}\")"
|
||||
for hook in "_callImplicitHook 1 $hookName" "${dummy[@]}"; do
|
||||
if _eval "$hook" "$@"; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
# Run the named hook, either by calling the function with that name or
|
||||
# by evaluating the variable with that name. This allows convenient
|
||||
# setting of hooks both from Nix expressions (as attributes /
|
||||
# environment variables) and from shell scripts (as functions).
|
||||
runHook() {
|
||||
local hookName="$1"
|
||||
# environment variables) and from shell scripts (as functions). If you
|
||||
# want to allow multiple hooks, use runHook instead.
|
||||
_callImplicitHook() {
|
||||
local def="$1"
|
||||
local hookName="$2"
|
||||
case "$(type -t $hookName)" in
|
||||
(function|alias|builtin) $hookName;;
|
||||
(file) source $hookName;;
|
||||
(keyword) :;;
|
||||
(*) eval "${!hookName}";;
|
||||
(*) if [ -z "${!hookName}" ]; then return "$def"; else eval "${!hookName}"; fi;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
# A function wrapper around ‘eval’ that ensures that ‘return’ inside
|
||||
# hooks exits the hook, not the caller.
|
||||
_eval() {
|
||||
local code="$1"
|
||||
shift
|
||||
if [ "$(type -t $code)" = function ]; then
|
||||
eval "$code \"\$@\""
|
||||
else
|
||||
eval "$code"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
# Error handling.
|
||||
|
||||
exitHandler() {
|
||||
exitCode=$?
|
||||
set +e
|
||||
|
@ -55,7 +116,7 @@ trap "exitHandler" EXIT
|
|||
|
||||
|
||||
######################################################################
|
||||
# Helper functions that might be useful in setup hooks.
|
||||
# Helper functions.
|
||||
|
||||
|
||||
addToSearchPathWithCustomDelimiter() {
|
||||
|
@ -74,13 +135,24 @@ addToSearchPath() {
|
|||
}
|
||||
|
||||
|
||||
ensureDir() {
|
||||
echo "warning: ‘ensureDir’ is deprecated; use ‘mkdir’ instead" >&2
|
||||
local dir
|
||||
for dir in "$@"; do
|
||||
if ! [ -x "$dir" ]; then mkdir -p "$dir"; fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
installBin() {
|
||||
mkdir -p $out/bin
|
||||
cp "$@" $out/bin
|
||||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
# Initialisation.
|
||||
|
||||
set -e
|
||||
|
||||
[ -z $NIX_GCC ] && NIX_GCC=@gcc@
|
||||
|
||||
|
||||
# Wildcard expansions that don't match should expand to an empty list.
|
||||
# This ensures that, for instance, "for i in *; do ...; done" does the
|
||||
|
@ -90,7 +162,7 @@ shopt -s nullglob
|
|||
|
||||
# Set up the initial path.
|
||||
PATH=
|
||||
for i in $NIX_GCC @initialPath@; do
|
||||
for i in $initialPath; do
|
||||
if [ "$i" = / ]; then i=; fi
|
||||
addToSearchPath PATH $i/bin
|
||||
addToSearchPath PATH $i/sbin
|
||||
|
@ -101,37 +173,13 @@ if [ "$NIX_DEBUG" = 1 ]; then
|
|||
fi
|
||||
|
||||
|
||||
# Execute the pre-hook.
|
||||
export SHELL=@shell@
|
||||
export CONFIG_SHELL="$SHELL"
|
||||
if [ -z "$shell" ]; then export shell=@shell@; fi
|
||||
runHook preHook
|
||||
|
||||
|
||||
# Check that the pre-hook initialised SHELL.
|
||||
if [ -z "$SHELL" ]; then echo "SHELL not set"; exit 1; fi
|
||||
|
||||
# Hack: run gcc's setup hook.
|
||||
envHooks=()
|
||||
crossEnvHooks=()
|
||||
if [ -f $NIX_GCC/nix-support/setup-hook ]; then
|
||||
source $NIX_GCC/nix-support/setup-hook
|
||||
fi
|
||||
|
||||
|
||||
# Ensure that the given directories exists.
|
||||
ensureDir() {
|
||||
echo "warning: ‘ensureDir’ is deprecated; use ‘mkdir’ instead" >&2
|
||||
local dir
|
||||
for dir in "$@"; do
|
||||
if ! [ -x "$dir" ]; then mkdir -p "$dir"; fi
|
||||
done
|
||||
}
|
||||
|
||||
installBin() {
|
||||
mkdir -p $out/bin
|
||||
cp "$@" $out/bin
|
||||
}
|
||||
# Execute the pre-hook.
|
||||
export CONFIG_SHELL="$SHELL"
|
||||
if [ -z "$shell" ]; then export shell=$SHELL; fi
|
||||
|
||||
|
||||
# Allow the caller to augment buildInputs (it's not always possible to
|
||||
|
@ -154,6 +202,10 @@ findInputs() {
|
|||
|
||||
eval $var="'${!var} $pkg '"
|
||||
|
||||
if [ -f $pkg ]; then
|
||||
source $pkg
|
||||
fi
|
||||
|
||||
if [ -f $pkg/nix-support/setup-hook ]; then
|
||||
source $pkg/nix-support/setup-hook
|
||||
fi
|
||||
|
@ -178,7 +230,7 @@ done
|
|||
|
||||
# Set the relevant environment variables to point to the build inputs
|
||||
# found above.
|
||||
addToNativeEnv() {
|
||||
_addToNativeEnv() {
|
||||
local pkg=$1
|
||||
|
||||
if [ -d $1/bin ]; then
|
||||
|
@ -186,16 +238,14 @@ addToNativeEnv() {
|
|||
fi
|
||||
|
||||
# Run the package-specific hooks set by the setup-hook scripts.
|
||||
for i in "${envHooks[@]}"; do
|
||||
$i $pkg
|
||||
done
|
||||
runHook envHook "$pkg"
|
||||
}
|
||||
|
||||
for i in $nativePkgs; do
|
||||
addToNativeEnv $i
|
||||
_addToNativeEnv $i
|
||||
done
|
||||
|
||||
addToCrossEnv() {
|
||||
_addToCrossEnv() {
|
||||
local pkg=$1
|
||||
|
||||
# Some programs put important build scripts (freetype-config and similar)
|
||||
|
@ -206,13 +256,11 @@ addToCrossEnv() {
|
|||
fi
|
||||
|
||||
# Run the package-specific hooks set by the setup-hook scripts.
|
||||
for i in "${crossEnvHooks[@]}"; do
|
||||
$i $pkg
|
||||
done
|
||||
runHook crossEnvHook "$pkg"
|
||||
}
|
||||
|
||||
for i in $crossPkgs; do
|
||||
addToCrossEnv $i
|
||||
_addToCrossEnv $i
|
||||
done
|
||||
|
||||
|
||||
|
@ -273,42 +321,11 @@ fi
|
|||
export NIX_BUILD_CORES
|
||||
|
||||
|
||||
######################################################################
|
||||
# Misc. helper functions.
|
||||
# Dummy implementation of the paxmark function. On Linux, this is
|
||||
# overwritten by paxctl's setup hook.
|
||||
paxmark() { true; }
|
||||
|
||||
|
||||
stripDirs() {
|
||||
local dirs="$1"
|
||||
local stripFlags="$2"
|
||||
local dirsNew=
|
||||
|
||||
for d in ${dirs}; do
|
||||
if [ -d "$prefix/$d" ]; then
|
||||
dirsNew="${dirsNew} $prefix/$d "
|
||||
fi
|
||||
done
|
||||
dirs=${dirsNew}
|
||||
|
||||
if [ -n "${dirs}" ]; then
|
||||
header "stripping (with flags $stripFlags) in $dirs"
|
||||
find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} strip $commonStripFlags $stripFlags || true
|
||||
stopNest
|
||||
fi
|
||||
}
|
||||
|
||||
# PaX-mark binaries
|
||||
paxmark() {
|
||||
local flags="$1"
|
||||
shift
|
||||
|
||||
if [ -z "@needsPax@" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
paxctl -c "$@"
|
||||
paxctl -zex -${flags} "$@"
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# Textual substitution functions.
|
||||
|
||||
|
@ -439,39 +456,43 @@ stripHash() {
|
|||
}
|
||||
|
||||
|
||||
unpackFile() {
|
||||
curSrc="$1"
|
||||
local cmd
|
||||
unpackCmdHooks+=(_defaultUnpack)
|
||||
_defaultUnpack() {
|
||||
local fn="$1"
|
||||
|
||||
header "unpacking source archive $curSrc" 3
|
||||
if [ -d "$fn" ]; then
|
||||
|
||||
case "$curSrc" in
|
||||
stripHash "$fn"
|
||||
cp -prd --no-preserve=timestamps "$fn" $strippedName
|
||||
|
||||
else
|
||||
|
||||
case "$fn" in
|
||||
*.tar.xz | *.tar.lzma)
|
||||
# Don't rely on tar knowing about .xz.
|
||||
xz -d < $curSrc | tar xf -
|
||||
xz -d < "$fn" | tar xf -
|
||||
;;
|
||||
*.tar | *.tar.* | *.tgz | *.tbz2)
|
||||
# GNU tar can automatically select the decompression method
|
||||
# (info "(tar) gzip").
|
||||
tar xf $curSrc
|
||||
;;
|
||||
*.zip)
|
||||
unzip -qq $curSrc
|
||||
tar xf "$fn"
|
||||
;;
|
||||
*)
|
||||
if [ -d "$curSrc" ]; then
|
||||
stripHash $curSrc
|
||||
cp -prd --no-preserve=timestamps $curSrc $strippedName
|
||||
else
|
||||
if [ -z "$unpackCmd" ]; then
|
||||
echo "source archive $curSrc has unknown type"
|
||||
exit 1
|
||||
fi
|
||||
runHook unpackCmd
|
||||
fi
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
unpackFile() {
|
||||
curSrc="$1"
|
||||
header "unpacking source archive $curSrc" 3
|
||||
if ! runOneHook unpackCmd "$curSrc"; then
|
||||
echo "do not know how to unpack source archive $curSrc"
|
||||
exit 1
|
||||
fi
|
||||
stopNest
|
||||
}
|
||||
|
||||
|
@ -505,7 +526,7 @@ unpackPhase() {
|
|||
|
||||
# Find the source directory.
|
||||
if [ -n "$setSourceRoot" ]; then
|
||||
runHook setSourceRoot
|
||||
runOneHook setSourceRoot
|
||||
elif [ -z "$sourceRoot" ]; then
|
||||
sourceRoot=
|
||||
for i in *; do
|
||||
|
@ -654,80 +675,6 @@ checkPhase() {
|
|||
}
|
||||
|
||||
|
||||
patchELF() {
|
||||
# Patch all ELF executables and shared libraries.
|
||||
header "patching ELF executables and libraries"
|
||||
if [ -e "$prefix" ]; then
|
||||
find "$prefix" \( \
|
||||
\( -type f -a -name "*.so*" \) -o \
|
||||
\( -type f -a -perm +0100 \) \
|
||||
\) -print -exec patchelf --shrink-rpath '{}' \;
|
||||
fi
|
||||
stopNest
|
||||
}
|
||||
|
||||
|
||||
patchShebangs() {
|
||||
# Rewrite all script interpreter file names (`#! /path') under the
|
||||
# specified directory tree to paths found in $PATH. E.g.,
|
||||
# /bin/sh will be rewritten to /nix/store/<hash>-some-bash/bin/sh.
|
||||
# /usr/bin/env gets special treatment so that ".../bin/env python" is
|
||||
# rewritten to /nix/store/<hash>/bin/python.
|
||||
# Interpreters that are already in the store are left untouched.
|
||||
header "patching script interpreter paths"
|
||||
local dir="$1"
|
||||
local f
|
||||
local oldPath
|
||||
local newPath
|
||||
local arg0
|
||||
local args
|
||||
local oldInterpreterLine
|
||||
local newInterpreterLine
|
||||
|
||||
find "$dir" -type f -perm +0100 | while read f; do
|
||||
if [ "$(head -1 "$f" | head -c +2)" != '#!' ]; then
|
||||
# missing shebang => not a script
|
||||
continue
|
||||
fi
|
||||
|
||||
oldInterpreterLine=$(head -1 "$f" | tail -c +3)
|
||||
read -r oldPath arg0 args <<< "$oldInterpreterLine"
|
||||
|
||||
if $(echo "$oldPath" | grep -q "/bin/env$"); then
|
||||
# Check for unsupported 'env' functionality:
|
||||
# - options: something starting with a '-'
|
||||
# - environment variables: foo=bar
|
||||
if $(echo "$arg0" | grep -q -- "^-.*\|.*=.*"); then
|
||||
echo "unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)"
|
||||
exit 1
|
||||
fi
|
||||
newPath="$(command -v "$arg0" || true)"
|
||||
else
|
||||
if [ "$oldPath" = "" ]; then
|
||||
# If no interpreter is specified linux will use /bin/sh. Set
|
||||
# oldpath="/bin/sh" so that we get /nix/store/.../sh.
|
||||
oldPath="/bin/sh"
|
||||
fi
|
||||
newPath="$(command -v "$(basename "$oldPath")" || true)"
|
||||
args="$arg0 $args"
|
||||
fi
|
||||
|
||||
newInterpreterLine="$newPath $args"
|
||||
|
||||
if [ -n "$oldPath" -a "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]; then
|
||||
if [ -n "$newPath" -a "$newPath" != "$oldPath" ]; then
|
||||
echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""
|
||||
# escape the escape chars so that sed doesn't interpret them
|
||||
escapedInterpreterLine=$(echo "$newInterpreterLine" | sed 's|\\|\\\\|g')
|
||||
sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
stopNest
|
||||
}
|
||||
|
||||
|
||||
installPhase() {
|
||||
runHook preInstall
|
||||
|
||||
|
@ -743,74 +690,22 @@ installPhase() {
|
|||
}
|
||||
|
||||
|
||||
# The fixup phase performs generic, package-independent, Nix-related
|
||||
# stuff, like running patchelf and setting the
|
||||
# propagated-build-inputs. It should rarely be overriden.
|
||||
# The fixup phase performs generic, package-independent stuff, like
|
||||
# stripping binaries, running patchelf and setting
|
||||
# propagated-build-inputs.
|
||||
fixupPhase() {
|
||||
# Make sure everything is writable so "strip" et al. work.
|
||||
for output in $outputs; do
|
||||
if [ -e "${!output}" ]; then chmod -R u+w "${!output}"; fi
|
||||
done
|
||||
|
||||
runHook preFixup
|
||||
|
||||
# Make sure everything is writable so "strip" et al. work.
|
||||
if [ -e "$prefix" ]; then chmod -R u+w "$prefix"; fi
|
||||
|
||||
# Put man/doc/info under $out/share.
|
||||
forceShare=${forceShare:=man doc info}
|
||||
if [ -n "$forceShare" ]; then
|
||||
for d in $forceShare; do
|
||||
if [ -d "$prefix/$d" ]; then
|
||||
if [ -d "$prefix/share/$d" ]; then
|
||||
echo "both $d/ and share/$d/ exists!"
|
||||
else
|
||||
echo "fixing location of $d/ subdirectory"
|
||||
mkdir -p $prefix/share
|
||||
if [ -w $prefix/share ]; then
|
||||
mv -v $prefix/$d $prefix/share
|
||||
ln -sv share/$d $prefix
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done;
|
||||
fi
|
||||
|
||||
if [ -z "$dontGzipMan" ]; then
|
||||
echo "gzipping man pages"
|
||||
GLOBIGNORE=.:..:*.gz:*.bz2
|
||||
for f in "$out"/share/man/*/* "$out"/share/man/*/*/*; do
|
||||
if [ -f "$f" -a ! -L "$f" ]; then
|
||||
if gzip -c -n "$f" > "$f".gz; then
|
||||
rm "$f"
|
||||
else
|
||||
rm "$f".gz
|
||||
fi
|
||||
fi
|
||||
# Apply fixup to each output.
|
||||
local output
|
||||
for output in $outputs; do
|
||||
prefix=${!output} runHook fixupOutput
|
||||
done
|
||||
for f in "$out"/share/man/*/* "$out"/share/man/*/*/*; do
|
||||
if [ -L "$f" -a -f `readlink -f "$f"`.gz ]; then
|
||||
ln -sf `readlink "$f"`.gz "$f".gz && rm "$f"
|
||||
fi
|
||||
done
|
||||
unset GLOBIGNORE
|
||||
fi
|
||||
|
||||
# TODO: strip _only_ ELF executables, and return || fail here...
|
||||
if [ -z "$dontStrip" ]; then
|
||||
stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}
|
||||
if [ -n "$stripDebugList" ]; then
|
||||
stripDirs "$stripDebugList" "${stripDebugFlags:--S}"
|
||||
fi
|
||||
|
||||
stripAllList=${stripAllList:-}
|
||||
if [ -n "$stripAllList" ]; then
|
||||
stripDirs "$stripAllList" "${stripAllFlags:--s}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$havePatchELF" = 1 -a -z "$dontPatchELF" ]; then
|
||||
patchELF "$prefix"
|
||||
fi
|
||||
|
||||
if [ -z "$dontPatchShebangs" ]; then
|
||||
patchShebangs "$prefix"
|
||||
fi
|
||||
|
||||
if [ -n "$propagatedBuildInputs" ]; then
|
||||
mkdir -p "$out/nix-support"
|
||||
|
@ -935,7 +830,6 @@ genericBuild() {
|
|||
|
||||
|
||||
# Execute the post-hooks.
|
||||
for i in "${postHooks[@]}"; do $i; done
|
||||
runHook postHook
|
||||
|
||||
|
||||
|
|
|
@ -7,12 +7,10 @@
|
|||
# The function defaults are for easy testing.
|
||||
{ system ? builtins.currentSystem
|
||||
, allPackages ? import ../../top-level/all-packages.nix
|
||||
, platform ? null, config ? {} }:
|
||||
, platform ? null, config ? {}, lib }:
|
||||
|
||||
rec {
|
||||
|
||||
lib = import ../../../lib;
|
||||
|
||||
bootstrapFiles =
|
||||
if system == "i686-linux" then import ./bootstrap/i686.nix
|
||||
else if system == "x86_64-linux" then import ./bootstrap/x86_64.nix
|
||||
|
@ -26,7 +24,6 @@ rec {
|
|||
commonPreHook =
|
||||
''
|
||||
export NIX_ENFORCE_PURITY=1
|
||||
havePatchELF=1
|
||||
${if system == "x86_64-linux" then "NIX_LIB64_IN_SELF_RPATH=1" else ""}
|
||||
${if system == "mips64el-linux" then "NIX_LIB32_IN_SELF_RPATH=1" else ""}
|
||||
'';
|
||||
|
@ -209,7 +206,7 @@ rec {
|
|||
extraAttrs = {
|
||||
glibc = stage2.pkgs.glibc; # Required by gcc47 build
|
||||
};
|
||||
extraPath = [ stage2.pkgs.paxctl ];
|
||||
extraPath = [ stage2.pkgs.patchelf stage2.pkgs.paxctl ];
|
||||
};
|
||||
|
||||
|
||||
|
@ -223,13 +220,9 @@ rec {
|
|||
coreutils = bootstrapTools;
|
||||
name = "";
|
||||
};
|
||||
extraPath = [ stage3.pkgs.xz ];
|
||||
extraPath = [ stage2.pkgs.patchelf stage3.pkgs.xz ];
|
||||
overrides = pkgs: {
|
||||
# Zlib has to be inherited and not rebuilt in this stage,
|
||||
# because gcc (since JAR support) already depends on zlib, and
|
||||
# then if we already have a zlib we want to use that for the
|
||||
# other purposes (binutils and top-level pkgs) too.
|
||||
inherit (stage3.pkgs) gettext gnum4 gmp perl glibc zlib;
|
||||
inherit (stage3.pkgs) gettext gnum4 gmp perl glibc;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -253,8 +246,9 @@ rec {
|
|||
'';
|
||||
|
||||
initialPath =
|
||||
((import ../common-path.nix) {pkgs = stage4.pkgs;})
|
||||
++ [stage4.pkgs.patchelf stage4.pkgs.paxctl ];
|
||||
((import ../common-path.nix) {pkgs = stage4.pkgs;});
|
||||
|
||||
extraBuildInputs = [ stage4.pkgs.patchelf stage4.pkgs.paxctl ];
|
||||
|
||||
shell = stage4.pkgs.bash + "/bin/bash";
|
||||
|
||||
|
@ -278,7 +272,7 @@ rec {
|
|||
inherit (stage4.pkgs)
|
||||
gzip bzip2 xz bash binutils coreutils diffutils findutils gawk
|
||||
glibc gnumake gnused gnutar gnugrep gnupatch patchelf
|
||||
attr acl paxctl zlib;
|
||||
attr acl paxctl;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ stdenv, pkgs, config }:
|
||||
{ stdenv, pkgs, config, lib }:
|
||||
|
||||
import ../generic rec {
|
||||
inherit config;
|
||||
|
@ -7,7 +7,7 @@ import ../generic rec {
|
|||
''
|
||||
export NIX_ENFORCE_PURITY=1
|
||||
export NIX_IGNORE_LD_THROUGH_GCC=1
|
||||
'' + (if stdenv.isDarwin then ''
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
export NIX_ENFORCE_PURITY=
|
||||
export NIX_DONT_SET_RPATH=1
|
||||
export NIX_NO_SELF_RPATH=1
|
||||
|
@ -18,7 +18,7 @@ import ../generic rec {
|
|||
export SDKROOT=$(/usr/bin/xcrun --show-sdk-path 2> /dev/null || true)
|
||||
export NIX_CFLAGS_COMPILE+=" --sysroot=/var/empty -idirafter $SDKROOT/usr/include -F$SDKROOT/System/Library/Frameworks -Wno-multichar -Wno-deprecated-declarations"
|
||||
export NIX_LDFLAGS_AFTER+=" -L$SDKROOT/usr/lib"
|
||||
'' else "");
|
||||
'';
|
||||
|
||||
initialPath = (import ../common-path.nix) {pkgs = pkgs;};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ stdenv, fetchurl, bzip2
|
||||
, enableNLS ? false, libnatspec }:
|
||||
|
||||
stdenv.mkDerivation ({
|
||||
stdenv.mkDerivation {
|
||||
name = "unzip-6.0";
|
||||
|
||||
src = fetchurl {
|
||||
|
@ -9,6 +9,13 @@ stdenv.mkDerivation ({
|
|||
sha256 = "0dxx11knh3nk95p2gg2ak777dd11pr7jx5das2g49l262scrcv83";
|
||||
};
|
||||
|
||||
patches = stdenv.lib.optional enableNLS
|
||||
(fetchurl {
|
||||
url = "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-arch/unzip/files/unzip-6.0-natspec.patch?revision=1.1";
|
||||
name = "unzip-6.0-natspec.patch";
|
||||
sha256 = "67ab260ae6adf8e7c5eda2d1d7846929b43562943ec4aff629bd7018954058b1";
|
||||
});
|
||||
|
||||
nativeBuildInputs = [ bzip2 ];
|
||||
buildInputs = [ bzip2 ] ++ stdenv.lib.optional enableNLS libnatspec;
|
||||
|
||||
|
@ -24,19 +31,12 @@ stdenv.mkDerivation ({
|
|||
|
||||
installFlags = "prefix=$(out)";
|
||||
|
||||
setupHook = ./setup-hook.sh;
|
||||
|
||||
meta = {
|
||||
homepage = http://www.info-zip.org;
|
||||
description = "An extraction utility for archives compressed in .zip format";
|
||||
license = "free"; # http://www.info-zip.org/license.html
|
||||
platforms = stdenv.lib.platforms.all;
|
||||
};
|
||||
} // (if enableNLS then {
|
||||
patches =
|
||||
[ ( fetchurl {
|
||||
url =
|
||||
"http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-arch/unzip/files/unzip-6.0-natspec.patch?revision=1.1";
|
||||
name = "unzip-6.0-natspec.patch";
|
||||
sha256 = "67ab260ae6adf8e7c5eda2d1d7846929b43562943ec4aff629bd7018954058b1";
|
||||
})
|
||||
];
|
||||
} else {}))
|
||||
}
|
||||
|
|
5
pkgs/tools/archivers/unzip/setup-hook.sh
Normal file
5
pkgs/tools/archivers/unzip/setup-hook.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
unpackCmdHooks+=(_tryUnzip)
|
||||
_tryUnzip() {
|
||||
if ! [[ "foo.zip" =~ \.zip$ ]]; then return 1; fi
|
||||
unzip -qq "$curSrc"
|
||||
}
|
|
@ -18,5 +18,5 @@ if test -z "$sgmlHookDone"; then
|
|||
export ftp_proxy=http://nodtd.invalid/
|
||||
|
||||
export SGML_CATALOG_FILES
|
||||
envHooks=(${envHooks[@]} addSGMLCatalogs)
|
||||
envHooks+=(addSGMLCatalogs)
|
||||
fi
|
||||
|
|
|
@ -4,4 +4,4 @@ addTeXMFPath () {
|
|||
fi
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addTeXMFPath)
|
||||
envHooks+=(addTeXMFPath)
|
||||
|
|
|
@ -4,4 +4,4 @@ addTeXMFPath () {
|
|||
fi
|
||||
}
|
||||
|
||||
envHooks=(${envHooks[@]} addTeXMFPath)
|
||||
envHooks+=(addTeXMFPath)
|
||||
|
|
|
@ -205,7 +205,7 @@ let
|
|||
|
||||
|
||||
allStdenvs = import ../stdenv {
|
||||
inherit system platform config;
|
||||
inherit system platform config lib;
|
||||
allPackages = args: import ./all-packages.nix ({ inherit config system; } // args);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue