{bintools,cc}-wrapper: Ensure nix-support/*-flags files exist
This will unbreak firefox and a few other packages which try to grab some of the libcxx flags.
This commit is contained in:
parent
1085403acd
commit
704daf7a6e
|
@ -204,7 +204,8 @@ stdenv.mkDerivation {
|
|||
## General libc support
|
||||
##
|
||||
optionalString (libc != null) (''
|
||||
echo "-L${libc_lib}${libc.libdir or "/lib"}" > $out/nix-support/libc-ldflags
|
||||
touch "$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_dev}" > $out/nix-support/orig-libc-dev
|
||||
|
@ -230,25 +231,23 @@ stdenv.mkDerivation {
|
|||
*) echo "Multiple dynamic linkers found for platform '${targetPlatform.config}'." >&2;;
|
||||
esac
|
||||
|
||||
if [ -n "''${dynamicLinker:-}" ]; then
|
||||
if [ -n "''${dynamicLinker-}" ]; then
|
||||
echo $dynamicLinker > $out/nix-support/dynamic-linker
|
||||
|
||||
'' + (if targetPlatform.isDarwin then ''
|
||||
printf "export LD_DYLD_PATH=%q\n" "$dynamicLinker" >> $out/nix-support/setup-hook
|
||||
'' else ''
|
||||
'' else ''
|
||||
if [ -e ${libc_lib}/lib/32/ld-linux.so.2 ]; then
|
||||
echo ${libc_lib}/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32
|
||||
fi
|
||||
|
||||
local ldflagsBefore=(-dynamic-linker "$dynamicLinker")
|
||||
''
|
||||
# The dynamic linker is passed in `ldflagsBefore' to allow
|
||||
# explicit overrides of the dynamic linker by callers to ld
|
||||
# (the *last* value counts, so ours should come first).
|
||||
+ ''
|
||||
echo -dynamic-linker "$dynamicLinker" >> $out/nix-support/libc-ldflags-before
|
||||
'') + ''
|
||||
fi
|
||||
''
|
||||
# The dynamic linker is passed in `ldflagsBefore' to allow
|
||||
# explicit overrides of the dynamic linker by callers to ld
|
||||
# (the *last* value counts, so ours should come first).
|
||||
+ ''
|
||||
printWords "''${ldflagsBefore[@]}" > $out/nix-support/libc-ldflags-before
|
||||
'')
|
||||
|
||||
# Ensure consistent LC_VERSION_MIN_MACOSX and remove LC_UUID.
|
||||
|
@ -306,6 +305,10 @@ stdenv.mkDerivation {
|
|||
''
|
||||
|
||||
+ ''
|
||||
for flags in "$out/nix-support"/*flags*; do
|
||||
substituteInPlace "$flags" --replace $'\n' ' '
|
||||
done
|
||||
|
||||
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
|
||||
|
|
|
@ -230,12 +230,19 @@ stdenv.mkDerivation {
|
|||
];
|
||||
|
||||
postFixup =
|
||||
# Ensure flags files exists, as some other programs cat them. (That these
|
||||
# are considered an exposed interface is a bit dubious, but fine for now.)
|
||||
''
|
||||
touch "$out/nix-support/cc-cflags"
|
||||
touch "$out/nix-support/cc-ldflags"
|
||||
''
|
||||
|
||||
# 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
|
||||
|
@ -278,6 +285,8 @@ stdenv.mkDerivation {
|
|||
# limits.h file in ../includes-fixed. To remedy the problem,
|
||||
# another -idirafter is necessary to add that directory again.
|
||||
+ optionalString (libc != null) (''
|
||||
touch "$out/nix-support/libc-cflags"
|
||||
touch "$out/nix-support/libc-ldflags"
|
||||
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
|
||||
|
@ -294,7 +303,13 @@ stdenv.mkDerivation {
|
|||
##
|
||||
## General libc++ support
|
||||
##
|
||||
+ optionalString (libcxx == null && cc ? gcc) ''
|
||||
|
||||
# We have a libc++ directly, we have one via "smuggled" GCC, or we have one
|
||||
# bundled with the C compiler because it is GCC
|
||||
+ optionalString (libcxx != null || cc.gcc.langCC or false || (isGNU && cc.langCC or false)) ''
|
||||
touch "$out/nix-support/libcxx-cxxflags"
|
||||
touch "$out/nix-support/libcxx-ldflags"
|
||||
'' + optionalString (libcxx == null && cc ? gcc) ''
|
||||
for dir in ${cc.gcc}/include/c++/*; do
|
||||
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
|
||||
done
|
||||
|
@ -326,14 +341,16 @@ stdenv.mkDerivation {
|
|||
ccCFlags+=" -B${cc_solib}/lib"
|
||||
|
||||
'' + optionalString cc.langAda or false ''
|
||||
touch "$out/nix-support/gnat-cflags"
|
||||
touch "$out/nix-support/gnat-ldflags"
|
||||
basePath=$(echo $cc/lib/*/*/*)
|
||||
ccCFlags+=" -B$basePath -I$basePath/adainclude"
|
||||
gnatCFlags="-I$basePath/adainclude -I$basePath/adalib"
|
||||
|
||||
echo "$gnatCFlags" > $out/nix-support/gnat-cflags
|
||||
echo "$gnatCFlags" >> $out/nix-support/gnat-cflags
|
||||
'' + ''
|
||||
echo "$ccLDFlags" > $out/nix-support/cc-ldflags
|
||||
echo "$ccCFlags" > $out/nix-support/cc-cflags
|
||||
echo "$ccLDFlags" >> $out/nix-support/cc-ldflags
|
||||
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
|
||||
''
|
||||
|
@ -419,7 +436,7 @@ stdenv.mkDerivation {
|
|||
# There are a few tools (to name one libstdcxx5) which do not work
|
||||
# well with multi line flags, so make the flags single line again
|
||||
+ ''
|
||||
for flags in "$out/nix-support"/*flags; do
|
||||
for flags in "$out/nix-support"/*flags*; do
|
||||
substituteInPlace "$flags" --replace $'\n' ' '
|
||||
done
|
||||
|
||||
|
|
Loading…
Reference in a new issue