summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-01-10 18:59:17 -0500
committerLuke Shumaker <lukeshu@lukeshu.com>2018-01-10 19:31:53 -0500
commit9d01df379517d16572b5c32baa5c48f06aeab443 (patch)
tree529d2c9334035172cb18987a0fd03cedd712b3a7
parenta4f714f5cd953b99a3d176c8cac57b3af5adf4b2 (diff)
makepkg: improve modifying OPTIONS and BUILDENV
-rw-r--r--.config/pacman/makepkg.conf40
1 files changed, 30 insertions, 10 deletions
diff --git a/.config/pacman/makepkg.conf b/.config/pacman/makepkg.conf
index 2e627b8..fe64828 100644
--- a/.config/pacman/makepkg.conf
+++ b/.config/pacman/makepkg.conf
@@ -9,16 +9,36 @@ PACKAGER="Luke Shumaker <lukeshu@sbcglobal.net>"
MAKEFLAGS="-j$(($(nproc)+1))"
-if type ccache &>/dev/null; then
- f=false
+lukeshu_set_BUILDENV() {
+ local thing=$1
+ local i
for i in "${!BUILDENV[@]}"; do
- if [[ "${BUILDENV[$i]}" == '!ccache' ]]; then
- BUILDENV[$i]='ccache'
- f=true
- fi
+ case "${BUILDENV[$i]}" in
+ "!${thing#!}"|"${thing#!}")
+ BUILDENV[$i]=$thing
+ return
+ ;;
+ esac
+ done
+ BUILDENV+=("$thing")
+}
+
+lukeshu_set_OPTIONS() {
+ local thing=$1
+ local i
+ for i in "${!OPTIONS[@]}"; do
+ case "${OPTIONS[$i]}" in
+ "!${thing#!}"|"${thing#!}")
+ OPTIONS[$i]=$thing
+ return
+ ;;
+ esac
done
- if [[ $f == false ]]; then
- BUILDENV+=('ccache')
- fi
- unset f i
+ OPTIONS+=("$thing")
+}
+
+lukeshu_set_OPTIONS debug
+
+if type ccache &>/dev/null; then
+ lukeshu_set_BUILDENV ccache
fi