# HG changeset patch # User Patric Stout # Date 2018-04-14 18:11:49 # Node ID f5b7f87b98f279d27550c87f98b826b2778d2f33 # Parent deed187ee38f8baae34c4ba2b985bdf840a1e5f7 Change: [Build] use flags set by env at the end, not at the start (based on patch by adf88) (#6715) This closes #6433 diff --git a/config.lib b/config.lib --- a/config.lib +++ b/config.lib @@ -1481,21 +1481,27 @@ make_compiler_cflags() { make_cflags_and_ldflags() { # General CFlags for BUILD - CFLAGS_BUILD="$CFLAGS_BUILD" + CFLAGS_BUILD_ENV="$CFLAGS_BUILD" + CFLAGS_BUILD="" # Special CXXFlags for BUILD - CXXFLAGS_BUILD="$CXXFLAGS_BUILD" + CXXFLAGS_BUILD_ENV="$CXXFLAGS_BUILD" + CXXFLAGS_BUILD="" # LDFLAGS for BUILD - LDFLAGS_BUILD="$LDFLAGS_BUILD" + LDFLAGS_BUILD_ENV="$LDFLAGS_BUILD" + LDFLAGS_BUILD="" # FEATURES for BUILD (lto) FEATURES_BUILD="" # General CFlags for HOST - CFLAGS="$CFLAGS" + CFLAGS_ENV="$CFLAGS" + CFLAGS="" # Special CXXFlags for HOST - CXXFLAGS="$CXXFLAGS" + CXXFLAGS_ENV="$CXXFLAGS" + CXXFLAGS="" # Libs to compile. In fact this is just LDFLAGS LIBS="-lstdc++" # LDFLAGS used for HOST - LDFLAGS="$LDFLAGS" + LDFLAGS_ENV="$LDFLAGS" + LDFLAGS="" # FEATURES for HOST (lto) FEATURES="" @@ -1913,6 +1919,14 @@ make_cflags_and_ldflags() { fi fi + # All flags to be extended via the env + CFLAGS_BUILD="$CFLAGS_BUILD $CFLAGS_BUILD_ENV" + CXXFLAGS_BUILD="$CXXFLAGS_BUILD $CXXFLAGS_BUILD_ENV" + LDFLAGS_BUILD="$LDFLAGS_BUILD $LDFLAGS_BUILD_ENV" + CFLAGS="$CFLAGS $CFLAGS_ENV" + CXXFLAGS="$CXXFLAGS $CXXFLAGS_ENV" + LDFLAGS="$LDFLAGS $LDFLAGS_ENV" + log 1 "using CFLAGS_BUILD... $CFLAGS_BUILD" log 1 "using CXXFLAGS_BUILD... $CXXFLAGS_BUILD" log 1 "using LDFLAGS_BUILD... $LDFLAGS_BUILD"