Set CFLAGS/LDFLAGS/etc according to Debian policy

Debian wants to build all binaries with particular hardening flags.
The Rust makefiles are inconsistent in which architectures they
correctly include CFLAGS/etc from the enivoronment (see mk/cfg/*).

This patch adds LDFLAGS, and then unconditionally prepends
CFLAGS/LDFLAGS/etc to the build commands.
This commit is contained in:
Angus Lees 2015-11-20 12:48:19 -02:00 committed by Bruno Tavares
parent 6861c51453
commit 07b7f2fbc9
2 changed files with 9 additions and 4 deletions

9
configure vendored
View File

@ -1053,12 +1053,13 @@ fi
# point in the script; after this point, script logic should inspect
# $CFG_USING_CLANG rather than $CFG_ENABLE_CLANG.
# Set CFG_{CC,CXX,CPP,CFLAGS,CXXFLAGS}
# Set CFG_{CC,CXX,CPP,CFLAGS,CXXFLAGS,LDFLAGS}
envopt CC
envopt CXX
envopt CPP
envopt CFLAGS
envopt CXXFLAGS
envopt LDFLAGS
# stdc++ name in use
# used to manage non-standard name (on OpenBSD for example)
@ -1667,9 +1668,9 @@ do
CXX=$LLVM_CXX
CC=$LLVM_CC
CFLAGS=$LLVM_CFLAGS
CXXFLAGS=$LLVM_CXXFLAGS
LDFLAGS=$LLVM_LDFLAGS
CFLAGS="$CFLAGS $LLVM_CFLAGS"
CXXFLAGS="$CXXFLAGS $LLVM_CXXFLAGS"
LDFLAGS="$LDFLAGS $LLVM_LDFLAGS"
if [ -z "$CFG_DISABLE_LIBCPP" ] && [ -n "$CFG_USING_CLANG" ]; then
LLVM_OPTS="$LLVM_OPTS --enable-libcpp"

View File

@ -189,21 +189,25 @@ define CFG_MAKE_TOOLCHAIN
endif
CFG_COMPILE_C_$(1) = $$(CC_$(1)) \
$$(CFLAGS) \
$$(CFG_GCCISH_CFLAGS) \
$$(CFG_GCCISH_CFLAGS_$(1)) \
-c $$(call CFG_CC_OUTPUT_$(1),$$(1)) $$(2)
CFG_LINK_C_$(1) = $$(CC_$(1)) \
$$(LDFLAGS) \
$$(CFG_GCCISH_LINK_FLAGS) -o $$(1) \
$$(CFG_GCCISH_LINK_FLAGS_$(1)) \
$$(CFG_GCCISH_DEF_FLAG_$(1))$$(3) $$(2) \
$$(call CFG_INSTALL_NAME_$(1),$$(4))
CFG_COMPILE_CXX_$(1) = $$(CXX_$(1)) \
$$(CXXFLAGS) \
$$(CFG_GCCISH_CFLAGS) \
$$(CFG_GCCISH_CXXFLAGS) \
$$(CFG_GCCISH_CFLAGS_$(1)) \
$$(CFG_GCCISH_CXXFLAGS_$(1)) \
-c $$(call CFG_CC_OUTPUT_$(1),$$(1)) $$(2)
CFG_LINK_CXX_$(1) = $$(CXX_$(1)) \
$$(LDFLAGS) \
$$(CFG_GCCISH_LINK_FLAGS) -o $$(1) \
$$(CFG_GCCISH_LINK_FLAGS_$(1)) \
$$(CFG_GCCISH_DEF_FLAG_$(1))$$(3) $$(2) \