{cc,bintools}-wrapper: Comments no longer spliced
This means we can freely keep the comments up to date without the penalty of a mass rebuild.
This commit is contained in:
@@ -132,15 +132,15 @@ stdenv.mkDerivation {
|
|||||||
ldPath="${bintools_bin}/bin"
|
ldPath="${bintools_bin}/bin"
|
||||||
''
|
''
|
||||||
|
|
||||||
|
# Solaris needs an additional ld wrapper.
|
||||||
+ optionalString (targetPlatform.isSunOS && nativePrefix != "") ''
|
+ optionalString (targetPlatform.isSunOS && nativePrefix != "") ''
|
||||||
# Solaris needs an additional ld wrapper.
|
|
||||||
ldPath="${nativePrefix}/bin"
|
ldPath="${nativePrefix}/bin"
|
||||||
exec="$ldPath/${targetPrefix}ld"
|
exec="$ldPath/${targetPrefix}ld"
|
||||||
wrap ld-solaris ${./ld-solaris-wrapper.sh}
|
wrap ld-solaris ${./ld-solaris-wrapper.sh}
|
||||||
'')
|
'')
|
||||||
|
|
||||||
|
# Create a symlink to as (the assembler).
|
||||||
+ ''
|
+ ''
|
||||||
# Create a symlink to as (the assembler).
|
|
||||||
if [ -e $ldPath/${targetPrefix}as ]; then
|
if [ -e $ldPath/${targetPrefix}as ]; then
|
||||||
ln -s $ldPath/${targetPrefix}as $out/bin/${targetPrefix}as
|
ln -s $ldPath/${targetPrefix}as $out/bin/${targetPrefix}as
|
||||||
fi
|
fi
|
||||||
@@ -200,26 +200,28 @@ stdenv.mkDerivation {
|
|||||||
];
|
];
|
||||||
|
|
||||||
postFixup =
|
postFixup =
|
||||||
|
##
|
||||||
|
## General libc support
|
||||||
|
##
|
||||||
optionalString (libc != null) (''
|
optionalString (libc != null) (''
|
||||||
##
|
|
||||||
## General libc support
|
|
||||||
##
|
|
||||||
|
|
||||||
echo "-L${libc_lib}${libc.libdir or "/lib"}" > $out/nix-support/libc-ldflags
|
echo "-L${libc_lib}${libc.libdir or "/lib"}" > $out/nix-support/libc-ldflags
|
||||||
|
|
||||||
echo "${libc_lib}" > $out/nix-support/orig-libc
|
echo "${libc_lib}" > $out/nix-support/orig-libc
|
||||||
echo "${libc_dev}" > $out/nix-support/orig-libc-dev
|
echo "${libc_dev}" > $out/nix-support/orig-libc-dev
|
||||||
|
''
|
||||||
|
|
||||||
##
|
##
|
||||||
## Dynamic linker support
|
## Dynamic linker support
|
||||||
##
|
##
|
||||||
|
+ ''
|
||||||
if [[ -z ''${dynamicLinker+x} ]]; then
|
if [[ -z ''${dynamicLinker+x} ]]; then
|
||||||
echo "Don't know the name of the dynamic linker for platform '${targetPlatform.config}', so guessing instead." >&2
|
echo "Don't know the name of the dynamic linker for platform '${targetPlatform.config}', so guessing instead." >&2
|
||||||
local dynamicLinker="${libc_lib}/lib/ld*.so.?"
|
local dynamicLinker="${libc_lib}/lib/ld*.so.?"
|
||||||
fi
|
fi
|
||||||
|
''
|
||||||
|
|
||||||
# Expand globs to fill array of options
|
# Expand globs to fill array of options
|
||||||
|
+ ''
|
||||||
dynamicLinker=($dynamicLinker)
|
dynamicLinker=($dynamicLinker)
|
||||||
|
|
||||||
case ''${#dynamicLinker[@]} in
|
case ''${#dynamicLinker[@]} in
|
||||||
@@ -241,45 +243,45 @@ stdenv.mkDerivation {
|
|||||||
local ldflagsBefore=(-dynamic-linker "$dynamicLinker")
|
local ldflagsBefore=(-dynamic-linker "$dynamicLinker")
|
||||||
'') + ''
|
'') + ''
|
||||||
fi
|
fi
|
||||||
|
''
|
||||||
# The dynamic linker is passed in `ldflagsBefore' to allow
|
# The dynamic linker is passed in `ldflagsBefore' to allow
|
||||||
# explicit overrides of the dynamic linker by callers to ld
|
# explicit overrides of the dynamic linker by callers to ld
|
||||||
# (the *last* value counts, so ours should come first).
|
# (the *last* value counts, so ours should come first).
|
||||||
|
+ ''
|
||||||
printWords "''${ldflagsBefore[@]}" > $out/nix-support/libc-ldflags-before
|
printWords "''${ldflagsBefore[@]}" > $out/nix-support/libc-ldflags-before
|
||||||
'')
|
'')
|
||||||
|
|
||||||
|
# Ensure consistent LC_VERSION_MIN_MACOSX and remove LC_UUID.
|
||||||
+ optionalString stdenv.targetPlatform.isMacOS ''
|
+ optionalString stdenv.targetPlatform.isMacOS ''
|
||||||
# Ensure consistent LC_VERSION_MIN_MACOSX and remove LC_UUID.
|
|
||||||
echo "-macosx_version_min 10.12 -sdk_version 10.12 -no_uuid" >> $out/nix-support/libc-ldflags-before
|
echo "-macosx_version_min 10.12 -sdk_version 10.12 -no_uuid" >> $out/nix-support/libc-ldflags-before
|
||||||
''
|
''
|
||||||
|
|
||||||
+ 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 (same for any
|
# install the wrapper, you get tools like objdump (same for any
|
||||||
# binaries of libc).
|
# binaries of libc).
|
||||||
|
+ optionalString (!nativeTools) ''
|
||||||
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
|
||||||
''
|
''
|
||||||
|
|
||||||
|
##
|
||||||
|
## Man page and info support
|
||||||
|
##
|
||||||
+ optionalString propagateDoc (''
|
+ optionalString propagateDoc (''
|
||||||
##
|
|
||||||
## Man page and info support
|
|
||||||
##
|
|
||||||
|
|
||||||
ln -s ${bintools.man} $man
|
ln -s ${bintools.man} $man
|
||||||
'' + optionalString (bintools ? info) ''
|
'' + optionalString (bintools ? info) ''
|
||||||
ln -s ${bintools.info} $info
|
ln -s ${bintools.info} $info
|
||||||
'')
|
'')
|
||||||
|
|
||||||
+ ''
|
##
|
||||||
##
|
## Hardening support
|
||||||
## Hardening support
|
##
|
||||||
##
|
|
||||||
|
|
||||||
# some linkers on some platforms don't support specific -z flags
|
# some linkers on some platforms don't support specific -z flags
|
||||||
|
+ ''
|
||||||
export hardening_unsupported_flags=""
|
export hardening_unsupported_flags=""
|
||||||
if [[ "$($ldPath/${targetPrefix}ld -z now 2>&1 || true)" =~ un(recognized|known)\ option ]]; then
|
if [[ "$($ldPath/${targetPrefix}ld -z now 2>&1 || true)" =~ un(recognized|known)\ option ]]; then
|
||||||
hardening_unsupported_flags+=" bindnow"
|
hardening_unsupported_flags+=" bindnow"
|
||||||
@@ -307,12 +309,11 @@ stdenv.mkDerivation {
|
|||||||
substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh
|
substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh
|
||||||
substituteAll ${./add-hardening.sh} $out/nix-support/add-hardening.sh
|
substituteAll ${./add-hardening.sh} $out/nix-support/add-hardening.sh
|
||||||
substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash
|
substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash
|
||||||
|
|
||||||
##
|
|
||||||
## Extra custom steps
|
|
||||||
##
|
|
||||||
''
|
''
|
||||||
|
|
||||||
|
##
|
||||||
|
## Extra custom steps
|
||||||
|
##
|
||||||
+ extraBuildCommands;
|
+ extraBuildCommands;
|
||||||
|
|
||||||
inherit dynamicLinker expand-response-params;
|
inherit dynamicLinker expand-response-params;
|
||||||
|
|||||||
@@ -154,16 +154,18 @@ stdenv.mkDerivation {
|
|||||||
ccPath="${cc}/bin"
|
ccPath="${cc}/bin"
|
||||||
'')
|
'')
|
||||||
|
|
||||||
|
# Create symlinks to everything in the bintools wrapper.
|
||||||
+ ''
|
+ ''
|
||||||
# Create symlinks to everything in the bintools wrapper.
|
|
||||||
for bbin in $bintools/bin/*; do
|
for bbin in $bintools/bin/*; do
|
||||||
mkdir -p "$out/bin"
|
mkdir -p "$out/bin"
|
||||||
ln -s "$bbin" "$out/bin/$(basename $bbin)"
|
ln -s "$bbin" "$out/bin/$(basename $bbin)"
|
||||||
done
|
done
|
||||||
|
''
|
||||||
|
|
||||||
# We export environment variables pointing to the wrapped nonstandard
|
# We export environment variables pointing to the wrapped nonstandard
|
||||||
# cmds, lest some lousy configure script use those to guess compiler
|
# cmds, lest some lousy configure script use those to guess compiler
|
||||||
# version.
|
# version.
|
||||||
|
+ ''
|
||||||
export named_cc=${targetPrefix}cc
|
export named_cc=${targetPrefix}cc
|
||||||
export named_cxx=${targetPrefix}c++
|
export named_cxx=${targetPrefix}c++
|
||||||
|
|
||||||
@@ -228,12 +230,12 @@ stdenv.mkDerivation {
|
|||||||
];
|
];
|
||||||
|
|
||||||
postFixup =
|
postFixup =
|
||||||
|
# Backwards compatability for packages expecting this file, e.g. with
|
||||||
|
# `$NIX_CC/nix-support/dynamic-linker`.
|
||||||
|
#
|
||||||
|
# TODO(@Ericson2314): Remove this after stable release and force
|
||||||
|
# everyone to refer to bintools-wrapper directly.
|
||||||
''
|
''
|
||||||
# Backwards compatability for packages expecting this file, e.g. with
|
|
||||||
# `$NIX_CC/nix-support/dynamic-linker`.
|
|
||||||
#
|
|
||||||
# TODO(@Ericson2314): Remove this after stable release and force
|
|
||||||
# everyone to refer to bintools-wrapper directly.
|
|
||||||
if [[ -f "$bintools/nix-support/dynamic-linker" ]]; then
|
if [[ -f "$bintools/nix-support/dynamic-linker" ]]; then
|
||||||
ln -s "$bintools/nix-support/dynamic-linker" "$out/nix-support"
|
ln -s "$bintools/nix-support/dynamic-linker" "$out/nix-support"
|
||||||
fi
|
fi
|
||||||
@@ -242,40 +244,40 @@ stdenv.mkDerivation {
|
|||||||
fi
|
fi
|
||||||
''
|
''
|
||||||
|
|
||||||
|
##
|
||||||
|
## General Clang support
|
||||||
|
##
|
||||||
+ optionalString isClang ''
|
+ optionalString isClang ''
|
||||||
##
|
|
||||||
## General Clang support
|
|
||||||
##
|
|
||||||
|
|
||||||
echo "-target ${targetPlatform.config}" >> $out/nix-support/cc-cflags
|
echo "-target ${targetPlatform.config}" >> $out/nix-support/cc-cflags
|
||||||
''
|
''
|
||||||
|
|
||||||
|
##
|
||||||
|
## GCC libs for non-GCC support
|
||||||
|
##
|
||||||
+ optionalString (isClang && libcxx == null && cc ? gcc) ''
|
+ optionalString (isClang && libcxx == null && cc ? gcc) ''
|
||||||
##
|
|
||||||
## GCC libs for non-GCC support
|
|
||||||
##
|
|
||||||
|
|
||||||
echo "-B${cc.gcc}/lib/gcc/${targetPlatform.config}/${cc.gcc.version}" >> $out/nix-support/cc-cflags
|
echo "-B${cc.gcc}/lib/gcc/${targetPlatform.config}/${cc.gcc.version}" >> $out/nix-support/cc-cflags
|
||||||
echo "-L${cc.gcc}/lib/gcc/${targetPlatform.config}/${cc.gcc.version}" >> $out/nix-support/cc-ldflags
|
echo "-L${cc.gcc}/lib/gcc/${targetPlatform.config}/${cc.gcc.version}" >> $out/nix-support/cc-ldflags
|
||||||
echo "-L${cc.gcc.lib}/${targetPlatform.config}/lib" >> $out/nix-support/cc-ldflags
|
echo "-L${cc.gcc.lib}/${targetPlatform.config}/lib" >> $out/nix-support/cc-ldflags
|
||||||
''
|
''
|
||||||
|
|
||||||
+ optionalString (libc != null) (''
|
##
|
||||||
##
|
## General libc support
|
||||||
## General libc support
|
##
|
||||||
##
|
|
||||||
|
|
||||||
# The "-B${libc_lib}/lib/" flag is a quick hack to force gcc to link
|
# The "-B${libc_lib}/lib/" flag is a quick hack to force gcc to link
|
||||||
# against the crt1.o from our own glibc, rather than the one in
|
# against the crt1.o from our own glibc, rather than the one in
|
||||||
# /usr/lib. (This is only an issue when using an `impure'
|
# /usr/lib. (This is only an issue when using an `impure'
|
||||||
# compiler/linker, i.e., one that searches /usr/lib and so on.)
|
# compiler/linker, i.e., one that searches /usr/lib and so on.)
|
||||||
#
|
#
|
||||||
# Unfortunately, setting -B appears to override the default search
|
# Unfortunately, setting -B appears to override the default search
|
||||||
# path. Thus, the gcc-specific "../includes-fixed" directory is
|
# path. Thus, the gcc-specific "../includes-fixed" directory is
|
||||||
# now longer searched and glibc's <limits.h> header fails to
|
# now longer searched and glibc's <limits.h> header fails to
|
||||||
# compile, because it uses "#include_next <limits.h>" to find the
|
# compile, because it uses "#include_next <limits.h>" to find the
|
||||||
# limits.h file in ../includes-fixed. To remedy the problem,
|
# limits.h file in ../includes-fixed. To remedy the problem,
|
||||||
# another -idirafter is necessary to add that directory again.
|
# another -idirafter is necessary to add that directory again.
|
||||||
|
+ optionalString (libc != null) (''
|
||||||
echo "-B${libc_lib}${libc.libdir or "/lib/"}" >> $out/nix-support/libc-cflags
|
echo "-B${libc_lib}${libc.libdir or "/lib/"}" >> $out/nix-support/libc-cflags
|
||||||
'' + optionalString (!(cc.langD or false)) ''
|
'' + optionalString (!(cc.langD or false)) ''
|
||||||
echo "-idirafter ${libc_dev}${libc.incdir or "/include"}" >> $out/nix-support/libc-cflags
|
echo "-idirafter ${libc_dev}${libc.incdir or "/include"}" >> $out/nix-support/libc-cflags
|
||||||
@@ -289,12 +291,9 @@ stdenv.mkDerivation {
|
|||||||
echo "${libc_dev}" > $out/nix-support/orig-libc-dev
|
echo "${libc_dev}" > $out/nix-support/orig-libc-dev
|
||||||
'')
|
'')
|
||||||
|
|
||||||
+ ''
|
##
|
||||||
##
|
## General libc++ support
|
||||||
## General libc++ support
|
##
|
||||||
##
|
|
||||||
|
|
||||||
''
|
|
||||||
+ optionalString (libcxx == null && cc ? gcc) ''
|
+ optionalString (libcxx == null && cc ? gcc) ''
|
||||||
for dir in ${cc.gcc}/include/c++/*; do
|
for dir in ${cc.gcc}/include/c++/*; do
|
||||||
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
|
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
|
||||||
@@ -310,15 +309,15 @@ stdenv.mkDerivation {
|
|||||||
echo "-lc++abi" >> $out/nix-support/libcxx-ldflags
|
echo "-lc++abi" >> $out/nix-support/libcxx-ldflags
|
||||||
'')
|
'')
|
||||||
|
|
||||||
+ optionalString (!nativeTools) ''
|
##
|
||||||
##
|
## Initial CFLAGS
|
||||||
## Initial CFLAGS
|
##
|
||||||
##
|
|
||||||
|
|
||||||
# GCC shows ${cc_solib}/lib in `gcc -print-search-dirs', but not
|
# GCC shows ${cc_solib}/lib in `gcc -print-search-dirs', but not
|
||||||
# ${cc_solib}/lib64 (even though it does actually search there...)..
|
# ${cc_solib}/lib64 (even though it does actually search there...)..
|
||||||
# This confuses libtool. So add it to the compiler tool search
|
# This confuses libtool. So add it to the compiler tool search
|
||||||
# path explicitly.
|
# path explicitly.
|
||||||
|
+ optionalString (!nativeTools) ''
|
||||||
if [ -e "${cc_solib}/lib64" -a ! -L "${cc_solib}/lib64" ]; then
|
if [ -e "${cc_solib}/lib64" -a ! -L "${cc_solib}/lib64" ]; then
|
||||||
ccLDFlags+=" -L${cc_solib}/lib64"
|
ccLDFlags+=" -L${cc_solib}/lib64"
|
||||||
ccCFlags+=" -B${cc_solib}/lib64"
|
ccCFlags+=" -B${cc_solib}/lib64"
|
||||||
@@ -337,22 +336,22 @@ stdenv.mkDerivation {
|
|||||||
echo "$ccCFlags" > $out/nix-support/cc-cflags
|
echo "$ccCFlags" > $out/nix-support/cc-cflags
|
||||||
'' + optionalString (targetPlatform.isDarwin && (libcxx != null) && (cc.isClang or false)) ''
|
'' + optionalString (targetPlatform.isDarwin && (libcxx != null) && (cc.isClang or false)) ''
|
||||||
echo " -L${libcxx}/lib" >> $out/nix-support/cc-ldflags
|
echo " -L${libcxx}/lib" >> $out/nix-support/cc-ldflags
|
||||||
'' + optionalString propagateDoc ''
|
''
|
||||||
##
|
|
||||||
## Man page and info support
|
|
||||||
##
|
|
||||||
|
|
||||||
|
##
|
||||||
|
## Man page and info support
|
||||||
|
##
|
||||||
|
+ optionalString propagateDoc ''
|
||||||
ln -s ${cc.man} $man
|
ln -s ${cc.man} $man
|
||||||
ln -s ${cc.info} $info
|
ln -s ${cc.info} $info
|
||||||
'' + optionalString (cc.langD or false) ''
|
'' + optionalString (cc.langD or false) ''
|
||||||
echo "-B${zlib}${zlib.libdir or "/lib/"}" >> $out/nix-support/libc-cflags
|
echo "-B${zlib}${zlib.libdir or "/lib/"}" >> $out/nix-support/libc-cflags
|
||||||
''
|
''
|
||||||
|
|
||||||
|
##
|
||||||
|
## Hardening support
|
||||||
|
##
|
||||||
+ ''
|
+ ''
|
||||||
##
|
|
||||||
## Hardening support
|
|
||||||
##
|
|
||||||
|
|
||||||
export hardening_unsupported_flags="${builtins.concatStringsSep " " (cc.hardeningUnsupportedFlags or [])}"
|
export hardening_unsupported_flags="${builtins.concatStringsSep " " (cc.hardeningUnsupportedFlags or [])}"
|
||||||
''
|
''
|
||||||
|
|
||||||
@@ -427,12 +426,11 @@ stdenv.mkDerivation {
|
|||||||
substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh
|
substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh
|
||||||
substituteAll ${./add-hardening.sh} $out/nix-support/add-hardening.sh
|
substituteAll ${./add-hardening.sh} $out/nix-support/add-hardening.sh
|
||||||
substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash
|
substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash
|
||||||
|
|
||||||
##
|
|
||||||
## Extra custom steps
|
|
||||||
##
|
|
||||||
''
|
''
|
||||||
|
|
||||||
|
##
|
||||||
|
## Extra custom steps
|
||||||
|
##
|
||||||
+ extraBuildCommands;
|
+ extraBuildCommands;
|
||||||
|
|
||||||
inherit expand-response-params;
|
inherit expand-response-params;
|
||||||
|
|||||||
Reference in New Issue
Block a user