Merge pull request #35071 from oxij/stdenv/infopages

stdenv, bash: fixing info pages and stuff
This commit is contained in:
John Ericson 2018-02-26 18:06:11 -05:00 committed by GitHub
commit 4a29081a94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 48 deletions

View File

@ -5,7 +5,8 @@
# script that sets up the right environment variables so that the # script that sets up the right environment variables so that the
# compiler and the linker just "work". # compiler and the linker just "work".
{ name ? "", stdenvNoCC, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" { name ? ""
, stdenvNoCC, nativeTools, propagateDoc ? !nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
, bintools ? null, libc ? null , bintools ? null, libc ? null
, coreutils ? null, shell ? stdenvNoCC.shell, gnugrep ? null , coreutils ? null, shell ? stdenvNoCC.shell, gnugrep ? null
, extraPackages ? [], extraBuildCommands ? "" , extraPackages ? [], extraBuildCommands ? ""
@ -15,7 +16,7 @@
with stdenvNoCC.lib; with stdenvNoCC.lib;
assert nativeTools -> nativePrefix != ""; assert nativeTools -> !propagateDoc && nativePrefix != "";
assert !nativeTools -> assert !nativeTools ->
bintools != null && coreutils != null && gnugrep != null; bintools != null && coreutils != null && gnugrep != null;
assert !(nativeLibc && noLibc); assert !(nativeLibc && noLibc);
@ -83,7 +84,7 @@ stdenv.mkDerivation {
inherit targetPrefix infixSalt; inherit targetPrefix infixSalt;
outputs = [ "out" "info" "man" ]; outputs = [ "out" ] ++ optionals propagateDoc [ "man" "info" ];
passthru = { passthru = {
inherit bintools libc nativeTools nativeLibc nativePrefix; inherit bintools libc nativeTools nativeLibc nativePrefix;
@ -111,7 +112,7 @@ stdenv.mkDerivation {
'' ''
set -u set -u
mkdir -p $out/bin {$out,$info,$man}/nix-support mkdir -p $out/bin $out/nix-support
wrap() { wrap() {
local dst="$1" local dst="$1"
@ -237,28 +238,27 @@ stdenv.mkDerivation {
'') '')
+ optionalString (!nativeTools) '' + optionalString (!nativeTools) ''
## ##
## User env support ## User env support
## ##
# Propagate the underling unwrapped bintools so that if you # Propagate the underling unwrapped bintools so that if you
# install the wrapper, you get tools like objdump, the manpages, # install the wrapper, you get tools like objdump (same for any
# etc. as well (same for any binaries of libc). # binaries of libc).
printWords ${bintools_bin} ${if libc == null then "" else libc_bin} > $out/nix-support/propagated-user-env-packages printWords ${bintools_bin} ${if libc == null then "" else libc_bin} > $out/nix-support/propagated-user-env-packages
''
+ optionalString propagateDoc ''
## ##
## Man page and info support ## Man page and info support
## ##
printWords ${bintools.info or ""} \ mkdir -p $man/nix-support $info/nix-support
>> $info/nix-support/propagated-build-inputs printWords ${bintools.man or ""} >> $man/nix-support/propagated-build-inputs
printWords ${bintools.man or ""} \ printWords ${bintools.info or ""} >> $info/nix-support/propagated-build-inputs
>> $man/nix-support/propagated-build-inputs
'' ''
+ '' + ''
## ##
## Hardening support ## Hardening support
## ##
@ -286,8 +286,8 @@ stdenv.mkDerivation {
## ##
## Extra custom steps ## Extra custom steps
## ##
'' ''
+ extraBuildCommands; + extraBuildCommands;
inherit dynamicLinker expand-response-params; inherit dynamicLinker expand-response-params;

View File

@ -5,7 +5,8 @@
# script that sets up the right environment variables so that the # script that sets up the right environment variables so that the
# compiler and the linker just "work". # compiler and the linker just "work".
{ name ? "", stdenvNoCC, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" { name ? ""
, stdenvNoCC, nativeTools, propagateDoc ? !nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
, cc ? null, libc ? null, bintools, coreutils ? null, shell ? stdenvNoCC.shell , cc ? null, libc ? null, bintools, coreutils ? null, shell ? stdenvNoCC.shell
, zlib ? null, extraPackages ? [], extraBuildCommands ? "" , zlib ? null, extraPackages ? [], extraBuildCommands ? ""
, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null , isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
@ -14,7 +15,7 @@
with stdenvNoCC.lib; with stdenvNoCC.lib;
assert nativeTools -> nativePrefix != ""; assert nativeTools -> !propagateDoc && nativePrefix != "";
assert !nativeTools -> assert !nativeTools ->
cc != null && coreutils != null && gnugrep != null; cc != null && coreutils != null && gnugrep != null;
assert !(nativeLibc && noLibc); assert !(nativeLibc && noLibc);
@ -84,7 +85,7 @@ stdenv.mkDerivation {
inherit targetPrefix infixSalt; inherit targetPrefix infixSalt;
outputs = [ "out" "man" ]; outputs = [ "out" ] ++ optionals propagateDoc [ "man" "info" ];
passthru = { passthru = {
# "cc" is the generic name for a C compiler, but there is no one for package # "cc" is the generic name for a C compiler, but there is no one for package
@ -115,7 +116,7 @@ stdenv.mkDerivation {
'' ''
set -u set -u
mkdir -p $out/bin $out/nix-support $man/nix-support mkdir -p $out/bin $out/nix-support
wrap() { wrap() {
local dst="$1" local dst="$1"
@ -246,7 +247,6 @@ stdenv.mkDerivation {
'' ''
+ optionalString (!nativeTools) '' + optionalString (!nativeTools) ''
## ##
## Initial CFLAGS ## Initial CFLAGS
## ##
@ -276,19 +276,19 @@ stdenv.mkDerivation {
echo "$ccLDFlags" > $out/nix-support/cc-ldflags echo "$ccLDFlags" > $out/nix-support/cc-ldflags
echo "$ccCFlags" > $out/nix-support/cc-cflags echo "$ccCFlags" > $out/nix-support/cc-cflags
''
+ optionalString propagateDoc ''
## ##
## User env support ## Man page and info support
## ##
# Propagate the wrapped cc so that if you install the wrapper, mkdir -p $man/nix-support $info/nix-support
# you get tools like gcov, the manpages, etc. as well (including
# for binutils and Glibc).
printWords ${cc.man or ""} > $man/nix-support/propagated-user-env-packages printWords ${cc.man or ""} > $man/nix-support/propagated-user-env-packages
printWords ${cc.info or ""} > $info/nix-support/propagated-user-env-packages
'' ''
+ '' + ''
## ##
## Hardening support ## Hardening support
## ##
@ -308,8 +308,8 @@ stdenv.mkDerivation {
## ##
## Extra custom steps ## Extra custom steps
## ##
'' ''
+ extraBuildCommands; + extraBuildCommands;
inherit expand-response-params; inherit expand-response-params;

View File

@ -36,9 +36,7 @@ stdenv.mkDerivation rec {
hardeningDisable = [ "format" ]; hardeningDisable = [ "format" ];
outputs = [ "out" "dev" "doc" "info" ] outputs = [ "out" "dev" "man" "doc" "info" ];
# the man pages are small and useful enough, so include them in $out in interactive builds
++ stdenv.lib.optional (!interactive) "man";
NIX_CFLAGS_COMPILE = '' NIX_CFLAGS_COMPILE = ''
-DSYS_BASHRC="/etc/bashrc" -DSYS_BASHRC="/etc/bashrc"

View File

@ -61,12 +61,14 @@ in rec {
libcxx, libcxx,
allowedRequisites ? null}: allowedRequisites ? null}:
let let
name = "bootstrap-stage${toString step}";
buildPackages = lib.optionalAttrs (last ? stdenv) { buildPackages = lib.optionalAttrs (last ? stdenv) {
inherit (last) stdenv; inherit (last) stdenv;
}; };
coreutils = { name = "coreutils-9.9.9"; outPath = bootstrapTools; }; coreutils = { name = "${name}-coreutils"; outPath = bootstrapTools; };
gnugrep = { name = "gnugrep-9.9.9"; outPath = bootstrapTools; }; gnugrep = { name = "${name}-gnugrep"; outPath = bootstrapTools; };
bintools = import ../../build-support/bintools-wrapper { bintools = import ../../build-support/bintools-wrapper {
inherit shell; inherit shell;
@ -76,7 +78,7 @@ in rec {
nativeLibc = false; nativeLibc = false;
inherit buildPackages coreutils gnugrep; inherit buildPackages coreutils gnugrep;
libc = last.pkgs.darwin.Libsystem; libc = last.pkgs.darwin.Libsystem;
bintools = { name = "binutils-9.9.9"; outPath = bootstrapTools; }; bintools = { name = "${name}-binutils"; outPath = bootstrapTools; };
}; };
cc = if isNull last then "/dev/null" else import ../../build-support/cc-wrapper { cc = if isNull last then "/dev/null" else import ../../build-support/cc-wrapper {
@ -86,21 +88,22 @@ in rec {
extraPackages = lib.optional (libcxx != null) libcxx; extraPackages = lib.optional (libcxx != null) libcxx;
nativeTools = false; nativeTools = false;
propagateDoc = false;
nativeLibc = false; nativeLibc = false;
inherit buildPackages coreutils gnugrep bintools; inherit buildPackages coreutils gnugrep bintools;
libc = last.pkgs.darwin.Libsystem; libc = last.pkgs.darwin.Libsystem;
isClang = true; isClang = true;
cc = { name = "clang-9.9.9"; outPath = bootstrapTools; }; cc = { name = "${name}-clang"; outPath = bootstrapTools; };
}; };
thisStdenv = import ../generic { thisStdenv = import ../generic {
name = "${name}-stdenv-darwin";
inherit config shell extraNativeBuildInputs extraBuildInputs; inherit config shell extraNativeBuildInputs extraBuildInputs;
allowedRequisites = if allowedRequisites == null then null else allowedRequisites ++ [ allowedRequisites = if allowedRequisites == null then null else allowedRequisites ++ [
cc.expand-response-params cc.bintools cc.expand-response-params cc.bintools
]; ];
name = "stdenv-darwin-boot-${toString step}";
buildPlatform = localSystem; buildPlatform = localSystem;
hostPlatform = localSystem; hostPlatform = localSystem;
targetPlatform = localSystem; targetPlatform = localSystem;
@ -146,7 +149,7 @@ in rec {
overrides = self: super: with stage0; rec { overrides = self: super: with stage0; rec {
darwin = super.darwin // { darwin = super.darwin // {
Libsystem = stdenv.mkDerivation { Libsystem = stdenv.mkDerivation {
name = "bootstrap-Libsystem"; name = "bootstrap-stage0-Libsystem";
buildCommand = '' buildCommand = ''
mkdir -p $out mkdir -p $out
ln -s ${bootstrapTools}/lib $out/lib ln -s ${bootstrapTools}/lib $out/lib
@ -157,7 +160,7 @@ in rec {
}; };
libcxx = stdenv.mkDerivation { libcxx = stdenv.mkDerivation {
name = "bootstrap-libcxx"; name = "bootstrap-stage0-libcxx";
phases = [ "installPhase" "fixupPhase" ]; phases = [ "installPhase" "fixupPhase" ];
installPhase = '' installPhase = ''
mkdir -p $out/lib $out/include mkdir -p $out/lib $out/include
@ -169,7 +172,7 @@ in rec {
}; };
libcxxabi = stdenv.mkDerivation { libcxxabi = stdenv.mkDerivation {
name = "bootstrap-libcxxabi"; name = "bootstrap-stage0-libcxxabi";
buildCommand = '' buildCommand = ''
mkdir -p $out/lib mkdir -p $out/lib
ln -s ${bootstrapTools}/lib/libc++abi.dylib $out/lib/libc++abi.dylib ln -s ${bootstrapTools}/lib/libc++abi.dylib $out/lib/libc++abi.dylib
@ -325,11 +328,11 @@ in rec {
inherit binutils binutils-raw; inherit binutils binutils-raw;
}; };
in import ../generic rec { in import ../generic rec {
name = "stdenv-darwin";
inherit config; inherit config;
inherit (pkgs.stdenv) fetchurlBoot; inherit (pkgs.stdenv) fetchurlBoot;
name = "stdenv-darwin";
buildPlatform = localSystem; buildPlatform = localSystem;
hostPlatform = localSystem; hostPlatform = localSystem;
targetPlatform = localSystem; targetPlatform = localSystem;

View File

@ -66,7 +66,7 @@ let
let let
thisStdenv = import ../generic { thisStdenv = import ../generic {
name = "stdenv-linux-boot"; name = "${name}-stdenv-linux";
buildPlatform = localSystem; buildPlatform = localSystem;
hostPlatform = localSystem; hostPlatform = localSystem;
targetPlatform = localSystem; targetPlatform = localSystem;
@ -88,7 +88,9 @@ let
cc = if isNull prevStage.gcc-unwrapped cc = if isNull prevStage.gcc-unwrapped
then null then null
else lib.makeOverridable (import ../../build-support/cc-wrapper) { else lib.makeOverridable (import ../../build-support/cc-wrapper) {
name = "${name}-gcc-wrapper";
nativeTools = false; nativeTools = false;
propagateDoc = false;
nativeLibc = false; nativeLibc = false;
buildPackages = lib.optionalAttrs (prevStage ? stdenv) { buildPackages = lib.optionalAttrs (prevStage ? stdenv) {
inherit (prevStage) stdenv; inherit (prevStage) stdenv;
@ -98,7 +100,6 @@ let
isGNU = true; isGNU = true;
libc = getLibc prevStage; libc = getLibc prevStage;
inherit (prevStage) coreutils gnugrep; inherit (prevStage) coreutils gnugrep;
name = name;
stdenvNoCC = prevStage.ccWrapperStdenv; stdenvNoCC = prevStage.ccWrapperStdenv;
}; };
@ -138,7 +139,7 @@ in
# Build a dummy stdenv with no GCC or working fetchurl. This is # Build a dummy stdenv with no GCC or working fetchurl. This is
# because we need a stdenv to build the GCC wrapper and fetchurl. # because we need a stdenv to build the GCC wrapper and fetchurl.
(prevStage: stageFun prevStage { (prevStage: stageFun prevStage {
name = null; name = "bootstrap-stage0";
overrides = self: super: { overrides = self: super: {
# We thread stage0's stdenv through under this name so downstream stages # We thread stage0's stdenv through under this name so downstream stages
@ -152,7 +153,7 @@ in
# create a dummy Glibc here, which will be used in the stdenv of # create a dummy Glibc here, which will be used in the stdenv of
# stage1. # stage1.
${localSystem.libc} = self.stdenv.mkDerivation { ${localSystem.libc} = self.stdenv.mkDerivation {
name = "bootstrap-${localSystem.libc}"; name = "bootstrap-stage0-${localSystem.libc}";
buildCommand = '' buildCommand = ''
mkdir -p $out mkdir -p $out
ln -s ${bootstrapTools}/lib $out/lib ln -s ${bootstrapTools}/lib $out/lib
@ -164,13 +165,13 @@ in
}; };
gcc-unwrapped = bootstrapTools; gcc-unwrapped = bootstrapTools;
binutils = import ../../build-support/bintools-wrapper { binutils = import ../../build-support/bintools-wrapper {
name = "bootstrap-stage0-binutils-wrapper";
nativeTools = false; nativeTools = false;
nativeLibc = false; nativeLibc = false;
buildPackages = { }; buildPackages = { };
libc = getLibc self; libc = getLibc self;
inherit (self) stdenvNoCC coreutils gnugrep; inherit (self) stdenvNoCC coreutils gnugrep;
bintools = bootstrapTools; bintools = bootstrapTools;
name = "bootstrap-binutils-wrapper";
}; };
coreutils = bootstrapTools; coreutils = bootstrapTools;
gnugrep = bootstrapTools; gnugrep = bootstrapTools;
@ -189,7 +190,7 @@ in
# simply re-export those packages in the middle stage(s) using the # simply re-export those packages in the middle stage(s) using the
# overrides attribute and the inherit syntax. # overrides attribute and the inherit syntax.
(prevStage: stageFun prevStage { (prevStage: stageFun prevStage {
name = "bootstrap-gcc-wrapper"; name = "bootstrap-stage1";
# Rebuild binutils to use from stage2 onwards. # Rebuild binutils to use from stage2 onwards.
overrides = self: super: { overrides = self: super: {
@ -213,7 +214,7 @@ in
# 2nd stdenv that contains our own rebuilt binutils and is used for # 2nd stdenv that contains our own rebuilt binutils and is used for
# compiling our own Glibc. # compiling our own Glibc.
(prevStage: stageFun prevStage { (prevStage: stageFun prevStage {
name = "bootstrap-gcc-wrapper"; name = "bootstrap-stage2";
overrides = self: super: { overrides = self: super: {
inherit (prevStage) inherit (prevStage)
@ -234,7 +235,7 @@ in
# one uses the rebuilt Glibc from stage2. It still uses the recent # one uses the rebuilt Glibc from stage2. It still uses the recent
# binutils and rest of the bootstrap tools, including GCC. # binutils and rest of the bootstrap tools, including GCC.
(prevStage: stageFun prevStage { (prevStage: stageFun prevStage {
name = "bootstrap-gcc-wrapper"; name = "bootstrap-stage3";
overrides = self: super: rec { overrides = self: super: rec {
inherit (prevStage) inherit (prevStage)
@ -262,7 +263,7 @@ in
# Construct a fourth stdenv that uses the new GCC. But coreutils is # Construct a fourth stdenv that uses the new GCC. But coreutils is
# still from the bootstrap tools. # still from the bootstrap tools.
(prevStage: stageFun prevStage { (prevStage: stageFun prevStage {
name = ""; name = "bootstrap-stage4";
overrides = self: super: { overrides = self: super: {
# Zlib has to be inherited and not rebuilt in this stage, # Zlib has to be inherited and not rebuilt in this stage,
@ -291,7 +292,6 @@ in
bintools = self.binutils; bintools = self.binutils;
libc = getLibc self; libc = getLibc self;
inherit (self) stdenvNoCC coreutils gnugrep; inherit (self) stdenvNoCC coreutils gnugrep;
name = "";
shell = self.bash + "/bin/bash"; shell = self.bash + "/bin/bash";
}; };
}; };
@ -310,6 +310,8 @@ in
(prevStage: { (prevStage: {
inherit config overlays; inherit config overlays;
stdenv = import ../generic rec { stdenv = import ../generic rec {
name = "stdenv-linux";
buildPlatform = localSystem; buildPlatform = localSystem;
hostPlatform = localSystem; hostPlatform = localSystem;
targetPlatform = localSystem; targetPlatform = localSystem;