Skip to content

Commit 8e873b5

Browse files
committed
Feat: Add -j flag to control build concurrency
Hilariously enough on my overclocked i9 if I try to build tor with the previously hardcoded `fmt.Sprintf("-j%d", runtime.NumCPU())` - I get sporadic internal gcc errors. This allows passing `-j 16`, which in my case permits me to build tor.
1 parent 187c19c commit 8e873b5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

build.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,17 @@ var (
2525
autopointPath string
2626
folders = []string{"_openssl", "libevent", "zlib", "xz", "tor"}
2727
absCurrDir = getAbsCurrDir()
28-
numJobs = fmt.Sprintf("-j%d", runtime.NumCPU())
28+
numJobsInt = runtime.NumCPU()
29+
numJobs = ""
2930
)
3031

3132
func main() {
3233
flag.BoolVar(&verbose, "verbose", false, "Whether to show command output")
3334
flag.StringVar(&host, "host", "", "Host option, useful for cross-compilation")
3435
flag.StringVar(&autopointPath, "autopoint-path", "/usr/local/opt/gettext/bin", "OSX: Directory that contains autopoint binary")
36+
flag.IntVar(&numJobsInt, "j", runtime.NumCPU(), "Number of jobs to run in parallel")
3537
flag.Parse()
38+
numJobs = fmt.Sprintf("-j%d", numJobsInt)
3639
if len(flag.Args()) != 1 {
3740
log.Fatal("Missing command. Can be build-all, build-<folder>, clean-all, clean-<folder>, show-libs, or package-libs")
3841
}

0 commit comments

Comments
 (0)