Skip to content

functions.sh.in: Export original CC, CXX, CPPFLAGS, CXXFLAGS, CFLAGS, LDFLAGS

Thermi requested to merge Thermi/abuild:build-variables into master

in BUILDCC, BUILDCXX, BUILDLD, BUILDCPPFLAGS, BUILDCXXFLAGS, BUILDCFLAGS, BUILDLDFLAGS Default CC to gcc, CXX to g++, LD to ld

This contains code that ensures that any variables exported by functions.sh are not by default empty. This can cause issues in Makefiles that only check if a variable is defined, but not if it is empty. The code ensures the variables are not empty by moving the defaulting to gcc, g+, and ld to the declaration of the local variables that are later used to export CC, CXX, LD, and their derived variables.

The BUILD* variables are exported with values of their associated non-BUILD* variables before any cross compilation changes are applied (like converting CC from gcc to ${CROSS_COMPILE}-$CC). This is done to enable users to use these variables in Makefiles of software that is cross compiled and run locally at build time to specify flags from abuild.conf and other variables. Otherwise, these variables would end up containing --sysroot=$CBUILDROOT, which points at an environment with files for the wrong architecture (and in the wrong format).

BUILDCC
BUILDCXX
BUILDLD
BUILDCPPFLAGS
BUILDCXXFLAGS
BUILDCFLAGS
BUILDLDFLAGS

Please consider that cross compiling is much faster than using qemu-user. I will later add a commit that adds a check that users know that cross compiling is not the best choice for building their packages from source for a foreign architecture.

Edited by Thermi

Merge request reports