From d3dbbff9262148f20f07c562e5a822ba6fbedac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= Date: Sat, 22 Aug 2020 01:08:10 -0300 Subject: [PATCH] srcpkgs: don't append CFLAGS outside of funtions. Package templates are sourced multiple times during the build process, which can lead to issues when defining variables like CFLAGS using `CFLAGS+=`, since the contents will be added multiple times. This can lead to a build command with `-static -static`, for example. Adding to CFLAGS inside functions is safe, since functions are run only once. --- srcpkgs/arcan/template | 2 +- srcpkgs/execline/template | 4 ++-- srcpkgs/fuse-sshfs/template | 2 +- srcpkgs/gdb/template | 4 ++-- srcpkgs/musl-bootstrap/template | 2 +- srcpkgs/qemu/template | 2 +- srcpkgs/runit/template | 4 ++-- srcpkgs/wxPython4/template | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/srcpkgs/arcan/template b/srcpkgs/arcan/template index b9136364a05..9e2b638d9ef 100644 --- a/srcpkgs/arcan/template +++ b/srcpkgs/arcan/template @@ -27,7 +27,7 @@ fi if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then makedepends+=" libatomic-devel" - CFLAGS+=" -latomic" + CFLAGS="-latomic" fi build_options="tesseract" diff --git a/srcpkgs/execline/template b/srcpkgs/execline/template index 92c5df11259..ad3b509a2f1 100644 --- a/srcpkgs/execline/template +++ b/srcpkgs/execline/template @@ -20,8 +20,8 @@ CFLAGS="-fPIC" build_options="static" if [ "$build_option_static" ]; then - CFLAGS+=" -static" - LDFLAGS+=" -static" + CFLAGS="-static" + LDFLAGS="-static" fi case "$XBPS_TARGET_MACHINE" in diff --git a/srcpkgs/fuse-sshfs/template b/srcpkgs/fuse-sshfs/template index a0205b77250..6ca7098266d 100644 --- a/srcpkgs/fuse-sshfs/template +++ b/srcpkgs/fuse-sshfs/template @@ -18,7 +18,7 @@ checksum=6e7e86831f3066b356e7f16e22f1b8a8f177fda05146f6a5eb821c2fd0541c34 case "${XBPS_TARGET_MACHINE}" in i686|armv6l|armv7l) - CFLAGS+=" -D_FILE_OFFSET_BITS=64" + CFLAGS="-D_FILE_OFFSET_BITS=64" esac do_check() { diff --git a/srcpkgs/gdb/template b/srcpkgs/gdb/template index a3d345a20de..a9170869a9a 100644 --- a/srcpkgs/gdb/template +++ b/srcpkgs/gdb/template @@ -22,8 +22,8 @@ patch_args="-Np1" if [ "${CROSS_BUILD}" ]; then # Make python3.x detection work in cross builds - CFLAGS+=" -I${XBPS_CROSS_BASE}/${py3_inc}" - CXXFLAGS+=" -I${XBPS_CROSS_BASE}/${py3_inc}" + CFLAGS="-I${XBPS_CROSS_BASE}/${py3_inc}" + CXXFLAGS="-I${XBPS_CROSS_BASE}/${py3_inc}" fi # Package build options build_options="gdbserver static python" diff --git a/srcpkgs/musl-bootstrap/template b/srcpkgs/musl-bootstrap/template index 99a5d77f016..67cc82e1474 100644 --- a/srcpkgs/musl-bootstrap/template +++ b/srcpkgs/musl-bootstrap/template @@ -16,7 +16,7 @@ distfiles="http://www.musl-libc.org/releases/musl-${version}.tar.gz" checksum=1370c9a812b2cf2a7d92802510cca0058cc37e66a7bedd70051f0a34015022a3 case "$XBPS_TARGET_MACHINE" in - ppc*) CFLAGS+=" -mlong-double-64";; + ppc*) CFLAGS="-mlong-double-64";; esac post_install() { diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template index 55da90e6139..1f38b7ed5a6 100644 --- a/srcpkgs/qemu/template +++ b/srcpkgs/qemu/template @@ -35,7 +35,7 @@ desc_option_iscsi="Enable support for iSCSI" case "$XBPS_TARGET_MACHINE" in i686*|x86_64*|ppc64le*) build_options_default+=" spice";; - aarch64-musl) CFLAGS+=" -D_LINUX_SYSINFO_H";; + aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";; esac pre_configure() { diff --git a/srcpkgs/runit/template b/srcpkgs/runit/template index 2e64ff83697..081d5fe2c73 100644 --- a/srcpkgs/runit/template +++ b/srcpkgs/runit/template @@ -15,8 +15,8 @@ checksum=6fd0160cb0cf1207de4e66754b6d39750cff14bb0aa66ab49490992c0c47ba18 build_options="static" if [ "$build_option_static" ]; then - CFLAGS+=" -static" - LDFLAGS+=" -static" + CFLAGS="-static" + LDFLAGS="-static" fi pre_build() { diff --git a/srcpkgs/wxPython4/template b/srcpkgs/wxPython4/template index 4823b2e11cb..7fc5b7a36a5 100644 --- a/srcpkgs/wxPython4/template +++ b/srcpkgs/wxPython4/template @@ -18,7 +18,7 @@ distfiles="${PYPI_SITE}/w/wxPython/wxPython-${version}.tar.gz" checksum=3be608bfdede3063678cc703453850ab0a018b82bafd5ee057302250b18f0233 if [ "$CROSS_BUILD" ]; then - CFLAGS+=" -I${XBPS_CROSS_BASE}/usr/include/python${py3_ver}" + CFLAGS="-I${XBPS_CROSS_BASE}/usr/include/python${py3_ver}" fi pre_build() {