|
|
|
@ -154,16 +154,18 @@ stdenv.mkDerivation { |
|
|
|
|
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 |
|
|
|
|
mkdir -p "$out/bin" |
|
|
|
|
ln -s "$bbin" "$out/bin/$(basename $bbin)" |
|
|
|
|
done |
|
|
|
|
'' |
|
|
|
|
|
|
|
|
|
# We export environment variables pointing to the wrapped nonstandard |
|
|
|
|
# cmds, lest some lousy configure script use those to guess compiler |
|
|
|
|
# version. |
|
|
|
|
# We export environment variables pointing to the wrapped nonstandard |
|
|
|
|
# cmds, lest some lousy configure script use those to guess compiler |
|
|
|
|
# version. |
|
|
|
|
+ '' |
|
|
|
|
export named_cc=${targetPrefix}cc |
|
|
|
|
export named_cxx=${targetPrefix}c++ |
|
|
|
|
|
|
|
|
@ -228,12 +230,12 @@ stdenv.mkDerivation { |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
ln -s "$bintools/nix-support/dynamic-linker" "$out/nix-support" |
|
|
|
|
fi |
|
|
|
@ -242,40 +244,40 @@ stdenv.mkDerivation { |
|
|
|
|
fi |
|
|
|
|
'' |
|
|
|
|
|
|
|
|
|
## |
|
|
|
|
## General Clang support |
|
|
|
|
## |
|
|
|
|
+ optionalString isClang '' |
|
|
|
|
## |
|
|
|
|
## General Clang support |
|
|
|
|
## |
|
|
|
|
|
|
|
|
|
echo "-target ${targetPlatform.config}" >> $out/nix-support/cc-cflags |
|
|
|
|
'' |
|
|
|
|
|
|
|
|
|
## |
|
|
|
|
## GCC libs for non-GCC support |
|
|
|
|
## |
|
|
|
|
+ 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 "-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 |
|
|
|
|
'' |
|
|
|
|
|
|
|
|
|
## |
|
|
|
|
## General libc support |
|
|
|
|
## |
|
|
|
|
|
|
|
|
|
# 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 |
|
|
|
|
# /usr/lib. (This is only an issue when using an `impure' |
|
|
|
|
# compiler/linker, i.e., one that searches /usr/lib and so on.) |
|
|
|
|
# |
|
|
|
|
# Unfortunately, setting -B appears to override the default search |
|
|
|
|
# path. Thus, the gcc-specific "../includes-fixed" directory is |
|
|
|
|
# now longer searched and glibc's <limits.h> header fails to |
|
|
|
|
# compile, because it uses "#include_next <limits.h>" to find the |
|
|
|
|
# limits.h file in ../includes-fixed. To remedy the problem, |
|
|
|
|
# another -idirafter is necessary to add that directory again. |
|
|
|
|
+ optionalString (libc != null) ('' |
|
|
|
|
## |
|
|
|
|
## General libc support |
|
|
|
|
## |
|
|
|
|
|
|
|
|
|
# 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 |
|
|
|
|
# /usr/lib. (This is only an issue when using an `impure' |
|
|
|
|
# compiler/linker, i.e., one that searches /usr/lib and so on.) |
|
|
|
|
# |
|
|
|
|
# Unfortunately, setting -B appears to override the default search |
|
|
|
|
# path. Thus, the gcc-specific "../includes-fixed" directory is |
|
|
|
|
# now longer searched and glibc's <limits.h> header fails to |
|
|
|
|
# compile, because it uses "#include_next <limits.h>" to find the |
|
|
|
|
# limits.h file in ../includes-fixed. To remedy the problem, |
|
|
|
|
# another -idirafter is necessary to add that directory again. |
|
|
|
|
echo "-B${libc_lib}${libc.libdir or "/lib/"}" >> $out/nix-support/libc-cflags |
|
|
|
|
'' + optionalString (!(cc.langD or false)) '' |
|
|
|
|
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 |
|
|
|
|
'') |
|
|
|
|
|
|
|
|
|
+ '' |
|
|
|
|
## |
|
|
|
|
## General libc++ support |
|
|
|
|
## |
|
|
|
|
|
|
|
|
|
'' |
|
|
|
|
## |
|
|
|
|
## General libc++ support |
|
|
|
|
## |
|
|
|
|
+ optionalString (libcxx == null && cc ? gcc) '' |
|
|
|
|
for dir in ${cc.gcc}/include/c++/*; do |
|
|
|
|
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags |
|
|
|
@ -310,15 +309,15 @@ stdenv.mkDerivation { |
|
|
|
|
echo "-lc++abi" >> $out/nix-support/libcxx-ldflags |
|
|
|
|
'') |
|
|
|
|
|
|
|
|
|
## |
|
|
|
|
## Initial CFLAGS |
|
|
|
|
## |
|
|
|
|
|
|
|
|
|
# GCC shows ${cc_solib}/lib in `gcc -print-search-dirs', but not |
|
|
|
|
# ${cc_solib}/lib64 (even though it does actually search there...).. |
|
|
|
|
# This confuses libtool. So add it to the compiler tool search |
|
|
|
|
# path explicitly. |
|
|
|
|
+ optionalString (!nativeTools) '' |
|
|
|
|
## |
|
|
|
|
## Initial CFLAGS |
|
|
|
|
## |
|
|
|
|
|
|
|
|
|
# GCC shows ${cc_solib}/lib in `gcc -print-search-dirs', but not |
|
|
|
|
# ${cc_solib}/lib64 (even though it does actually search there...).. |
|
|
|
|
# This confuses libtool. So add it to the compiler tool search |
|
|
|
|
# path explicitly. |
|
|
|
|
if [ -e "${cc_solib}/lib64" -a ! -L "${cc_solib}/lib64" ]; then |
|
|
|
|
ccLDFlags+=" -L${cc_solib}/lib64" |
|
|
|
|
ccCFlags+=" -B${cc_solib}/lib64" |
|
|
|
@ -337,22 +336,22 @@ stdenv.mkDerivation { |
|
|
|
|
echo "$ccCFlags" > $out/nix-support/cc-cflags |
|
|
|
|
'' + optionalString (targetPlatform.isDarwin && (libcxx != null) && (cc.isClang or false)) '' |
|
|
|
|
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.info} $info |
|
|
|
|
'' + optionalString (cc.langD or false) '' |
|
|
|
|
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 [])}" |
|
|
|
|
'' |
|
|
|
|
|
|
|
|
@ -427,12 +426,11 @@ stdenv.mkDerivation { |
|
|
|
|
substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh |
|
|
|
|
substituteAll ${./add-hardening.sh} $out/nix-support/add-hardening.sh |
|
|
|
|
substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash |
|
|
|
|
|
|
|
|
|
## |
|
|
|
|
## Extra custom steps |
|
|
|
|
## |
|
|
|
|
'' |
|
|
|
|
|
|
|
|
|
## |
|
|
|
|
## Extra custom steps |
|
|
|
|
## |
|
|
|
|
+ extraBuildCommands; |
|
|
|
|
|
|
|
|
|
inherit expand-response-params; |
|
|
|
|