aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2015-02-08 20:04:07 -0500
committerJack Nagel2015-02-08 20:04:07 -0500
commit4b910178940b2a716821e5b80288f2102ee72619 (patch)
treecd98d7d7c1c59a2da014a01ce6a039e81a517d79 /Library
parentd4e24dce0ab1537f3e91dc57d1a6445395fee29a (diff)
downloadbrew-4b910178940b2a716821e5b80288f2102ee72619.tar.bz2
Make compiler shim robust against missing environment variables
Fixes Homebrew/homebrew#36217.
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/ENV/4.3/cc15
1 files changed, 4 insertions, 11 deletions
diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc
index 999f2104b..5194ca377 100755
--- a/Library/ENV/4.3/cc
+++ b/Library/ENV/4.3/cc
@@ -27,6 +27,7 @@ LOGGER = Logger.new
class Cmd
attr_reader :config, :prefix, :cellar, :tmpdir, :sysroot
+ attr_reader :archflags, :optflags
def initialize path, args
@arg0 = File.basename(path).freeze
@@ -36,6 +37,8 @@ class Cmd
@cellar = ENV['HOMEBREW_CELLAR']
@tmpdir = ENV['HOMEBREW_TEMP']
@sysroot = ENV['HOMEBREW_SDKROOT']
+ @archflags = ENV.fetch("HOMEBREW_ARCHFLAGS") { "" }.split(" ")
+ @optflags = ENV.fetch("HOMEBREW_OPTFLAGS") { "" }.split(" ")
end
def mode
@@ -211,6 +214,7 @@ class Cmd
args << '-pipe'
args << '-w' unless configure?
+ args << "-#{ENV["HOMEBREW_OPTIMIZATION_LEVEL"]}"
args.concat(optflags)
args.concat(archflags)
args << "-std=#{@arg0}" if @arg0 =~ /c[89]9/
@@ -225,17 +229,6 @@ class Cmd
args
end
- def optflags
- args = []
- args << "-#{ENV['HOMEBREW_OPTIMIZATION_LEVEL']}"
- args.concat ENV['HOMEBREW_OPTFLAGS'].split(' ') if ENV['HOMEBREW_OPTFLAGS']
- args
- end
-
- def archflags
- ENV["HOMEBREW_ARCHFLAGS"].split(" ")
- end
-
def cppflags
path_flags("-isystem", isystem_paths) + path_flags("-I", include_paths)
end