diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc index 26468cdfa1..42771a4d0c 100755 --- a/Library/ENV/4.3/cc +++ b/Library/ENV/4.3/cc @@ -33,7 +33,7 @@ class Cmd @args = args.freeze @brewfix = ENV['HOMEBREW_PREFIX'] @brewtmp = ENV['HOMEBREW_TEMP'] - @sysroot = ENV['HOMEBREW_SYSROOT'] + @sysroot = ENV['HOMEBREW_SDKROOT'] end def mode @@ -93,7 +93,7 @@ class Cmd if tool == "ld" args << "-syslibroot" << sysroot else - args << "--sysroot=#{sysroot}" + args << "-isysroot" << sysroot << "--sysroot=#{sysroot}" end end diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index 31718a2b99..cb3c12b33b 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -46,7 +46,7 @@ module Superenv self['HOMEBREW_BREW_FILE'] = HOMEBREW_BREW_FILE.to_s self['HOMEBREW_PREFIX'] = HOMEBREW_PREFIX.to_s self['HOMEBREW_TEMP'] = HOMEBREW_TEMP.to_s - self['HOMEBREW_SDKROOT'] = "#{MacOS.sdk_path}" if MacOS::Xcode.without_clt? + self['HOMEBREW_SDKROOT'] = effective_sysroot self['HOMEBREW_OPTFLAGS'] = determine_optflags self['HOMEBREW_ARCHFLAGS'] = '' self['CMAKE_PREFIX_PATH'] = determine_cmake_prefix_path @@ -59,12 +59,6 @@ module Superenv self["HOMEBREW_INCLUDE_PATHS"] = determine_include_paths self["HOMEBREW_LIBRARY_PATHS"] = determine_library_paths - # On 10.9 the developer tools honor the correct sysroot by default. - # On 10.7 and 10.8 we need to set it ourselves. - if MacOS::Xcode.without_clt? && (MacOS.version <= "10.8" || compiler != :clang) - self["HOMEBREW_SYSROOT"] = effective_sysroot - end - # On 10.9, the tools in /usr/bin proxy to the active developer directory. # This means we can use them for any combination of CLT and Xcode. self["HOMEBREW_PREFER_CLT_PROXIES"] = "1" if MacOS.version >= "10.9" @@ -96,7 +90,7 @@ module Superenv end def effective_sysroot - if MacOS::Xcode.without_clt? then MacOS.sdk_path.to_s else "" end + MacOS::Xcode.without_clt? ? MacOS.sdk_path.to_s : nil end def determine_cxx