superenv: Work if build tool changes DEVELOPER_DIR

Some build systems still set the DEVELOPER_DIR to /Developer
and then nothing works any more (xcrun, xcodebuild etc.)
I am looking at you MacVim.
This commit is contained in:
Samuel John 2013-05-31 12:30:25 +02:00
parent c524895666
commit 0688991507
2 changed files with 7 additions and 3 deletions

View File

@ -7,6 +7,9 @@
require "#{File.dirname __FILE__}/../libsuperenv"
SUPERBIN = __FILE__.dirname.cleanpath.freeze
# Some build tools are stupid and still set DEVELOPER_DIR to old /Developer
ENV['DEVELOPER_DIR'] = ENV['HOMEBREW_DEVELOPER_DIR']
exec "/usr/bin/xcrun", *ARGV if ARGV.empty? or ARGV[0][0..0] == '-'
if File.exist?("/usr/bin/#{ARGV.first}")
exec "/usr/bin/#{ARGV.shift}", *ARGV unless ENV['HOMEBREW_SDKROOT'].directory?
@ -19,8 +22,8 @@ end
arg0 = ARGV.shift
try `/usr/bin/xcrun --find #{arg0}`.chomp
# Nuts, Xcode is not setup properly or something. Try to find the tools anyway!
try "#{ENV['DEVELOPER_DIR']}/usr/bin/#{arg0}"
try "#{ENV['DEVELOPER_DIR']}/Toolchains/XcodeDefault.xctoolchain/usr/bin/#{arg0}"
try "#{ENV['HOMEBREW_DEVELOPER_DIR']}/usr/bin/#{arg0}"
try "#{ENV['HOMEBREW_DEVELOPER_DIR']}/Toolchains/XcodeDefault.xctoolchain/usr/bin/#{arg0}"
# xcrun won't always be able to find Homebrew's apple-gcc42,
# even when it's in the PATH
ENV['PATH'].split(':').each do |p|

View File

@ -47,7 +47,7 @@ class << ENV
ENV['CXX'] = 'c++'
ENV['OBJC'] = 'cc'
ENV['OBJCXX'] = 'c++'
ENV['DEVELOPER_DIR'] = determine_developer_dir # effects later settings
ENV['DEVELOPER_DIR'] = determine_developer_dir
ENV['MAKEFLAGS'] ||= "-j#{determine_make_jobs}"
ENV['PATH'] = determine_path
ENV['PKG_CONFIG_PATH'] = determine_pkg_config_path
@ -56,6 +56,7 @@ class << ENV
ENV['HOMEBREW_CCCFG'] = determine_cccfg
ENV['HOMEBREW_BREW_FILE'] = HOMEBREW_BREW_FILE
ENV['HOMEBREW_SDKROOT'] = "#{MacOS.sdk_path}" if MacSystem.xcode43_without_clt?
ENV['HOMEBREW_DEVELOPER_DIR'] = determine_developer_dir # used by our xcrun shim
ENV['CMAKE_PREFIX_PATH'] = determine_cmake_prefix_path
ENV['CMAKE_FRAMEWORK_PATH'] = determine_cmake_frameworks_path
ENV['CMAKE_INCLUDE_PATH'] = determine_cmake_include_path