xbps-src: set default compiler/preprocessor/linker flags via etc/conf.
Rather than setting them in the build profile, just set them in etc/defaults.conf (overridable via etc/conf) to simplify the code. - Also enable _FORTIFY_SOURCE=2 in CPPFLAGS. - Also enable -z,relro in LDFLAGS. As suggested by @chneukirchen.
This commit is contained in:
parent
6cf2ac3983
commit
50a116d27a
|
@ -1,3 +1,3 @@
|
|||
XBPS_CFLAGS="-O2 -pipe -fstack-protector-strong -march=armv6 -mfpu=vfp -mfloat-abi=hard"
|
||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||
XBPS_TARGET_CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=hard"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TRIPLET="armv6l-unknown-linux-musleabi"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
XBPS_CFLAGS="-O2 -pipe -fstack-protector-strong -march=armv6 -mfpu=vfp -mfloat-abi=hard"
|
||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||
XBPS_TARGET_CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=hard"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TRIPLET="armv6l-unknown-linux-gnueabihf"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
XBPS_CFLAGS="-O2 -pipe -fstack-protector-strong -march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
|
||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||
XBPS_TARGET_CFLAGS="-march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_CXXFLAGS"
|
||||
XBPS_TRIPLET="armv7l-unknown-linux-musleabi"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
XBPS_CFLAGS="-O2 -pipe -fstack-protector-strong -march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
|
||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||
XBPS_TARGET_CFLAGS="-march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TRIPLET="armv7l-unknown-linux-gnueabihf"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
XBPS_CFLAGS="-O2 -pipe -mtune=i686 -fstack-protector-strong"
|
||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||
XBPS_TARGET_CFLAGS="-mtune=i686"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_HOST_TRIPLET="i686-unknown-linux-musl"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
XBPS_CFLAGS="-O2 -pipe -mtune=i686 -fstack-protector-strong"
|
||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||
XBPS_TARGET_CFLAGS="-mtune=i686"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TRIPLET="i686-pc-linux-gnu"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
XBPS_CFLAGS="-O2 -mtune=generic -pipe -fstack-protector-strong"
|
||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||
XBPS_TARGET_CFLAGS="-mtune=generic"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TRIPLET="x86_64-unknown-linux-musl"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
XBPS_CFLAGS="-O2 -mtune=generic -pipe -fstack-protector-strong"
|
||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||
XBPS_TARGET_CFLAGS="-mtune=generic"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TRIPLET="x86_64-unknown-linux-gnu"
|
||||
|
|
|
@ -2,7 +2,5 @@
|
|||
|
||||
XBPS_TARGET_ARCH="armv5tel"
|
||||
XBPS_CROSS_TRIPLET="arm-linux-gnueabi"
|
||||
XBPS_CFLAGS="-O2 -pipe"
|
||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||
XBPS_CROSS_CFLAGS="-march=armv5te -msoft-float -mfloat-abi=soft"
|
||||
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
|
||||
|
|
|
@ -2,7 +2,5 @@
|
|||
|
||||
XBPS_TARGET_ARCH="armv6l-musl"
|
||||
XBPS_CROSS_TRIPLET="arm-linux-musleabi"
|
||||
XBPS_CFLAGS="-O2 -pipe -fstack-protector-strong"
|
||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||
XBPS_CROSS_CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=hard"
|
||||
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
|
||||
|
|
|
@ -2,7 +2,5 @@
|
|||
|
||||
XBPS_TARGET_ARCH="armv6l"
|
||||
XBPS_CROSS_TRIPLET="arm-linux-gnueabihf"
|
||||
XBPS_CFLAGS="-O2 -pipe -fstack-protector-strong"
|
||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||
XBPS_CROSS_CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=hard"
|
||||
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
|
||||
|
|
|
@ -2,7 +2,5 @@
|
|||
|
||||
XBPS_TARGET_ARCH="armv7l-musl"
|
||||
XBPS_CROSS_TRIPLET="arm-linux-musleabi"
|
||||
XBPS_CFLAGS="-O2 -pipe -fstack-protector-strong"
|
||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||
XBPS_CROSS_CFLAGS="-march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
|
||||
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
|
||||
|
|
|
@ -2,7 +2,5 @@
|
|||
|
||||
XBPS_TARGET_ARCH="armv7l"
|
||||
XBPS_CROSS_TRIPLET="arm-linux-gnueabihf7"
|
||||
XBPS_CFLAGS="-O2 -pipe -fstack-protector-strong"
|
||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||
XBPS_CROSS_CFLAGS="-march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
|
||||
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
|
||||
|
|
|
@ -2,7 +2,5 @@
|
|||
|
||||
XBPS_TARGET_ARCH="i686-musl"
|
||||
XBPS_CROSS_TRIPLET="i686-linux-musl"
|
||||
XBPS_CFLAGS="-O2 -pipe -fstack-protector-strong"
|
||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||
XBPS_CROSS_CFLAGS="-march=i686"
|
||||
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
|
||||
|
|
|
@ -2,7 +2,5 @@
|
|||
|
||||
XBPS_TARGET_ARCH="i686"
|
||||
XBPS_CROSS_TRIPLET="i686-pc-linux-gnu"
|
||||
XBPS_CFLAGS="-O2 -pipe"
|
||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||
XBPS_CROSS_CFLAGS="-march=i686 -mtune=generic"
|
||||
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
|
||||
|
|
|
@ -2,7 +2,5 @@
|
|||
|
||||
XBPS_TARGET_ARCH="mips"
|
||||
XBPS_CROSS_TRIPLET="mips-softfloat-linux-gnu"
|
||||
XBPS_CFLAGS="-O2 -pipe"
|
||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||
XBPS_CROSS_CFLAGS="-mtune=mips32r2 -mabi=32 -msoft-float"
|
||||
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
|
||||
|
|
|
@ -2,7 +2,5 @@
|
|||
|
||||
XBPS_TARGET_ARCH="mipsel"
|
||||
XBPS_CROSS_TRIPLET="mipsel-softfloat-linux-gnu"
|
||||
XBPS_CFLAGS="-O2 -pipe"
|
||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||
XBPS_CROSS_CFLAGS="-mtune=mips32r2 -mabi=32 -msoft-float"
|
||||
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
|
||||
|
|
|
@ -2,7 +2,5 @@
|
|||
|
||||
XBPS_TARGET_ARCH="x86_64-musl"
|
||||
XBPS_CROSS_TRIPLET="x86_64-linux-musl"
|
||||
XBPS_CFLAGS="-O2 -pipe -fstack-protector-strong"
|
||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||
XBPS_CROSS_CFLAGS="-mtune=generic"
|
||||
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
|
||||
|
|
|
@ -352,17 +352,18 @@ setup_pkg() {
|
|||
dbgflags="-g"
|
||||
fi
|
||||
|
||||
if [ -z "$XBPS_CFLAGS" -a -z "$XBPS_CXXFLAGS" ]; then
|
||||
if [ -z "$cross" ]; then
|
||||
if [ -z "$CHROOT_READY" ]; then
|
||||
source_file ${XBPS_COMMONDIR}/build-profiles/bootstrap.sh
|
||||
else
|
||||
source_file ${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"
|
||||
export LDFLAGS="$XBPS_LDFLAGS $XBPS_CROSS_LDFLAGS $LDFLAGS"
|
||||
|
||||
export CFLAGS="$XBPS_TARGET_CFLAGS $XBPS_CFLAGS $XBPS_CROSS_CFLAGS $CFLAGS $dbgflags"
|
||||
export CXXFLAGS="$XBPS_TARGET_CXXFLAGS $XBPS_CXXFLAGS $XBPS_CROSS_CXXFLAGS $CXXFLAGS $dbgflags"
|
||||
export CPPFLAGS="$XBPS_TARGET_CPPFLAGS $XBPS_CPPFLAGS $XBPS_CROSS_CPPFLAGS $CPPFLAGS"
|
||||
export LDFLAGS="$XBPS_TARGET_LDFLAGS $XBPS_LDFLAGS $XBPS_CROSS_LDFLAGS $LDFLAGS"
|
||||
|
||||
if [ -n "$broken_as_needed" ]; then
|
||||
LDFLAGS="${LDFLAGS/-Wl,--as-needed/}"
|
||||
|
|
|
@ -24,15 +24,16 @@ XBPS_INSTALL_ARGS="--repository=http://repo.voidlinux.eu/current"
|
|||
# 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}"
|
||||
XBPS_CPPFLAGS="-D_FORTIFY_SOURCE=2"
|
||||
|
||||
# [OPTIONAL]
|
||||
# Linker flags passed to the compiler. By default we use --as-needed to
|
||||
# avoid linking extra libraries into binaries. See the following link
|
||||
# for info: http://www.gentoo.org/proj/en/qa/asneeded.xml
|
||||
#
|
||||
XBPS_LDFLAGS="-Wl,--as-needed"
|
||||
XBPS_LDFLAGS="-Wl,--as-needed -Wl,-z,relro"
|
||||
|
||||
# [REQUIRED]
|
||||
# Command to execute to gain root privileges when using the `update-sys`
|
||||
|
|
2
xbps-src
2
xbps-src
|
@ -499,7 +499,7 @@ export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
|
|||
XBPS_UHELPER_CMD XBPS_INSTALL_CMD XBPS_QUERY_CMD \
|
||||
XBPS_RINDEX_CMD XBPS_RECONFIGURE_CMD XBPS_REMOVE_CMD \
|
||||
XBPS_CMPVER_CMD XBPS_FETCH_CMD XBPS_VERSION XBPS_APIVER \
|
||||
XBPS_BUILDSTYLEDIR XBPS_CFLAGS XBPS_CXXFLAGS XBPS_LDFLAGS \
|
||||
XBPS_BUILDSTYLEDIR XBPS_CPPFLAGS XBPS_CFLAGS XBPS_CXXFLAGS XBPS_LDFLAGS \
|
||||
XBPS_MAKEJOBS XBPS_BUILD_FORCEMODE XBPS_USE_GIT_REVS XBPS_DEBUG_PKGS \
|
||||
XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
|
||||
XBPS_SKIP_REMOTEREPOS XBPS_CROSS_BUILD XBPS_PKG_OPTIONS \
|
||||
|
|
Loading…
Reference in New Issue