Change to add `-j` flag at only compile-time

parent ab5491fd
...@@ -218,7 +218,9 @@ end ...@@ -218,7 +218,9 @@ end
def build_and_preconfigure (target_dir) def build_and_preconfigure (target_dir)
Dir.chdir target_dir do Dir.chdir target_dir do
puts "Building from source, this may take a while..." puts "Building from source, this may take a while..."
@pkg.in_build = true
@pkg.build @pkg.build
@pkg.in_build = false
system "rm -rf", CREW_DEST_DIR + "/*" #wipe crew destdir system "rm -rf", CREW_DEST_DIR + "/*" #wipe crew destdir
puts "Preconfiguring package..." puts "Preconfiguring package..."
@pkg.install @pkg.install
......
...@@ -5,7 +5,7 @@ class Package ...@@ -5,7 +5,7 @@ class Package
class << self class << self
attr_reader :dependencies, :is_fake attr_reader :dependencies, :is_fake
attr_accessor :name attr_accessor :name, :in_build
end end
def self.depends_on (dependency = nil) def self.depends_on (dependency = nil)
@dependencies = [] unless @dependencies @dependencies = [] unless @dependencies
...@@ -28,13 +28,15 @@ class Package ...@@ -28,13 +28,15 @@ class Package
end end
def self.system(*args) def self.system(*args)
# add "-j#{CREW_NPROC}" argument to "make" # add "-j#{CREW_NPROC}" argument to "make" at only compile-time
if args[0] == "make" if @in_build == true
# modify ["make", "args", ...] into ["make", "-j#{CREW_NPROC}", "args", ...] if args[0] == "make"
args.insert(1, "-j#{CREW_NPROC}") # modify ["make", "args", ...] into ["make", "-j#{CREW_NPROC}", "args", ...]
elsif args.length == 1 args.insert(1, "-j#{CREW_NPROC}")
# modify ["make args..."] into ["make -j#{CREW_NPROC} args..."] elsif args.length == 1
args[0].gsub!(/^make /, "make -j#{CREW_NPROC} ") # modify ["make args..."] into ["make -j#{CREW_NPROC} args..."]
args[0].gsub!(/^make /, "make -j#{CREW_NPROC} ")
end
end end
Kernel.system(*args) Kernel.system(*args)
exitstatus = $?.exitstatus exitstatus = $?.exitstatus
......
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