cc-wrapper: allow building without documentation, propagate info pages

This commit is contained in:
Jan Malakhovski 2018-02-01 00:00:00 +00:00
parent 0ab1067d12
commit f1074211ce

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;