Github messages for voidlinux
 help / color / mirror / Atom feed
From: classabbyamp <classabbyamp@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] [RFC] [WIP] use bash arrays for some template fields
Date: Wed, 08 Mar 2023 10:48:52 +0100	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-42656@inbox.vuxu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1007 bytes --]

There is a new pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages declare-a
https://github.com/void-linux/void-packages/pull/42656

[RFC] [WIP] use bash arrays for some template fields
this will allow select variables to be defined as arrays or strings. if a string is specified, it will be converted to an array for internal usage. if it is an array, it passes through untouched. this should allow for a smooth transition to using more arrays inside xbps-src, and should solve issues with shell quoting in things like configure_args, make_check_args, etc.

to start, I've only done this with configure_args, and fixed *some* templates

would like to get some feedback before continuing, as this will be a fairly massive undertaking.

#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**

[ci skip]


A patch file from https://github.com/void-linux/void-packages/pull/42656.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-declare-a-42656.patch --]
[-- Type: text/x-diff, Size: 25274 bytes --]

From 6913c072e5720835878acb3d8d30969f5c8e0d41 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Wed, 8 Mar 2023 04:26:21 -0500
Subject: [PATCH 1/5] common/xbps-src/shutils/common.sh: add function for
 str->array

this will allow select variables to be defined as arrays or strings. if
a string is specified, it will be converted to an array for internal
usage. if it is an array, it passes through untouched. this should
allow for a smooth transition to using more arrays inside xbps-src,
and should solve issues with shell quoting in things like configure_args,
make_check_args, etc.
---
 common/xbps-src/shutils/common.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/common/xbps-src/shutils/common.sh b/common/xbps-src/shutils/common.sh
index fdc0c5eedd92..b311214e036a 100644
--- a/common/xbps-src/shutils/common.sh
+++ b/common/xbps-src/shutils/common.sh
@@ -250,6 +250,19 @@ source_file() {
     fi
 }
 
