pkgs/build-support: stdenv.lib -> lib

Changed files
+33 -27
pkgs
build-support
bintools-wrapper
cc-wrapper
pkg-config-wrapper
release
stdenv
darwin
linux
+8 -7
pkgs/build-support/bintools-wrapper/default.nix
···
# compiler and the linker just "work".
{ name ? ""
, stdenvNoCC
, bintools ? null, libc ? null, coreutils ? null, shell ? stdenvNoCC.shell, gnugrep ? null
, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
···
, useMacosReexportHack ? false
}:
-
with stdenvNoCC.lib;
assert nativeTools -> !propagateDoc && nativePrefix != "";
assert !nativeTools ->
···
#
# TODO(@Ericson2314) Make unconditional, or optional but always true by
# default.
-
targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform)
(targetPlatform.config + "-");
-
bintoolsVersion = stdenv.lib.getVersion bintools;
-
bintoolsName = stdenv.lib.removePrefix targetPrefix (stdenv.lib.getName bintools);
libc_bin = if libc == null then null else getBin libc;
libc_dev = if libc == null then null else getDev libc;
···
else if targetPlatform.system == "powerpc-linux" then "${libc_lib}/lib/ld.so.1"
else if targetPlatform.isMips then "${libc_lib}/lib/ld.so.1"
else if targetPlatform.isDarwin then "/usr/lib/dyld"
-
else if stdenv.lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1"
else null;
expand-response-params =
···
let bintools_ = if bintools != null then bintools else {}; in
(if bintools_ ? meta then removeAttrs bintools.meta ["priority"] else {}) //
{ description =
-
stdenv.lib.attrByPath ["meta" "description"] "System binary utilities" bintools_
+ " (wrapper script)";
priority = 10;
} // optionalAttrs useMacosReexportHack {
-
platforms = stdenv.lib.platforms.darwin;
};
}
···
# compiler and the linker just "work".
{ name ? ""
+
, lib
, stdenvNoCC
, bintools ? null, libc ? null, coreutils ? null, shell ? stdenvNoCC.shell, gnugrep ? null
, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
···
, useMacosReexportHack ? false
}:
+
with lib;
assert nativeTools -> !propagateDoc && nativePrefix != "";
assert !nativeTools ->
···
#
# TODO(@Ericson2314) Make unconditional, or optional but always true by
# default.
+
targetPrefix = lib.optionalString (targetPlatform != hostPlatform)
(targetPlatform.config + "-");
+
bintoolsVersion = lib.getVersion bintools;
+
bintoolsName = lib.removePrefix targetPrefix (lib.getName bintools);
libc_bin = if libc == null then null else getBin libc;
libc_dev = if libc == null then null else getDev libc;
···
else if targetPlatform.system == "powerpc-linux" then "${libc_lib}/lib/ld.so.1"
else if targetPlatform.isMips then "${libc_lib}/lib/ld.so.1"
else if targetPlatform.isDarwin then "/usr/lib/dyld"
+
else if lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1"
else null;
expand-response-params =
···
let bintools_ = if bintools != null then bintools else {}; in
(if bintools_ ? meta then removeAttrs bintools.meta ["priority"] else {}) //
{ description =
+
lib.attrByPath ["meta" "description"] "System binary utilities" bintools_
+ " (wrapper script)";
priority = 10;
} // optionalAttrs useMacosReexportHack {
+
platforms = lib.platforms.darwin;
};
}
+9 -8
pkgs/build-support/cc-wrapper/default.nix
···
# compiler and the linker just "work".
{ name ? ""
, stdenvNoCC
, cc ? null, libc ? null, bintools, coreutils ? null, shell ? stdenvNoCC.shell
, gccForLibs ? null
···
, libcxx ? null
}:
-
with stdenvNoCC.lib;
assert nativeTools -> !propagateDoc && nativePrefix != "";
assert !nativeTools ->
···
#
# TODO(@Ericson2314) Make unconditional, or optional but always true by
# default.
-
targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform)
(targetPlatform.config + "-");
-
ccVersion = stdenv.lib.getVersion cc;
-
ccName = stdenv.lib.removePrefix targetPrefix (stdenv.lib.getName cc);
libc_bin = if libc == null then null else getBin libc;
libc_dev = if libc == null then null else getDev libc;
···
setupHooks = [
../setup-hooks/role.bash
-
] ++ stdenv.lib.optional (cc.langC or true) ./setup-hook.sh
-
++ stdenv.lib.optional (cc.langFortran or false) ./fortran-hook.sh;
postFixup =
# Ensure flags files exists, as some other programs cat them. (That these
···
+ optionalString (libcxx.isLLVM or false) (''
echo "-isystem ${libcxx}/include/c++/v1" >> $out/nix-support/libcxx-cxxflags
echo "-stdlib=libc++" >> $out/nix-support/libcxx-ldflags
-
'' + stdenv.lib.optionalString stdenv.targetPlatform.isLinux ''
echo "-lc++abi" >> $out/nix-support/libcxx-ldflags
'')
···
let cc_ = if cc != null then cc else {}; in
(if cc_ ? meta then removeAttrs cc.meta ["priority"] else {}) //
{ description =
-
stdenv.lib.attrByPath ["meta" "description"] "System C compiler" cc_
+ " (wrapper script)";
priority = 10;
};
···
# compiler and the linker just "work".
{ name ? ""
+
, lib
, stdenvNoCC
, cc ? null, libc ? null, bintools, coreutils ? null, shell ? stdenvNoCC.shell
, gccForLibs ? null
···
, libcxx ? null
}:
+
with lib;
assert nativeTools -> !propagateDoc && nativePrefix != "";
assert !nativeTools ->
···
#
# TODO(@Ericson2314) Make unconditional, or optional but always true by
# default.
+
targetPrefix = lib.optionalString (targetPlatform != hostPlatform)
(targetPlatform.config + "-");
+
ccVersion = lib.getVersion cc;
+
ccName = lib.removePrefix targetPrefix (lib.getName cc);
libc_bin = if libc == null then null else getBin libc;
libc_dev = if libc == null then null else getDev libc;
···
setupHooks = [
../setup-hooks/role.bash
+
] ++ lib.optional (cc.langC or true) ./setup-hook.sh
+
++ lib.optional (cc.langFortran or false) ./fortran-hook.sh;
postFixup =
# Ensure flags files exists, as some other programs cat them. (That these
···
+ optionalString (libcxx.isLLVM or false) (''
echo "-isystem ${libcxx}/include/c++/v1" >> $out/nix-support/libcxx-cxxflags
echo "-stdlib=libc++" >> $out/nix-support/libcxx-ldflags
+
'' + lib.optionalString stdenv.targetPlatform.isLinux ''
echo "-lc++abi" >> $out/nix-support/libcxx-ldflags
'')
···
let cc_ = if cc != null then cc else {}; in
(if cc_ ? meta then removeAttrs cc.meta ["priority"] else {}) //
{ description =
+
lib.attrByPath ["meta" "description"] "System C compiler" cc_
+ " (wrapper script)";
priority = 10;
};
+1 -1
pkgs/build-support/pkg-config-wrapper/default.nix
···
, extraPackages ? [], extraBuildCommands ? ""
}:
-
with stdenvNoCC.lib;
let
stdenv = stdenvNoCC;
···
, extraPackages ? [], extraBuildCommands ? ""
}:
+
with lib;
let
stdenv = stdenvNoCC;
+8 -8
pkgs/build-support/release/ant-build.nix
···
{ src
, pkgs
, stdenv ? pkgs.stdenv
, name
, antTargets ? []
···
, ... } @ args:
let
-
antFlags = "-f ${buildfile} " + stdenv.lib.concatMapStrings ({name, value}: "-D${name}=${value} " ) antProperties ;
-
lib = stdenv.lib;
in
stdenv.mkDerivation (
···
prePhases =
["antSetupPhase"];
-
antSetupPhase = with stdenv.lib; ''
if test "$hydraAntLogger" != "" ; then
export ANT_ARGS="-logger org.hydra.ant.HydraLogger -lib `ls $hydraAntLogger/share/java/*.jar | head -1`"
fi
···
mkdir -p $out/share/java
${ if jars == [] then ''
find . -name "*.jar" | xargs -I{} cp -v {} $out/share/java
-
'' else stdenv.lib.concatMapStrings (j: ''
cp -v ${j} $out/share/java
'') jars }
···
in
''
header "Generating jar wrappers"
-
'' + (stdenv.lib.concatMapStrings (w: ''
mkdir -p $out/bin
cat >> $out/bin/${w.name} <<EOF
···
header "Building default ant target"
ant ${antFlags}
closeNest
-
'' else stdenv.lib.concatMapStrings (t: ''
header "Building '${t}' target"
ant ${antFlags} ${t}
closeNest
···
'';
}
-
// removeAttrs args ["antProperties" "buildInputs" "pkgs" "jarWrappers"] //
{
name = name + (if src ? version then "-" + src.version else "");
-
buildInputs = [ant jre zip unzip] ++ stdenv.lib.optional (args ? buildInputs) args.buildInputs ;
postHook = ''
mkdir -p $out/nix-support
···
{ src
, pkgs
+
, lib
, stdenv ? pkgs.stdenv
, name
, antTargets ? []
···
, ... } @ args:
let
+
antFlags = "-f ${buildfile} " + lib.concatMapStrings ({name, value}: "-D${name}=${value} " ) antProperties ;
in
stdenv.mkDerivation (
···
prePhases =
["antSetupPhase"];
+
antSetupPhase = with lib; ''
if test "$hydraAntLogger" != "" ; then
export ANT_ARGS="-logger org.hydra.ant.HydraLogger -lib `ls $hydraAntLogger/share/java/*.jar | head -1`"
fi
···
mkdir -p $out/share/java
${ if jars == [] then ''
find . -name "*.jar" | xargs -I{} cp -v {} $out/share/java
+
'' else lib.concatMapStrings (j: ''
cp -v ${j} $out/share/java
'') jars }
···
in
''
header "Generating jar wrappers"
+
'' + (lib.concatMapStrings (w: ''
mkdir -p $out/bin
cat >> $out/bin/${w.name} <<EOF
···
header "Building default ant target"
ant ${antFlags}
closeNest
+
'' else lib.concatMapStrings (t: ''
header "Building '${t}' target"
ant ${antFlags} ${t}
closeNest
···
'';
}
+
// removeAttrs args ["antProperties" "buildInputs" "pkgs" "lib" "jarWrappers"] //
{
name = name + (if src ? version then "-" + src.version else "");
+
buildInputs = [ant jre zip unzip] ++ lib.optional (args ? buildInputs) args.buildInputs ;
postHook = ''
mkdir -p $out/nix-support
+1 -1
pkgs/build-support/release/debian-build.nix
···
{ name ? "debian-build"
, lib
, diskImage
-
, src, stdenv, vmTools, checkinstall
, fsTranslation ? false
, # Features provided by this package.
debProvides ? []
···
{ name ? "debian-build"
, lib
, diskImage
+
, src, lib, stdenv, vmTools, checkinstall
, fsTranslation ? false
, # Features provided by this package.
debProvides ? []
+1 -1
pkgs/build-support/release/default.nix
···
} // args);
antBuild = args: import ./ant-build.nix (
-
{ inherit pkgs;
} // args);
mvnBuild = args: import ./maven-build.nix (
···
} // args);
antBuild = args: import ./ant-build.nix (
+
{ inherit lib pkgs;
} // args);
mvnBuild = args: import ./maven-build.nix (
+2 -1
pkgs/stdenv/darwin/default.nix
···
mkCC = overrides: import ../../build-support/cc-wrapper (
let args = {
-
inherit shell;
inherit (last) stdenvNoCC;
nativeTools = false;
···
binutils = lib.makeOverridable (import ../../build-support/bintools-wrapper) {
shell = "${bootstrapTools}/bin/bash";
inherit (self) stdenvNoCC;
nativeTools = false;
···
mkCC = overrides: import ../../build-support/cc-wrapper (
let args = {
+
inherit lib shell;
inherit (last) stdenvNoCC;
nativeTools = false;
···
binutils = lib.makeOverridable (import ../../build-support/bintools-wrapper) {
shell = "${bootstrapTools}/bin/bash";
+
inherit lib;
inherit (self) stdenvNoCC;
nativeTools = false;
+3
pkgs/stdenv/linux/default.nix
···
bintools = prevStage.binutils;
isGNU = true;
libc = getLibc prevStage;
inherit (prevStage) coreutils gnugrep;
stdenvNoCC = prevStage.ccWrapperStdenv;
};
···
nativeLibc = false;
buildPackages = { };
libc = getLibc self;
inherit (self) stdenvNoCC coreutils gnugrep;
bintools = bootstrapTools;
};
···
cc = prevStage.gcc-unwrapped;
bintools = self.binutils;
libc = getLibc self;
inherit (self) stdenvNoCC coreutils gnugrep;
shell = self.bash + "/bin/bash";
};
···
bintools = prevStage.binutils;
isGNU = true;
libc = getLibc prevStage;
+
inherit lib;
inherit (prevStage) coreutils gnugrep;
stdenvNoCC = prevStage.ccWrapperStdenv;
};
···
nativeLibc = false;
buildPackages = { };
libc = getLibc self;
+
inherit lib;
inherit (self) stdenvNoCC coreutils gnugrep;
bintools = bootstrapTools;
};
···
cc = prevStage.gcc-unwrapped;
bintools = self.binutils;
libc = getLibc self;
+
inherit lib;
inherit (self) stdenvNoCC coreutils gnugrep;
shell = self.bash + "/bin/bash";
};