2009-10-15 12:36:09 +01:00
|
|
|
module HomebrewEnvExtension
|
|
|
|
# -w: keep signal to noise high
|
2009-12-02 12:17:14 +00:00
|
|
|
SAFE_CFLAGS_FLAGS = "-w -pipe"
|
2009-10-15 12:36:09 +01:00
|
|
|
|
|
|
|
def setup_build_environment
|
|
|
|
# Clear CDPATH to avoid make issues that depend on changing directories
|
2010-08-10 07:58:08 -07:00
|
|
|
delete('CDPATH')
|
|
|
|
delete('CPPFLAGS')
|
|
|
|
delete('LDFLAGS')
|
2012-02-16 17:12:53 +00:00
|
|
|
delete('GREP_OPTIONS') # can break CMake (lol)
|
2012-02-16 16:55:28 -06:00
|
|
|
delete('CLICOLOR_FORCE') # autotools doesn't like this
|
2009-10-15 12:36:09 +01:00
|
|
|
|
2011-07-26 00:01:22 -05:00
|
|
|
self['MAKEFLAGS'] = "-j#{self.make_jobs}"
|
2009-10-15 12:36:09 +01:00
|
|
|
|
|
|
|
unless HOMEBREW_PREFIX.to_s == '/usr/local'
|
2009-12-01 11:27:44 +00:00
|
|
|
# /usr/local is already an -isystem and -L directory so we skip it
|
2010-08-10 07:58:08 -07:00
|
|
|
self['CPPFLAGS'] = "-isystem #{HOMEBREW_PREFIX}/include"
|
|
|
|
self['LDFLAGS'] = "-L#{HOMEBREW_PREFIX}/lib"
|
2009-12-09 04:49:19 +01:00
|
|
|
# CMake ignores the variables above
|
2010-08-10 07:58:08 -07:00
|
|
|
self['CMAKE_PREFIX_PATH'] = "#{HOMEBREW_PREFIX}"
|
2009-10-15 12:36:09 +01:00
|
|
|
end
|
|
|
|
|
2012-02-16 17:23:11 +00:00
|
|
|
# Os is the default Apple uses for all its stuff so let's trust them
|
|
|
|
self['CFLAGS'] = self['CXXFLAGS'] = "-Os #{SAFE_CFLAGS_FLAGS}"
|
2010-02-12 13:35:29 +00:00
|
|
|
|
2012-02-16 18:00:04 +00:00
|
|
|
# set us up for the user's compiler choice
|
2011-11-23 19:52:00 +00:00
|
|
|
self.send self.compiler
|
2012-02-16 18:00:04 +00:00
|
|
|
|
2011-08-31 17:50:39 +01:00
|
|
|
# we must have a working compiler!
|
2011-09-06 11:20:09 +01:00
|
|
|
unless File.exist? ENV['CC'] and File.exist? ENV['CXX']
|
2011-11-23 19:52:00 +00:00
|
|
|
@compiler = MacOS.default_compiler
|
|
|
|
self.send @compiler
|
2012-02-16 18:00:04 +00:00
|
|
|
|
2011-09-06 11:20:09 +01:00
|
|
|
ENV['CC'] = '/usr/bin/cc'
|
|
|
|
ENV['CXX'] = '/usr/bin/c++'
|
|
|
|
end
|
2011-08-31 17:50:39 +01:00
|
|
|
|
2010-08-09 21:03:29 -07:00
|
|
|
# In rare cases this may break your builds, as the tool for some reason wants
|
|
|
|
# to use a specific linker. However doing this in general causes formula to
|
2009-10-15 12:36:09 +01:00
|
|
|
# build more successfully because we are changing CC and many build systems
|
2010-08-09 21:03:29 -07:00
|
|
|
# don't react properly to that.
|
2010-08-10 07:58:08 -07:00
|
|
|
self['LD'] = self['CC']
|
2009-10-15 12:36:09 +01:00
|
|
|
end
|
2010-08-09 21:03:29 -07:00
|
|
|
|
2009-10-15 12:36:09 +01:00
|
|
|
def deparallelize
|
|
|
|
remove 'MAKEFLAGS', /-j\d+/
|
|
|
|
end
|
|
|
|
alias_method :j1, :deparallelize
|
2009-10-23 14:51:40 +01:00
|
|
|
|
2010-02-12 13:35:29 +00:00
|
|
|
# recommended by Apple, but, eg. wget won't compile with this flag, so…
|
|
|
|
def fast
|
2010-10-25 21:12:41 -07:00
|
|
|
remove_from_cflags(/-O./)
|
2010-02-12 13:35:29 +00:00
|
|
|
append_to_cflags '-fast'
|
|
|
|
end
|
2010-06-18 14:32:25 -07:00
|
|
|
def O4
|
|
|
|
# LLVM link-time optimization
|
2010-10-25 21:12:41 -07:00
|
|
|
remove_from_cflags(/-O./)
|
2010-06-18 14:32:25 -07:00
|
|
|
append_to_cflags '-O4'
|
|
|
|
end
|
2009-10-23 14:51:40 +01:00
|
|
|
def O3
|
|
|
|
# Sometimes O4 just takes fucking forever
|
2010-10-25 21:12:41 -07:00
|
|
|
remove_from_cflags(/-O./)
|
2009-10-23 14:51:40 +01:00
|
|
|
append_to_cflags '-O3'
|
|
|
|
end
|
|
|
|
def O2
|
|
|
|
# Sometimes O3 doesn't work or produces bad binaries
|
2010-10-25 21:12:41 -07:00
|
|
|
remove_from_cflags(/-O./)
|
2009-10-23 14:51:40 +01:00
|
|
|
append_to_cflags '-O2'
|
|
|
|
end
|
2009-12-02 12:17:14 +00:00
|
|
|
def Os
|
|
|
|
# Sometimes you just want a small one
|
2010-10-25 21:12:41 -07:00
|
|
|
remove_from_cflags(/-O./)
|
2009-12-02 12:17:14 +00:00
|
|
|
append_to_cflags '-Os'
|
|
|
|
end
|
2011-05-24 18:15:05 -07:00
|
|
|
def Og
|
|
|
|
# Sometimes you want a debug build
|
|
|
|
remove_from_cflags(/-O./)
|
|
|
|
append_to_cflags '-g -O0'
|
|
|
|
end
|
2009-10-23 14:51:40 +01:00
|
|
|
|
2009-10-15 12:36:09 +01:00
|
|
|
def gcc_4_0_1
|
2012-02-16 18:00:04 +00:00
|
|
|
self['CC'] = "#{MacOS.dev_tools_path}/gcc-4.0"
|
|
|
|
self['CXX'] = "#{MacOS.dev_tools_path}/g++-4.0"
|
2011-11-23 19:52:00 +00:00
|
|
|
replace_in_cflags '-O4', '-O3'
|
2011-12-31 19:10:05 +00:00
|
|
|
set_cpu_cflags 'nocona -mssse3', :core => 'prescott', :bottle => 'generic'
|
2011-09-06 11:20:09 +01:00
|
|
|
@compiler = :gcc
|
2009-10-15 12:36:09 +01:00
|
|
|
end
|
2009-12-02 10:39:06 +00:00
|
|
|
alias_method :gcc_4_0, :gcc_4_0_1
|
|
|
|
|
2011-09-06 11:21:34 +01:00
|
|
|
def gcc args = {}
|
2012-02-16 18:00:04 +00:00
|
|
|
# Apple stopped shipping gcc-4.2 with Xcode 4.2
|
|
|
|
# However they still provide a gcc symlink to llvm
|
|
|
|
# But we don't want LLVM of course.
|
|
|
|
|
|
|
|
gcc_path = Pathname.new "#{MacOS.dev_tools_path}/gcc-4.2"
|
|
|
|
gxx_path = Pathname.new "#{MacOS.dev_tools_path}/g++-4.2"
|
2012-01-02 17:20:30 -06:00
|
|
|
self['CC'] = gcc_path.exist? ? gcc_path : HOMEBREW_PREFIX+'bin/gcc-4.2'
|
|
|
|
self['CXX'] = gxx_path.exist? ? gxx_path : HOMEBREW_PREFIX+'bin/g++-4.2'
|
2011-11-23 19:52:00 +00:00
|
|
|
replace_in_cflags '-O4', '-O3'
|
2011-12-31 19:10:05 +00:00
|
|
|
set_cpu_cflags 'core2 -msse4', :penryn => 'core2 -msse4.1', :core2 => 'core2', :core => 'prescott', :bottle => 'generic'
|
2011-09-06 11:20:09 +01:00
|
|
|
@compiler = :gcc
|
2011-09-06 11:21:34 +01:00
|
|
|
|
2012-01-02 17:20:30 -06:00
|
|
|
raise "GCC could not be found" if not File.exist? ENV['CC'] \
|
2011-12-26 12:03:55 -06:00
|
|
|
or (Pathname.new(ENV['CC']).realpath.to_s =~ /llvm/)
|
2009-10-15 12:36:09 +01:00
|
|
|
end
|
2011-08-26 13:53:36 +01:00
|
|
|
alias_method :gcc_4_2, :gcc
|
2009-10-23 14:51:40 +01:00
|
|
|
|
2010-06-17 10:57:41 -05:00
|
|
|
def llvm
|
2012-02-16 18:00:04 +00:00
|
|
|
self['CC'] = "#{MacOS.dev_tools_path}/llvm-gcc"
|
|
|
|
self['CXX'] = "#{MacOS.dev_tools_path}/llvm-g++"
|
2011-11-23 19:52:00 +00:00
|
|
|
set_cpu_cflags 'core2 -msse4', :penryn => 'core2 -msse4.1', :core2 => 'core2', :core => 'prescott'
|
2011-09-06 11:20:09 +01:00
|
|
|
@compiler = :llvm
|
2011-08-26 13:53:36 +01:00
|
|
|
end
|
|
|
|
|
2012-01-16 20:05:51 +00:00
|
|
|
def clang args = {}
|
2012-02-16 18:00:04 +00:00
|
|
|
self['CC'] = "#{MacOS.dev_tools_path}/clang"
|
|
|
|
self['CXX'] = "#{MacOS.dev_tools_path}/clang++"
|
2011-11-23 19:52:00 +00:00
|
|
|
replace_in_cflags(/-Xarch_i386 (-march=\S*)/, '\1')
|
|
|
|
# Clang mistakenly enables AES-NI on plain Nehalem
|
|
|
|
set_cpu_cflags 'native', :nehalem => 'native -Xclang -target-feature -Xclang -aes'
|
2011-09-06 11:20:09 +01:00
|
|
|
@compiler = :clang
|
2010-06-17 10:57:41 -05:00
|
|
|
end
|
|
|
|
|
2011-03-10 11:23:42 -08:00
|
|
|
def fortran
|
|
|
|
if self['FC']
|
|
|
|
ohai "Building with an alternative Fortran compiler. This is unsupported."
|
|
|
|
self['F77'] = self['FC'] unless self['F77']
|
|
|
|
|
|
|
|
if ARGV.include? '--default-fortran-flags'
|
|
|
|
self['FCFLAGS'] = self['CFLAGS'] unless self['FCFLAGS']
|
2011-11-23 09:25:22 -08:00
|
|
|
self['FFLAGS'] = self['CFLAGS'] unless self['FFLAGS']
|
2011-03-10 11:23:42 -08:00
|
|
|
elsif not self['FCFLAGS'] or self['FFLAGS']
|
2012-02-16 17:23:25 +00:00
|
|
|
opoo <<-EOS.undent
|
|
|
|
No Fortran optimization information was provided. You may want to consider
|
|
|
|
setting FCFLAGS and FFLAGS or pass the `--default-fortran-flags` option to
|
|
|
|
`brew install` if your compiler is compatible with GCC.
|
2011-03-10 11:23:42 -08:00
|
|
|
|
2012-02-16 17:23:25 +00:00
|
|
|
If you like the default optimization level of your compiler, ignore this
|
|
|
|
warning.
|
2011-03-10 11:23:42 -08:00
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
elsif `/usr/bin/which gfortran`.chomp.size > 0
|
2012-02-16 17:23:25 +00:00
|
|
|
ohai <<-EOS.undent
|
|
|
|
Using Homebrew-provided fortran compiler.
|
|
|
|
This may be changed by setting the FC environment variable.
|
|
|
|
EOS
|
2011-03-10 11:23:42 -08:00
|
|
|
self['FC'] = `/usr/bin/which gfortran`.chomp
|
|
|
|
self['F77'] = self['FC']
|
|
|
|
|
|
|
|
self['FCFLAGS'] = self['CFLAGS']
|
|
|
|
self['FFLAGS'] = self['CFLAGS']
|
|
|
|
|
|
|
|
else
|
|
|
|
onoe <<-EOS
|
|
|
|
This formula requires a fortran compiler, but we could not find one by
|
|
|
|
looking at the FC environment variable or searching your PATH for `gfortran`.
|
|
|
|
Please take one of the following actions:
|
|
|
|
|
|
|
|
- Decide to use the build of gfortran 4.2.x provided by Homebrew using
|
|
|
|
`brew install gfortran`
|
|
|
|
|
|
|
|
- Choose another Fortran compiler by setting the FC environment variable:
|
|
|
|
export FC=/path/to/some/fortran/compiler
|
|
|
|
Using an alternative compiler may produce more efficient code, but we will
|
|
|
|
not be able to provide support for build errors.
|
|
|
|
EOS
|
|
|
|
exit 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-10-15 12:36:09 +01:00
|
|
|
def osx_10_4
|
2009-10-23 14:51:40 +01:00
|
|
|
self['MACOSX_DEPLOYMENT_TARGET']="10.4"
|
2009-10-15 12:36:09 +01:00
|
|
|
remove_from_cflags(/ ?-mmacosx-version-min=10\.\d/)
|
2009-10-23 14:51:40 +01:00
|
|
|
append_to_cflags('-mmacosx-version-min=10.4')
|
2009-10-15 12:36:09 +01:00
|
|
|
end
|
2009-10-23 14:51:40 +01:00
|
|
|
def osx_10_5
|
|
|
|
self['MACOSX_DEPLOYMENT_TARGET']="10.5"
|
|
|
|
remove_from_cflags(/ ?-mmacosx-version-min=10\.\d/)
|
|
|
|
append_to_cflags('-mmacosx-version-min=10.5')
|
|
|
|
end
|
|
|
|
|
2009-10-15 12:36:09 +01:00
|
|
|
def minimal_optimization
|
2010-08-10 07:58:08 -07:00
|
|
|
self['CFLAGS'] = self['CXXFLAGS'] = "-Os #{SAFE_CFLAGS_FLAGS}"
|
2009-10-15 12:36:09 +01:00
|
|
|
end
|
|
|
|
def no_optimization
|
2010-08-10 07:58:08 -07:00
|
|
|
self['CFLAGS'] = self['CXXFLAGS'] = SAFE_CFLAGS_FLAGS
|
2009-10-15 12:36:09 +01:00
|
|
|
end
|
2009-12-02 12:17:14 +00:00
|
|
|
|
2011-03-14 13:58:30 -07:00
|
|
|
# Some configure scripts won't find libxml2 without help
|
2009-10-15 12:36:09 +01:00
|
|
|
def libxml2
|
2011-11-23 19:52:00 +00:00
|
|
|
append 'CPPFLAGS', '-I/usr/include/libxml2'
|
2009-10-15 12:36:09 +01:00
|
|
|
end
|
2010-08-07 16:50:45 -07:00
|
|
|
|
2009-10-15 12:36:09 +01:00
|
|
|
def x11
|
2010-09-11 20:22:54 +01:00
|
|
|
opoo "You do not have X11 installed, this formula may not build." if not MacOS.x11_installed?
|
2010-08-07 16:50:45 -07:00
|
|
|
|
|
|
|
# There are some config scripts (e.g. freetype) here that should go in the path
|
2010-08-10 07:58:08 -07:00
|
|
|
prepend 'PATH', '/usr/X11/bin', ':'
|
2009-10-15 12:36:09 +01:00
|
|
|
# CPPFLAGS are the C-PreProcessor flags, *not* C++!
|
2011-04-18 10:25:51 -07:00
|
|
|
append 'CPPFLAGS', '-I/usr/X11/include'
|
|
|
|
append 'LDFLAGS', '-L/usr/X11/lib'
|
2009-12-09 04:49:19 +01:00
|
|
|
# CMake ignores the variables above
|
2011-04-18 10:25:51 -07:00
|
|
|
append 'CMAKE_PREFIX_PATH', '/usr/X11', ':'
|
2009-10-15 12:36:09 +01:00
|
|
|
end
|
|
|
|
alias_method :libpng, :x11
|
2010-08-07 16:50:45 -07:00
|
|
|
|
2009-10-15 12:36:09 +01:00
|
|
|
# we've seen some packages fail to build when warnings are disabled!
|
|
|
|
def enable_warnings
|
|
|
|
remove_from_cflags '-w'
|
|
|
|
end
|
2010-08-10 08:01:06 -07:00
|
|
|
|
2009-10-15 12:36:09 +01:00
|
|
|
# Snow Leopard defines an NCURSES value the opposite of most distros
|
|
|
|
# See: http://bugs.python.org/issue6848
|
|
|
|
def ncurses_define
|
|
|
|
append 'CPPFLAGS', "-DNCURSES_OPAQUE=0"
|
|
|
|
end
|
2010-08-10 08:01:06 -07:00
|
|
|
|
2010-09-07 10:09:22 -07:00
|
|
|
# Shortcuts for reading common flags
|
|
|
|
def cc; self['CC'] or "gcc"; end
|
|
|
|
def cxx; self['CXX'] or "g++"; end
|
|
|
|
def cflags; self['CFLAGS']; end
|
2012-02-12 17:29:02 -06:00
|
|
|
def cxxflags;self['CXXFLAGS']; end
|
2012-02-16 17:23:25 +00:00
|
|
|
def cppflags;self['CPPFLAGS']; end
|
2010-09-07 10:09:22 -07:00
|
|
|
def ldflags; self['LDFLAGS']; end
|
2009-10-23 14:51:50 +01:00
|
|
|
|
2009-10-15 12:36:09 +01:00
|
|
|
def m64
|
|
|
|
append_to_cflags '-m64'
|
2010-08-10 07:58:08 -07:00
|
|
|
append 'LDFLAGS', '-arch x86_64'
|
2009-10-15 12:36:09 +01:00
|
|
|
end
|
2009-10-23 14:51:50 +01:00
|
|
|
def m32
|
|
|
|
append_to_cflags '-m32'
|
2010-08-10 07:58:08 -07:00
|
|
|
append 'LDFLAGS', '-arch i386'
|
2009-10-23 14:51:50 +01:00
|
|
|
end
|
|
|
|
|
2011-06-04 09:05:52 -07:00
|
|
|
# i386 and x86_64 (no PPC)
|
2009-10-19 12:44:30 +01:00
|
|
|
def universal_binary
|
|
|
|
append_to_cflags '-arch i386 -arch x86_64'
|
2011-11-23 19:52:00 +00:00
|
|
|
replace_in_cflags '-O4', '-O3' # O4 seems to cause the build to fail
|
2010-08-10 07:58:08 -07:00
|
|
|
append 'LDFLAGS', '-arch i386 -arch x86_64'
|
2010-04-22 11:15:03 -07:00
|
|
|
|
2011-11-23 19:52:00 +00:00
|
|
|
unless compiler == :clang
|
|
|
|
# Can't mix "-march" for a 32-bit CPU with "-arch x86_64"
|
|
|
|
replace_in_cflags(/-march=\S*/, '-Xarch_i386 \0') if Hardware.is_32_bit?
|
|
|
|
end
|
2009-10-19 12:44:30 +01:00
|
|
|
end
|
2009-10-15 12:36:09 +01:00
|
|
|
|
|
|
|
def prepend key, value, separator = ' '
|
2010-09-30 10:17:41 -07:00
|
|
|
# Value should be a string, but if it is a pathname then coerce it.
|
|
|
|
value = value.to_s
|
2009-10-15 12:36:09 +01:00
|
|
|
unless self[key].to_s.empty?
|
|
|
|
self[key] = value + separator + self[key]
|
|
|
|
else
|
|
|
|
self[key] = value
|
|
|
|
end
|
|
|
|
end
|
2010-09-30 10:17:41 -07:00
|
|
|
|
2009-10-21 11:50:37 -07:00
|
|
|
def append key, value, separator = ' '
|
2010-09-30 10:17:41 -07:00
|
|
|
# Value should be a string, but if it is a pathname then coerce it.
|
|
|
|
value = value.to_s
|
|
|
|
unless self[key].to_s.empty?
|
|
|
|
self[key] = self[key] + separator + value
|
2009-10-15 12:36:09 +01:00
|
|
|
else
|
2010-09-30 10:17:41 -07:00
|
|
|
self[key] = value
|
2009-10-15 12:36:09 +01:00
|
|
|
end
|
|
|
|
end
|
2010-08-10 07:58:08 -07:00
|
|
|
|
2009-10-15 12:36:09 +01:00
|
|
|
def append_to_cflags f
|
|
|
|
append 'CFLAGS', f
|
|
|
|
append 'CXXFLAGS', f
|
|
|
|
end
|
2011-11-23 19:52:00 +00:00
|
|
|
|
2009-10-15 12:36:09 +01:00
|
|
|
def remove key, value
|
|
|
|
return if self[key].nil?
|
2010-08-10 07:58:08 -07:00
|
|
|
self[key] = self[key].sub value, '' # can't use sub! on ENV
|
|
|
|
self[key] = nil if self[key].empty? # keep things clean
|
2009-10-15 12:36:09 +01:00
|
|
|
end
|
2011-11-23 19:52:00 +00:00
|
|
|
|
2009-10-15 12:36:09 +01:00
|
|
|
def remove_from_cflags f
|
|
|
|
remove 'CFLAGS', f
|
|
|
|
remove 'CXXFLAGS', f
|
|
|
|
end
|
2011-06-16 20:55:59 -07:00
|
|
|
|
2011-11-23 19:52:00 +00:00
|
|
|
def replace_in_cflags before, after
|
|
|
|
%w{CFLAGS CXXFLAGS}.each do |key|
|
|
|
|
self[key] = self[key].sub before, after if self[key]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def set_cpu_cflags default, map = {}
|
|
|
|
cflags =~ %r{(-Xarch_i386 )-march=}
|
|
|
|
xarch = $1.to_s
|
|
|
|
remove_from_cflags %r{(-Xarch_i386 )?-march=\S*}
|
2011-12-14 15:06:04 +02:00
|
|
|
remove_from_cflags %r{( -Xclang \S+)+}
|
2011-11-23 19:52:00 +00:00
|
|
|
remove_from_cflags %r{-mssse3}
|
|
|
|
remove_from_cflags %r{-msse4(\.\d)?}
|
2012-01-19 22:54:28 -06:00
|
|
|
append_to_cflags xarch unless xarch.empty?
|
2011-11-23 19:52:00 +00:00
|
|
|
# Don't set -msse3 and older flags because -march does that for us
|
2011-12-31 19:10:05 +00:00
|
|
|
if ARGV.build_bottle?
|
|
|
|
if map.has_key?(:bottle)
|
|
|
|
append_to_cflags '-mtune=' + map.fetch(:bottle)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
append_to_cflags '-march=' + map.fetch(Hardware.intel_family, default)
|
|
|
|
end
|
2011-11-23 19:52:00 +00:00
|
|
|
end
|
|
|
|
|
2011-09-06 11:20:09 +01:00
|
|
|
# actually c-compiler, so cc would be a better name
|
2011-08-26 14:21:37 +01:00
|
|
|
def compiler
|
|
|
|
# TODO seems that ENV.clang in a Formula.install should warn when called
|
|
|
|
# if the user has set something that is tested here
|
|
|
|
|
|
|
|
# test for --flags first so that installs can be overridden on a per
|
2011-09-01 14:17:29 +01:00
|
|
|
# install basis. Then test for ENVs in inverse order to flags, this is
|
|
|
|
# sensible, trust me
|
2011-09-06 11:20:09 +01:00
|
|
|
@compiler ||= if ARGV.include? '--use-gcc'
|
2011-08-26 14:21:37 +01:00
|
|
|
:gcc
|
|
|
|
elsif ARGV.include? '--use-llvm'
|
|
|
|
:llvm
|
|
|
|
elsif ARGV.include? '--use-clang'
|
|
|
|
:clang
|
2011-09-01 14:17:29 +01:00
|
|
|
elsif self['HOMEBREW_USE_CLANG']
|
2011-08-26 14:21:37 +01:00
|
|
|
:clang
|
|
|
|
elsif self['HOMEBREW_USE_LLVM']
|
|
|
|
:llvm
|
|
|
|
elsif self['HOMEBREW_USE_GCC']
|
|
|
|
:gcc
|
|
|
|
else
|
2011-08-31 16:59:04 +01:00
|
|
|
MacOS.default_compiler
|
2011-08-26 14:21:37 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-07-26 00:01:22 -05:00
|
|
|
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
|
2011-09-10 11:24:29 +01:00
|
|
|
|
|
|
|
def remove_cc_etc
|
2011-11-23 19:52:00 +00:00
|
|
|
keys = %w{CC CXX LD CPP CFLAGS CXXFLAGS LDFLAGS CPPFLAGS}
|
2011-09-10 11:24:29 +01:00
|
|
|
removed = Hash[*keys.map{ |key| [key, ENV[key]] }.flatten]
|
|
|
|
keys.each do |key|
|
|
|
|
ENV[key] = nil
|
|
|
|
end
|
|
|
|
removed
|
|
|
|
end
|
2009-10-15 12:36:09 +01:00
|
|
|
end
|