summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorFerdinand Bachmann2021-04-06 15:00:10 +0200
committerFerdinand Bachmann2021-04-06 15:23:19 +0200
commit4809fa9acd994084bccef58153d5360f28a0ce83 (patch)
tree8de2f3f54067c980c8ab0ce432b6db07c5b041bb /PKGBUILD
parent083c1a024d6f1e61947e0bb1892a42ed8ca9c5f5 (diff)
downloadaur-4809fa9acd994084bccef58153d5360f28a0ce83.tar.gz
remove compilation flags incompatible with clang before building
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD34
1 files changed, 34 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 35c565473a35..0c769d09f203 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -46,7 +46,41 @@ prepare() {
patch -Np1 -i ../wit-titles.patch
}
+_not() {
+ if "$@"; then
+ return 1
+ else
+ return 0
+ fi
+}
+
+_array_contains() {
+ local haystack="$1[@]"
+ local needle="$2"
+
+ for value in "${!haystack}"; do
+ if [[ "$value" == "$needle" ]]; then
+ return 0
+ fi
+ done
+
+ return 1
+}
+
+_incompatible_flags=( "-fvar-tracking-assignments" )
+_clang_remove_incompatible_flags() {
+ local newflags=
+ for flag in $CFLAGS; do
+ if _not _array_contains _incompatible_flags "$flag"; then
+ newflags="$newflags $flag"
+ fi
+ done
+
+ export CFLAGS="$newflags"
+}
+
build() {
+ _clang_remove_incompatible_flags
make INSTALL_PATH="${pkgdir}/usr" CC=clang -C wiimms-iso-tools/project tools
make INSTALL_PATH="${pkgdir}/usr" CC=clang -C wiimms-iso-tools/project doc
}