Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] [RFC] switch to functions for stuff like libc, atomic support, etc checks 
@ 2020-08-30  2:49 ericonr
  2020-08-30  9:51 ` [RFC] switch to functions for " fosslinux
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: ericonr @ 2020-08-30  2:49 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ericonr/void-packages xbps_target
https://github.com/void-linux/void-packages/pull/24539

[RFC] switch to functions for stuff like libc, atomic support, etc checks 
- I just threw the functions in `shutils/common.sh`, they can certainly go elsewhere. They haven't undergone extensive testing at all.
- The pacakges with additional changes in the second commit (`xbps_target_libc`) should get their own commits.

Possible additions: `xbps_target_wordsize`, `xbps_host_target_wordsize_differ` (or something to that effect).

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

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

From 69570710db7059d94b2b81eca5f4da87ef624970 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Sat, 29 Aug 2020 23:00:41 -0300
Subject: [PATCH 1/3] common/xbps-src/shutils/common.sh: add xbps_ functions.

Replace `if [ "$XBPS_TARGET...` tests with functions:

- xbps_target_libc
- xbps_target_no_atomic8

[ci skip]
---
 common/xbps-src/shutils/common.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/common/xbps-src/shutils/common.sh b/common/xbps-src/shutils/common.sh
index e8bcf577c6b..0f70b030693 100644
--- a/common/xbps-src/shutils/common.sh
+++ b/common/xbps-src/shutils/common.sh
@@ -657,3 +657,14 @@ setup_pkg() {
         . $XBPS_BUILDHELPERDIR/${f}.sh
     done
 }
+
+xbps_target_libc() {
+    local libc="$1"
+    [ "$XBPS_TARGET_LIBC" = "$libc" ]
+    return $?
+}
+
+xbps_target_no_atomic8() {
+    [ "$XBPS_TARGET_NO_ATOMIC8" ]
+    return $?
+}

From 32f42f9815eadd14855ef9fbc04558f6e5f4d1cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Sat, 29 Aug 2020 23:04:40 -0300
Subject: [PATCH 2/3] srcpkgs: use xbps_target_libc.

Additional changes:

- yaz: assigned to LDFLAGS instead of adding to it

- libasr: changed check to checking for glibc, instead of checking for
"not musl"

- go1.12-bootstrap: lib64 is only guaranteed for glibc.

[ci skip]
---
 srcpkgs/EternalTerminal/template              |  4 ++--
 srcpkgs/FeedReader/template                   |  4 ++--
 srcpkgs/aml/template                          |  2 +-
 srcpkgs/anope/template                        |  2 +-
 srcpkgs/base-chroot/template                  |  2 +-
 srcpkgs/bluez/template                        |  2 +-
 srcpkgs/bsd-games/template                    |  2 +-
 srcpkgs/bsdunzip/template                     |  2 +-
 srcpkgs/cairo-dock-plugins/template           |  2 +-
 srcpkgs/chromium/template                     |  2 +-
 srcpkgs/clamav/template                       |  2 +-
 srcpkgs/clens/template                        |  2 +-
 srcpkgs/cronie/template                       |  4 ++--
 srcpkgs/cross-aarch64-linux-gnu/template      |  2 +-
 srcpkgs/cross-arm-linux-gnueabi/template      |  2 +-
 srcpkgs/cross-arm-linux-gnueabihf/template    |  2 +-
 srcpkgs/cross-armv7l-linux-gnueabihf/template |  2 +-
 srcpkgs/cross-i686-pc-linux-gnu/template      |  2 +-
 srcpkgs/cross-powerpc-linux-gnu/template      |  2 +-
 srcpkgs/cross-powerpc64-linux-gnu/template    |  2 +-
 srcpkgs/cross-powerpc64le-linux-gnu/template  |  2 +-
 srcpkgs/cross-x86_64-linux-gnu/template       |  2 +-
 srcpkgs/cwm/template                          |  2 +-
 srcpkgs/dante/template                        |  2 +-
 srcpkgs/deadbeef/template                     |  2 +-
 srcpkgs/dma/template                          |  2 +-
 srcpkgs/drbd-utils/template                   |  2 +-
 srcpkgs/electron7/template                    |  2 +-
 srcpkgs/elogind/template                      |  2 +-
 srcpkgs/fatsort/template                      |  2 +-
 srcpkgs/fdm/template                          |  2 +-
 srcpkgs/firebird3/template                    |  2 +-
 srcpkgs/flightgear/template                   |  2 +-
 srcpkgs/fotoxx/template                       |  6 ++---
 srcpkgs/freecad/template                      |  2 +-
 srcpkgs/freecell-solver/template              |  2 +-
 srcpkgs/freedroidRPG/template                 |  2 +-
 srcpkgs/frr/template                          |  2 +-
 srcpkgs/gcc/template                          |  4 ++--
 srcpkgs/gcc6/template                         |  2 +-
 srcpkgs/gmime/template                        |  2 +-
 srcpkgs/gmime3/template                       |  4 ++--
 srcpkgs/go1.12-bootstrap/template             |  4 ++--
 srcpkgs/gperftools/template                   |  2 +-
 srcpkgs/gpgme/template                        |  2 +-
 srcpkgs/gtk-vnc/template                      |  2 +-
 srcpkgs/hfsprogs/template                     |  2 +-
 srcpkgs/highlight/template                    |  2 +-
 srcpkgs/kodi-addon-pvr-hts/template           |  2 +-
 srcpkgs/kore/template                         |  2 +-
 srcpkgs/libasr/template                       |  2 +-
 srcpkgs/libgit2-glib/template                 |  2 +-
 srcpkgs/libglvnd/template                     |  2 +-
 srcpkgs/libkqueue/template                    |  2 +-
 srcpkgs/libmilter/template                    |  2 +-
 srcpkgs/libreoffice/template                  |  4 ++--
 srcpkgs/librpcsecgss/template                 |  6 ++---
 srcpkgs/libselinux/template                   |  2 +-
 srcpkgs/libvirt/template                      |  2 +-
 srcpkgs/lnav/template                         |  2 +-
 srcpkgs/ltrace/template                       |  2 +-
 srcpkgs/mesa/template                         |  2 +-
 srcpkgs/micropython/template                  |  2 +-
 srcpkgs/minidlna/template                     |  2 +-
 srcpkgs/minissdpd/template                    |  2 +-
 srcpkgs/miniupnpd/template                    |  2 +-
 srcpkgs/mlt/template                          |  2 +-
 srcpkgs/netrek-client-cow/template            |  2 +-
 srcpkgs/nfs-utils/template                    |  2 +-
 srcpkgs/nsjail/template                       |  2 +-
 srcpkgs/nudoku/template                       |  2 +-
 srcpkgs/open-vm-tools/template                |  2 +-
 srcpkgs/openbsd-file/template                 |  2 +-
 srcpkgs/openjdk10-bootstrap/template          | 14 ++++++------
 srcpkgs/openjdk11/template                    | 10 ++++-----
 srcpkgs/openjdk8/template                     | 22 +++++++++----------
 srcpkgs/openjdk9-bootstrap/template           | 14 ++++++------
 srcpkgs/pacman/template                       |  2 +-
 srcpkgs/pam_ssh/template                      |  2 +-
 srcpkgs/paraview/template                     |  2 +-
 srcpkgs/perl/template                         |  2 +-
 srcpkgs/pev/template                          |  2 +-
 srcpkgs/planner/template                      |  2 +-
 srcpkgs/ppp/template                          |  2 +-
 srcpkgs/projectM/template                     |  2 +-
 srcpkgs/proot/template                        |  2 +-
 srcpkgs/python3-elementpath/template          |  2 +-
 srcpkgs/qt5-webengine/template                |  2 +-
 srcpkgs/qtcreator/template                    |  4 ++--
 srcpkgs/remmina/template                      |  2 +-
 srcpkgs/rott/template                         |  2 +-
 srcpkgs/rsyslog/template                      |  2 +-
 srcpkgs/ruby/template                         |  2 +-
 srcpkgs/rvault/template                       |  2 +-
 srcpkgs/samba/template                        |  2 +-
 srcpkgs/siril/template                        |  2 +-
 srcpkgs/sniproxy/template                     |  2 +-
 srcpkgs/squeak/template                       |  2 +-
 srcpkgs/swiften/template                      |  2 +-
 srcpkgs/tacacs/template                       |  2 +-
 srcpkgs/tbb/template                          |  2 +-
 srcpkgs/texi2mdoc/template                    |  2 +-
 srcpkgs/tomahawk/template                     |  2 +-
 srcpkgs/transmission/template                 |  2 +-
 srcpkgs/trinity/template                      |  2 +-
 srcpkgs/ttyd/template                         |  2 +-
 srcpkgs/vino/template                         |  2 +-
 srcpkgs/vtk/template                          |  2 +-
 srcpkgs/watchdog/template                     |  2 +-
 srcpkgs/wayfire/template                      |  2 +-
 srcpkgs/wayvnc/template                       |  2 +-
 srcpkgs/webkit2gtk/template                   |  2 +-
 srcpkgs/widelands/template                    |  2 +-
 srcpkgs/wmfs/template                         |  2 +-
 srcpkgs/workrave/template                     |  2 +-
 srcpkgs/xcb-util-xrm/template                 |  2 +-
 srcpkgs/yaz/template                          |  8 +++----
 srcpkgs/zeek/template                         |  2 +-
 118 files changed, 159 insertions(+), 159 deletions(-)

diff --git a/srcpkgs/EternalTerminal/template b/srcpkgs/EternalTerminal/template
index 277b8dad254..79368636ef6 100644
--- a/srcpkgs/EternalTerminal/template
+++ b/srcpkgs/EternalTerminal/template
@@ -16,12 +16,12 @@ system_accounts="_eternal"
 
 LDFLAGS="-lgflags"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" libexecinfo-devel"
 fi
 
 post_patch() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 		# Use external libexecinfo
 		vsed -i CMakeLists.txt \
 			-e '/execinfo/!s/CORE_LIBRARIES util resolv/& execinfo/'
diff --git a/srcpkgs/FeedReader/template b/srcpkgs/FeedReader/template
index a584421fc55..18fa5960540 100644
--- a/srcpkgs/FeedReader/template
+++ b/srcpkgs/FeedReader/template
@@ -14,13 +14,13 @@ homepage="https://jangernert.github.io/FeedReader/"
 distfiles="https://github.com/jangernert/${pkgname}/archive/v${version}.tar.gz"
 checksum=9f679cc08e5673e9e90541b0a0c4066990deacddfe2692f6611799d99bdf5b3e
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" libexecinfo-devel"
 	LDFLAGS+=" -lexecinfo"
 fi
 
 pre_configure() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 		patch -Np0 -i ${FILESDIR}/fix-FeedServerMain_vala.patch
 	fi
 }
diff --git a/srcpkgs/aml/template b/srcpkgs/aml/template
index 5c1754fc6d7..4312efb2693 100644
--- a/srcpkgs/aml/template
+++ b/srcpkgs/aml/template
@@ -11,7 +11,7 @@ homepage="https://github.com/any1/aml"
 distfiles="https://github.com/any1/aml/archive/v${version}.tar.gz"
 checksum=50341861e9bb4eaaf11731941c276ef22b78e0e3d9b1442f6cf683f1b8e08bff
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/anope/template b/srcpkgs/anope/template
index 42b05622161..27e0374ba30 100644
--- a/srcpkgs/anope/template
+++ b/srcpkgs/anope/template
@@ -20,7 +20,7 @@ make_dirs="
  /var/lib/anope 755 _anope _anope
  /var/log/anope 755 _anope _anope"
 
-if [ "$XBPS_TARGET_LIBC" = musl ]; then
+if xbps_target_libc musl; then
 	makedepends+=" gettext-devel"
 	LDFLAGS="-lintl"
 fi
diff --git a/srcpkgs/base-chroot/template b/srcpkgs/base-chroot/template
index a8a519d9bea..50f80b08d6d 100644
--- a/srcpkgs/base-chroot/template
+++ b/srcpkgs/base-chroot/template
@@ -21,7 +21,7 @@ depends+="
  chroot-bash chroot-grep chroot-gawk chroot-distcc
  chroot-util-linux chroot-git"
 
