Commit 26cd82da authored by lyxell's avatar lyxell Committed by GitHub

Merge pull request #430 from jam7/use-multicores

Change to use -j option in make to reduce the compile time
parents c6035820 a3fcaa37
......@@ -15,6 +15,13 @@ CREW_CONFIG_PATH = CREW_PREFIX + '/etc/crew/'
CREW_BREW_DIR = CREW_PREFIX + '/tmp/crew/'
CREW_DEST_DIR = CREW_BREW_DIR + '/dest'
# Set CREW_NPROC from environment variable or `nproc`
if ENV["CREW_NPROC"].to_s == ''
CREW_NPROC = `nproc`.strip
else
CREW_NPROC = ENV["CREW_NPROC"]
end
ARCH = `uname -m`.strip
#SHORTARCH = `getconf LONG_BIT`.strip # will refactor this line in the future
case ARCH
......
......@@ -33,6 +33,14 @@ class Package
args = args.map {|s| s.gsub("-m32", "")}
args = args.map {|s| s.gsub("lib32", "lib")}
end
# add "-j#{CREW_NPROC}" argument to "make"
if args[0] == "make"
# modify ["make", "args", ...] into ["make", "-j#{CREW_NPROC}", "args", ...]
args.insert(1, "-j#{CREW_NPROC}")
elsif args.length == 1
# modify ["make args..."] into ["make -j#{CREW_NPROC} args..."]
args[0].gsub!(/^make /, "make -j#{CREW_NPROC} ")
end
Kernel.system(*args)
exitstatus = $?.exitstatus
raise InstallError.new("`#{args.join(" ")}` exited with #{exitstatus}") unless exitstatus == 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment