Revert "Merge pull request #28557 from obsidiansystems/binutils-wrapper"
This reverts commit0a944b345e, reversing changes made to61733ed6cc. I dislike these massive stdenv changes with unclear motivation, especially when they involve gratuitous mass renames like NIX_CC -> NIX_BINUTILS. The previous such rename (NIX_GCC -> NIX_CC) caused months of pain, so let's not do that again.
This commit is contained in:
@@ -4,14 +4,19 @@
|
||||
# that case, it is cheaper/better to not repeat this step and let the forked
|
||||
# wrapped binary just inherit the work of the forker's wrapper script.
|
||||
|
||||
var_templates_list=(
|
||||
var_templates=(
|
||||
NIX+CFLAGS_COMPILE
|
||||
NIX+CFLAGS_LINK
|
||||
NIX+CXXSTDLIB_COMPILE
|
||||
NIX+CXXSTDLIB_LINK
|
||||
NIX+GNATFLAGS_COMPILE
|
||||
)
|
||||
var_templates_bool=(
|
||||
NIX+IGNORE_LD_THROUGH_GCC
|
||||
NIX+LDFLAGS
|
||||
NIX+LDFLAGS_BEFORE
|
||||
NIX+LDFLAGS_AFTER
|
||||
|
||||
NIX+SET_BUILD_ID
|
||||
NIX+DONT_SET_RPATH
|
||||
NIX+ENFORCE_NO_NATIVE
|
||||
)
|
||||
|
||||
@@ -30,11 +35,17 @@ fi
|
||||
|
||||
# We need to mangle names for hygiene, but also take parameters/overrides
|
||||
# from the environment.
|
||||
for var in "${var_templates_list[@]}"; do
|
||||
mangleVarList "$var" "${role_infixes[@]}"
|
||||
done
|
||||
for var in "${var_templates_bool[@]}"; do
|
||||
mangleVarBool "$var" "${role_infixes[@]}"
|
||||
for var in "${var_templates[@]}"; do
|
||||
outputVar="${var/+/_@infixSalt@_}"
|
||||
export ${outputVar}+=''
|
||||
# For each role we serve, we accumulate the input parameters into our own
|
||||
# cc-wrapper-derivation-specific environment variables.
|
||||
for infix in "${role_infixes[@]}"; do
|
||||
inputVar="${var/+/${infix}}"
|
||||
if [ -v "$inputVar" ]; then
|
||||
export ${outputVar}+="${!outputVar:+ }${!inputVar}"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# `-B@out@/bin' forces cc to use ld-wrapper.sh when calling ld.
|
||||
@@ -55,13 +66,17 @@ if [ -e @out@/nix-support/gnat-cflags ]; then
|
||||
NIX_@infixSalt@_GNATFLAGS_COMPILE="$(< @out@/nix-support/gnat-cflags) $NIX_@infixSalt@_GNATFLAGS_COMPILE"
|
||||
fi
|
||||
|
||||
if [ -e @out@/nix-support/libc-ldflags ]; then
|
||||
NIX_@infixSalt@_LDFLAGS+=" $(< @out@/nix-support/libc-ldflags)"
|
||||
fi
|
||||
|
||||
if [ -e @out@/nix-support/cc-ldflags ]; then
|
||||
# We don't import this above, but just tack this on know. binutils-wrapper's
|
||||
# add-flags will not clobber it.
|
||||
#
|
||||
# TODO(@Ericson2314): Consider `NIX_@infixSalt@_CFLAGS_LINK` instead
|
||||
NIX_@infixSalt@_LDFLAGS+=" $(< @out@/nix-support/cc-ldflags)"
|
||||
fi
|
||||
|
||||
if [ -e @out@/nix-support/libc-ldflags-before ]; then
|
||||
NIX_@infixSalt@_LDFLAGS_BEFORE="$(< @out@/nix-support/libc-ldflags-before) $NIX_@infixSalt@_LDFLAGS_BEFORE"
|
||||
fi
|
||||
|
||||
# That way forked processes will not extend these environment variables again.
|
||||
export NIX_CC_WRAPPER_@infixSalt@_FLAGS_SET=1
|
||||
|
||||
Reference in New Issue
Block a user