+into_array() {
+    for array_name; do
+        local declaration="$(declare -p "$array_name" 2> /dev/null)"
+        if [ -z "$declaration" ]; then
+            eval "$array_name=()"
+        elif ! $(echo $declaration | grep -q '^declare -a'); then
+            local existing_val="$(eval echo "\${$array_name}" | sed -e 's,^[[:space:]]*,,' -e 's,[[:space:]]*$,,')"
+            unset "${array_name?}"
+            IFS=" " read -r -a "${array_name?}" <<< "${existing_val}"
+        fi
+    done
+}
+
 run_pkg_hooks() {
     local phase="$1" hookn f
 
@@ -530,6 +543,8 @@ setup_pkg() {
 
     set_build_options
 
+    into_array configure_args
+
     export CFLAGS="$XBPS_CFLAGS $XBPS_CROSS_CFLAGS $CFLAGS $dbgflags"
     export CXXFLAGS="$XBPS_CXXFLAGS $XBPS_CROSS_CXXFLAGS $CXXFLAGS $dbgflags"
     export FFLAGS="$XBPS_FFLAGS $XBPS_CROSS_FFLAGS $FFLAGS $dbgflags"

From 4645a07acdb3e5d4e51e2728dd4fb5310a7dfc2c Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Wed, 8 Mar 2023 04:32:03 -0500
Subject: [PATCH 2/5] common/xbps-src/shutils/show.sh: refactor show_pkg_var to
 support arrays

---
 common/xbps-src/shutils/show.sh | 87 ++++++++++++++++++++++-----------
 1 file changed, 59 insertions(+), 28 deletions(-)

diff --git a/common/xbps-src/shutils/show.sh b/common/xbps-src/shutils/show.sh
index 6ae0f4e6d7df..0238a5534f13 100644
--- a/common/xbps-src/shutils/show.sh
+++ b/common/xbps-src/shutils/show.sh
@@ -1,27 +1,27 @@
 # vim: set ts=4 sw=4 et:
 
 show_pkg() {
-    show_pkg_var "pkgname" "$pkgname"
-    show_pkg_var "version" "$version"
-    show_pkg_var "revision" "$revision"
-    show_pkg_var "distfiles" "$distfiles" 1
-    show_pkg_var "checksum" "$checksum" 1
-    show_pkg_var "archs" "$archs" 1
-    show_pkg_var "maintainer" "${maintainer}"
-    show_pkg_var "Upstream URL" "$homepage"
-    show_pkg_var "License(s)" "${license//,/ }" 1
-    show_pkg_var "Changelog" "$changelog"
-    show_pkg_var "build_style" "$build_style"
-    show_pkg_var "build_helper" "$build_helper" 1
-    show_pkg_var "configure_args" "$configure_args" 1
-    show_pkg_var "short_desc" "$short_desc"
-    show_pkg_var "subpackages" "$subpackages" 1
+    show_pkg_var 0 "pkgname" "$pkgname"
+    show_pkg_var 0 "version" "$version"
+    show_pkg_var 0 "revision" "$revision"
+    show_pkg_var 1 "distfiles" "$distfiles"
+    show_pkg_var 1 "checksum" "$checksum"
+    show_pkg_var 1 "archs" "$archs"
+    show_pkg_var 0 "maintainer" "${maintainer}"
+    show_pkg_var 0 "Upstream URL" "$homepage"
+    show_pkg_var 1 "License(s)" "${license//,/ }"
+    show_pkg_var 0 "Changelog" "$changelog"
+    show_pkg_var 0 "build_style" "$build_style"
+    show_pkg_var 1 "build_helper" "$build_helper"
+    show_pkg_var 2 "configure_args" "${configure_args[@]}"
+    show_pkg_var 0 "short_desc" "$short_desc"
+    show_pkg_var 1 "subpackages" "$subpackages"
     set -f
-    show_pkg_var "conf_files" "$conf_files" 1
+    show_pkg_var 1 "conf_files" "$conf_files"
     set +f
-    show_pkg_var "replaces" "$replaces" 1
-    show_pkg_var "provides" "$provides" 1
-    show_pkg_var "conflicts" "$conflicts" 1
+    show_pkg_var 1 "replaces" "$replaces"
+    show_pkg_var 1 "provides" "$provides"
+    show_pkg_var 1 "conflicts" "$conflicts"
     local OIFS="$IFS"
     IFS=','
     for var in $1; do
@@ -29,9 +29,9 @@ show_pkg() {
         if [ ${var} != ${var/'*'} ]
         then
             var="${var/'*'}"
-            show_pkg_var "$var" "${!var//$'\n'/' '}"
+            show_pkg_var 0 "$var" "${!var//$'\n'/' '}"
         else
-            show_pkg_var "$var" "${!var}" 1
+            show_pkg_var 1 "$var" "${!var}"
         fi
     done
     IFS="$OIFS"
@@ -41,26 +41,57 @@ show_pkg() {
 
 show_pkg_var() {
     local _sep i=
-    local _label="$1"
-    local _value="$2"
-    local _always_split="$3"
-    if [ -n "$_value" ] && [ -n "$_label" ]; then
+    local _split="$1" # 0 = no, 1 = always, 2 = array
+    local _label="$2"
+    shift 2
+    if [ -n "$_label" ]; then
         # on short labels, use more padding so everything lines up
         if [ "${#_label}" -lt 7 ]; then
             _sep="		"
         else
             _sep="	"
         fi
-        if [ -n "$_always_split" ] || [[ "$_value" =~ $'\n' ]]; then
-            for i in ${_value}; do
+
+        if [ "$_split" -eq 2 ]; then
+            for _value; do
+                if [ -n "$_value" ]; then
+                    if [[ "$_value" =~ $'\n' ]]; then
+                        OIFS="$IFS"; IFS=$'\n'
+                        for i in $_value; do
+                            [ -n "$i" ] && echo "${_label}:${_sep}${i}"
+                        done
+                        IFS="$OIFS"
+                    else
+                        echo "${_label}:${_sep}${_value}"
+                    fi
+                fi
+            done
+        elif [ "$_split" -eq 1 ] || [[ "$@" =~ $'\n' ]]; then
+            _value="$@"
+            for i in $_value; do
                 [ -n "$i" ] && echo "${_label}:${_sep}${i}"
             done
         else
-            echo "${_label}:${_sep}${_value}"
+            _value="$@"
+            [ -n "$_value" ] && echo "${_label}:${_sep}${_value}"
         fi
     fi
 }
 
+show_pkg_arr() {
+    local _sep i=
+    local _label="$1"
+    shift
+    for _value; do
+        # on short labels, use more padding so everything lines up
+        if [ "${#_label}" -lt 7 ]; then
+            _sep="		"
+        else
+            _sep="	"
+        fi
+    done
+}
+
 show_pkg_deps() {
     [ -f "${PKGDESTDIR}/rdeps" ] && cat ${PKGDESTDIR}/rdeps
 }

From 4030691f615f21930c65b5e35ac95773d32d0361 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Wed, 8 Mar 2023 04:32:56 -0500
Subject: [PATCH 3/5] common/build-style/: convert configure-args to array

---
 common/build-style/cargo.sh            | 6 +++---
 common/build-style/cmake.sh            | 4 ++--
 common/build-style/configure.sh        | 2 +-
 common/build-style/gemspec.sh          | 2 +-
 common/build-style/gnu-configure.sh    | 2 +-
 common/build-style/meson.sh            | 4 ++--
 common/build-style/perl-ModuleBuild.sh | 2 +-
 common/build-style/perl-module.sh      | 2 +-
 common/build-style/qmake.sh            | 4 ++--
 common/build-style/sip-build.sh        | 2 +-
 common/build-style/void-cross.sh       | 4 ++--
 common/build-style/waf.sh              | 2 +-
 common/build-style/waf3.sh             | 2 +-
 common/build-style/zig-build.sh        | 2 +-
 14 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/common/build-style/cargo.sh b/common/build-style/cargo.sh
index 387e711060bc..8c21f9c20445 100644
--- a/common/build-style/cargo.sh
+++ b/common/build-style/cargo.sh
@@ -5,13 +5,13 @@
 do_build() {
 	: ${make_cmd:=cargo auditable}
 
-	${make_cmd} build --release --target ${RUST_TARGET} ${configure_args}
+	${make_cmd} build --release --target ${RUST_TARGET} "${configure_args[@]}"
 }
 
 do_check() {
 	: ${make_cmd:=cargo auditable}
 
-	${make_check_pre} ${make_cmd} test --release --target ${RUST_TARGET} ${configure_args} \
+	${make_check_pre} ${make_cmd} test --release --target ${RUST_TARGET} "${configure_args[@]}" \
 		${make_check_args}
 }
 
@@ -20,7 +20,7 @@ do_install() {
 	: ${make_install_args:=--path .}
 
 	${make_cmd} install --target ${RUST_TARGET} --root="${DESTDIR}/usr" \
-		--offline --locked ${configure_args} ${make_install_args}
+		--offline --locked "${configure_args[@]}" ${make_install_args}
 
 	rm -f "${DESTDIR}"/usr/.crates.toml
 	rm -f "${DESTDIR}"/usr/.crates2.json
diff --git a/common/build-style/cmake.sh b/common/build-style/cmake.sh
index 43750ad20dcd..92032b7a8b09 100644
--- a/common/build-style/cmake.sh
+++ b/common/build-style/cmake.sh
@@ -19,7 +19,7 @@ SET(CMAKE_FIND_ROOT_PATH  "${XBPS_MASTERDIR}/usr;${XBPS_MASTERDIR}")
 SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
 SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
 _EOF
-		configure_args+=" -DCMAKE_TOOLCHAIN_FILE=bootstrap.cmake"
+		configure_args+=("-DCMAKE_TOOLCHAIN_FILE=bootstrap.cmake")
 	elif [ "$CROSS_BUILD" ]; then
 		case "$XBPS_TARGET_MACHINE" in
 			x86_64*) _CMAKE_SYSTEM_PROCESSOR=x86_64 ;;
@@ -74,7 +74,7 @@ _EOF
 	export CMAKE_GENERATOR="${CMAKE_GENERATOR:-Ninja}"
 	# Remove -pipe: https://gitlab.kitware.com/cmake/cmake/issues/19590
 	CFLAGS="-DNDEBUG ${CFLAGS/ -pipe / }" CXXFLAGS="-DNDEBUG ${CXXFLAGS/ -pipe / }" \
-		cmake ${cmake_args} ${configure_args} \
+		cmake ${cmake_args} "${configure_args[@]}" \
 		${LIBS:+-DCMAKE_C_STANDARD_LIBRARIES="$LIBS"} \
 		${LIBS:+-DCMAKE_CXX_STANDARD_LIBRARIES="$LIBS"} \
 		${wrksrc}/${build_wrksrc}
diff --git a/common/build-style/configure.sh b/common/build-style/configure.sh
index 8fe327507d9e..9b472ca28ccc 100644
--- a/common/build-style/configure.sh
+++ b/common/build-style/configure.sh
@@ -5,7 +5,7 @@
 do_configure() {
 	: ${configure_script:=./configure}
 
-	${configure_script} ${configure_args}
+	${configure_script} "${configure_args[@]}"
 }
 
 do_build() {
diff --git a/common/build-style/gemspec.sh b/common/build-style/gemspec.sh
index 9568e819ed45..0ed948dbff0e 100644
--- a/common/build-style/gemspec.sh
+++ b/common/build-style/gemspec.sh
@@ -120,7 +120,7 @@ do_install() {
 		--no-document \
 		--verbose \
 		"${pkgname#ruby-}-${version}.gem" \
-		-- $configure_args
+		-- "${configure_args[@]}"
 
 	# Remove cache
 	rm -rf ${DESTDIR}/${_GEMDIR}/cache
diff --git a/common/build-style/gnu-configure.sh b/common/build-style/gnu-configure.sh
index 82d36f6ee0f7..b89008875a89 100644
--- a/common/build-style/gnu-configure.sh
+++ b/common/build-style/gnu-configure.sh
@@ -5,7 +5,7 @@ do_configure() {
 	: ${configure_script:=./configure}
 
 	export lt_cv_sys_lib_dlsearch_path_spec="/usr/lib64 /usr/lib32 /usr/lib /lib /usr/local/lib"
-	${configure_script} ${configure_args}
+	${configure_script} "${configure_args[@]}"
 }
 
 do_build() {
diff --git a/common/build-style/meson.sh b/common/build-style/meson.sh
index e983c5f42c2f..2f97671388ff 100644
--- a/common/build-style/meson.sh
+++ b/common/build-style/meson.sh
@@ -91,7 +91,7 @@ do_configure() {
 	: ${meson_crossfile:=xbps_meson.cross}
 
 	if [ "$CROSS_BUILD" ]; then
-		configure_args+=" --cross-file=${meson_crossfile}"
+		configure_args+=("--cross-file=${meson_crossfile}")
 	fi
 
 	# binutils ar needs a plugin when LTO is used on static libraries, so we
@@ -122,7 +122,7 @@ do_configure() {
 		--wrap-mode=nodownload \
 		-Db_lto=true -Db_ndebug=true \
 		-Db_staticpic=true \
-		${configure_args} . ${meson_builddir}
+		"${configure_args[@]}" . ${meson_builddir}
 }
 
 do_build() {
diff --git a/common/build-style/perl-ModuleBuild.sh b/common/build-style/perl-ModuleBuild.sh
index f21d2b0efb4c..5efa8484068e 100644
--- a/common/build-style/perl-ModuleBuild.sh
+++ b/common/build-style/perl-ModuleBuild.sh
@@ -24,7 +24,7 @@ do_configure() {
 			perl Build.PL --config optimize="$_optimize" --config ccflags="$_ccflags" \
 			--config lddlflags="$_lddlflags" --config ldflags="$_ldflags" \
 			--config archlibexp="${XBPS_CROSS_BASE}${_archlibexp}" \
-			${configure_args} INSTALLDIRS=vendor
+			"${configure_args[@]}" INSTALLDIRS=vendor
 	else
 		msg_error "$pkgver: cannot find Build.PL for perl module!\n"
 	fi
diff --git a/common/build-style/perl-module.sh b/common/build-style/perl-module.sh
index 2945787ffbe1..2bcfda743083 100644
--- a/common/build-style/perl-module.sh
+++ b/common/build-style/perl-module.sh
@@ -47,7 +47,7 @@ do_configure() {
 			CFLAGS="$CFLAGS -I${XBPS_CROSS_BASE}/usr/include" \
 			LDFLAGS="$LDFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
 			LDDLFLAGS="-shared $CFLAGS -L${XBPS_CROSS_BASE}/usr/lib" \
-			perl -I. Makefile.PL ${configure_args} INSTALLDIRS=vendor
+			perl -I. Makefile.PL "${configure_args[@]}" INSTALLDIRS=vendor
 	fi
 
 	for i in ${perl_configure_dirs}; do
diff --git a/common/build-style/qmake.sh b/common/build-style/qmake.sh
index 31745833606e..1f79fd42d55c 100644
--- a/common/build-style/qmake.sh
+++ b/common/build-style/qmake.sh
@@ -117,7 +117,7 @@ _EOF
 			QT_INSTALL_PREFIX=/usr \
 			LIB=/usr/lib \
 			QT_TARGET_ARCH=$_qt_arch \
-			${configure_args}
+			"${configure_args[@]}"
 	else
 		${qmake} ${qmake_args} \
 			PREFIX=/usr \
@@ -129,7 +129,7 @@ _EOF
 			QMAKE_CXXFLAGS="${CXXFLAGS}" \
 			QMAKE_LFLAGS="${LDFLAGS}" \
 			CONFIG+=no_qt_rpath \
-			${configure_args}
+			"${configure_args[@]}"
 	fi
 }
 
diff --git a/common/build-style/sip-build.sh b/common/build-style/sip-build.sh
index d8b3bcea98bf..42b5b2bff191 100644
--- a/common/build-style/sip-build.sh
+++ b/common/build-style/sip-build.sh
@@ -124,7 +124,7 @@ do_configure() {
 	sip-build --no-make \
 		${_qt:+--qmake "$XBPS_WRAPPERDIR/sip-qmake"} \
 		--api-dir /usr/share/$_qt/qsci/api/python \
-		$configure_args \
+		"${configure_args[@]}" \
 		--build-dir "$sip_builddir"
 
 	if [ "$CROSS_BUILD" ]; then
diff --git a/common/build-style/void-cross.sh b/common/build-style/void-cross.sh
index 02bd1f555741..aae5db2b7355 100644
--- a/common/build-style/void-cross.sh
+++ b/common/build-style/void-cross.sh
@@ -142,7 +142,7 @@ _void_cross_build_bootstrap_gcc() {
 		--with-gnu-ld \
 		--with-gnu-as \
 		${extra_args} \
-		${configure_args} \
+		"${configure_args[@]}" \
 		${cross_gcc_bootstrap_configure_args}
 
 	make ${makejobs}
@@ -438,7 +438,7 @@ _void_cross_build_gcc() {
 		--with-gnu-as \
 		--with-linker-hash-style=gnu \
 		${extra_args} \
-		${configure_args} \
+		"${configure_args[@]}" \
 		${cross_gcc_configure_args}
 
 	make ${makejobs}
diff --git a/common/build-style/waf.sh b/common/build-style/waf.sh
index e943765f9b17..2b3b6eb03c9d 100644
--- a/common/build-style/waf.sh
+++ b/common/build-style/waf.sh
@@ -5,7 +5,7 @@ do_configure() {
 	: ${configure_script:=waf}
 
 	PYTHON=/usr/bin/python2 python2 ${configure_script} configure \
-		--prefix=/usr --libdir=/usr/lib${XBPS_TARGET_WORDSIZE} ${configure_args}
+		--prefix=/usr --libdir=/usr/lib${XBPS_TARGET_WORDSIZE} "${configure_args[@]}"
 }
 
 do_build() {
diff --git a/common/build-style/waf3.sh b/common/build-style/waf3.sh
index 54fd221172b7..455b043ebfa3 100644
--- a/common/build-style/waf3.sh
+++ b/common/build-style/waf3.sh
@@ -13,7 +13,7 @@ do_configure() {
 
 	PYTHON=/usr/bin/python3 python3 ${configure_script} configure \
 		--prefix=/usr --libdir=/usr/lib${XBPS_TARGET_WORDSIZE} \
-		${configure_args} ${cross_args}
+		"${configure_args[@]}" ${cross_args}
 }
 
 do_build() {
diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
index 205c4cadf53f..e2d02fb11b7f 100644
--- a/common/build-style/zig-build.sh
+++ b/common/build-style/zig-build.sh
@@ -33,7 +33,7 @@ do_build() {
 		--libc xbps_zig_libc.txt \
 		-Dtarget="${zig_target}" -Dcpu="${zig_cpu}" \
 		-Drelease-safe --prefix /usr install \
-		${configure_args}
+		"${configure_args[@]}"
 }
 
 do_install() {

From 62462b53d16dc286c949936bc246d2987f45e75d Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Wed, 8 Mar 2023 04:33:30 -0500
Subject: [PATCH 4/5] common/environment/configure/gnu-configure-args.sh:
 configure_args->array

---
 .../environment/configure/gnu-configure-args.sh  | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/common/environment/configure/gnu-configure-args.sh b/common/environment/configure/gnu-configure-args.sh
index dafbf5dc110c..60946b0439b3 100644
--- a/common/environment/configure/gnu-configure-args.sh
+++ b/common/environment/configure/gnu-configure-args.sh
@@ -6,18 +6,18 @@ fi
 
 # Store args from template so they can be included last and override
 # our defaults
-TEMPLATE_CONFIGURE_ARGS="${configure_args}"
+TEMPLATE_CONFIGURE_ARGS=("${configure_args[@]}")
 
-export configure_args="--prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin --bindir=/usr/bin
- --mandir=/usr/share/man --infodir=/usr/share/info --localstatedir=/var"
+export configure_args=(--prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin --bindir=/usr/bin
+ --mandir=/usr/share/man --infodir=/usr/share/info --localstatedir=/var)
 
 . ${XBPS_COMMONDIR}/build-profiles/${XBPS_MACHINE}.sh
-export configure_args+=" --host=$XBPS_TRIPLET --build=$XBPS_TRIPLET"
+export configure_args+=("--host=$XBPS_TRIPLET" "--build=$XBPS_TRIPLET")
 
 # Always use wordsize-specific libdir even though the real path is lib
 # This is to make sure 32-bit and 64-bit libs can coexist when looking
 # up things (the opposite-libdir is always symlinked as libNN)
-export configure_args+=" --libdir=\${exec_prefix}/lib${XBPS_TARGET_WORDSIZE}"
+export configure_args+=("--libdir=\${exec_prefix}/lib${XBPS_TARGET_WORDSIZE}")
 
 _AUTOCONFCACHEDIR=${XBPS_COMMONDIR}/environment/configure/autoconf_cache
 
@@ -33,16 +33,16 @@ esac
 
 # Cross compilation vars
 if [ -z "$CROSS_BUILD" ]; then
-	export configure_args+=" ${TEMPLATE_CONFIGURE_ARGS}"
+	export configure_args+=("${TEMPLATE_CONFIGURE_ARGS[@]}")
 	unset TEMPLATE_CONFIGURE_ARGS
 
 	set +a
 	return 0
 fi
 
-export configure_args+=" --host=$XBPS_CROSS_TRIPLET --with-sysroot=$XBPS_CROSS_BASE --with-libtool-sysroot=$XBPS_CROSS_BASE "
+export configure_args+=("--host=$XBPS_CROSS_TRIPLET" "--with-sysroot=$XBPS_CROSS_BASE" "--with-libtool-sysroot=$XBPS_CROSS_BASE")
 
-export configure_args+=" ${TEMPLATE_CONFIGURE_ARGS}"
+export configure_args+=("${TEMPLATE_CONFIGURE_ARGS[@]}")
 unset TEMPLATE_CONFIGURE_ARGS
 
 # Read autoconf cache variables for cross target (taken from OE).

From b98845350065c42910e07c9022fc9ff77565e136 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Wed, 8 Mar 2023 04:45:40 -0500
Subject: [PATCH 5/5] srcpkgs/: fix configure_args

---
 srcpkgs/backintime/template          |  4 ++--
 srcpkgs/coreutils/template           |  8 ++++----
 srcpkgs/emacs/template               |  6 +++---
 srcpkgs/ndpi/template                |  2 +-
 srcpkgs/net-snmp/template            | 12 ++++++------
 srcpkgs/nx-libs/template             |  4 ++--
 srcpkgs/openjdk15-bootstrap/template | 11 +++++------
 srcpkgs/xen/template                 |  2 +-
 8 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/srcpkgs/backintime/template b/srcpkgs/backintime/template
index 2d8c9328216f..b0110046f42c 100644
--- a/srcpkgs/backintime/template
+++ b/srcpkgs/backintime/template
@@ -16,9 +16,9 @@ python_version=3
 
 do_configure() {
 	cd $wrksrc/common
-	./configure $configure_args
+	./configure "${configure_args[@]}"
 	cd $wrksrc/qt
-	./configure $configure_args
+	./configure "${configure_args[@]}"
 }
 
 do_build() {
diff --git a/srcpkgs/coreutils/template b/srcpkgs/coreutils/template
index b9148c854960..6964a3b748a1 100644
--- a/srcpkgs/coreutils/template
+++ b/srcpkgs/coreutils/template
@@ -49,19 +49,19 @@ pre_configure() {
 
 do_configure() {
 	if [ "$CROSS_BUILD" ]; then
-		configure_args+=" fu_cv_sys_stat_statfs2_bsize=no
+		configure_args+=(fu_cv_sys_stat_statfs2_bsize=no
 			gl_cv_func_working_mkstemp=yes
-			gl_cv_func_working_acl_get_file=yes "
+			gl_cv_func_working_acl_get_file=yes)
 	fi
 	case "$XBPS_TARGET_MACHINE" in
 		# XXX syncfs() in src/sync.c expects a return value.
-		*-musl) configure_args+=" ac_cv_func_syncfs=no";;
+		*-musl) configure_args+=(ac_cv_func_syncfs=no);;
 	esac
 	#
 	# Do not install kill: provided by util-linux.
 	# Do not install uptime: provided by procps-ng.
 	#
-	env $_force_unsafe_configure ./configure ${configure_args} \
+	env $_force_unsafe_configure ./configure "${configure_args[@]}" \
 		--enable-install-program=arch,hostname \
 		--enable-no-install-program=kill,uptime \
 		--disable-rpath
diff --git a/srcpkgs/emacs/template b/srcpkgs/emacs/template
index 1e74ec047dac..796d787225a6 100644
--- a/srcpkgs/emacs/template
+++ b/srcpkgs/emacs/template
@@ -59,16 +59,16 @@ post_extract() {
 
 do_configure() {
 	cd $wrksrc/nox
-	./configure --without-x $(vopt_with dbus) ${configure_args} \
+	./configure --without-x $(vopt_with dbus) "${configure_args[@]}" \
 		--without-native-compilation
 
 	cd $wrksrc/x11
 	./configure --with-x-toolkit=athena --without-toolkit-scroll-bars \
 		$(vopt_with dbus) --without-gconf --without-gsettings \
-		${configure_args}
+		"${configure_args[@]}"
 
 	cd $wrksrc/gtk3
-	./configure --with-x-toolkit=gtk3 --with-xwidgets ${configure_args}
+	./configure --with-x-toolkit=gtk3 --with-xwidgets "${configure_args[@]}"
 }
 
 do_build() {
diff --git a/srcpkgs/ndpi/template b/srcpkgs/ndpi/template
index 4fdef1b182e9..bcd50cc81954 100644
--- a/srcpkgs/ndpi/template
+++ b/srcpkgs/ndpi/template
@@ -13,7 +13,7 @@ distfiles="https://github.com/ntop/nDPI/archive/${version}.tar.gz"
 checksum=dc9b291c7fde94edb45fb0f222e0d93c93f8d6d37f4efba20ebd9c655bfcedf9
 
 do_configure() {
-	./autogen.sh ${configure_args}
+	./autogen.sh ${configure_args[@]}
 }
 
 do_check() {
diff --git a/srcpkgs/net-snmp/template b/srcpkgs/net-snmp/template
index af0d79685f15..6eed952b84d0 100644
--- a/srcpkgs/net-snmp/template
+++ b/srcpkgs/net-snmp/template
@@ -2,6 +2,11 @@
 pkgname=net-snmp
 version=5.9.1
 revision=3
+configure_args=(--enable-ucd-snmp-compatibility --enable-ipv6
+ --with-default-snmp-version="3" --with-sys-contact="root@localhost"
+ --with-sys-location="Unknown" --with-logfile=/var/log/snmpd.log
+ --sbindir=/usr/bin --with-persistent-directory=/var/net-snmp --disable-static
+ --with-mib-modules="host misc/ipfwacc ucd-snmp/diskio tunnel ucd-snmp/dlmod ucd-snmp/lmsensorsMib")
 hostmakedepends="pkg-config unzip"
 makedepends="bzip2-devel openssl-devel libnl-devel pciutils-devel
  libsensors-devel pcre-devel"
@@ -20,12 +25,7 @@ do_configure() {
 	# lack magic words.
 	export GREP='grep -a'
 
-	./configure ${configure_args} --enable-ucd-snmp-compatibility \
-		--enable-ipv6 --with-default-snmp-version="3" \
-		--with-sys-contact="root@localhost" --with-sys-location="Unknown" \
-		--with-logfile=/var/log/snmpd.log --sbindir=/usr/bin \
-		--with-mib-modules="host misc/ipfwacc ucd-snmp/diskio tunnel ucd-snmp/dlmod ucd-snmp/lmsensorsMib" \
-		--with-persistent-directory=/var/net-snmp --disable-static
+	./configure "${configure_args[@]}"
 }
 
 do_build() {
diff --git a/srcpkgs/nx-libs/template b/srcpkgs/nx-libs/template
index f604983c82c9..18c83aed0016 100644
--- a/srcpkgs/nx-libs/template
+++ b/srcpkgs/nx-libs/template
@@ -42,11 +42,11 @@ do_configure() {
 	# Configure all subprojects in advance of build
 	local _subdir
 	for _subdir in nxcomp nxcompshad nxproxy nxdialog; do
-		( cd ${_subdir} && ./configure ${configure_args} )
+		( cd ${_subdir} && ./configure "${configure_args[@]}" )
 	done
 
 	# nx-X11 configure has an extra argument
-	( cd nx-X11/lib && ./configure ${configure_args} --disable-poll )
+	( cd nx-X11/lib && ./configure "${configure_args[@]}" --disable-poll )
 }
 
 post_install() {
diff --git a/srcpkgs/openjdk15-bootstrap/template b/srcpkgs/openjdk15-bootstrap/template
index a3b515b98a96..430cf43eb215 100644
--- a/srcpkgs/openjdk15-bootstrap/template
+++ b/srcpkgs/openjdk15-bootstrap/template
@@ -61,14 +61,14 @@ esac
 
 if [ -n "$_use_zero" ]; then
 	makedepends+=" libffi-devel"
-	configure_args+=" --with-jvm-variants=zero"
+	configure_args+=("--with-jvm-variants=zero")
 	case "$XBPS_TARGET_MACHINE" in
-		ppc*) configure_args+=" --with-boot-jdk-jvmargs=-XX:ThreadStackSize=2560";;
+		ppc*) configure_args+=("--with-boot-jdk-jvmargs=-XX:ThreadStackSize=2560");;
 	esac
 fi
 
 if [ -n "$XBPS_DEBUG_PKGS" ]; then
-	configure_args+=" --with-native-debug-symbols=internal"
+	configure_args+=("--with-native-debug-symbols=internal")
 fi
 
 post_extract() {
@@ -100,13 +100,12 @@ do_configure() {
 			;;
 	esac
 
-	configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
 	if [ "$XBPS_CCACHE" ]; then
-		configure_args+=" --enable-ccache"
+		configure_args+=(--enable-ccache)
 	fi
 	CC="/usr/bin/cc"
 	CXX="/usr/bin/c++"
-	./configure ${configure_args} \
+	./configure "${configure_args[@]/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}" \
 		--with-extra-cflags="$CFLAGS" \
 		--with-extra-cxxflags="$CXXFLAGS" \
 		--with-extra-ldflags="$LDFLAGS" \
diff --git a/srcpkgs/xen/template b/srcpkgs/xen/template
index 160db8e65929..dde7b0aa5df3 100644
--- a/srcpkgs/xen/template
+++ b/srcpkgs/xen/template
@@ -146,7 +146,7 @@ do_configure() {
 	cp -a ${FILESDIR}/stdint_local.h ${wrksrc}/tools/libxl/
 	rm -f ${XBPS_WRAPPERDIR}/strip
 	./autogen.sh
-	./configure ${configure_args}
+	./configure ${configure_args[@]}
 }
 
 do_build() {

             reply	other threads:[~2023-03-08  9:48 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08  9:48 classabbyamp [this message]
2023-03-08 10:00 ` tranzystorek-io
2023-03-08 10:03 ` tranzystorek-io
2023-03-08 10:09 ` tranzystorek-io
2023-03-08 10:11 ` classabbyamp
2023-03-08 10:12 ` classabbyamp
2023-03-08 10:17 ` tranzystorek-io
2023-03-08 11:41 ` [PR REVIEW] " ahesford
2023-03-08 12:26 ` leahneukirchen
2023-03-08 18:02 ` paper42
2023-03-08 18:12 ` classabbyamp
2023-03-09  5:43 ` [PR REVIEW] " classabbyamp
2023-03-09  5:44 ` [PR PATCH] [Updated] " classabbyamp
2023-03-09  5:45 ` classabbyamp
2023-03-09 12:40 ` [PR REVIEW] " leahneukirchen
2023-03-09 12:42 ` leahneukirchen
2023-03-09 12:42 ` leahneukirchen
2023-03-09 12:43 ` leahneukirchen
2023-03-09 16:14 ` classabbyamp
2023-03-09 16:22 ` Duncaen
2023-03-09 16:37 ` [PR PATCH] [Updated] " classabbyamp
2023-03-09 16:38 ` classabbyamp
2023-03-09 16:38 ` classabbyamp
2023-06-08  2:05 ` github-actions
2023-06-08  2:35 ` classabbyamp
2023-09-07  1:44 ` github-actions
2023-09-07  1:55 ` classabbyamp
2023-11-02 13:42 ` [PR PATCH] [Updated] " classabbyamp
2023-11-02 15:54 ` classabbyamp
2023-11-02 15:56 ` classabbyamp
2023-11-02 16:31 ` [PR PATCH] [Updated] " classabbyamp
2023-11-02 16:44 ` classabbyamp
2024-02-01  1:45 ` github-actions
2024-03-17  2:13 ` [PR PATCH] [Updated] " classabbyamp
2024-03-17  2:31 ` classabbyamp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-42656@inbox.vuxu.org \
    --to=classabbyamp@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).