-if [ "$XBPS_TARGET_LIBC" = musl ]; then
+if xbps_target_libc musl; then
 
 base-chroot-musl_package() {
 	build_style=meta
diff --git a/srcpkgs/bluez/template b/srcpkgs/bluez/template
index 5c2aff5fb13..5ad21b90319 100644
--- a/srcpkgs/bluez/template
+++ b/srcpkgs/bluez/template
@@ -20,7 +20,7 @@ system_groups="bluetooth"
 build_options="mesh nfc"
 patch_args="-Np1"
 
-if [ "$XBPS_TARGET_LIBC" = musl ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/bsd-games/template b/srcpkgs/bsd-games/template
index 6a641a540bb..e7bb3fd2720 100644
--- a/srcpkgs/bsd-games/template
+++ b/srcpkgs/bsd-games/template
@@ -53,7 +53,7 @@ if [ "$XBPS_LIBC" = musl ]; then
 	hostmakedepends+=" musl-legacy-compat"
 fi
 
-if [ "$XBPS_TARGET_LIBC" = musl ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/bsdunzip/template b/srcpkgs/bsdunzip/template
index fe26c540d5f..b0c3f072e23 100644
--- a/srcpkgs/bsdunzip/template
+++ b/srcpkgs/bsdunzip/template
@@ -11,7 +11,7 @@ homepage="https://github.com/somasis/bsdunzip"
 distfiles="https://github.com/somasis/bsdunzip/archive/${version}.tar.gz"
 checksum=06c52c77fa518732665aa2daa73f364cd2470a5d47a83c9c79f86f207cf3ecc1
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/cairo-dock-plugins/template b/srcpkgs/cairo-dock-plugins/template
index 0b7836b6d91..511dea4c62e 100644
--- a/srcpkgs/cairo-dock-plugins/template
+++ b/srcpkgs/cairo-dock-plugins/template
@@ -23,7 +23,7 @@ if [ "$CROSS_BUILD" ]; then
 fi
 
 CFLAGS="-fcommon"
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	CFLAGS+=" -D_GNU_SOURCE"
 fi
 
diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index f3b057128b3..a11f9cfeedd 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -45,7 +45,7 @@ esac
 build_options_default="clang js_optimize vaapi pulseaudio"
 
 post_patch() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 		for f in "${FILESDIR}"/musl-patches/*.patch; do
 			echo "Applying $f"
 			patch -Np0 -i "$f"
diff --git a/srcpkgs/clamav/template b/srcpkgs/clamav/template
index 0f178c148d9..8be19098525 100644
--- a/srcpkgs/clamav/template
+++ b/srcpkgs/clamav/template
@@ -28,7 +28,7 @@ CPPFLAGS="-Wno-unused-local-typedefs"
 if [ "$CROSS_BUILD" ]; then
 	configure_args+=" --disable-mempool"
 fi
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-fts-devel"
 	LDFLAGS="-lfts"
 fi
diff --git a/srcpkgs/clens/template b/srcpkgs/clens/template
index cfa3581f076..60f73876e5c 100644
--- a/srcpkgs/clens/template
+++ b/srcpkgs/clens/template
@@ -10,7 +10,7 @@ homepage="https://sourceforge.net/projects/clens/"
 distfiles="$SOURCEFORGE_SITE/clens/clens-${version}.tar.gz"
 checksum=064ac9954d38633e2cff6b696fd049dedc3e90b79acffbee1a87754bcf604267
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/cronie/template b/srcpkgs/cronie/template
index e2c40f9e645..4a464061371 100644
--- a/srcpkgs/cronie/template
+++ b/srcpkgs/cronie/template
@@ -33,12 +33,12 @@ alternatives="
  crond:crond.8:/usr/share/man/man8/cronie-crond.8
 "
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-obstack-devel"
 fi
 
 pre_configure() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 		export LIBS="-lobstack"
 	fi
 }
diff --git a/srcpkgs/cross-aarch64-linux-gnu/template b/srcpkgs/cross-aarch64-linux-gnu/template
index 5921456060a..4ab67a79813 100644
--- a/srcpkgs/cross-aarch64-linux-gnu/template
+++ b/srcpkgs/cross-aarch64-linux-gnu/template
@@ -36,7 +36,7 @@ depends="${pkgname}-libc-${version}_${revision}"
 nostrip_files="libcaf_single.a libgcc.a libgcov.a libgcc_eh.a
  libgnarl_pic.a libgnarl.a libgnat_pic.a libgnat.a libgmem.a"
 
-if [ "$XBPS_TARGET_LIBC" != "glibc" ]; then
+if ! xbps_target_libc glibc; then
 	broken="glibc crosstoolchain only available on glibc"
 fi
 
diff --git a/srcpkgs/cross-arm-linux-gnueabi/template b/srcpkgs/cross-arm-linux-gnueabi/template
index 427a22b19c5..250e8d67f1c 100644
--- a/srcpkgs/cross-arm-linux-gnueabi/template
+++ b/srcpkgs/cross-arm-linux-gnueabi/template
@@ -39,7 +39,7 @@ depends="${pkgname}-libc-${version}_${revision}"
 nostrip_files="libcaf_single.a libgcc.a libgcov.a libgcc_eh.a
  libgnarl_pic.a libgnarl.a libgnat_pic.a libgnat.a libgmem.a"
 
-if [ "$XBPS_TARGET_LIBC" != "glibc" ]; then
+if ! xbps_target_libc glibc; then
 	broken="glibc crosstoolchain only available on glibc"
 fi
 
diff --git a/srcpkgs/cross-arm-linux-gnueabihf/template b/srcpkgs/cross-arm-linux-gnueabihf/template
index 7a92cfa248f..30311509033 100644
--- a/srcpkgs/cross-arm-linux-gnueabihf/template
+++ b/srcpkgs/cross-arm-linux-gnueabihf/template
@@ -39,7 +39,7 @@ depends="${pkgname}-libc-${version}_${revision}"
 nostrip_files="libcaf_single.a libgcc.a libgcov.a libgcc_eh.a
  libgnarl_pic.a libgnarl.a libgnat_pic.a libgnat.a libgmem.a"
 
-if [ "$XBPS_TARGET_LIBC" != "glibc" ]; then
+if ! xbps_target_libc glibc; then
 	broken="glibc crosstoolchain only available on glibc"
 fi
 
diff --git a/srcpkgs/cross-armv7l-linux-gnueabihf/template b/srcpkgs/cross-armv7l-linux-gnueabihf/template
index 66c34d29325..c861d9a34f8 100644
--- a/srcpkgs/cross-armv7l-linux-gnueabihf/template
+++ b/srcpkgs/cross-armv7l-linux-gnueabihf/template
@@ -39,7 +39,7 @@ depends="${pkgname}-libc-${version}_${revision}"
 nostrip_files="libcaf_single.a libgcc.a libgcov.a libgcc_eh.a
  libgnarl_pic.a libgnarl.a libgnat_pic.a libgnat.a libgmem.a"
 
-if [ "$XBPS_TARGET_LIBC" != "glibc" ]; then
+if ! xbps_target_libc glibc; then
 	broken="glibc crosstoolchain only available on glibc"
 fi
 
diff --git a/srcpkgs/cross-i686-pc-linux-gnu/template b/srcpkgs/cross-i686-pc-linux-gnu/template
index 3e5c3f5881a..ec8881e7310 100644
--- a/srcpkgs/cross-i686-pc-linux-gnu/template
+++ b/srcpkgs/cross-i686-pc-linux-gnu/template
@@ -37,7 +37,7 @@ depends="${pkgname}-libc-${version}_${revision}"
 nostrip_files="libcaf_single.a libgcc.a libgcov.a libgcc_eh.a
  libgnarl_pic.a libgnarl.a libgnat_pic.a libgnat.a libgmem.a"
 
-if [ "$XBPS_TARGET_LIBC" != "glibc" ]; then
+if ! xbps_target_libc glibc; then
 	broken="glibc crosstoolchain only available on glibc"
 fi
 
diff --git a/srcpkgs/cross-powerpc-linux-gnu/template b/srcpkgs/cross-powerpc-linux-gnu/template
index 7c5231736d7..cdf3716aa5d 100644
--- a/srcpkgs/cross-powerpc-linux-gnu/template
+++ b/srcpkgs/cross-powerpc-linux-gnu/template
@@ -35,7 +35,7 @@ depends="${pkgname}-libc-${version}_${revision}"
 nostrip_files="libcaf_single.a libgcc.a libgcov.a libgcc_eh.a
  libgnarl_pic.a libgnarl.a libgnat_pic.a libgnat.a libgmem.a"
 
-if [ "$XBPS_TARGET_LIBC" != "glibc" ]; then
+if ! xbps_target_libc glibc; then
 	broken="glibc crosstoolchain only available on glibc"
 fi
 
diff --git a/srcpkgs/cross-powerpc64-linux-gnu/template b/srcpkgs/cross-powerpc64-linux-gnu/template
index 471e0c98659..09edc8dbeec 100644
--- a/srcpkgs/cross-powerpc64-linux-gnu/template
+++ b/srcpkgs/cross-powerpc64-linux-gnu/template
@@ -35,7 +35,7 @@ nostrip_files="libcaf_single.a libgcc.a libgcov.a libgcc_eh.a
  libgnarl_pic.a libgnarl.a libgnat_pic.a libgnat.a libgmem.a"
 depends="${pkgname}-libc-${version}_${revision}"
 
-if [ "$XBPS_TARGET_LIBC" != "glibc" ]; then
+if ! xbps_target_libc glibc; then
 	broken="glibc crosstoolchain only available on glibc"
 fi
 
diff --git a/srcpkgs/cross-powerpc64le-linux-gnu/template b/srcpkgs/cross-powerpc64le-linux-gnu/template
index c8803a6970b..41324b75e9b 100644
--- a/srcpkgs/cross-powerpc64le-linux-gnu/template
+++ b/srcpkgs/cross-powerpc64le-linux-gnu/template
@@ -35,7 +35,7 @@ nostrip_files="libcaf_single.a libgcc.a libgcov.a libgcc_eh.a
  libgnarl_pic.a libgnarl.a libgnat_pic.a libgnat.a libgmem.a"
 depends="${pkgname}-libc-${version}_${revision}"
 
-if [ "$XBPS_TARGET_LIBC" != "glibc" ]; then
+if ! xbps_target_libc glibc; then
 	broken="glibc crosstoolchain only available on glibc"
 fi
 
diff --git a/srcpkgs/cross-x86_64-linux-gnu/template b/srcpkgs/cross-x86_64-linux-gnu/template
index 5bfbef24a29..90afdd55650 100644
--- a/srcpkgs/cross-x86_64-linux-gnu/template
+++ b/srcpkgs/cross-x86_64-linux-gnu/template
@@ -35,7 +35,7 @@ nostrip_files="libcaf_single.a libgcc.a libgcov.a libgcc_eh.a
  libgnarl_pic.a libgnarl.a libgnat_pic.a libgnat.a libgmem.a"
 depends="${pkgname}-libc-${version}_${revision}"
 
-if [ "$XBPS_TARGET_LIBC" != "glibc" ]; then
+if ! xbps_target_libc glibc; then
 	broken="glibc crosstoolchain only available on glibc"
 fi
 
diff --git a/srcpkgs/cwm/template b/srcpkgs/cwm/template
index 4dcc6e11819..27d8cc5fa61 100644
--- a/srcpkgs/cwm/template
+++ b/srcpkgs/cwm/template
@@ -12,7 +12,7 @@ homepage="http://man.openbsd.org/cwm"
 distfiles="https://github.com/leahneukirchen/cwm/archive/v${version}.tar.gz"
 checksum=fdd3d5b4fe9b1b03e1fc270d3dd5a031218589a8e40170e8438d2b9c44a35f08
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/dante/template b/srcpkgs/dante/template
index 44e08fd6ab1..7fe296c0be8 100644
--- a/srcpkgs/dante/template
+++ b/srcpkgs/dante/template
@@ -11,7 +11,7 @@ homepage="http://www.inet.no/dante/index.html"
 distfiles="http://www.inet.no/dante/files/dante-${version}.tar.gz"
 checksum=4c97cff23e5c9b00ca1ec8a95ab22972813921d7fbf60fc453e3e06382fc38a7
 
-if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then
+if xbps_target_libc glibc; then
 	configure_args="--with-libc=libc.so.6"
 fi
 
diff --git a/srcpkgs/deadbeef/template b/srcpkgs/deadbeef/template
index bd2823649a1..aed77ac1386 100644
--- a/srcpkgs/deadbeef/template
+++ b/srcpkgs/deadbeef/template
@@ -24,7 +24,7 @@ build_options="gtk3"
 build_options_default="gtk3"
 LDFLAGS+=" -Wl,-z,stack-size=1048576"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/dma/template b/srcpkgs/dma/template
index 91fa000a9bc..608396723d1 100644
--- a/srcpkgs/dma/template
+++ b/srcpkgs/dma/template
@@ -17,7 +17,7 @@ system_accounts="mail"
 provides="smtp-server-0_1 smtp-forwarder-0_1"
 replaces="smtp-server>=0 smtp-forwarder>=0"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/drbd-utils/template b/srcpkgs/drbd-utils/template
index 10574a2bee1..5230f159e06 100644
--- a/srcpkgs/drbd-utils/template
+++ b/srcpkgs/drbd-utils/template
@@ -30,7 +30,7 @@ distfiles="https://www.linbit.com/downloads/drbd/utils/${pkgname}-${version}.tar
 checksum=1102e2a2001a45685c2f4ce5cb14e5a8a099044f53389d38480b3a88f5db3fd1
 
 # XXX mirror which is reachable from musl builders
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	distfiles="https://distfiles.voidlinux.de/${pkgname}-${version}.tar.gz"
 fi
 
diff --git a/srcpkgs/electron7/template b/srcpkgs/electron7/template
index 40f9ccbf5bf..796547fd2f4 100644
--- a/srcpkgs/electron7/template
+++ b/srcpkgs/electron7/template
@@ -126,7 +126,7 @@ post_patch() {
 		esac
 	done
 
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 	for x in $FILESDIR/musl-patches/*; do
 		case "${x##*/}" in
 			chromium*.patch)
diff --git a/srcpkgs/elogind/template b/srcpkgs/elogind/template
index 35480b0ece0..e5140fefab1 100644
--- a/srcpkgs/elogind/template
+++ b/srcpkgs/elogind/template
@@ -21,7 +21,7 @@ distfiles="https://github.com/${pkgname}/${pkgname}/archive/v${version}.tar.gz"
 checksum=f1098745863138e6270ea22e78a39baef9a0356b48246c5a53b34211992dc7db
 conf_files="/etc/elogind/*.conf"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	configure_args+=" -Dutmp=false"
 fi
 
diff --git a/srcpkgs/fatsort/template b/srcpkgs/fatsort/template
index a31c5f1d9a5..04ddf1dfb60 100644
--- a/srcpkgs/fatsort/template
+++ b/srcpkgs/fatsort/template
@@ -13,6 +13,6 @@ homepage="https://fatsort.sourceforge.io/"
 distfiles="${SOURCEFORGE_SITE}/project/fatsort/fatsort-${version}.tar.xz"
 checksum=481c94ea08f6faaafe67594726d70fb3e3d5ac9672745f0034e55134ea5256fc
 
-if [ "$XBPS_TARGET_LIBC" = musl ]; then
+if xbps_target_libc musl; then
 	broken="most tests are failed"
 fi
diff --git a/srcpkgs/fdm/template b/srcpkgs/fdm/template
index 9523085603b..15377123f5f 100644
--- a/srcpkgs/fdm/template
+++ b/srcpkgs/fdm/template
@@ -13,7 +13,7 @@ homepage="https://github.com/nicm/fdm"
 distfiles="https://github.com/nicm/${pkgname}/releases/download/${version}/${pkgname}-${version}.tar.gz"
 checksum=06b28cb6b792570bc61d7e29b13d2af46b92fea77e058b2b17e11e8f7ed0cea4
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/firebird3/template b/srcpkgs/firebird3/template
index 93b6c0b6305..22312acc623 100644
--- a/srcpkgs/firebird3/template
+++ b/srcpkgs/firebird3/template
@@ -43,7 +43,7 @@ CXXFLAGS="-fno-delete-null-pointer-checks"
 
 pre_configure() {
 	# musl does not have gcrt1.o needed for -p
-	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	if xbps_target_libc musl; then
 		vsed -i -e '/FLAGS=/s/ \-p / /g' \
 			builds/posix/prefix.linux_powerpc* \
 			builds/posix/prefix.linux_arm* \
diff --git a/srcpkgs/flightgear/template b/srcpkgs/flightgear/template
index 324a4e3d156..864e054117a 100644
--- a/srcpkgs/flightgear/template
+++ b/srcpkgs/flightgear/template
@@ -33,7 +33,7 @@ fi
 # Suppress warnings regarding auto_ptr
 CXXFLAGS="-Wno-deprecated-declarations"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" libexecinfo-devel"
 	configure_args+=" -DCMAKE_EXE_LINKER_FLAGS=-lexecinfo"
 fi
diff --git a/srcpkgs/fotoxx/template b/srcpkgs/fotoxx/template
index 5e2272558e6..175acd88e51 100644
--- a/srcpkgs/fotoxx/template
+++ b/srcpkgs/fotoxx/template
@@ -21,9 +21,9 @@ if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" libchamplain-devel"
 fi
 
-case "$XBPS_TARGET_LIBC" in
-	musl) makedepends+=" libexecinfo-devel"
-esac
+if xbps_target_libc musl; then
+	makedepends+=" libexecinfo-devel"
+fi
 
 post_install() {
 	rm -rv ${DESTDIR}/usr/share/doc/fotoxx/{changelog.gz,copyright,fotoxx.man} \
diff --git a/srcpkgs/freecad/template b/srcpkgs/freecad/template
index 8a36d1a38e4..5630458198a 100644
--- a/srcpkgs/freecad/template
+++ b/srcpkgs/freecad/template
@@ -36,7 +36,7 @@ homepage="https://freecadweb.org/"
 distfiles="https://github.com/FreeCAD/FreeCAD/archive/${version}.tar.gz"
 checksum=4e0cce447b31b8989a00cf68c49ae012ce8e5546a56c6e0874fbd8f7ddedffd2
 
-if [ "$XBPS_TARGET_LIBC" = musl ]; then
+if xbps_target_libc musl; then
 	makedepends+=" libexecinfo-devel"
 fi
 
diff --git a/srcpkgs/freecell-solver/template b/srcpkgs/freecell-solver/template
index 475e1dbd82a..29db8569c6e 100644
--- a/srcpkgs/freecell-solver/template
+++ b/srcpkgs/freecell-solver/template
@@ -16,7 +16,7 @@ changelog="https://fc-solve.shlomifish.org/docs/distro/NEWS.html"
 distfiles="https://fc-solve.shlomifish.org/downloads/fc-solve/freecell-solver-${version}.tar.xz"
 checksum=9f1a4c6d5c8ac54c6619b3b988efb5562d460cd048d33345e52a0c849fd0d9df
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/freedroidRPG/template b/srcpkgs/freedroidRPG/template
index 8d4fbd70207..479a9dbda27 100644
--- a/srcpkgs/freedroidRPG/template
+++ b/srcpkgs/freedroidRPG/template
@@ -16,7 +16,7 @@ distfiles="http://ftp.osuosl.org/pub/freedroid/${pkgname}-${version%.*}/${pkgnam
 checksum=426df175034b12095e7498fd80c907e507667c960ee1da331d9e5566d1b09358
 python_version=2
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	configure_args+=" --disable-backtrace"
 fi
 
diff --git a/srcpkgs/frr/template b/srcpkgs/frr/template
index 019022d486b..7f933133659 100644
--- a/srcpkgs/frr/template
+++ b/srcpkgs/frr/template
@@ -30,7 +30,7 @@ _frr_groups="_frrvty"
 _daemons="zebra staticd bgpd ospfd ospf6d ripd ripngd isisd pimd ldpd nhrpd
  eigrpd babeld sharpd pbrd bfdd fabricd"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/gcc/template b/srcpkgs/gcc/template
index ead6f05a498..9176d935c3b 100644
--- a/srcpkgs/gcc/template
+++ b/srcpkgs/gcc/template
@@ -82,7 +82,7 @@ fi
 if [ "$_have_gccgo" = "yes" ]; then
 	subpackages+=" gcc-go gcc-go-tools libgo-devel libgo"
 	# we need this for gcc-go on musl
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 		makedepends+=" libucontext-devel"
 	fi
 fi
@@ -252,7 +252,7 @@ do_configure() {
 		_langs+=",go"
 	fi
 
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 		_args+=" --disable-libsanitizer"
 		_args+=" --disable-symvers"
 		_args+=" libat_cv_have_ifunc=no"
diff --git a/srcpkgs/gcc6/template b/srcpkgs/gcc6/template
index 352ae9bbff5..5476514f33b 100644
--- a/srcpkgs/gcc6/template
+++ b/srcpkgs/gcc6/template
@@ -156,7 +156,7 @@ do_configure() {
 	_args+=" --disable-libmudflap"
 	_args+=" --disable-libssp"
 
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 		_args+=" --disable-symvers"
 		_args+=" libat_cv_have_ifunc=no"
 	fi
diff --git a/srcpkgs/gmime/template b/srcpkgs/gmime/template
index 697cbd0ab67..c4da6d6f616 100644
--- a/srcpkgs/gmime/template
+++ b/srcpkgs/gmime/template
@@ -29,7 +29,7 @@ fi
 pre_build() {
 	if [ -z "$CROSS_BUILD" ]; then
 		:
-	elif [ "$XBPS_TARGET_LIBC" = musl ]; then
+	elif xbps_target_libc musl; then
 		cp ${FILESDIR}/musl-iconv-detect.h ${wrksrc}/iconv-detect.h
 	else
 		cp ${FILESDIR}/iconv-detect.h ${wrksrc}
diff --git a/srcpkgs/gmime3/template b/srcpkgs/gmime3/template
index 43e04197d50..f1f851b80fa 100644
--- a/srcpkgs/gmime3/template
+++ b/srcpkgs/gmime3/template
@@ -26,7 +26,7 @@ pre_configure() {
 
 	configure_args+=" ac_cv_have_iconv_detect_h=yes"
 
-	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	if xbps_target_libc musl; then
 		cp ${FILESDIR}/musl-iconv-detect.h ${wrksrc}/iconv-detect.h
 	else
 		cp ${FILESDIR}/iconv-detect.h ${wrksrc}/iconv-detect.h
@@ -34,7 +34,7 @@ pre_configure() {
 }
 
 do_check() {
-	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	if xbps_target_libc musl; then
 		make check VERBOSITY=-vv |
 		awk '
 			1
diff --git a/srcpkgs/go1.12-bootstrap/template b/srcpkgs/go1.12-bootstrap/template
index 2b3c298cb92..10ffa84b8b8 100644
--- a/srcpkgs/go1.12-bootstrap/template
+++ b/srcpkgs/go1.12-bootstrap/template
@@ -13,7 +13,7 @@ noverifyrdeps=yes
 nocross=yes
 lib32disabled=yes
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	depends+=" gcompat"
 	hostmakedepends+=" patchelf"
 fi
@@ -44,7 +44,7 @@ esac
 distfiles="https://dl.google.com/go/go${version}.linux-${_dist_arch}.tar.gz"
 
 post_build() {
-	[ "$XBPS_TARGET_LIBC" != "musl" ] && return 0
+	xbps_target_libc glibc && return 0
 
 	# we don't have lib64 compatibility path on musl 64-bit systems
 	# use patchelf to replace /lib64/<dynlinker> with /lib/<dynlinker>
diff --git a/srcpkgs/gperftools/template b/srcpkgs/gperftools/template
index 4805b244030..4748aaa485e 100644
--- a/srcpkgs/gperftools/template
+++ b/srcpkgs/gperftools/template
@@ -13,7 +13,7 @@ homepage="https://github.com/gperftools/gperftools"
 distfiles="https://github.com/${pkgname}/${pkgname}/releases/download/${pkgname}-${version}/${pkgname}-${version}.tar.gz"
 checksum=1ee8c8699a0eff6b6a203e59b43330536b22bbcbe6448f54c7091e5efb0763c9
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	# needed by some newly enabled code
 	CXXFLAGS+=" -D__WORDSIZE=$XBPS_TARGET_WORDSIZE"
 	# needed on musl other than x86_64
diff --git a/srcpkgs/gpgme/template b/srcpkgs/gpgme/template
index d9aa938c608..a01eb43ea26 100644
--- a/srcpkgs/gpgme/template
+++ b/srcpkgs/gpgme/template
@@ -16,7 +16,7 @@ homepage="https://www.gnupg.org/software/gpgme/index.html"
 distfiles="https://www.gnupg.org/ftp/gcrypt/gpgme/gpgme-${version}.tar.bz2"
 checksum=cef1f710a6b0d28f5b44242713ad373702d1466dcbe512eb4e754d7f35cd4307
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	configure_args+=" ac_cv_sys_file_offset_bits=no"
 elif [ "$XBPS_TARGET_WORDSIZE" = "32" ]; then
 	CFLAGS="-D_FILE_OFFSET_BITS=64 -DLARGEFILE_SOURCE=1"
diff --git a/srcpkgs/gtk-vnc/template b/srcpkgs/gtk-vnc/template
index f07e530d23f..1f89a5d0db8 100644
--- a/srcpkgs/gtk-vnc/template
+++ b/srcpkgs/gtk-vnc/template
@@ -18,7 +18,7 @@ checksum=a81a1f1a79ad4618027628ffac27d3391524c063d9411c7a36a5ec3380e6c080
 build_options="gir"
 build_options_default="gir"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	configure_args+=" -Dwith-coroutine=gthread"
 fi
 
diff --git a/srcpkgs/hfsprogs/template b/srcpkgs/hfsprogs/template
index 7a74ae3bd12..96868686586 100644
--- a/srcpkgs/hfsprogs/template
+++ b/srcpkgs/hfsprogs/template
@@ -14,7 +14,7 @@ homepage="http://www.opensource.apple.com/"
 distfiles="http://cavan.codon.org.uk/~mjg59/diskdev_cmds/diskdev_cmds-${version}.tar.gz"
 checksum=b01b203a97f9a3bf36a027c13ddfc59292730552e62722d690d33bd5c24f5497
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/highlight/template b/srcpkgs/highlight/template
index ffaca39dcba..533a72e13f3 100644
--- a/srcpkgs/highlight/template
+++ b/srcpkgs/highlight/template
@@ -23,7 +23,7 @@ post_extract() {
 pre_build() {
 	# extra flags used during build of perl itself
 	local _ecflags=
-	if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then
+	if xbps_target_libc glibc; then
 		_ecflags="-D_FILE_OFFSET_BITS=64 -DLARGE_FILE_SUPPORT64"
 	fi
 	make -C extras/swig perl "CXX=$CXX -fPIC -lperl $CFLAGS $_ecflags $LDFLAGS"
diff --git a/srcpkgs/kodi-addon-pvr-hts/template b/srcpkgs/kodi-addon-pvr-hts/template
index a0b9f28702b..63e867c4c9d 100644
--- a/srcpkgs/kodi-addon-pvr-hts/template
+++ b/srcpkgs/kodi-addon-pvr-hts/template
@@ -14,6 +14,6 @@ distfiles="https://github.com/kodi-pvr/pvr.hts/archive/${version}-${_kodi_releas
 checksum=6958b91ca616554e4c068bc303c66388e9a2c3a68b5979d8918b4e0d7b6bb95c
 nocross="depends on kodi-platform"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
diff --git a/srcpkgs/kore/template b/srcpkgs/kore/template
index a31cdf1802b..7ff87612b08 100644
--- a/srcpkgs/kore/template
+++ b/srcpkgs/kore/template
@@ -13,7 +13,7 @@ homepage="https://kore.io"
 distfiles="https://kore.io/releases/kore-${version}.tar.gz"
 checksum=c80d7a817883e631adf9eb5271b4ffa6ebb06c2e2fca40ce6c3c75638c08b67a
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/libasr/template b/srcpkgs/libasr/template
index 484976cde3c..35d84aac8e5 100644
--- a/srcpkgs/libasr/template
+++ b/srcpkgs/libasr/template
@@ -12,7 +12,7 @@ homepage="https://www.opensmtpd.org/"
 distfiles="https://github.com/OpenSMTPD/${pkgname}/releases/download/${version}/${pkgname}-${version}.tar.gz"
 checksum=19fb6bed10d15c9775c8d008cd1130155917ae4e801c729fe85e6d88a545dab4
 
-if [ "$XBPS_TARGET_LIBC" != "musl" ]; then
+if xbps_target_libc glibc; then
 	CFLAGS="-DHAVE_RES_RANDOMID"
 fi
 
diff --git a/srcpkgs/libgit2-glib/template b/srcpkgs/libgit2-glib/template
index f94d7e07d8c..42d0750bc94 100644
--- a/srcpkgs/libgit2-glib/template
+++ b/srcpkgs/libgit2-glib/template
@@ -21,7 +21,7 @@ build_options_default="gir"
 CPPFLAGS="-UG_DISABLE_ASSERT"
 
 post_patch() {
-	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	if xbps_target_libc musl; then
 		vsed -i "s,TEST.*encoding.*,/* & */," tests/repository.c
 	fi
 }
diff --git a/srcpkgs/libglvnd/template b/srcpkgs/libglvnd/template
index 77b80b0abcf..c6f2aa6359f 100644
--- a/srcpkgs/libglvnd/template
+++ b/srcpkgs/libglvnd/template
@@ -17,7 +17,7 @@ provides="libGL-7.11_1 libEGL-7.11_1 libGLES-7.11_1"
 replaces="libGL>=0 libEGL>=0 libGLES>=0"
 
 # Disable TLS with musl: https://bugs.freedesktop.org/show_bug.cgi?id=35268
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	configure_args="-Dtls=disabled"
 fi
 
diff --git a/srcpkgs/libkqueue/template b/srcpkgs/libkqueue/template
index 31f0831b079..bd74c6395df 100644
--- a/srcpkgs/libkqueue/template
+++ b/srcpkgs/libkqueue/template
@@ -12,7 +12,7 @@ distfiles="https://github.com/mheily/libkqueue/archive/v${version}.tar.gz"
 checksum=6ef91fb9ffd0630e14ed7e551e64fbe14f1af84fed34f1972cdb703593b6ad1f
 CFLAGS="-Wno-error=format-truncation -Wno-error=stringop-overflow"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/libmilter/template b/srcpkgs/libmilter/template
index b801ee3e5b9..6035ed2c6bd 100644
--- a/srcpkgs/libmilter/template
+++ b/srcpkgs/libmilter/template
@@ -13,7 +13,7 @@ distfiles="ftp://ftp.mirrorservice.org/sites/ftp.sendmail.org/pub/${_pkgname}/${
 checksum=24f94b5fd76705f15897a78932a5f2439a32b1a2fdc35769bb1a5f5d9b4db439
 wrksrc="${_pkgname}-${_version}"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/libreoffice/template b/srcpkgs/libreoffice/template
index 0eb5941e2ad..5ecc19c3e11 100644
--- a/srcpkgs/libreoffice/template
+++ b/srcpkgs/libreoffice/template
@@ -257,7 +257,7 @@ case "$XBPS_TARGET_MACHINE" in
 		;;
 esac
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	# use shipped clucene, because CLucene/analysis/cjk/CJKAnalyzer.h
 	# is missing in the musl clucene-devel files
 	makedepends+=" libexecinfo-devel"
@@ -438,7 +438,7 @@ do_configure() {
 		-e "s|.1.gz|.1|g"
 	chmod +x bin/unpack-sources
 
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 		vsed -i sal/Library_sal.mk -e "s;-ldl ;-lexecinfo &;"
 	fi
 
diff --git a/srcpkgs/librpcsecgss/template b/srcpkgs/librpcsecgss/template
index d20446cb3ce..b7517356714 100644
--- a/srcpkgs/librpcsecgss/template
+++ b/srcpkgs/librpcsecgss/template
@@ -12,9 +12,9 @@ homepage="http://www.citi.umich.edu/projects/nfsv4/linux/"
 distfiles="$homepage/$pkgname/$pkgname-$version.tar.gz"
 checksum=0cafb86b67e5eb4c89e8abaaad9165298946bc164d258e8925fc6dc1fa913abd
 
-case "$XBPS_TARGET_LIBC" in
-	musl) broken="rpc/rpc.h header is not available on musl"
-esac
+if xbps_target_libc musl; then
+	broken="rpc/rpc.h header is not available on musl"
+fi
 
 post_install() {
 	vlicense COPYING
diff --git a/srcpkgs/libselinux/template b/srcpkgs/libselinux/template
index fdd8d639932..fecd3e00a9d 100644
--- a/srcpkgs/libselinux/template
+++ b/srcpkgs/libselinux/template
@@ -14,7 +14,7 @@ homepage="https://www.nsa.gov/what-we-do/research/selinux/"
 distfiles="https://github.com/SELinuxProject/selinux/releases/download/20191204/${pkgname}-${version}.tar.gz"
 checksum=2ea2b30f671dae9d6b1391cbe8fb2ce5d36a3ee4fb1cd3c32f0d933c31b82433
 
-if [ "$XBPS_TARGET_LIBC" = musl ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-fts-devel"
 	export FTS_LDLIBS="-lfts"
 fi
diff --git a/srcpkgs/libvirt/template b/srcpkgs/libvirt/template
index 470165f1527..a33899385b2 100644
--- a/srcpkgs/libvirt/template
+++ b/srcpkgs/libvirt/template
@@ -77,7 +77,7 @@ post_install() {
 	rm -rf ${DESTDIR}/var/log
 
 	# workaround for musl not providing an utmpx implementation
-	if [ "$XBPS_TARGET_LIBC" = "musl" ];
+	if xbps_target_libc musl;
 	then
 		echo "remember_owner = 0" >> ${DESTDIR}/etc/libvirt/qemu.conf
 	fi
diff --git a/srcpkgs/lnav/template b/srcpkgs/lnav/template
index e2ffc66c26e..169f4676063 100644
--- a/srcpkgs/lnav/template
+++ b/srcpkgs/lnav/template
@@ -14,7 +14,7 @@ homepage="http://lnav.org/"
 distfiles="https://github.com/tstack/${pkgname}/archive/v${version}.tar.gz"
 checksum=5e5bfde95da71d9e00ec20b4a17d7f260ca90d23c86a47f8bc3fb98418aea6bc
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/ltrace/template b/srcpkgs/ltrace/template
index a26e64e3c79..aadcb052b35 100644
--- a/srcpkgs/ltrace/template
+++ b/srcpkgs/ltrace/template
@@ -17,7 +17,7 @@ checksum=4aecf69e4a33331aed1e50ce4907e73a98cbccc4835febc3473863474304d547
 CFLAGS="-Wno-error -D_GNU_SOURCE"
 
 pre_configure() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 		sed -i '/HOST_OS/s/linux-uclibc/linux-musl/g' configure.ac
 		sed -i -e '/error.h/d' -e 's/error(1, errno/err(1/' \
 			read_config_file.c expr.c zero.c
diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 81d85531da1..4618cc5c87a 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -165,7 +165,7 @@ case "$XBPS_TARGET_MACHINE" in
 	i686) configure_args+=" -Ddri-drivers-path=/usr/lib32/dri";;
 esac
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	configure_args+=" -Duse-elf-tls=false"
 fi
 
diff --git a/srcpkgs/micropython/template b/srcpkgs/micropython/template
index 45ba29c81c4..5ca63743d37 100644
--- a/srcpkgs/micropython/template
+++ b/srcpkgs/micropython/template
@@ -16,7 +16,7 @@ case "$XBPS_TARGET_MACHINE" in
 	ppc*) broken="missing nlr_push" ;;
 esac
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/minidlna/template b/srcpkgs/minidlna/template
index 636b4c72204..57700b25ce8 100644
--- a/srcpkgs/minidlna/template
+++ b/srcpkgs/minidlna/template
@@ -26,7 +26,7 @@ minidlna_homedir="/var/lib/minidlna"
 
 CFLAGS="-fcommon"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/minissdpd/template b/srcpkgs/minissdpd/template
index b0d56f0058d..63608ac43bb 100644
--- a/srcpkgs/minissdpd/template
+++ b/srcpkgs/minissdpd/template
@@ -13,7 +13,7 @@ checksum=dfd637b185731e1acb412a86faa9718eb93c04ca08280541a6d22d14d1fb890f
 
 CFLAGS="-D_GNU_SOURCE"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/miniupnpd/template b/srcpkgs/miniupnpd/template
index 9e568d0bc7b..5898534edcf 100644
--- a/srcpkgs/miniupnpd/template
+++ b/srcpkgs/miniupnpd/template
@@ -17,7 +17,7 @@ homepage="http://miniupnp.free.fr"
 distfiles="http://miniupnp.free.fr/files/miniupnpd-${version}.tar.gz"
 checksum=950894779661197fe093855fda29a728f434b5756eb4fa6cb5f7b9bff7ffe0c1
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/mlt/template b/srcpkgs/mlt/template
index 1579a5b21dd..74aeb4fa853 100644
--- a/srcpkgs/mlt/template
+++ b/srcpkgs/mlt/template
@@ -22,7 +22,7 @@ checksum=ab211e27c06c0688f9cbe2d74dc0623624ef75ea4f94eea915cdc313196be2dd
 CFLAGS+=" -DHAVE_STRTOD_L=1 -DHAVE_LOCALE_H=1"
 CXXFLAGS+=" -DHAVE_STRTOD_L=1 -DHAVE_LOCALE_H=1"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/netrek-client-cow/template b/srcpkgs/netrek-client-cow/template
index 10e677c2f27..cd2811a4a14 100644
--- a/srcpkgs/netrek-client-cow/template
+++ b/srcpkgs/netrek-client-cow/template
@@ -14,7 +14,7 @@ distfiles="https://www.netrek.org/files/COW/netrek-client-cow-${version}.tar.gz"
 checksum=cac219248d71033b62098c3da1ca6b4408974b22996da39eaba213b2253e6da3
 nocross='./mkcflags compiled without HOSTCC'
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-fts-devel"
 	export LIBS+=" -lfts"
 fi
diff --git a/srcpkgs/nfs-utils/template b/srcpkgs/nfs-utils/template
index 1b9926217f6..9b00026f7b8 100644
--- a/srcpkgs/nfs-utils/template
+++ b/srcpkgs/nfs-utils/template
@@ -31,7 +31,7 @@ make_dirs="
  /etc/exports.d			0750	root	root
 "
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/nsjail/template b/srcpkgs/nsjail/template
index 067460be92a..fdd4d06929d 100644
--- a/srcpkgs/nsjail/template
+++ b/srcpkgs/nsjail/template
@@ -16,7 +16,7 @@ checksum="cfa66d3ed136b2e221752287b95e544915e8a6760aa866f023b604d14a374919
 
 archs="aarch64* armv5tel* armv6l* armv7l* x86_64*"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/nudoku/template b/srcpkgs/nudoku/template
index ab21861d5a6..f1d8ef3e9cd 100644
--- a/srcpkgs/nudoku/template
+++ b/srcpkgs/nudoku/template
@@ -12,7 +12,7 @@ homepage="https://github.com/jubalh/nudoku"
 distfiles="https://github.com/jubalh/${pkgname}/archive/${version}.tar.gz"
 checksum=44d3ec1ff34a010910ac7a92f6d84e8a7a4678a966999b7be27d224609ae54e1
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	configure_args+=" --disable-nls"
 fi
 
diff --git a/srcpkgs/open-vm-tools/template b/srcpkgs/open-vm-tools/template
index ffecab65967..276eb1238bd 100644
--- a/srcpkgs/open-vm-tools/template
+++ b/srcpkgs/open-vm-tools/template
@@ -26,7 +26,7 @@ build_options_default="pam x11"
 
 CFLAGS="-fcommon"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	configure_args+=" --disable-glibc-check"
 fi
 
diff --git a/srcpkgs/openbsd-file/template b/srcpkgs/openbsd-file/template
index 839afee47d0..ab2dbb22dd2 100644
--- a/srcpkgs/openbsd-file/template
+++ b/srcpkgs/openbsd-file/template
@@ -15,7 +15,7 @@ checksum=f6bf601f513bd83038e343bbd93b7982f373669a2ffa76dc52d48fa7251515b2
 
 system_accounts="_file"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	CFLAGS="-DREG_STARTEND=0"
 	makedepends+=" musl-legacy-compat"
 fi
diff --git a/srcpkgs/openjdk10-bootstrap/template b/srcpkgs/openjdk10-bootstrap/template
index 9695f1f1f43..cbbc9fac4aa 100644
--- a/srcpkgs/openjdk10-bootstrap/template
+++ b/srcpkgs/openjdk10-bootstrap/template
@@ -64,18 +64,18 @@ export CCACHE_DISABLE=1
 post_extract() {
 	chmod +x configure
 
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 		rm -r src/jdk.hotspot.agent
 	fi
 }
 
 post_patch() {
-	[ "$XBPS_TARGET_LIBC" != "musl" ] && return 0
-
-	for f in ${FILESDIR}/musl_*.patch; do
-		echo "Applying $f"
-		patch -sNp1 -i "$f"
-	done
+	if xbps_target_libc musl; then
+		for f in ${FILESDIR}/musl_*.patch; do
+			echo "Applying $f"
+			patch -sNp1 -i "$f"
+		done
+	fi
 }
 
 do_configure() {
diff --git a/srcpkgs/openjdk11/template b/srcpkgs/openjdk11/template
index df3cf793ae5..15c2f41b6d5 100644
--- a/srcpkgs/openjdk11/template
+++ b/srcpkgs/openjdk11/template
@@ -63,9 +63,9 @@ if [ -n "$_use_zero" ]; then
 	esac
 fi
 
-case "$XBPS_TARGET_LIBC" in
-	glibc) build_options_default+=" docs";;
-esac
+if xbps_target_libc glibc; then
+	build_options_default+=" docs"
+fi
 
 if [ ! "$CROSS_BUILD" ]; then
 	hostmakedepends+=" openjdk10-bootstrap"
@@ -120,13 +120,13 @@ alternatives="
 
 post_extract() {
 	chmod +x configure
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 		rm -r src/jdk.hotspot.agent
 	fi
 }
 
 post_patch() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 		for f in "${FILESDIR}"/musl_patches/*.patch; do
 			echo "Applying $f"
 			patch -Np1 -i "$f"
diff --git a/srcpkgs/openjdk8/template b/srcpkgs/openjdk8/template
index 80b2b88331a..9dce8efc598 100644
--- a/srcpkgs/openjdk8/template
+++ b/srcpkgs/openjdk8/template
@@ -168,17 +168,17 @@ post_extract() {
 }
 
 post_patch() {
-	[ "$XBPS_TARGET_LIBC" != "musl" ] && return 0
-
-	for f in ${FILESDIR}/musl_*.patch; do
-		echo "Applying $f"
-		patch -sNp1 -i "$f"
-	done
-
-	# add cross prefix for thread_db.h check, fix cross from glibc to musl
-	sed -i "s,/usr/include/thread_db.h,${XBPS_CROSS_BASE}/usr/include/thread_db.h," \
-	 hotspot/make/linux/makefiles/defs.make hotspot/make/linux/makefiles/sa.make \
-	 hotspot/make/linux/makefiles/saproc.make
+	if xbps_target_libc musl; then
+		for f in ${FILESDIR}/musl_*.patch; do
+			echo "Applying $f"
+			patch -sNp1 -i "$f"
+		done
+
+		# add cross prefix for thread_db.h check, fix cross from glibc to musl
+		sed -i "s,/usr/include/thread_db.h,${XBPS_CROSS_BASE}/usr/include/thread_db.h," \
+		 hotspot/make/linux/makefiles/defs.make hotspot/make/linux/makefiles/sa.make \
+		 hotspot/make/linux/makefiles/saproc.make
+	fi
 }
 
 do_configure() {
diff --git a/srcpkgs/openjdk9-bootstrap/template b/srcpkgs/openjdk9-bootstrap/template
index 7fc5dc69376..1db6ccc614a 100644
--- a/srcpkgs/openjdk9-bootstrap/template
+++ b/srcpkgs/openjdk9-bootstrap/template
@@ -83,18 +83,18 @@ post_extract() {
 		mv ../${subrepo}-jdk-${_repo_ver} ${subrepo}
 	done
 
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 		rm -r hotspot/src/jdk.hotspot.agent
 	fi
 }
 
 post_patch() {
-	[ "$XBPS_TARGET_LIBC" != "musl" ] && return 0
-
-	for f in ${FILESDIR}/musl_*.patch; do
-		echo "Applying $f"
-		patch -sNp1 -i "$f"
-	done
+	if xbps_target_libc musl; then
+		for f in ${FILESDIR}/musl_*.patch; do
+			echo "Applying $f"
+			patch -sNp1 -i "$f"
+		done
+	fi
 }
 
 do_configure() {
diff --git a/srcpkgs/pacman/template b/srcpkgs/pacman/template
index 0ea2567b905..297dc31d4b5 100644
--- a/srcpkgs/pacman/template
+++ b/srcpkgs/pacman/template
@@ -18,7 +18,7 @@ homepage="https://www.archlinux.org/pacman/"
 distfiles="https://sources.archlinux.org/other/pacman/pacman-${version}.tar.gz"
 checksum=bb201a9f2fb53c28d011f661d50028efce6eef2c1d2a36728bdd0130189349a0
 
-if [ "$XBPS_TARGET_LIBC" = musl ]; then
+if xbps_target_libc musl; then
 	do_check() {
 		: fakechroot is not available
 	}
diff --git a/srcpkgs/pam_ssh/template b/srcpkgs/pam_ssh/template
index f8a17f44cc9..9cc44d59024 100644
--- a/srcpkgs/pam_ssh/template
+++ b/srcpkgs/pam_ssh/template
@@ -17,7 +17,7 @@ checksum=0c456f6a5c9e47ce6825ac50d467e7a797e14239b2b9a72bfeb2df0100f4af31
 
 CFLAGS="-fcommon"
 
-if [ "${XBPS_TARGET_LIBC}" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/paraview/template b/srcpkgs/paraview/template
index 5cf3ee74adb..7a4c4474060 100644
--- a/srcpkgs/paraview/template
+++ b/srcpkgs/paraview/template
@@ -37,7 +37,7 @@ CXXFLAGS="-D_GNU_SOURCE -fcommon"
 # qhelpgenerator: could not find a Qt installation of ''
 export QT_SELECT="5"
 
-if [ "$XBPS_TARGET_LIBC" = musl ]; then
+if xbps_target_libc musl; then
 	makedepends+=" libexecinfo-devel"
 fi
 if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
diff --git a/srcpkgs/perl/template b/srcpkgs/perl/template
index 00b402b1b8e..f0a0dd94dd8 100644
--- a/srcpkgs/perl/template
+++ b/srcpkgs/perl/template
@@ -167,7 +167,7 @@ do_configure() {
 	LDFLAGS+=" -pthread"
 	export HOSTLDFLAGS+=" -pthread"
 
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 		export HOSTCFLAGS+=" -D_GNU_SOURCE"
 		export CFLAGS+=" -DNO_POSIX_2008_LOCALE -D_GNU_SOURCE"
 	else
diff --git a/srcpkgs/pev/template b/srcpkgs/pev/template
index 54138734945..8cdd141bb74 100644
--- a/srcpkgs/pev/template
+++ b/srcpkgs/pev/template
@@ -19,7 +19,7 @@ homepage="http://pev.sourceforge.net/"
 distfiles="http://http.debian.net/debian/pool/main/p/pev/pev_${version}.orig.tar.gz"
 checksum=f68c8596f16d221d9a742812f6f728bcc739be90957bc1b00fbaa5943ffc5cfa
 
-if [ "$XBPS_TARGET_LIBC" = musl ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/planner/template b/srcpkgs/planner/template
index c76a38b87ea..7ffb4a0b205 100644
--- a/srcpkgs/planner/template
+++ b/srcpkgs/planner/template
@@ -18,7 +18,7 @@ if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" evolution-data-server-devel"
 fi
 pre_configure() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 		# In musl libc there is no _NL_TIME_FIRST_WEEKDAY in langinfo.h
 		# thus replace Posix.NLTime.FIRST_WEEKDAY.to_string ().data[0];
 		# with 0; (sunday)
diff --git a/srcpkgs/ppp/template b/srcpkgs/ppp/template
index 64a484a6fc7..efa94273aa1 100644
--- a/srcpkgs/ppp/template
+++ b/srcpkgs/ppp/template
@@ -28,7 +28,7 @@ conf_files="
 
 CFLAGS="-D_GNU_SOURCE"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/projectM/template b/srcpkgs/projectM/template
index ca2b22afdd9..2a0dbe5989e 100644
--- a/srcpkgs/projectM/template
+++ b/srcpkgs/projectM/template
@@ -15,7 +15,7 @@ homepage="https://github.com/projectM-visualizer/projectm"
 distfiles="${homepage}/releases/download/v${version}/projectM-${version}.tar.gz"
 checksum=30af6d1c108efc19311a5636efbbedbe83d23905bb8472dd3fe4b07a21fb5fd3
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-fts-devel"
 	export LDFLAGS+=" -lfts"
 fi
diff --git a/srcpkgs/proot/template b/srcpkgs/proot/template
index bf03af65a90..51bc4ee133f 100644
--- a/srcpkgs/proot/template
+++ b/srcpkgs/proot/template
@@ -14,7 +14,7 @@ homepage="https://proot-me.github.io"
 distfiles="https://github.com/proot-me/PRoot/archive/v${version}.tar.gz"
 checksum=ce0a3baca8312613bd10f65bb436a3aaa28e1034f498a22c35ad0693600e01dd
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/python3-elementpath/template b/srcpkgs/python3-elementpath/template
index 9f1a1fe1a8e..17fbb4eaec0 100644
--- a/srcpkgs/python3-elementpath/template
+++ b/srcpkgs/python3-elementpath/template
@@ -18,7 +18,7 @@ checksum=5bbce8de94551c84eb8371dae8f0c7a3850385b1f9d8e9adf9c801bb7c722ffe
 post_patch() {
 	# locale handling in musl is NOT that ideal,
 	# those tests are broken on musl
-	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	if xbps_target_libc musl; then
 		vsed -i tests/test_xpath2_functions.py \
 			-e "/compare.*Strassen.* 1/d" \
 			-e "/with self\.assertRaises(locale\.Error)/,+3d"
diff --git a/srcpkgs/qt5-webengine/template b/srcpkgs/qt5-webengine/template
index 09c41278a80..5bef412d1cd 100644
--- a/srcpkgs/qt5-webengine/template
+++ b/srcpkgs/qt5-webengine/template
@@ -34,7 +34,7 @@ if [ "$CROSS_BUILD" ]; then
 	 qt5-declarative-devel"
 fi
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index e8cc8990fe0..611a20f39cc 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -22,12 +22,12 @@ if [ "$CROSS_BUILD" ]; then
 	makedepends+=" clang llvm"
 fi
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" libexecinfo-devel"
 fi
 
 pre_configure() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 		vsed -i src/plugins/qmldesigner/qmldesignerplugin.pro \
 			src/plugins/clangformat/clangformat.pro \
 			-e "/LIBS += /aLIBS += -L${XBPS_CROSS_BASE}/usr/lib -lexecinfo"
diff --git a/srcpkgs/remmina/template b/srcpkgs/remmina/template
index 68aad77f6ec..7c4cc614817 100644
--- a/srcpkgs/remmina/template
+++ b/srcpkgs/remmina/template
@@ -22,6 +22,6 @@ changelog="https://gitlab.com/Remmina/Remmina/-/raw/master/CHANGELOG.md"
 distfiles="https://gitlab.com/Remmina/Remmina/-/archive/v${version}/Remmina-v${version}.tar.bz2"
 checksum=7614d447dc588403aff2ff97b253f46c5f03a6347d024618e84490b8ab4cd87b
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" libexecinfo-devel"
 fi
diff --git a/srcpkgs/rott/template b/srcpkgs/rott/template
index 8ed9236e672..50b1e0c3e2d 100644
--- a/srcpkgs/rott/template
+++ b/srcpkgs/rott/template
@@ -13,7 +13,7 @@ homepage="http://icculus.org/rott/"
 distfiles="${homepage}/releases/rott-${version}.tar.gz"
 checksum=102516e8c312f6b0bbf6c623e1f01cbfbbc314ace8adfe1f201d47b15bd927ff
 
-if [ "$XBPS_TARGET_LIBC" = musl ]; then
+if xbps_target_libc musl; then
 	makedepends+=" libexecinfo-devel"
 	export LDLIBS="-lexecinfo"
 fi
diff --git a/srcpkgs/rsyslog/template b/srcpkgs/rsyslog/template
index d1734805dd9..fe324ff0986 100644
--- a/srcpkgs/rsyslog/template
+++ b/srcpkgs/rsyslog/template
@@ -24,7 +24,7 @@ make_dirs="/etc/rsyslog.d 0755 root root"
 lib32disabled=yes
 disable_parallel_build=yes
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/ruby/template b/srcpkgs/ruby/template
index 5159f3c3b88..51c77dd6140 100644
--- a/srcpkgs/ruby/template
+++ b/srcpkgs/ruby/template
@@ -49,7 +49,7 @@ if [ "$CROSS_BUILD" ]; then
 fi
 
 post_patch() {
-	[ "$XBPS_TARGET_LIBC" = "glibc" ] && return 0
+	xbps_target_libc glibc && return 0
 
 	echo "Patching out using binary gems for non-glibc..."
 	patch -sNp1 -i ${FILESDIR}/rubygems-avoid-platform-specific-gems.patch
diff --git a/srcpkgs/rvault/template b/srcpkgs/rvault/template
index 8198657c82c..88e00e96233 100644
--- a/srcpkgs/rvault/template
+++ b/srcpkgs/rvault/template
@@ -17,7 +17,7 @@ homepage="https://github.com/rmind/rvault"
 distfiles="https://github.com/rmind/rvault/archive/v${version}.tar.gz"
 checksum=0927017cab3d0f29cb9e6cd537405aa3c1bf302d1285cb7c16da656ba73aa1be
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/samba/template b/srcpkgs/samba/template
index e4ccd9f083c..764f4dddccc 100644
--- a/srcpkgs/samba/template
+++ b/srcpkgs/samba/template
@@ -27,7 +27,7 @@ hostmakedepends="pkg-config perl python-devel"
 makedepends="readline-devel libcap-devel popt-devel e2fsprogs-devel mit-krb5-devel
  libldap-devel pam-devel acl-devel avahi-libs-devel tdb-devel talloc-devel cups-devel"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/siril/template b/srcpkgs/siril/template
index 25a7a414e72..69c947f3bef 100644
--- a/srcpkgs/siril/template
+++ b/srcpkgs/siril/template
@@ -15,7 +15,7 @@ homepage="https://www.siril.org/"
 distfiles="https://free-astro.org/download/${pkgname}-${version}.tar.bz2"
 checksum=9fb7f8a10630ea028137e8f213727519ae9916ea1d88cd8d0cc87f336d8d53b1
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" libexecinfo-devel"
 fi
 
diff --git a/srcpkgs/sniproxy/template b/srcpkgs/sniproxy/template
index 1aa2e194671..02640d3e1f7 100644
--- a/srcpkgs/sniproxy/template
+++ b/srcpkgs/sniproxy/template
@@ -16,7 +16,7 @@ conf_files="/etc/${pkgname}.conf"
 
 CFLAGS="-fcommon"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/squeak/template b/srcpkgs/squeak/template
index 409928a4fe5..115e5046c98 100644
--- a/srcpkgs/squeak/template
+++ b/srcpkgs/squeak/template
@@ -17,7 +17,7 @@ distfiles="http://squeakvm.org/unix/release/Squeak-${version}-src.tar.gz"
 checksum=3db6d12ea223e5bc49f52af7f6f832e383a3a006a53bc8a87f6469e1af5dfc2e
 
 # a terrible hack around terrible code
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	CFLAGS+=" -D__NEED_struct__IO_FILE"
 fi
 
diff --git a/srcpkgs/swiften/template b/srcpkgs/swiften/template
index 0db980396ee..de8077ec71e 100644
--- a/srcpkgs/swiften/template
+++ b/srcpkgs/swiften/template
@@ -12,7 +12,7 @@ homepage="http://swift.im/"
 distfiles="http://swift.im/git/swift/snapshot/swift-${version}.tar.bz2"
 checksum=2e48f081d337f471b4eba7c0c807a7b640216a76ed3568ced55abb5b927c7fd2
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/tacacs/template b/srcpkgs/tacacs/template
index d0cc7cce107..fc17de9df59 100644
--- a/srcpkgs/tacacs/template
+++ b/srcpkgs/tacacs/template
@@ -16,7 +16,7 @@ python_version=2
 disable_parallel_build=yes
 
 pre_configure() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 		patch -Np0 -i ${FILESDIR}/no-reap-child-test-no-nsl.patch
 	fi
 }
diff --git a/srcpkgs/tbb/template b/srcpkgs/tbb/template
index 65886aae299..5c124b6d239 100644
--- a/srcpkgs/tbb/template
+++ b/srcpkgs/tbb/template
@@ -45,7 +45,7 @@ post_extract() {
 
 	# alternative might be:
 	# https://git.alpinelinux.org/cgit/aports/tree/testing/libtbb/glibc-struct-mallinfo.patch
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	if xbps_target_libc musl; then
 		vsed -e "s@#define MALLOC_UNIXLIKE_OVERLOAD_ENABLED __linux__@@" \
 		  -i src/tbbmalloc/proxy.h
 	fi
diff --git a/srcpkgs/texi2mdoc/template b/srcpkgs/texi2mdoc/template
index 1d3eceaee50..f0c558b1c19 100644
--- a/srcpkgs/texi2mdoc/template
+++ b/srcpkgs/texi2mdoc/template
@@ -10,7 +10,7 @@ homepage="http://mdocml.bsd.lv/texi2mdoc"
 distfiles="http://mdocml.bsd.lv/texi2mdoc/snapshots/${pkgname}-${version}.tgz"
 checksum=7a45fd87c27cc8970a18db9ddddb2f09f18b8dd5152bf0ca377c3a5e7d304bfe
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/tomahawk/template b/srcpkgs/tomahawk/template
index 0edbacc5f8a..274c08d976c 100644
--- a/srcpkgs/tomahawk/template
+++ b/srcpkgs/tomahawk/template
@@ -36,7 +36,7 @@ if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" qt5-host-tools qt5-qmake"
 fi
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/transmission/template b/srcpkgs/transmission/template
index 83053ed4a68..0f5e1f33dd4 100644
--- a/srcpkgs/transmission/template
+++ b/srcpkgs/transmission/template
@@ -26,7 +26,7 @@ if [ -z "$CROSS_BUILD" ]; then
 	subpackages+=" transmission-qt"
 fi
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/trinity/template b/srcpkgs/trinity/template
index a7a561e89cb..21a2d19ade2 100644
--- a/srcpkgs/trinity/template
+++ b/srcpkgs/trinity/template
@@ -17,7 +17,7 @@ if [ "$CROSS_BUILD" ]; then
 	export CROSS_COMPILE=${XBPS_TARGET_TRIPLET}
 fi
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	CFLAGS+=" -Dloff_t=off_t"
 fi
 
diff --git a/srcpkgs/ttyd/template b/srcpkgs/ttyd/template
index 85bee66710e..a96e6d3e10c 100644
--- a/srcpkgs/ttyd/template
+++ b/srcpkgs/ttyd/template
@@ -13,7 +13,7 @@ homepage="https://tsl0922.github.io/ttyd/"
 distfiles="https://github.com/tsl0922/ttyd/archive/${version}.tar.gz"
 checksum=d14740bc82be0d0760dd0a3c97acbcbde490412a4edc61edabe46d311b068f83
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/vino/template b/srcpkgs/vino/template
index ce9af658784..3b587a227ae 100644
--- a/srcpkgs/vino/template
+++ b/srcpkgs/vino/template
@@ -16,6 +16,6 @@ homepage="https://wiki.gnome.org/action/show/Projects/Vino"
 distfiles="${GNOME_SITE}/$pkgname/${version%.*}/$pkgname-$version.tar.xz"
 checksum=2911c779b6a2c46e5bc8e5a0c94c2a4d5bd4a1ee7e35f2818702cb13d9d23bab
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
diff --git a/srcpkgs/vtk/template b/srcpkgs/vtk/template
index be751c69812..d9c16b0595e 100644
--- a/srcpkgs/vtk/template
+++ b/srcpkgs/vtk/template
@@ -21,7 +21,7 @@ checksum=1b39a5e191c282861e7af4101eaa8585969a2de05f5646c9199a161213a622c7
 
 nocross="hdf5 is nocross"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" libexecinfo-devel"
 	LDFLAGS="-lexecinfo"
 fi
diff --git a/srcpkgs/watchdog/template b/srcpkgs/watchdog/template
index 743b8d4f129..ec5ff9a17d1 100644
--- a/srcpkgs/watchdog/template
+++ b/srcpkgs/watchdog/template
@@ -11,7 +11,7 @@ distfiles="${SOURCEFORGE_SITE}/${pkgname}/${pkgname}-${version}.tar.gz"
 checksum=b8e7c070e1b72aee2663bdc13b5cc39f76c9232669cfbb1ac0adc7275a3b019d
 conf_files="/etc/watchdog.conf"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	broken="nfsmount.h:9:10: fatal error: rpc/rpc.h: No such file or directory"
 fi
 
diff --git a/srcpkgs/wayfire/template b/srcpkgs/wayfire/template
index 97cee3c6f98..a4e27a1f687 100644
--- a/srcpkgs/wayfire/template
+++ b/srcpkgs/wayfire/template
@@ -18,7 +18,7 @@ checksum="24c1a2c963dac5af762f87cd024bc3dd736ec9a28a6735d357a05e8f6502e8aa
 
 build_options="elogind"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" libexecinfo-devel"
 fi
 
diff --git a/srcpkgs/wayvnc/template b/srcpkgs/wayvnc/template
index 4ff4c5d3afb..96ee2e73ce7 100644
--- a/srcpkgs/wayvnc/template
+++ b/srcpkgs/wayvnc/template
@@ -12,7 +12,7 @@ homepage="https://github.com/any1/wayvnc"
 distfiles="https://github.com/any1/wayvnc/archive/v${version}.tar.gz"
 checksum=a4ee6f49a821b326e89b2534048687330bc84ed3984499ab2cf39422517fb731
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/webkit2gtk/template b/srcpkgs/webkit2gtk/template
index f4ffefa237b..9aa4955f50e 100644
--- a/srcpkgs/webkit2gtk/template
+++ b/srcpkgs/webkit2gtk/template
@@ -67,7 +67,7 @@ esac
 case "$XBPS_TARGET_MACHINE" in
 	aarch64*|x86_64*)
 		build_options_default+=" jit"
-		if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then
+		if xbps_target_libc glibc; then
 			build_options_default+=" sampling_profiler"
 		elif [ "$build_option_sampling_profiler" ]; then
 			broken="sampling_profiler is only supported on glibc"
diff --git a/srcpkgs/widelands/template b/srcpkgs/widelands/template
index 061040d9ae4..23cb6bc1c04 100644
--- a/srcpkgs/widelands/template
+++ b/srcpkgs/widelands/template
@@ -20,7 +20,7 @@ checksum=601e0e4c6f91b3fb0ece2cd1b83ecfb02344a1b9194fbb70ef3f70e06994e357
 
 CXXFLAGS="-DU_USING_ICU_NAMESPACE=1"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" libexecinfo-devel gettext-devel"
 fi
 
diff --git a/srcpkgs/wmfs/template b/srcpkgs/wmfs/template
index 17f350c60ad..c718a9b0916 100644
--- a/srcpkgs/wmfs/template
+++ b/srcpkgs/wmfs/template
@@ -16,7 +16,7 @@ checksum=c28b7cec28a6e3f2bc38a136fb1773bab8ec8f48c69ebe25c24192f96e782d64
 
 CFLAGS="-I${XBPS_CROSS_BASE}/usr/include/freetype2 -fcommon"
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/workrave/template b/srcpkgs/workrave/template
index 733e6d13f79..fa37a9aff91 100644
--- a/srcpkgs/workrave/template
+++ b/srcpkgs/workrave/template
@@ -21,7 +21,7 @@ checksum=31a090b48c67c5a2ccb73fb56633f182fcc6d7aca5ec6376146671c72fda1444
 
 build_options="pulseaudio"
 
-if [ "$XBPS_TARGET_LIBC" = musl ]; then
+if xbps_target_libc musl; then
 	makedepends+=" gettext-devel"
 	LDFLAGS="-lintl"
 fi
diff --git a/srcpkgs/xcb-util-xrm/template b/srcpkgs/xcb-util-xrm/template
index 83fa1ee05a1..551bd646d34 100644
--- a/srcpkgs/xcb-util-xrm/template
+++ b/srcpkgs/xcb-util-xrm/template
@@ -12,7 +12,7 @@ homepage="https://github.com/Airblader/xcb-util-xrm"
 distfiles="https://github.com/Airblader/xcb-util-xrm/archive/v${version}.tar.gz"
 checksum=9d4a66c7366abb4840f6f822c613e1776c5898235358de728ba4554263fa0783
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
diff --git a/srcpkgs/yaz/template b/srcpkgs/yaz/template
index 85f207fa4b6..fccb17b92d6 100644
--- a/srcpkgs/yaz/template
+++ b/srcpkgs/yaz/template
@@ -15,10 +15,10 @@ homepage="https://www.indexdata.com/resources/software/yaz/"
 distfiles="http://ftp.indexdata.dk/pub/yaz/yaz-${version}.tar.gz"
 checksum=311bcb386d6327dfa22e0e442aea26d1be7c633eb664b9f70d982f072a130112
 
-case "$XBPS_TARGET_LIBC" in
-	musl) makedepends+=" libexecinfo-devel"
-		LDFLAGS+=" -lexecinfo" ;;
-esac
+if xbps_target_libc musl; then
+	makedepends+=" libexecinfo-devel"
+	LDFLAGS="-lexecinfo"
+fi
 
 post_install() {
 	vlicense LICENSE
diff --git a/srcpkgs/zeek/template b/srcpkgs/zeek/template
index 825e56e0fe4..360de181e48 100644
--- a/srcpkgs/zeek/template
+++ b/srcpkgs/zeek/template
@@ -14,7 +14,7 @@ homepage="https://www.zeek.org"
 distfiles="https://old.zeek.org/downloads/zeek-${version}.tar.gz"
 checksum=af3ee5635140a54d305667983d38ea28f36457c9f2f8727e90ea3ef00b22c44f
 
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+if xbps_target_libc musl; then
 	makedepends+=" musl-fts-devel musl-legacy-compat"
 fi
 

From b248dcc2601913924968d2043b1011d425a3c113 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Sat, 29 Aug 2020 23:05:55 -0300
Subject: [PATCH 3/3] srcpkgs: use xbps_target_no_atomic8.

[ci skip]
---
 srcpkgs/Aegisub/template              | 2 +-
 srcpkgs/CubicSDR/template             | 2 +-
 srcpkgs/FreeRADIUS/template           | 2 +-
 srcpkgs/LGOGDownloader/template       | 2 +-
 srcpkgs/QMPlay2/template              | 2 +-
 srcpkgs/RandomX/template              | 2 +-
 srcpkgs/ahoviewer/template            | 4 ++--
 srcpkgs/akonadi5/template             | 4 ++--
 srcpkgs/alembic/template              | 2 +-
 srcpkgs/android-tools/template        | 4 ++--
 srcpkgs/apr-util/template             | 2 +-
 srcpkgs/apr/template                  | 2 +-
 srcpkgs/arcan/template                | 2 +-
 srcpkgs/audacity/template             | 2 +-
 srcpkgs/bacula-common/template        | 2 +-
 srcpkgs/ccls/template                 | 4 ++--
 srcpkgs/cereal/template               | 2 +-
 srcpkgs/chatterino2/template          | 2 +-
 srcpkgs/cmus/template                 | 2 +-
 srcpkgs/corectrl/template             | 2 +-
 srcpkgs/dhcp/template                 | 4 ++--
 srcpkgs/encfs/template                | 2 +-
 srcpkgs/filezilla/template            | 2 +-
 srcpkgs/firefox-esr/template          | 4 ++--
 srcpkgs/firefox/template              | 4 ++--
 srcpkgs/fish-shell/template           | 2 +-
 srcpkgs/flacon/template               | 2 +-
 srcpkgs/fswatch/template              | 2 +-
 srcpkgs/giada/template                | 4 ++--
 srcpkgs/gnunet/template               | 2 +-
 srcpkgs/goxel/template                | 4 ++--
 srcpkgs/grpc/template                 | 2 +-
 srcpkgs/haproxy/template              | 2 +-
 srcpkgs/icecat/template               | 4 ++--
 srcpkgs/inkscape/template             | 2 +-
 srcpkgs/jack_capture/template         | 2 +-
 srcpkgs/kiwix-lib/template            | 2 +-
 srcpkgs/kiwix-tools/template          | 2 +-
 srcpkgs/kjsembed/template             | 2 +-
 srcpkgs/krita/template                | 2 +-
 srcpkgs/kross/template                | 2 +-
 srcpkgs/kwin/template                 | 2 +-
 srcpkgs/libbitcoin-explorer/template  | 2 +-
 srcpkgs/libfilezilla/template         | 2 +-
 srcpkgs/libogre/template              | 2 +-
 srcpkgs/libopenshot-audio/template    | 2 +-
 srcpkgs/libreoffice/template          | 2 +-
 srcpkgs/libtd/template                | 2 +-
 srcpkgs/libtorrent-rasterbar/template | 2 +-
 srcpkgs/monero-gui/template           | 2 +-
 srcpkgs/monero/template               | 4 ++--
 srcpkgs/mozjs52/template              | 2 +-
 srcpkgs/mozjs60/template              | 2 +-
 srcpkgs/mozjs68/template              | 2 +-
 srcpkgs/musikcube/template            | 2 +-
 srcpkgs/namecoin/template             | 2 +-
 srcpkgs/nix/template                  | 4 ++--
 srcpkgs/nodejs-lts-10/template        | 2 +-
 srcpkgs/nodejs-lts/template           | 2 +-
 srcpkgs/nodejs/template               | 2 +-
 srcpkgs/opencv/template               | 2 +-
 srcpkgs/opencv4/template              | 2 +-
 srcpkgs/openimageio/template          | 4 ++--
 srcpkgs/openmw/template               | 2 +-
 srcpkgs/openvdb/template              | 4 ++--
 srcpkgs/paraview/template             | 4 ++--
 srcpkgs/pipewire/template             | 2 +-
 srcpkgs/protobuf24/template           | 2 +-
 srcpkgs/qpdf/template                 | 2 +-
 srcpkgs/qt5-webengine/template        | 2 +-
 srcpkgs/qt5-webkit/template           | 2 +-
 srcpkgs/qtox/template                 | 2 +-
 srcpkgs/rocksdb/template              | 4 ++--
 srcpkgs/snapcast/template             | 2 +-
 srcpkgs/sonic-visualiser/template     | 4 ++--
 srcpkgs/squid/template                | 2 +-
 srcpkgs/stockfish/template            | 2 +-
 srcpkgs/swi-prolog/template           | 2 +-
 srcpkgs/sysbench/template             | 2 +-
 srcpkgs/thrift/template               | 2 +-
 srcpkgs/thunderbird/template          | 4 ++--
 srcpkgs/tomahawk/template             | 2 +-
 82 files changed, 100 insertions(+), 100 deletions(-)

diff --git a/srcpkgs/Aegisub/template b/srcpkgs/Aegisub/template
index 7410825542b..daf45edeb92 100644
--- a/srcpkgs/Aegisub/template
+++ b/srcpkgs/Aegisub/template
@@ -27,7 +27,7 @@ desc_option_portaudio="Enable support for portaudio"
 
 LDFLAGS+=" -pthread"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+="libatomic-devel"
 	configure_args+=" --with-libatomic"
 fi
diff --git a/srcpkgs/CubicSDR/template b/srcpkgs/CubicSDR/template
index 2f8c589d9ae..0b59015521f 100644
--- a/srcpkgs/CubicSDR/template
+++ b/srcpkgs/CubicSDR/template
@@ -18,7 +18,7 @@ checksum=5cb44c110fcbbb70a468b7fa402cf35f84d8901b3dd42d471a90ac3f5db00f4d
 build_options="alsa pulseaudio jack"
 build_options_default="alsa pulseaudio"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	configure_args+=" -DOTHER_LIBRARIES=atomic"
 fi
diff --git a/srcpkgs/FreeRADIUS/template b/srcpkgs/FreeRADIUS/template
index ad05f62732d..0110dc4c42f 100644
--- a/srcpkgs/FreeRADIUS/template
+++ b/srcpkgs/FreeRADIUS/template
@@ -16,7 +16,7 @@ nocross=yes # Not supported by upstream
 system_accounts="_freeradius"
 make_dirs="/etc/raddb 0750 _freeradius _freeradius"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
diff --git a/srcpkgs/LGOGDownloader/template b/srcpkgs/LGOGDownloader/template
index 1ad9e8165b7..3e3ef8f5393 100644
--- a/srcpkgs/LGOGDownloader/template
+++ b/srcpkgs/LGOGDownloader/template
@@ -15,6 +15,6 @@ distfiles="https://github.com/Sude-/lgogdownloader/archive/v${version}.tar.gz"
 checksum=38e0c8cdff395d92754dda630bf6f3c64e45ae2b0cf696a47a299f879fefa9ac
 
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
diff --git a/srcpkgs/QMPlay2/template b/srcpkgs/QMPlay2/template
index 4fdb278054d..5b3c3aca877 100644
--- a/srcpkgs/QMPlay2/template
+++ b/srcpkgs/QMPlay2/template
@@ -17,7 +17,7 @@ changelog="https://raw.githubusercontent.com/zaps166/QMPlay2/master/ChangeLog"
 distfiles="https://github.com/zaps166/QMPlay2/releases/download/${version}/QMPlay2-src-${version}.tar.xz"
 checksum=0f71152708b4b217a9b62ea3690688bc6566812bfc94abf7d4cb6149cc12e3be
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	configure_args+=" -DCMAKE_CXX_STANDARD_LIBRARIES=-latomic"
 fi
diff --git a/srcpkgs/RandomX/template b/srcpkgs/RandomX/template
index 8d2bba4f93d..efee92c9e61 100644
--- a/srcpkgs/RandomX/template
+++ b/srcpkgs/RandomX/template
@@ -10,7 +10,7 @@ homepage="https://github.com/tevador/RandomX"
 distfiles="https://github.com/tevador/RandomX/archive/v${version}.tar.gz"
 checksum=f982a12d18b1d260bef2a1d3c46ae4902975fbf63abb38ca6413c96d1778db3a
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	CFLAGS+=" -Wl,-latomic"
 	makedepends="libatomic-devel"
 fi
diff --git a/srcpkgs/ahoviewer/template b/srcpkgs/ahoviewer/template
index a231be63f6a..f95fdc613e4 100644
--- a/srcpkgs/ahoviewer/template
+++ b/srcpkgs/ahoviewer/template
@@ -17,12 +17,12 @@ distfiles="${homepage}/archive/${version}.tar.gz"
 checksum=a14e32b4a8095c9f8b4b607c090a50cc8ac1076550e57b5a9303c54089068152
 nocross="https://travis-ci.org/void-linux/void-packages/jobs/490108528#L1022"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
 post_patch() {
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		echo "ahoviewer_LDADD += -latomic" >> src/Makefile.am
 	fi
 }
diff --git a/srcpkgs/akonadi5/template b/srcpkgs/akonadi5/template
index d2f7a63a800..76107f43cba 100644
--- a/srcpkgs/akonadi5/template
+++ b/srcpkgs/akonadi5/template
@@ -23,12 +23,12 @@ if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" qt5-tools-devel qt5-devel kconfig kcoreaddons"
 fi
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
 pre_configure() {
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		vsed -e "s;^\(target_link_libraries(.*\);\1 atomic;" -i src/server/CMakeLists.txt
 	fi
 }
diff --git a/srcpkgs/alembic/template b/srcpkgs/alembic/template
index 71fc79c0da4..76db5319708 100644
--- a/srcpkgs/alembic/template
+++ b/srcpkgs/alembic/template
@@ -21,7 +21,7 @@ if [ -z "$CROSS_BUILD" ]; then
 	makedepends+=" hdf5-devel"
 fi
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 
 	post_patch() {
diff --git a/srcpkgs/android-tools/template b/srcpkgs/android-tools/template
index 7e011afdb69..4a2959a24c0 100644
--- a/srcpkgs/android-tools/template
+++ b/srcpkgs/android-tools/template
@@ -13,7 +13,7 @@ homepage="http://developer.android.com/tools/help/adb.html"
 distfiles="https://github.com/nmeum/android-tools/releases/download/${version}/android-tools-${version}.tar.xz"
 checksum=7fb1c127c36b0752657593838b6823743bf8e5730f9f8b0f7ba2c185424cf376
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
@@ -32,7 +32,7 @@ pre_configure() {
 		configure_args+=" ${boring_ssl_cmake_args}"
 	fi
 
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		sed -i vendor/CMakeLists.adb.txt \
 			-e "/target_link_libraries/s;$; atomic;"
 	fi
diff --git a/srcpkgs/apr-util/template b/srcpkgs/apr-util/template
index e78d1ee2714..ee8d4216725 100644
--- a/srcpkgs/apr-util/template
+++ b/srcpkgs/apr-util/template
@@ -20,7 +20,7 @@ homepage="http://apr.apache.org/"
 distfiles="http://www.apache.org/dist/apr/${pkgname}-${version}.tar.bz2"
 checksum=d3e12f7b6ad12687572a3a39475545a072608f4ba03a6ce8a3778f607dd0035b
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS="-latomic"
 fi
diff --git a/srcpkgs/apr/template b/srcpkgs/apr/template
index f2dc1241668..613c0102877 100644
--- a/srcpkgs/apr/template
+++ b/srcpkgs/apr/template
@@ -24,7 +24,7 @@ if [ "$CROSS_BUILD" ]; then
 	configure_args+=" ac_cv_func_sem_open=sem_open"
 fi
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS="-latomic"
 fi
diff --git a/srcpkgs/arcan/template b/srcpkgs/arcan/template
index 2e97c411161..9a11cc2d925 100644
--- a/srcpkgs/arcan/template
+++ b/srcpkgs/arcan/template
@@ -26,7 +26,7 @@ else
 fi
 
 CFLAGS="-fcommon"
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	CFLAGS="-latomic"
 fi
diff --git a/srcpkgs/audacity/template b/srcpkgs/audacity/template
index 7f4d0a49098..a5be3e845b0 100644
--- a/srcpkgs/audacity/template
+++ b/srcpkgs/audacity/template
@@ -24,7 +24,7 @@ case "$XBPS_TARGET_MACHINE" in
 	*) configure_args+=" --disable-sse" ;;
 esac
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS="-latomic"
 fi
diff --git a/srcpkgs/bacula-common/template b/srcpkgs/bacula-common/template
index 02c9bb07fcf..d148498c6f6 100644
--- a/srcpkgs/bacula-common/template
+++ b/srcpkgs/bacula-common/template
@@ -18,7 +18,7 @@ checksum=a40d04d2c48135972cecb6578405e835c4b9d798c0950017de0fad40ca94e8a0
 alternatives="bacula-db-backend:/usr/lib/libbaccats-${version}.so:/usr/lib/libbaccats-sqlite3-${version}.so"
 shlib_provides="libbaccats-${version}.so"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index bebfa0f4c61..9d848bcab94 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -13,12 +13,12 @@ distfiles="https://github.com/MaskRay/ccls/archive/${version}.tar.gz"
 checksum=83dd45120e9674319f91e4379013831e124c0858e050bbc3521e3f8aebe5c95b
 nocross="Clang cannot be installed as makedep"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
 post_extract() {
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		echo "target_link_libraries(ccls PRIVATE atomic)" >> CMakeLists.txt
 	fi
 }
diff --git a/srcpkgs/cereal/template b/srcpkgs/cereal/template
index c454ed85833..243965c4b3a 100644
--- a/srcpkgs/cereal/template
+++ b/srcpkgs/cereal/template
@@ -12,7 +12,7 @@ homepage="https://uscilab.github.io/cereal"
 distfiles="https://github.com/USCiLab/cereal/archive/v${version}.tar.gz"
 checksum=329ea3e3130b026c03a4acc50e168e7daff4e6e661bc6a7dfec0d77b570851d5
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS+=" -latomic"
 	configure_args+=" -DCMAKE_CXX_STANDARD_LIBRARIES=-latomic"
diff --git a/srcpkgs/chatterino2/template b/srcpkgs/chatterino2/template
index 9c38a6bf08b..99131c2ee41 100644
--- a/srcpkgs/chatterino2/template
+++ b/srcpkgs/chatterino2/template
@@ -27,7 +27,7 @@ checksum="c017005d1098af9bddafaef013e8d1120cb805101125b3a20df2bd7dd413ccce
 196ebfe37e6cdf61eaa1650b570cd50fcf6d8fc4c0aa408ff540b017d71ec634
 2945e445ecaa183c8678f0c1c33cd0b6957ef2ac9218ac630cced31c147c0b11"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	configure_args+=" LIBS+=-latomic"
 fi
diff --git a/srcpkgs/cmus/template b/srcpkgs/cmus/template
index 9f6a1d9a6ee..708f03740e7 100644
--- a/srcpkgs/cmus/template
+++ b/srcpkgs/cmus/template
@@ -20,7 +20,7 @@ build_options="elogind"
 build_options_default="elogind"
 desc_option_elogind="Support MPRIS interface via elogind"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	export LDLIBS+=" -latomic"
 fi
diff --git a/srcpkgs/corectrl/template b/srcpkgs/corectrl/template
index 386013e022e..970f8f31c55 100644
--- a/srcpkgs/corectrl/template
+++ b/srcpkgs/corectrl/template
@@ -17,7 +17,7 @@ distfiles="${homepage}/-/archive/v${version}/corectrl-v${version}.tar.gz"
 checksum=050f1b4f105615c26dcb23d09bbdadbc619c9b9782197cae482fb6921f5e3cf2
 patch_args="-Np1"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS+=" -latomic"
 	configure_args+=" -DCMAKE_CXX_STANDARD_LIBRARIES=-latomic"
diff --git a/srcpkgs/dhcp/template b/srcpkgs/dhcp/template
index d31df6728c1..4ee9e9fe297 100644
--- a/srcpkgs/dhcp/template
+++ b/srcpkgs/dhcp/template
@@ -12,7 +12,7 @@ homepage="https://www.isc.org/downloads/dhcp"
 distfiles="http://ftp.isc.org/isc/dhcp/${version/P/-P}/dhcp-${version/P/-P}.tar.gz"
 checksum=1a7ccd64a16e5e68f7b5e0f527fd07240a2892ea53fe245620f4f5f607004521
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
@@ -24,7 +24,7 @@ make_dirs="/var/lib/dhcp 0755 root root"
 CFLAGS="-fcommon"
 
 post_patch() {
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		vsed -i "/LIBATOMIC=/s/$/-latomic/" configure.ac
 	fi
 }
diff --git a/srcpkgs/encfs/template b/srcpkgs/encfs/template
index 36a4613197c..a3067f4fda9 100644
--- a/srcpkgs/encfs/template
+++ b/srcpkgs/encfs/template
@@ -18,7 +18,7 @@ if [ "$CROSS_BUILD" ]; then
 	configure_args="-DBUILD_UNIT_TESTS=0"
 fi
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS+=" -latomic"
 fi
diff --git a/srcpkgs/filezilla/template b/srcpkgs/filezilla/template
index c2391aa16bc..864b87cf17f 100644
--- a/srcpkgs/filezilla/template
+++ b/srcpkgs/filezilla/template
@@ -21,6 +21,6 @@ if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" wxWidgets-gtk3-devel xdg-utils"
 fi
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
diff --git a/srcpkgs/firefox-esr/template b/srcpkgs/firefox-esr/template
index eb3c32bed59..99baa4e68d6 100644
--- a/srcpkgs/firefox-esr/template
+++ b/srcpkgs/firefox-esr/template
@@ -36,7 +36,7 @@ case $XBPS_TARGET_MACHINE in
 	ppc*) broken="xptcall bitrot" ;;
 esac
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
@@ -90,7 +90,7 @@ do_build() {
 	ppc*) echo "ac_add_options --disable-webrtc" >>.mozconfig ;;
 	esac
 
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		export LDFLAGS+=" -latomic"
 	fi
 
diff --git a/srcpkgs/firefox/template b/srcpkgs/firefox/template
index 6a7eba8d957..1dc3d1fcdb6 100644
--- a/srcpkgs/firefox/template
+++ b/srcpkgs/firefox/template
@@ -36,7 +36,7 @@ case $XBPS_TARGET_MACHINE in
 	ppc*) broken="xptcall bitrot" ;;
 esac
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
@@ -91,7 +91,7 @@ do_build() {
 	ppc*) echo "ac_add_options --disable-webrtc" >>.mozconfig ;;
 	esac
 
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		export LDFLAGS+=" -latomic"
 	fi
 
diff --git a/srcpkgs/fish-shell/template b/srcpkgs/fish-shell/template
index a5411375dd8..0d864c12533 100644
--- a/srcpkgs/fish-shell/template
+++ b/srcpkgs/fish-shell/template
@@ -14,7 +14,7 @@ distfiles="https://github.com/fish-shell/fish-shell/releases/download/${version}
 checksum=d5b927203b5ca95da16f514969e2a91a537b2f75bec9b21a584c4cd1c7aa74ed
 register_shell="/bin/fish /usr/bin/fish"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
diff --git a/srcpkgs/flacon/template b/srcpkgs/flacon/template
index efdc282a78b..fc902589a24 100644
--- a/srcpkgs/flacon/template
+++ b/srcpkgs/flacon/template
@@ -16,7 +16,7 @@ checksum=b6af83ed30697ed82369d3eefaf8fcceabea69fc86a1d6d1a5594cc5768bad7b
 
 post_extract() {
 	# no support for 64-bit atomics on these platforms in qt
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		vsed -i 's/QAtomicInteger<quint64>/QAtomicInteger<quint32>/' \
 			converter/splitter.cpp
 	fi
diff --git a/srcpkgs/fswatch/template b/srcpkgs/fswatch/template
index 48a53b11977..d95b2af2f82 100644
--- a/srcpkgs/fswatch/template
+++ b/srcpkgs/fswatch/template
@@ -12,7 +12,7 @@ homepage="https://emcrisostomo.github.io/fswatch/"
 distfiles="https://github.com/emcrisostomo/fswatch/releases/download/${version}/fswatch-${version}.tar.gz"
 checksum=44d5707adc0e46d901ba95a5dc35c5cc282bd6f331fcf9dbf9fad4af0ed5b29d
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
diff --git a/srcpkgs/giada/template b/srcpkgs/giada/template
index 1e8714a6871..3c27767e949 100644
--- a/srcpkgs/giada/template
+++ b/srcpkgs/giada/template
@@ -15,12 +15,12 @@ homepage="https://www.giadamusic.com/"
 distfiles="https://github.com/monocasual/giada/archive/v${version}.tar.gz"
 checksum=a2ee69e66bfb4504ce4f91e758315d42e6b83d7b8b0db2eb1d89ab245342f73c
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
 post_extract() {
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		vsed -e 's/\($(ldAdd)\)/\1 -latomic/g' -i Makefile.am
 	fi
 	vsed -e 's;deps/json/single_include/\(nlohmann/json.hpp\);\1;' -i \
diff --git a/srcpkgs/gnunet/template b/srcpkgs/gnunet/template
index 0ca97a9168d..3f2dcfe4e2e 100644
--- a/srcpkgs/gnunet/template
+++ b/srcpkgs/gnunet/template
@@ -36,7 +36,7 @@ desc_option_jansson="Enable support for jansson"
 desc_option_opus="Enable support for opus"
 desc_option_zbar="Enable support for zbar"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
diff --git a/srcpkgs/goxel/template b/srcpkgs/goxel/template
index 18c7a5ee423..ade99a69e15 100644
--- a/srcpkgs/goxel/template
+++ b/srcpkgs/goxel/template
@@ -13,7 +13,7 @@ homepage="https://guillaumechereau.github.io/goxel/"
 distfiles="https://github.com/guillaumechereau/goxel/archive/v${version}.tar.gz"
 checksum=af57197910788131441a537cc658a3397448d90552a0fd3bfe9992635e9d64d8
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
@@ -23,7 +23,7 @@ pre_build() {
 			-e "/conf = env.Configure()/ a env.Replace(CC = \"$CC\")" \
 			-e "/conf = env.Configure()/ a env.Replace(CXX = \"$CXX\")"
 	fi
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		vsed -i SConstruct \
 			-e "/conf = env.Configure()/ a env.Append(LIBS='atomic')"
 	fi
diff --git a/srcpkgs/grpc/template b/srcpkgs/grpc/template
index fbdbf527ea4..b302f4b5c3d 100644
--- a/srcpkgs/grpc/template
+++ b/srcpkgs/grpc/template
@@ -22,7 +22,7 @@ checksum="c2ab8a42a0d673c1acb596d276055adcc074c1116e427f118415da3e79e52969
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" grpc"   # need host grpc_cpp_plugin
 fi
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	configure_args+=" -DCMAKE_CXX_STANDARD_LIBRARIES=-latomic"
 fi
diff --git a/srcpkgs/haproxy/template b/srcpkgs/haproxy/template
index a51a4126e14..de59192a456 100644
--- a/srcpkgs/haproxy/template
+++ b/srcpkgs/haproxy/template
@@ -21,7 +21,7 @@ system_accounts="$pkgname"
 do_build() {
 	local target="linux-${XBPS_TARGET_LIBC}"
 	local atomic
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		atomic="-latomic"
 	fi
 	make ${makejobs} CC="$CC" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" EXTRA= \
diff --git a/srcpkgs/icecat/template b/srcpkgs/icecat/template
index a717e9b4093..6ed89b04b95 100644
--- a/srcpkgs/icecat/template
+++ b/srcpkgs/icecat/template
@@ -36,7 +36,7 @@ fi
 
 CXXFLAGS="-Wno-class-memaccess -Wno-unused-function"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 if [ "$XBPS_WORDSIZE" -eq 32 ]; then
@@ -98,7 +98,7 @@ do_build() {
 	ppc*) echo "ac_add_options --disable-webrtc" >>.mozconfig ;;
 	esac
 
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		export LDFLAGS+=" -latomic"
 	fi
 
diff --git a/srcpkgs/inkscape/template b/srcpkgs/inkscape/template
index cd322cfafa6..df37ac749f9 100644
--- a/srcpkgs/inkscape/template
+++ b/srcpkgs/inkscape/template
@@ -19,7 +19,7 @@ checksum="673a1d8dfff4993917ac560d73ded4cab6edf8360cb97b99703658b14c03031f
  11d573e30d4b0c821e9c59a524c9f98b935dcfdad979066cc65fdf111cf116fe"
 python_version=3
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
diff --git a/srcpkgs/jack_capture/template b/srcpkgs/jack_capture/template
index 5b604fdb2ed..7bd0c173fee 100644
--- a/srcpkgs/jack_capture/template
+++ b/srcpkgs/jack_capture/template
@@ -13,7 +13,7 @@ distfiles="https://github.com/kmatheussen/${pkgname}/archive/${version}.tar.gz"
 checksum=21afb0257ed7437708cc9e5bec2f6299599461b7eec8bf66967d8ecadb0751de
 CFLAGS+=" -D__USE_GNU"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS+=" -latomic"
 fi
diff --git a/srcpkgs/kiwix-lib/template b/srcpkgs/kiwix-lib/template
index aaa20e9bf47..b945154bd45 100644
--- a/srcpkgs/kiwix-lib/template
+++ b/srcpkgs/kiwix-lib/template
@@ -14,7 +14,7 @@ changelog="https://github.com/kiwix/kiwix-lib/blob/${version}/ChangeLog"
 distfiles="https://github.com/kiwix/kiwix-lib/archive/${version}.tar.gz"
 checksum=b36500af589797e220d0a5fc551047f016c8914ac2d4b04666daef977aa0a4ce
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ] || [ "${XBPS_TARGET_MACHINE/-musl/}" = "armv7l" ]; then
+if xbps_target_no_atomic8 || [ "${XBPS_TARGET_MACHINE/-musl/}" = "armv7l" ]; then
 	makedepends+=" libatomic-devel"
 fi
 
diff --git a/srcpkgs/kiwix-tools/template b/srcpkgs/kiwix-tools/template
index 10fd9b543a2..3f4af3ac8f9 100644
--- a/srcpkgs/kiwix-tools/template
+++ b/srcpkgs/kiwix-tools/template
@@ -13,7 +13,7 @@ changelog="https://github.com/kiwix/kiwix-tools/blob/${version}/Changelog"
 distfiles="https://github.com/kiwix/kiwix-tools/archive/${version}.tar.gz"
 checksum=86325ec31976d40357f08c520806cf223fa1b0a5edb02ad106c2a0d6746ca364
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ] || [ "${XBPS_TARGET_MACHINE/-musl/}" = "armv7l" ]; then
+if xbps_target_no_atomic8 || [ "${XBPS_TARGET_MACHINE/-musl/}" = "armv7l" ]; then
 	makedepends+=" libatomic-devel"
 fi
 
diff --git a/srcpkgs/kjsembed/template b/srcpkgs/kjsembed/template
index 4cbaf968fa4..70e539e339d 100644
--- a/srcpkgs/kjsembed/template
+++ b/srcpkgs/kjsembed/template
@@ -17,7 +17,7 @@ if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" qt5-host-tools qt5-qmake python kdoctools"
 fi
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
diff --git a/srcpkgs/krita/template b/srcpkgs/krita/template
index a3f5f8fbe16..c4a7742bcb9 100644
--- a/srcpkgs/krita/template
+++ b/srcpkgs/krita/template
@@ -26,6 +26,6 @@ case "$XBPS_TARGET_MACHINE" in
 	i686*|x86_64*) makedepends+=" vc";;
 esac
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
diff --git a/srcpkgs/kross/template b/srcpkgs/kross/template
index e85eb25b057..0933d0cf4ed 100644
--- a/srcpkgs/kross/template
+++ b/srcpkgs/kross/template
@@ -15,7 +15,7 @@ homepage="https://invent.kde.org/frameworks/kross"
 distfiles="${KDE_SITE}/frameworks/${version%.*}/portingAids/${pkgname}-${version}.tar.xz"
 checksum=aa27b434da981f64c40985a61ee041417667844c6077c9fb52456635be67546e
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
diff --git a/srcpkgs/kwin/template b/srcpkgs/kwin/template
index 1c4be59b4e3..52ef675b248 100644
--- a/srcpkgs/kwin/template
+++ b/srcpkgs/kwin/template
@@ -23,7 +23,7 @@ if [ "$CROSS_BUILD" ]; then
 	configure_args+=" -DDESKTOPTOJSON_EXECUTABLE=/usr/bin/desktoptojson"
 fi
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
diff --git a/srcpkgs/libbitcoin-explorer/template b/srcpkgs/libbitcoin-explorer/template
index 39c2a55f654..4a0ffb23019 100644
--- a/srcpkgs/libbitcoin-explorer/template
+++ b/srcpkgs/libbitcoin-explorer/template
@@ -19,7 +19,7 @@ distfiles="https://github.com/libbitcoin/libbitcoin-explorer/archive/v${version}
 checksum=e1b3fa2723465f7366a6e8c55e14df53106e90b82cc977db638c78f9bc5c47db
 conf_files="/etc/libbitcoin/bx.cfg"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS="-latomic"
 fi
diff --git a/srcpkgs/libfilezilla/template b/srcpkgs/libfilezilla/template
index 0c0bff7fcee..8e7c130f37e 100644
--- a/srcpkgs/libfilezilla/template
+++ b/srcpkgs/libfilezilla/template
@@ -15,7 +15,7 @@ changelog="https://svn.filezilla-project.org/filezilla/libfilezilla/trunk/NEWS?v
 distfiles="https://download.filezilla-project.org/${pkgname}/${pkgname}-${version}.tar.bz2"
 checksum=adeac127fbd1714b22c828cdd27fc6c92e09fd1abcc96684bf30535fb8226852
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS+=" -latomic"
 fi
diff --git a/srcpkgs/libogre/template b/srcpkgs/libogre/template
index d94aa7497b5..1532bbba5ab 100644
--- a/srcpkgs/libogre/template
+++ b/srcpkgs/libogre/template
@@ -26,7 +26,7 @@ wrksrc=ogre-$version
 CXXFLAGS="-fcheck-new -fno-delete-null-pointer-checks -fno-lifetime-dse"
 
 pre_configure() {
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		find -name CMakeLists.txt -exec sed -i "{}" \
 			-e "/target_link_libraries/s/)/ atomic)/" \;
 	fi
diff --git a/srcpkgs/libopenshot-audio/template b/srcpkgs/libopenshot-audio/template
index d9a6a719734..658a7da7d1b 100644
--- a/srcpkgs/libopenshot-audio/template
+++ b/srcpkgs/libopenshot-audio/template
@@ -15,7 +15,7 @@ checksum=937ff4f1c2dfb8ab5d56ad85beacaa29dfd5a79af0d9cf647386034fe9882309
 
 CXXFLAGS="-I${XBPS_CROSS_BASE}/usr/include/freetype2"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	CXXFLAGS+=" -latomic "
 fi
diff --git a/srcpkgs/libreoffice/template b/srcpkgs/libreoffice/template
index 5ecc19c3e11..dfb0b74531c 100644
--- a/srcpkgs/libreoffice/template
+++ b/srcpkgs/libreoffice/template
@@ -263,7 +263,7 @@ if xbps_target_libc musl; then
 	makedepends+=" libexecinfo-devel"
 fi
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
diff --git a/srcpkgs/libtd/template b/srcpkgs/libtd/template
index abdf8792837..b6e3f67dbbb 100755
--- a/srcpkgs/libtd/template
+++ b/srcpkgs/libtd/template
@@ -18,7 +18,7 @@ if [ "$XBPS_TARGET_ENDIAN" = "be" ]; then
 	broken="Unsupported tl-schema version -1"
 fi
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	configure_args+=" -DCMAKE_CXX_STANDARD_LIBRARIES=-latomic"
 	makedepends+=" libatomic-devel"
 fi
diff --git a/srcpkgs/libtorrent-rasterbar/template b/srcpkgs/libtorrent-rasterbar/template
index 2a67bfa59fc..d855ba06672 100644
--- a/srcpkgs/libtorrent-rasterbar/template
+++ b/srcpkgs/libtorrent-rasterbar/template
@@ -17,7 +17,7 @@ homepage="https://libtorrent.org/"
 distfiles="https://github.com/arvidn/libtorrent/releases/download/libtorrent_${version//./_}/libtorrent-rasterbar-${version}.tar.gz"
 checksum=bc00069e65c0825cbe1eee5cdd26f94fcd9a621c4e7f791810b12fab64192f00
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS+=" -latomic"
 fi
diff --git a/srcpkgs/monero-gui/template b/srcpkgs/monero-gui/template
index 39fe1e42bc2..e04878be745 100644
--- a/srcpkgs/monero-gui/template
+++ b/srcpkgs/monero-gui/template
@@ -27,7 +27,7 @@ post_extract() {
 pre_configure() {
 	echo "var GUI_VERSION = \"${version}\"" > version.js
 	echo "var GUI_MONERO_VERSION = \"${version}\"" >> version.js
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		sed -i *.pro -e "s;-leasylogging;-leasylogging -latomic;"
 	fi
 }
diff --git a/srcpkgs/monero/template b/srcpkgs/monero/template
index a444d193f57..5516f068c96 100644
--- a/srcpkgs/monero/template
+++ b/srcpkgs/monero/template
@@ -44,7 +44,7 @@ case "$XBPS_TARGET_MACHINE" in
 	*) configure_args+=" -DARCH=default" ;;
 esac
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	CFLAGS+=" -latomic"
 fi
@@ -61,7 +61,7 @@ post_extract() {
 }
 
 pre_configure() {
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		sed -i CMakeLists.txt -e \
 			'/include(version.cmake)/i list(APPEND EXTRA_LIBRARIES libatomic.a)'
 	fi
diff --git a/srcpkgs/mozjs52/template b/srcpkgs/mozjs52/template
index 383767ea777..b256e7b2acc 100644
--- a/srcpkgs/mozjs52/template
+++ b/srcpkgs/mozjs52/template
@@ -25,7 +25,7 @@ LDFLAGS="-fuse-ld=bfd"
 CFLAGS+=" -Wno-format-overflow"
 CXXFLAGS+=" -Wno-format-overflow"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS+=" -latomic"
 fi
diff --git a/srcpkgs/mozjs60/template b/srcpkgs/mozjs60/template
index d2366ac11d6..ca337ca2481 100644
--- a/srcpkgs/mozjs60/template
+++ b/srcpkgs/mozjs60/template
@@ -19,7 +19,7 @@ patch_args="-Np1"
 CXXFLAGS="-Wno-class-memaccess"
 LDFLAGS+=" -Wl,-z,stack-size=1048576"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS+=" -latomic"
 fi
diff --git a/srcpkgs/mozjs68/template b/srcpkgs/mozjs68/template
index 80345a9ea9e..cf44edaf2ba 100644
--- a/srcpkgs/mozjs68/template
+++ b/srcpkgs/mozjs68/template
@@ -20,7 +20,7 @@ patch_args="-Np1"
 CXXFLAGS="-Wno-class-memaccess"
 LDFLAGS+=" -Wl,-z,stack-size=1048576"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS+=" -latomic"
 fi
diff --git a/srcpkgs/musikcube/template b/srcpkgs/musikcube/template
index 78cf86fe80d..26f7cd3beef 100644
--- a/srcpkgs/musikcube/template
+++ b/srcpkgs/musikcube/template
@@ -16,7 +16,7 @@ homepage="https://musikcube.com/"
 distfiles="https://github.com/clangen/musikcube/archive/${version}.tar.gz"
 checksum=e84e060acaab40266cc3d866f50f727c770c42273a5219fff5d6757186dbad21
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	configure_args+=" -DCMAKE_EXE_LINKER_FLAGS='-latomic'"
 fi
diff --git a/srcpkgs/namecoin/template b/srcpkgs/namecoin/template
index 91ae3c35d9a..21d9225b6fc 100644
--- a/srcpkgs/namecoin/template
+++ b/srcpkgs/namecoin/template
@@ -16,7 +16,7 @@ homepage="https://namecoin.org"
 distfiles="https://github.com/namecoin/namecoin-core/archive/nc${version}.tar.gz"
 checksum=7117a0a0b8f48d49e4abf3577660f8a4eb9a4dea753281d19d9470725fc75d8e
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS+=" -latomic"
 fi
diff --git a/srcpkgs/nix/template b/srcpkgs/nix/template
index b53ab551709..a7ab1f47e05 100644
--- a/srcpkgs/nix/template
+++ b/srcpkgs/nix/template
@@ -42,12 +42,12 @@ make_dirs="
 	/nix/var/nix/db 0755 root root
 	/nix/store 1775 root nixbld"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
 pre_configure() {
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		echo "libexpr_LDFLAGS += -latomic" >> src/libexpr/local.mk
 		echo "libutil_LDFLAGS += -latomic" >> src/libutil/local.mk
 		echo "libstore_LDFLAGS += -latomic" >> src/libstore/local.mk
diff --git a/srcpkgs/nodejs-lts-10/template b/srcpkgs/nodejs-lts-10/template
index ba72e480dac..8a13a51317c 100644
--- a/srcpkgs/nodejs-lts-10/template
+++ b/srcpkgs/nodejs-lts-10/template
@@ -36,7 +36,7 @@ if [ "$XBPS_WORDSIZE" -ne "$XBPS_TARGET_WORDSIZE" ]; then
 	nocross="host and target must have the same pointer size"
 fi
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 if [ "$XBPS_NO_ATOMIC8" ]; then
diff --git a/srcpkgs/nodejs-lts/template b/srcpkgs/nodejs-lts/template
index b8371430d13..b8b09b0749d 100644
--- a/srcpkgs/nodejs-lts/template
+++ b/srcpkgs/nodejs-lts/template
@@ -42,7 +42,7 @@ case "$XBPS_TARGET_MACHINE" in
 	ppc*) broken="Node 12.x does not support 32-bit ppc" ;;
 esac
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 if [ "$XBPS_NO_ATOMIC8" ]; then
diff --git a/srcpkgs/nodejs/template b/srcpkgs/nodejs/template
index c7dc1281b8a..6bea1eefdcb 100644
--- a/srcpkgs/nodejs/template
+++ b/srcpkgs/nodejs/template
@@ -42,7 +42,7 @@ case "$XBPS_TARGET_MACHINE" in
 	ppc*) broken="Node 12.x does not support 32-bit ppc" ;;
 esac
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 if [ "$XBPS_NO_ATOMIC8" ]; then
diff --git a/srcpkgs/opencv/template b/srcpkgs/opencv/template
index 648ff3a0c58..dbf0c75c3fc 100644
--- a/srcpkgs/opencv/template
+++ b/srcpkgs/opencv/template
@@ -19,7 +19,7 @@ homepage="https://opencv.org"
 distfiles="https://github.com/opencv/${pkgname}/archive/${version}.tar.gz"
 checksum=1ed6f5b02a7baf14daca04817566e7c98ec668cec381e0edf534fa49f10f58a2
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
diff --git a/srcpkgs/opencv4/template b/srcpkgs/opencv4/template
index cdeffdf991e..b3e27068127 100644
--- a/srcpkgs/opencv4/template
+++ b/srcpkgs/opencv4/template
@@ -25,7 +25,7 @@ distfiles="https://github.com/opencv/opencv/archive/${version}.tar.gz
 checksum="68bc40cbf47fdb8ee73dfaf0d9c6494cd095cf6294d99de445ab64cf853d278a
 	acb8e89c9e7d1174e63e40532125b60d248b00e517255a98a419d415228c6a55"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
diff --git a/srcpkgs/openimageio/template b/srcpkgs/openimageio/template
index bcab0e90b7d..a8d68f3457d 100644
--- a/srcpkgs/openimageio/template
+++ b/srcpkgs/openimageio/template
@@ -23,7 +23,7 @@ case "$XBPS_TARGET_MACHINE" in
 	i686*|x86_64*) configure_args+=" -DUSE_SIMD=sse2" ;;
 esac
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
@@ -36,7 +36,7 @@ pre_build() {
 	# Replace -isystem with -I to avoid "#include_next <stdlib.h>" file not found
 	vsed -i src/cmake/compiler.cmake -e "s;-isystem;-I;g"
 
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		# Add libatomic to the targets
 		vsed -i src/libOpenImageIO/CMakeLists.txt \
 			-e "s;^\(target_link_libraries (OpenImageIO ${ZLIB_LIBRARIES}\));\1 atomic);"
diff --git a/srcpkgs/openmw/template b/srcpkgs/openmw/template
index bcb29bd3cdf..f5fae81550f 100644
--- a/srcpkgs/openmw/template
+++ b/srcpkgs/openmw/template
@@ -20,7 +20,7 @@ if [ "$XBPS_TARGET_ENDIAN" != "le" ]; then
 	broken="https://gitlab.com/OpenMW/openmw/issues/564"
 fi
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	broken="https://build.voidlinux.org/builders/armv6l_builder/builds/26346/steps/shell_3/logs/stdio"
 fi
 
diff --git a/srcpkgs/openvdb/template b/srcpkgs/openvdb/template
index 72fde5bc637..8da800f9397 100644
--- a/srcpkgs/openvdb/template
+++ b/srcpkgs/openvdb/template
@@ -13,12 +13,12 @@ homepage="https://openvdb.org"
 distfiles="https://github.com/AcademySoftwareFoundation/openvdb/archive/v${version}.tar.gz"
 checksum=97bc8ae35ef7ccbf49a4e25cb73e8c2eccae6b235bac86f2150707efcd1e910d
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
 post_patch() {
-	[ "$XBPS_TARGET_NO_ATOMIC8" ] || return 0
+	xbps_target_no_atomic8 || return 0
 	vsed -i 's,ZLIB::ZLIB,ZLIB::ZLIB atomic,' openvdb/CMakeLists.txt
 }
 
diff --git a/srcpkgs/paraview/template b/srcpkgs/paraview/template
index 7a4c4474060..b12ca1d2183 100644
--- a/srcpkgs/paraview/template
+++ b/srcpkgs/paraview/template
@@ -40,7 +40,7 @@ export QT_SELECT="5"
 if xbps_target_libc musl; then
 	makedepends+=" libexecinfo-devel"
 fi
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
@@ -52,7 +52,7 @@ case "$XBPS_TARGET_MACHINE" in
 esac
 
 post_extract() {
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		echo "target_link_libraries(vtkCommonDataModel PRIVATE atomic)" >> \
 			VTK/Common/DataModel/CMakeLists.txt
 	fi
diff --git a/srcpkgs/pipewire/template b/srcpkgs/pipewire/template
index 494f2296327..fd4e8f9eb35 100644
--- a/srcpkgs/pipewire/template
+++ b/srcpkgs/pipewire/template
@@ -18,7 +18,7 @@ distfiles="https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/${version}
 checksum=927301640f87d68e52f4480667977bc6f47186ee7877f7aa86ce9172ff144edc
 conf_files="/etc/pipewire/pipewire.conf"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS+=" -latomic"
 fi
diff --git a/srcpkgs/protobuf24/template b/srcpkgs/protobuf24/template
index 872c4cfa97f..dc6f2f504e9 100644
--- a/srcpkgs/protobuf24/template
+++ b/srcpkgs/protobuf24/template
@@ -24,7 +24,7 @@ if [ "$CROSS_BUILD" ]; then
 	configure_args+=" --with-protoc=/usr/bin/protoc"
 fi
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS+=" -latomic"
 fi
diff --git a/srcpkgs/qpdf/template b/srcpkgs/qpdf/template
index a58cf3e656d..94a098fb86e 100644
--- a/srcpkgs/qpdf/template
+++ b/srcpkgs/qpdf/template
@@ -14,7 +14,7 @@ changelog="https://raw.githubusercontent.com/qpdf/qpdf/master/ChangeLog"
 distfiles="${homepage}/archive/release-qpdf-${version}.tar.gz"
 checksum=6bf21d71fc23b3dd0edf4699d4d68760402482cb8a96e7e36eae92914f931bca
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS+=" -latomic"
 fi
diff --git a/srcpkgs/qt5-webengine/template b/srcpkgs/qt5-webengine/template
index 5bef412d1cd..99509d877fd 100644
--- a/srcpkgs/qt5-webengine/template
+++ b/srcpkgs/qt5-webengine/template
@@ -63,7 +63,7 @@ case "$XBPS_MACHINE" in
 	ppc64*) hostmakedepends+=" libatomic-devel"
 esac
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
diff --git a/srcpkgs/qt5-webkit/template b/srcpkgs/qt5-webkit/template
index 742de47c6ab..c288371e3ba 100644
--- a/srcpkgs/qt5-webkit/template
+++ b/srcpkgs/qt5-webkit/template
@@ -41,7 +41,7 @@ case "$XBPS_TARGET_MACHINE" in
 esac
 
 # some platforms need libatomic
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LIBS+=" -latomic"
 fi
diff --git a/srcpkgs/qtox/template b/srcpkgs/qtox/template
index c739e676b3f..d507ede5b52 100644
--- a/srcpkgs/qtox/template
+++ b/srcpkgs/qtox/template
@@ -24,6 +24,6 @@ checksum=23b60fc6d5ce5e45e7099ad606218d16203157ab87a2582377001d3241336aac
 build_options="snorenotify"
 build_options_default="snorenotify"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
diff --git a/srcpkgs/rocksdb/template b/srcpkgs/rocksdb/template
index e39329e5d6a..a8ba32a768e 100644
--- a/srcpkgs/rocksdb/template
+++ b/srcpkgs/rocksdb/template
@@ -13,14 +13,14 @@ homepage="https://github.com/facebook/rocksdb"
 distfiles="${homepage}/archive/v${version}.tar.gz"
 checksum=7fb6738263d3f2b360d7468cf2ebe333f3109f3ba1ff80115abd145d75287254
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 # Use the C++17 feature to align new
 CXXFLAGS="-faligned-new -Wno-error=deprecated-copy -Wno-error=pessimizing-move"
 
 pre_configure() {
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		vsed -i CMakeLists.txt \
 			-e 's;target_link_libraries(${ROCKSDB_SHARED_LIB};& atomic;'
 	fi
diff --git a/srcpkgs/snapcast/template b/srcpkgs/snapcast/template
index a2c2cc7f1f9..7294a6f06e2 100644
--- a/srcpkgs/snapcast/template
+++ b/srcpkgs/snapcast/template
@@ -16,7 +16,7 @@ checksum=c7ce1094fa1231c66479bfd37a18f564805f632aaa42de99b52cb0f9f52a2c46
 
 build_options="avahi"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
diff --git a/srcpkgs/sonic-visualiser/template b/srcpkgs/sonic-visualiser/template
index 14b07ce7b62..9d0d827ba16 100644
--- a/srcpkgs/sonic-visualiser/template
+++ b/srcpkgs/sonic-visualiser/template
@@ -17,7 +17,7 @@ changelog="https://code.soundsoftware.ac.uk/projects/sonic-visualiser/repository
 distfiles="https://code.soundsoftware.ac.uk/attachments/download/2717/${pkgname}-${version}.tar.gz"
 checksum=baf04e8987bfbd6a8591db0e23bd8da98a2cf7688b10e4b00ac7091def81e182
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
@@ -36,7 +36,7 @@ post_extract() {
 		 test-svcore-system.pro
 	fi
 
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		sed -i -e "s/^linux\*:LIBS +=.*/& -latomic/" config.pri.in
 	fi
 }
diff --git a/srcpkgs/squid/template b/srcpkgs/squid/template
index 4c41803df26..e0215bd6eb7 100644
--- a/srcpkgs/squid/template
+++ b/srcpkgs/squid/template
@@ -68,7 +68,7 @@ distfiles="http://www.squid-cache.org/Versions/v4/squid-${version}.tar.xz"
 checksum=f42a03c8b3dc020722c88bf1a87da8cb0c087b2f66b41d8256c77ee1b527e317
 system_accounts="squid"
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS+=" -latomic"
 fi
diff --git a/srcpkgs/stockfish/template b/srcpkgs/stockfish/template
index d8919d79766..921554b3d75 100644
--- a/srcpkgs/stockfish/template
+++ b/srcpkgs/stockfish/template
@@ -26,7 +26,7 @@ case $XBPS_TARGET_MACHINE in
 	ppc*) make_build_args+="ARCH=ppc-32" ;;
 esac
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS+=" -latomic"
 fi
diff --git a/srcpkgs/swi-prolog/template b/srcpkgs/swi-prolog/template
index 6893ab19213..b3c1859bbed 100644
--- a/srcpkgs/swi-prolog/template
+++ b/srcpkgs/swi-prolog/template
@@ -18,7 +18,7 @@ changelog="http://www.swi-prolog.org/ChangeLog?branch=stable"
 distfiles="http://www.swi-prolog.org/download/stable/src/swipl-${version}.tar.gz"
 checksum=331bc5093d72af0c9f18fc9ed83b88ef9ddec0c8d379e6c49fa43739c8bda2fb
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 	LDFLAGS="-latomic"
 fi
diff --git a/srcpkgs/sysbench/template b/srcpkgs/sysbench/template
index 1cfb63d7caa..954929b0ad7 100644
--- a/srcpkgs/sysbench/template
+++ b/srcpkgs/sysbench/template
@@ -18,7 +18,7 @@ homepage="https://github.com/akopytov/sysbench"
 distfiles="https://github.com/akopytov/sysbench/archive/${version}.tar.gz"
 checksum=e8ee79b1f399b2d167e6a90de52ccc90e52408f7ade1b9b7135727efe181347f
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
diff --git a/srcpkgs/thrift/template b/srcpkgs/thrift/template
index 0630ef06a52..66bd6f829a4 100644
--- a/srcpkgs/thrift/template
+++ b/srcpkgs/thrift/template
@@ -13,7 +13,7 @@ homepage="https://thrift.apache.org/"
 distfiles="http://www-us.apache.org/dist/thrift/${version}/thrift-${version}.tar.gz"
 checksum=7ad348b88033af46ce49148097afe354d513c1fca7c607b59c33ebb6064b5179
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
diff --git a/srcpkgs/thunderbird/template b/srcpkgs/thunderbird/template
index 7d57aec6929..881c5443f05 100644
--- a/srcpkgs/thunderbird/template
+++ b/srcpkgs/thunderbird/template
@@ -36,7 +36,7 @@ case $XBPS_TARGET_MACHINE in
 	ppc*) broken="xptcall bitrot" ;;
 esac
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 
@@ -89,7 +89,7 @@ do_build() {
 	ppc*) echo "ac_add_options --disable-webrtc" >>.mozconfig ;;
 	esac
 
-	if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	if xbps_target_no_atomic8; then
 		export LDFLAGS+=" -latomic"
 	fi
 
diff --git a/srcpkgs/tomahawk/template b/srcpkgs/tomahawk/template
index 274c08d976c..c3018921a7e 100644
--- a/srcpkgs/tomahawk/template
+++ b/srcpkgs/tomahawk/template
@@ -40,7 +40,7 @@ if xbps_target_libc musl; then
 	makedepends+=" musl-legacy-compat"
 fi
 
-if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+if xbps_target_no_atomic8; then
 	makedepends+=" libatomic-devel"
 fi
 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC] switch to functions for libc, atomic support, etc checks 
  2020-08-30  2:49 [PR PATCH] [RFC] switch to functions for stuff like libc, atomic support, etc checks ericonr
@ 2020-08-30  9:51 ` fosslinux
  2020-08-30 10:58 ` [PR REVIEW] " hippi777
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: fosslinux @ 2020-08-30  9:51 UTC (permalink / raw)
  To: ml

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

New comment by fosslinux on void-packages repository

https://github.com/void-linux/void-packages/pull/24539#issuecomment-683399960

Comment:
Why?

I don't understand the rationale behind this at all, why make this a wrapper that IMHO for libc at least makes it look less clean?? `$XBPS_TARGET_LIBC = "musl"` is much easier to read than `if xbps_target_libc musl`....

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PR REVIEW] [RFC] switch to functions for libc, atomic support, etc checks 
  2020-08-30  2:49 [PR PATCH] [RFC] switch to functions for stuff like libc, atomic support, etc checks ericonr
  2020-08-30  9:51 ` [RFC] switch to functions for " fosslinux
@ 2020-08-30 10:58 ` hippi777
  2020-08-30 14:43 ` ericonr
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hippi777 @ 2020-08-30 10:58 UTC (permalink / raw)
  To: ml

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

New review comment by hippi777 on void-packages repository

https://github.com/void-linux/void-packages/pull/24539#discussion_r479715673

Comment:
this line is unnecessary, the same happens without it, just thats an implicit manner... also, why is the local libc if used only once? :D (note i didnt check for any conventions, so sorry if these are done to fullfill any)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PR REVIEW] [RFC] switch to functions for libc, atomic support, etc checks 
  2020-08-30  2:49 [PR PATCH] [RFC] switch to functions for stuff like libc, atomic support, etc checks ericonr
  2020-08-30  9:51 ` [RFC] switch to functions for " fosslinux
  2020-08-30 10:58 ` [PR REVIEW] " hippi777
@ 2020-08-30 14:43 ` ericonr
  2020-08-30 14:45 ` ericonr
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ericonr @ 2020-08-30 14:43 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/24539#discussion_r479778473

Comment:
Mostly wanted to give a name to the parameters that are used.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC] switch to functions for libc, atomic support, etc checks 
  2020-08-30  2:49 [PR PATCH] [RFC] switch to functions for stuff like libc, atomic support, etc checks ericonr
                   ` (2 preceding siblings ...)
  2020-08-30 14:43 ` ericonr
@ 2020-08-30 14:45 ` ericonr
  2020-08-30 17:10 ` q66
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ericonr @ 2020-08-30 14:45 UTC (permalink / raw)
  To: ml

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

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/24539#issuecomment-683429199

Comment:
@fosslinux 

> $XBPS_TARGET_LIBC = "musl" is much easier to read than if xbps_target_libc musl....

I kinda think the opposite :P . @the-maldridge and @q66 had expressed interest in an idea similar to this, which is why I went ahead on trying to implement it.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC] switch to functions for libc, atomic support, etc checks 
  2020-08-30  2:49 [PR PATCH] [RFC] switch to functions for stuff like libc, atomic support, etc checks ericonr
                   ` (3 preceding siblings ...)
  2020-08-30 14:45 ` ericonr
@ 2020-08-30 17:10 ` q66
  2020-08-30 23:08 ` fosslinux
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: q66 @ 2020-08-30 17:10 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/24539#issuecomment-683445513

Comment:
this is haphazard and in its current form completely pointless

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC] switch to functions for libc, atomic support, etc checks 
  2020-08-30  2:49 [PR PATCH] [RFC] switch to functions for stuff like libc, atomic support, etc checks ericonr
                   ` (4 preceding siblings ...)
  2020-08-30 17:10 ` q66
@ 2020-08-30 23:08 ` fosslinux
  2020-08-31 17:48 ` Duncaen
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: fosslinux @ 2020-08-30 23:08 UTC (permalink / raw)
  To: ml

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

New comment by fosslinux on void-packages repository

https://github.com/void-linux/void-packages/pull/24539#issuecomment-683482517

Comment:
@q66 @the-maldridge What idea did you have interest in?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC] switch to functions for libc, atomic support, etc checks 
  2020-08-30  2:49 [PR PATCH] [RFC] switch to functions for stuff like libc, atomic support, etc checks ericonr
                   ` (5 preceding siblings ...)
  2020-08-30 23:08 ` fosslinux
@ 2020-08-31 17:48 ` Duncaen
  2020-08-31 17:59 ` ericonr
  2020-08-31 17:59 ` [PR PATCH] [Closed]: " ericonr
  8 siblings, 0 replies; 10+ messages in thread
From: Duncaen @ 2020-08-31 17:48 UTC (permalink / raw)
  To: ml

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

New comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/24539#issuecomment-683930278

Comment:
Adding new functions also makes parsing template files even more complicated, now you need a new set of functions in addition to the environment variables.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC] switch to functions for libc, atomic support, etc checks 
  2020-08-30  2:49 [PR PATCH] [RFC] switch to functions for stuff like libc, atomic support, etc checks ericonr
                   ` (6 preceding siblings ...)
  2020-08-31 17:48 ` Duncaen
@ 2020-08-31 17:59 ` ericonr
  2020-08-31 17:59 ` [PR PATCH] [Closed]: " ericonr
  8 siblings, 0 replies; 10+ messages in thread
From: ericonr @ 2020-08-31 17:59 UTC (permalink / raw)
  To: ml

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

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/24539#issuecomment-683935838

Comment:
Closing this pending on a better design, then.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PR PATCH] [Closed]: [RFC] switch to functions for libc, atomic support, etc checks 
  2020-08-30  2:49 [PR PATCH] [RFC] switch to functions for stuff like libc, atomic support, etc checks ericonr
                   ` (7 preceding siblings ...)
  2020-08-31 17:59 ` ericonr
@ 2020-08-31 17:59 ` ericonr
  8 siblings, 0 replies; 10+ messages in thread
From: ericonr @ 2020-08-31 17:59 UTC (permalink / raw)
  To: ml

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

There's a closed pull request on the void-packages repository

[RFC] switch to functions for libc, atomic support, etc checks 
https://github.com/void-linux/void-packages/pull/24539

Description:
- I just threw the functions in `shutils/common.sh`, they can certainly go elsewhere. They haven't undergone extensive testing at all.
- The packages with additional changes in the second commit (`xbps_target_libc`) should get their own commits.

Possible additions: `xbps_target_wordsize`, `xbps_host_target_wordsize_differ` (or something to that effect).

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-08-31 17:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-30  2:49 [PR PATCH] [RFC] switch to functions for stuff like libc, atomic support, etc checks ericonr
2020-08-30  9:51 ` [RFC] switch to functions for " fosslinux
2020-08-30 10:58 ` [PR REVIEW] " hippi777
2020-08-30 14:43 ` ericonr
2020-08-30 14:45 ` ericonr
2020-08-30 17:10 ` q66
2020-08-30 23:08 ` fosslinux
2020-08-31 17:48 ` Duncaen
2020-08-31 17:59 ` ericonr
2020-08-31 17:59 ` [PR PATCH] [Closed]: " ericonr

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).