Skip to content

Commit 29e6426

Browse files
committed
build: honor SCCACHE_DISABLE for windows cc_wrapper
1 parent ae5b097 commit 29e6426

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

cmd/build-naive/cmd_build.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ func getExtraFlags(t Target) string {
7272
return strings.Join(flags, " ")
7373
}
7474

75+
func envFlagEnabled(name string) bool {
76+
value := strings.TrimSpace(strings.ToLower(os.Getenv(name)))
77+
return value != "" && value != "0" && value != "false" && value != "no"
78+
}
79+
7580
type openwrtConfig struct {
7681
target string // OpenWrt target (e.g., "x86", "armsr")
7782
subtarget string // OpenWrt subtarget (e.g., "64", "generic")
@@ -279,9 +284,11 @@ func buildTarget(t Target) {
279284
}
280285

281286
if runtime.GOOS == "windows" {
282-
sccachePath, _ := exec.LookPath("sccache")
283-
if sccachePath != "" {
284-
args = append(args, fmt.Sprintf(`cc_wrapper="%s"`, sccachePath))
287+
if !envFlagEnabled("SCCACHE_DISABLE") {
288+
sccachePath, _ := exec.LookPath("sccache")
289+
if sccachePath != "" {
290+
args = append(args, fmt.Sprintf(`cc_wrapper="%s"`, sccachePath))
291+
}
285292
}
286293
} else {
287294
ccachePath, _ := exec.LookPath("ccache")

0 commit comments

Comments
 (0)