[88541] trunk/base/src/port1.0/portconfigure.tcl

jberry at macports.org jberry at macports.org
Tue Jan 3 18:33:52 PST 2012


Revision: 88541
          http://trac.macports.org/changeset/88541
Author:   jberry at macports.org
Date:     2012-01-03 18:33:52 -0800 (Tue, 03 Jan 2012)
Log Message:
-----------
Use xcrun to find compilers installed by xcode.
Current builds of xcode 4.3 don't put all of these
in the developer_dir/usr/bin directory, so we let
xcrun find them for us.

Modified Paths:
--------------
    trunk/base/src/port1.0/portconfigure.tcl

Modified: trunk/base/src/port1.0/portconfigure.tcl
===================================================================
--- trunk/base/src/port1.0/portconfigure.tcl	2012-01-04 02:32:11 UTC (rev 88540)
+++ trunk/base/src/port1.0/portconfigure.tcl	2012-01-04 02:33:52 UTC (rev 88541)
@@ -370,6 +370,20 @@
     }
 }
 
+# Find a developer tool
+proc portconfigure::find_developer_tool {name} {
+	# Call xcode's xcrun to find the named tool.
+	# If this doesn't work reliably (or across enough xcode versions) we
+	# may need to fall-back to using ${developer_dir}/usr/bin in some
+	# instances (this doesn't work with current builds of Xcode 4.3).
+	set xcrun [findBinary xcrun $portutil::autoconf::xcrun_path]
+	if {[catch {set toolpath [exec ${xcrun} -find ${name}]} result] == 0} {
+		return ${toolpath}
+	} else {
+		return -code error "${result}"
+	}
+}
+
 # internal function to find correct compilers
 proc portconfigure::configure_get_compiler {type} {
     global configure.compiler prefix developer_dir
@@ -417,21 +431,22 @@
         }
         llvm-gcc-4.2 {
             switch -exact ${type} {
-                cc   { set ret ${developer_dir}/usr/bin/llvm-gcc-4.2 }
-                objc { set ret ${developer_dir}/usr/bin/llvm-gcc-4.2 }
-                cxx  { set ret ${developer_dir}/usr/bin/llvm-g++-4.2 }
-                cpp  { set ret ${developer_dir}/usr/bin/llvm-cpp-4.2 }
+                cc   { set ret [find_developer_tool llvm-gcc-4.2] }
+                objc { set ret [find_developer_tool llvm-gcc-4.2] }
+                cxx  { set ret [find_developer_tool llvm-g++-4.2] }
+                cpp  { set ret [find_developer_tool llvm-cpp-4.2] }
             }
         }
         clang {
             switch -exact ${type} {
-                cc   { set ret ${developer_dir}/usr/bin/clang }
-                objc { set ret ${developer_dir}/usr/bin/clang }
+                cc   { set ret [find_developer_tool clang] }
+                objc { set ret [find_developer_tool clang] }
                 cxx  {
-                    if {[file executable ${developer_dir}/usr/bin/clang++]} {
-                        set ret ${developer_dir}/usr/bin/clang++
+					set clangpp [find_developer_tool clang++]
+                    if {[file executable ${clangpp}]} {
+                        set ret ${clangpp}
                     } else {
-                        set ret ${developer_dir}/usr/bin/llvm-g++-4.2
+                        set ret [find_developer_tool llvm-g++-4.2]
                     }
                 }
             }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120103/6f1e5e9e/attachment.html>


More information about the macports-changes mailing list