Skip to content

Commit ff9a849

Browse files
committed
fix zig-cc script with different PKG_ROOT_PATH (and filter out some gcc-only warning options)
1 parent edeb5b9 commit ff9a849

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/SPC/store/scripts/zig-cc.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
#!/usr/bin/env bash
22

33
SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
4-
BUILDROOT_ABS="$(realpath "$SCRIPT_DIR/../../../buildroot/include" 2>/dev/null || true)"
4+
BUILDROOT_INC="${BUILD_INCLUDE_PATH:-$SCRIPT_DIR/../../../buildroot/include}"
5+
BUILDROOT_ABS="$(realpath "$BUILDROOT_INC" 2>/dev/null || true)"
56
PARSED_ARGS=()
67

8+
is_buildroot_inc() {
9+
[[ -n "$BUILDROOT_ABS" && "$1" == "$BUILDROOT_ABS" ]]
10+
}
11+
712
while [[ $# -gt 0 ]]; do
813
case "$1" in
914
-isystem)
1015
shift
1116
ARG="$1"
1217
shift
1318
ARG_ABS="$(realpath "$ARG" 2>/dev/null || true)"
14-
[[ "$ARG_ABS" == "$BUILDROOT_ABS" ]] && PARSED_ARGS+=("-I$ARG") || PARSED_ARGS+=("-isystem" "$ARG")
19+
is_buildroot_inc "$ARG_ABS" && PARSED_ARGS+=("-I$ARG") || PARSED_ARGS+=("-isystem" "$ARG")
1520
;;
1621
-isystem*)
1722
ARG="${1#-isystem}"
1823
shift
1924
ARG_ABS="$(realpath "$ARG" 2>/dev/null || true)"
20-
[[ "$ARG_ABS" == "$BUILDROOT_ABS" ]] && PARSED_ARGS+=("-I$ARG") || PARSED_ARGS+=("-isystem$ARG")
25+
is_buildroot_inc "$ARG_ABS" && PARSED_ARGS+=("-I$ARG") || PARSED_ARGS+=("-isystem$ARG")
2126
;;
2227
-march=*|-mcpu=*)
2328
OPT_NAME="${1%%=*}"
@@ -32,6 +37,10 @@ while [[ $# -gt 0 ]]; do
3237
PARSED_ARGS+=("${OPT_NAME}=${OPT_VALUE}")
3338
shift
3439
;;
40+
-Wlogical-op|-Wduplicated-cond|-Wduplicated-branches|-Wno-clobbered|-Wjump-misses-init|-Wformat-truncation|-Warray-bounds=*|-Wimplicit-fallthrough=*)
41+
# GCC-only warning flags that clang/zig doesn't recognize; drop to silence -Wunknown-warning-option noise
42+
shift
43+
;;
3544
*)
3645
PARSED_ARGS+=("$1")
3746
shift

0 commit comments

Comments
 (0)