xbps-src: introduce build profiles and use it by default.

common/build-profiles contains the compilation flags used in native
builds, and are defined per architecture:

	- x86_64 (glibc)
	- x86_64-musl (musl)

If XBPS_CFLAGS or XBPS_CXXFLAGS are set in `etc/conf`, the settings
from the build profile will be overrided.
This commit is contained in:
Juan RP 2014-11-10 11:15:53 +01:00
parent aa4d7feb93
commit c2bd01c8d3
11 changed files with 27 additions and 4 deletions

View File

@ -0,0 +1,2 @@
XBPS_CFLAGS="-O2 -pipe -fstack-protector -march=armv6 -mfpu=vfp -mfloat-abi=hard"
XBPS_CXXFLAGS="$XBPS_CFLAGS"

View File

@ -0,0 +1,2 @@
XBPS_CFLAGS="-O2 -pipe -fstack-protector-strong -march=armv6 -mfpu=vfp -mfloat-abi=hard"
XBPS_CXXFLAGS="$XBPS_CFLAGS"

View File

@ -0,0 +1,2 @@
XBPS_CFLAGS="-O2 -pipe -fstack-protector -march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
XBPS_CXXFLAGS="$XBPS_CFLAGS"

View File

@ -0,0 +1,2 @@
XBPS_CFLAGS="-O2 -pipe -fstack-protector-strong -march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
XBPS_CXXFLAGS="$XBPS_CFLAGS"

View File

@ -0,0 +1,2 @@
XBPS_CFLAGS="-O2 -pipe -mtune=i686 -fstack-protector"
XBPS_CXXFLAGS="$XBPS_CFLAGS"

View File

@ -0,0 +1,2 @@
XBPS_CFLAGS="-O2 -pipe -mtune=i686 -fstack-protector-strong"
XBPS_CXXFLAGS="$XBPS_CFLAGS"

View File

@ -0,0 +1,2 @@
XBPS_CFLAGS="-O2 -pipe -fstack-protector"
XBPS_CXXFLAGS="$XBPS_CFLAGS"

View File

@ -0,0 +1,2 @@
XBPS_CFLAGS="-O2 -pipe -fstack-protector-strong"
XBPS_CXXFLAGS="$XBPS_CFLAGS"

View File

@ -331,6 +331,11 @@ setup_pkg() {
dbgflags="-g"
fi
if [ -z "$XBPS_CFLAGS" -a -z "$XBPS_CXXFLAGS" -a -z "$bootstrap" ]; then
if [ -s ${XBPS_COMMONDIR}/build-profiles/${XBPS_MACHINE}.sh ]; then
. ${XBPS_COMMONDIR}/build-profiles/${XBPS_MACHINE}.sh
fi
fi
export CFLAGS="$XBPS_CFLAGS $XBPS_CROSS_CFLAGS $CFLAGS $dbgflags"
export CXXFLAGS="$XBPS_CXXFLAGS $XBPS_CROSS_CXXFLAGS $CXXFLAGS $dbgflags"
export CPPFLAGS="$XBPS_CPPFLAGS $XBPS_CROSS_CPPFLAGS $CPPFLAGS"

View File

@ -21,10 +21,11 @@
XBPS_INSTALL_ARGS="--repository=http://repo.voidlinux.eu/current"
# [OPTIONAL]
# Compilation flags for C and C++.
# Native Compilation flags for C and C++. Note that these settings override
# the pre-defined for the target architecture in common/build-profiles/arch.sh.
#
XBPS_CFLAGS="-O2 -pipe -fstack-protector-strong"
XBPS_CXXFLAGS="${XBPS_CFLAGS}"
#XBPS_CFLAGS="-O2 -pipe -fstack-protector-strong"
#XBPS_CXXFLAGS="${XBPS_CFLAGS}"
# [OPTIONAL]
# Linker flags passed to the compiler. By default we use --as-needed to

View File

@ -308,7 +308,7 @@ readonly XBPS_VERSION_REQ="0.41"
readonly XBPS_VERSION=$(xbps-uhelper -V|awk '{print $2}')
readonly XBPS_SRC_VERSION="113"
readonly XBPS_MACHINE=$(uname -m)
export XBPS_MACHINE=$(uname -m)
#
# main()
@ -447,6 +447,7 @@ fi
if [ -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
export XBPS_ARCH=$(cat $XBPS_MASTERDIR/.xbps_chroot_init)
export XBPS_MACHINE=$XBPS_ARCH
if [ "$XBPS_MACHINE" = "x86_64" -a "$XBPS_ARCH" = "i686" -a -z "$IN_CHROOT" ]; then
# reconfigure pkgs via linux32
linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null