From d5f7594748b4510d7c6ab0ea8c08c4ed9f249a85 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Tue, 26 Jul 2011 00:01:22 -0500 Subject: ENV: allow a user-configurable number of make jobs Let an environment variable, HOMEBREW_MAKE_JOBS, override the default '-j' make flag. Now we can more easily debug formula that normally build in parallel, or (potentially) speed up lengthy builds. --- Library/Contributions/manpages/brew.1.md | 6 ++++++ Library/Homebrew/extend/ENV.rb | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'Library') diff --git a/Library/Contributions/manpages/brew.1.md b/Library/Contributions/manpages/brew.1.md index 89d73f612..533937284 100644 --- a/Library/Contributions/manpages/brew.1.md +++ b/Library/Contributions/manpages/brew.1.md @@ -316,6 +316,12 @@ Some sample commands ship with Homebrew and are enabled by default. If set, Homebrew will not remove files from `share/info`, allowing them to be linked from the Cellar. + * HOMEBREW\_MAKE\_JOBS: + If set, instructs Homebrew to use the value of `HOMEBREW_MAKE_JOBS` as + the number of parallel jobs to run when building with `make`(1). + + *Default:* the number of available CPU cores. + * HOMEBREW\_SVN: When exporting from Subversion, Homebrew will use `HOMEBREW_SVN` if set, a Homebrew-built Subversion if installed, or the system-provided binary. diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb index 931f69271..8ca166ac0 100644 --- a/Library/Homebrew/extend/ENV.rb +++ b/Library/Homebrew/extend/ENV.rb @@ -8,7 +8,7 @@ module HomebrewEnvExtension delete('CPPFLAGS') delete('LDFLAGS') - self['MAKEFLAGS'] = "-j#{Hardware.processor_count}" + self['MAKEFLAGS'] = "-j#{self.make_jobs}" unless HOMEBREW_PREFIX.to_s == '/usr/local' # /usr/local is already an -isystem and -L directory so we skip it @@ -309,4 +309,13 @@ Please take one of the following actions: def use_llvm? self['HOMEBREW_USE_LLVM'] or ARGV.include? '--use-llvm' end + + def make_jobs + # '-j' requires a positive integral argument + if self['HOMEBREW_MAKE_JOBS'].to_i > 0 + self['HOMEBREW_MAKE_JOBS'] + else + Hardware.processor_count + end + end end -- cgit v1.2.3