Skip to content

Commit

Permalink
Merge pull request cretz#12 from vbatts/numJobs
Browse files Browse the repository at this point in the history
build.go: make jobs to match CPUs available
  • Loading branch information
cretz committed Oct 16, 2018
2 parents 2689de4 + 5e8c3e5 commit e5df13f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var verbose bool
var autopointPath string
var folders = []string{"openssl", "libevent", "zlib", "xz", "tor"}
var absCurrDir = getAbsCurrDir()
var numJobs = fmt.Sprintf("-j%d", runtime.NumCPU())

func main() {
flag.BoolVar(&verbose, "verbose", false, "Whether to show command output")
Expand Down Expand Up @@ -98,7 +99,7 @@ func build(folder string) error {
cmds := [][]string{
{"sh", "./config", "--prefix=" + pwd + "/dist", "no-shared", "no-dso", "no-zlib"},
{"make", "depend"},
{"make"},
{"make", numJobs},
{"make", "install"},
}
if runtime.GOOS == "windows" {
Expand All @@ -115,12 +116,12 @@ func build(folder string) error {
{"sh", "./configure", "--prefix=" + pwd + "/dist",
"--disable-shared", "--enable-static", "--with-pic", "--disable-samples", "--disable-libevent-regress",
"CPPFLAGS=-I../openssl/dist/include", "LDFLAGS=-L../openssl/dist/lib"},
{"make"},
{"make", numJobs},
{"make", "install"},
})
case "zlib":
var env []string
cmds := [][]string{{"sh", "./configure", "--prefix=" + pwd + "/dist"}, {"make"}, {"make", "install"}}
cmds := [][]string{{"sh", "./configure", "--prefix=" + pwd + "/dist"}, {"make", numJobs}, {"make", "install"}}
if runtime.GOOS == "windows" {
env = []string{"PREFIX=" + pwd + "/dist", "BINARY_PATH=" + pwd + "/dist/bin",
"INCLUDE_PATH=" + pwd + "/dist/include", "LIBRARY_PATH=" + pwd + "/dist/lib"}
Expand All @@ -137,7 +138,7 @@ func build(folder string) error {
{"sh", "./configure", "--prefix=" + pwd + "/dist", "--disable-shared", "--enable-static",
"--disable-doc", "--disable-scripts", "--disable-xz", "--disable-xzdec", "--disable-lzmadec",
"--disable-lzmainfo", "--disable-lzma-links"},
{"make"},
{"make", numJobs},
{"make", "install"},
})
case "tor":
Expand All @@ -164,7 +165,7 @@ func build(folder string) error {
return runCmds(folder, env, [][]string{
{"sh", "-l", "./autogen.sh"},
torConf,
{"make"},
{"make", numJobs},
{"make", "install"},
})
default:
Expand Down

0 comments on commit e5df13f

Please sign in to comment.