diff options
| author | Max Howell | 2012-08-30 10:03:26 -0400 |
|---|---|---|
| committer | Max Howell | 2012-08-30 20:02:29 -0400 |
| commit | d4503b1202c65df1fd636695aa633d5a60997ee8 (patch) | |
| tree | 4fe312e54ad6573d9614b323a0ce5689cf8a3b95 /Library/ENV | |
| parent | a4ccf68602ed7ed65dae9c517c9a957a771dd75e (diff) | |
| download | brew-d4503b1202c65df1fd636695aa633d5a60997ee8.tar.bz2 | |
Fixes Homebrew/homebrew#14542; ocaml superenv issues
This patch removes most of the settings for CC, CXX etc. because we are trying to be minimal. Then we force the compiler to Homebrew's choice underneath in superenv. We however leave LD because we prefer that build-systems use the c-compiler for linking, it generally works better (copiously tested), however when the build-system explicitly calls ld, we respect that. This gets around the ocaml bug in question, since somehow clang was crashing during link, but the ld tool itself (which is kind of clang, kind of llvm-gcc) is okay with this.
Also moved the setting of O (so that cc-args are refurbished) into a make wrapper. Not sure if this matter much, but seems more consistent.
Diffstat (limited to 'Library/ENV')
| -rwxr-xr-x | Library/ENV/4.3/cc | 50 | ||||
| -rwxr-xr-x | Library/ENV/4.3/make | 3 |
2 files changed, 32 insertions, 21 deletions
diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc index acc0227c2..ffd15f2e3 100755 --- a/Library/ENV/4.3/cc +++ b/Library/ENV/4.3/cc @@ -44,29 +44,29 @@ class Cmd end end def tool - case @cmd - when /gcc/ then 'gcc' - when /g\+\+/ then 'g++' - when 'clang', 'clang++' - @cmd - when 'ld', 'cpp', 'cc' - ENV['HOMEBREW_CC'].chuzzle or 'clang' - when 'c++' - case ENV['HOMEBREW_CC'] - when /gcc/ then 'g++' - else 'clang++' + @tool ||= if @cmd.include? '++' + if ENV['HOMEBREW_CC'].chuzzle =~ /gcc/ + 'g++' + else + 'clang++' end + elsif @cmd == 'ld' + 'ld' else - abort "Unknown command: #{@cmd}" + ENV['HOMEBREW_CC'].chuzzle or 'clang' end end def args - args = if cccfg? 'O' + args = if cccfg? 'O' and tool != 'ld' refurbished_args else @args.dup end - args.unshift("--sysroot=#$sdkroot") if nclt? + if @cmd != 'ld' + args.unshift("--sysroot=#$sdkroot") + else + args.unshift($sdkroot).unshift("-syslibroot") + end if nclt? case mode when :cpp %w{-E} + cppflags + args @@ -110,13 +110,7 @@ class Cmd args << arg end end - - rms = @args - args - %w{CPPFLAGS LDFLAGS CXXFLAGS CFLAGS}.each do |flag| - unison = ENV[flag].split(' ') & rms - puts "Warning! #{unison*' '} removed from #{flag.upcase} by superenv" unless unison.empty? - end - + make_fuss(args) args end def cflags @@ -141,6 +135,20 @@ class Cmd # they override the system options. sys.to_flags('-isystem') + opt.to_flags('-I') end + def make_fuss args + dels = @args - args + if ENV['VERBOSE'] + adds = args - @args + puts "brew: Superenv removed: #{dels*' '}" unless dels.empty? + puts "brew: Superenv added: #{adds*' '}" unless adds.empty? + else + %w{CPPFLAGS LDFLAGS CXXFLAGS CFLAGS}.each do |flag| + next unless ENV[flag] + flags = dels.select{|del| ENV[flag].include? del }.join(' ') + puts "brew: superenv removed `#{flags}' from #{flag}" unless flags.empty? + end + end + end end ####################################################################### sanity diff --git a/Library/ENV/4.3/make b/Library/ENV/4.3/make new file mode 100755 index 000000000..7e5196e6a --- /dev/null +++ b/Library/ENV/4.3/make @@ -0,0 +1,3 @@ +#!/bin/sh +export HOMEBREW_CCCFG="O$HOMEBREW_CCCFG" +exec xcrun make "$@" |
