aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
authorCharlie Sharpsteen2012-02-20 13:16:58 -0800
committerCharlie Sharpsteen2012-02-21 21:34:48 -0800
commitc0299ad19bf14b50c8453eeea6f03eaa2f9bbe6a (patch)
tree02dfcc89e9a67d33025a8fe9dfbc6b0629580126 /Library/Homebrew/extend
parentc34cdbbeb91984e5b4c326b4e2e419adf6977d4c (diff)
downloadbrew-c0299ad19bf14b50c8453eeea6f03eaa2f9bbe6a.tar.bz2
ENV.rb: Set flags for Objective-C
We set defaults for C and C++, might as well do the same for Objective-C and Objective-C++. Closes Homebrew/homebrew#10354.
Diffstat (limited to 'Library/Homebrew/extend')
-rw-r--r--Library/Homebrew/extend/ENV.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index 2f2a0d90a..996f69494 100644
--- a/Library/Homebrew/extend/ENV.rb
+++ b/Library/Homebrew/extend/ENV.rb
@@ -20,7 +20,7 @@ module HomebrewEnvExtension
end
# Os is the default Apple uses for all its stuff so let's trust them
- self['CFLAGS'] = self['CXXFLAGS'] = "-Os #{SAFE_CFLAGS_FLAGS}"
+ set_cflags "-Os #{SAFE_CFLAGS_FLAGS}"
# set us up for the user's compiler choice
self.send self.compiler
@@ -315,6 +315,8 @@ Please take one of the following actions:
def append_to_cflags f
append 'CFLAGS', f
append 'CXXFLAGS', f
+ append 'OBJCFLAGS', f
+ append 'OBJCXXFLAGS', f
end
def remove key, value
@@ -326,14 +328,23 @@ Please take one of the following actions:
def remove_from_cflags f
remove 'CFLAGS', f
remove 'CXXFLAGS', f
+ remove 'OBJCFLAGS', f
+ remove 'OBJCXXFLAGS', f
end
def replace_in_cflags before, after
- %w{CFLAGS CXXFLAGS}.each do |key|
+ %w{CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS}.each do |key|
self[key] = self[key].sub before, after if self[key]
end
end
+ # Convenience method to set all C compiler flags in one shot.
+ def set_cflags f
+ %w{CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS}.each do |key|
+ self[key] = f
+ end
+ end
+
def set_cpu_cflags default, map = {}
cflags =~ %r{(-Xarch_i386 )-march=}
xarch = $1.to_s
@@ -389,7 +400,7 @@ Please take one of the following actions:
end
def remove_cc_etc
- keys = %w{CC CXX LD CPP CFLAGS CXXFLAGS LDFLAGS CPPFLAGS}
+ keys = %w{CC CXX LD CPP CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS LDFLAGS CPPFLAGS}
removed = Hash[*keys.map{ |key| [key, ENV[key]] }.flatten]
keys.each do |key|
ENV[key] = nil