From 06889915075a22031463a86c54e54998535d3e07 Mon Sep 17 00:00:00 2001 From: Samuel John Date: Fri, 31 May 2013 12:30:25 +0200 Subject: [PATCH] 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. --- Library/ENV/4.3/xcrun | 7 +++++-- Library/Homebrew/superenv.rb | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Library/ENV/4.3/xcrun b/Library/ENV/4.3/xcrun index 4784cd4d50..39821c8337 100755 --- a/Library/ENV/4.3/xcrun +++ b/Library/ENV/4.3/xcrun @@ -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| diff --git a/Library/Homebrew/superenv.rb b/Library/Homebrew/superenv.rb index 022517534b..77b1211551 100644 --- a/Library/Homebrew/superenv.rb +++ b/Library/Homebrew/superenv.rb @@ -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