common/xbps-src/shutils/common.sh: add cross env
It seems that some (many?) projects rely on the environment defining compilers, tools and flags by specific XYZ_host and XYZ_target variables. When cross compiling, define these environment variables. This enables e.g. qt5/qtwebengine build to succeed. Specificially ninja relies on these variables when cross compiling.
This commit is contained in:
parent
f44f8f4cb1
commit
cb5e8ef57a
1 changed files with 43 additions and 4 deletions
|
@ -381,20 +381,21 @@ setup_pkg() {
|
|||
|
||||
export BUILD_CC="cc"
|
||||
export BUILD_CFLAGS="$XBPS_CFLAGS"
|
||||
export BUILD_CXXFLAGS="$XBPS_CXXFLAGS"
|
||||
export BUILD_CPPFLAGS="$XBPS_CPPFLAGS"
|
||||
export BUILD_LDFLAGS="$XBPS_LDFLAGS"
|
||||
|
||||
export CC_FOR_BUILD="cc"
|
||||
export CXX_FOR_BUILD="g++"
|
||||
export CPP_FOR_BUILD="cpp"
|
||||
export LD_FOR_BUILD="ld"
|
||||
export CFLAGS_FOR_BUILD="$XBPS_CFLAGS"
|
||||
export BUILD_CFLAGS="$XBPS_CFLAGS"
|
||||
export CXXFLAGS_FOR_BUILD="$XBPS_CXXFLAGS"
|
||||
export BUILD_CXXFLAGS="$XBPS_CXXFLAGS"
|
||||
export CPPFLAGS_FOR_BUILD="$XBPS_CPPFLAGS"
|
||||
export BUILD_CPPFLAGS="$XBPS_CPPFLAGS"
|
||||
export LDFLAGS_FOR_BUILD="$XBPS_LDFLAGS"
|
||||
export BUILD_LDFLAGS="$XBPS_LDFLAGS"
|
||||
|
||||
if [ -n "$cross" ]; then
|
||||
# Regular tools names
|
||||
export CC="${XBPS_CROSS_TRIPLET}-gcc"
|
||||
export CXX="${XBPS_CROSS_TRIPLET}-c++"
|
||||
export CPP="${XBPS_CROSS_TRIPLET}-cpp"
|
||||
|
@ -408,6 +409,44 @@ setup_pkg() {
|
|||
export OBJCOPY="${XBPS_CROSS_TRIPLET}-objcopy"
|
||||
export NM="${XBPS_CROSS_TRIPLET}-nm"
|
||||
export READELF="${XBPS_CROSS_TRIPLET}-readelf"
|
||||
# Target tools
|
||||
export CC_target="$CC"
|
||||
export CXX_target="$CXX"
|
||||
export CPP_target="$CPP"
|
||||
export GCC_target="$GCC"
|
||||
export LD_target="$LD"
|
||||
export AR_target="$AR"
|
||||
export AS_target="$AS"
|
||||
export RANLIB_target="$RANLIB"
|
||||
export STRIP_target="$STRIP"
|
||||
export OBJDUMP_target="$OBJDUMP"
|
||||
export OBJCOPY_target="$OBJCOPY"
|
||||
export NM_target="$NM"
|
||||
export READELF_target="$READELF"
|
||||
# Target flags
|
||||
export CFLAGS_target="$CFLAGS"
|
||||
export CXXFLAGS_target="$CXXFLAGS"
|
||||
export CPPFLAGS_target="$CPPFLAGS"
|
||||
export LDFLAGS_target="$LDFLAGS"
|
||||
# Host tools
|
||||
export CC_host="cc"
|
||||
export CXX_host="g++"
|
||||
export CPP_host="cpp"
|
||||
export GCC_host="$CC_host"
|
||||
export LD_host="ld"
|
||||
export AR_host="ar"
|
||||
export AS_host="as"
|
||||
export RANLIB_host="ranlib"
|
||||
export STRIP_host="strip"
|
||||
export OBJDUMP_host="objdump"
|
||||
export OBJCOPY_host="objcopy"
|
||||
export NM_host="nm"
|
||||
export READELF_host="readelf"
|
||||
# Host flags
|
||||
export CFLAGS_host="$XBPS_CFLAGS"
|
||||
export CXXFLAGS_host="$XBPS_CXXFLAGS"
|
||||
export CPPFLAGS_host="$XBPS_CPPFLAGS"
|
||||
export LDFLAGS_host="$XBPS_LDFLAGS"
|
||||
else
|
||||
export CC="cc"
|
||||
export CXX="g++"
|
||||
|
|
Loading…
Reference in a new issue