summaryrefslogtreecommitdiff
path: root/.config
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 18:59:17 -0500
commit8641367de7696f838d42e0b300bfae617de4f7a1 (patch)
tree1809a697bb8e7d94876aa764a4ebc01797cfc08c /.config
parent0a6e4253386ae7a92f7560dd412ef801c69fc1de (diff)
makepkg: improve modifying OPTIONS and BUILDENV
Diffstat (limited to '.config')
-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