[90031] branches/release_2_0/base
jberry at macports.org
jberry at macports.org
Sun Feb 19 16:43:59 PST 2012
Revision: 90031
http://trac.macports.org/changeset/90031
Author: jberry at macports.org
Date: 2012-02-19 16:43:59 -0800 (Sun, 19 Feb 2012)
Log Message:
-----------
Merge from trunk r89970,r89971,r89972,r89996,r89999,r90003,r90005-90009,r90018-90019,r90024
Search harder for developer directory.
Warn user when if xcode-select needs to be run.
Search for Xcode installations, providing suggestions to user on how to run xcode-select.
Revision Links:
--------------
http://trac.macports.org/changeset/89970
http://trac.macports.org/changeset/89971
http://trac.macports.org/changeset/89972
http://trac.macports.org/changeset/89996
http://trac.macports.org/changeset/89999
http://trac.macports.org/changeset/90003
http://trac.macports.org/changeset/90005
http://trac.macports.org/changeset/90018
http://trac.macports.org/changeset/90024
Modified Paths:
--------------
branches/release_2_0/base/src/macports1.0/macports.tcl
branches/release_2_0/base/src/port1.0/portmain.tcl
Property Changed:
----------------
branches/release_2_0/base/
Property changes on: branches/release_2_0/base
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692,79750,79762,79771-79774,79782,79787,79864,79943,80069,80088,80178,80220,80222,80224,80226,80229,80245,80287,80335,80443,80581,80583,80586,80779,80797-80798,80894,80928,80932,80934,80969,80971,81005,81119,81146,81171,81234,81269,81361,81371,81414-81415,81454,81464,81467,81475,81522,81556-81558,81562,81565,81567,81577,81630,81657,81830-81832,82111,82135,82767,82921,82924,82947,83136,83149,83267,83270-83271,83391,83395,83443,83471,83537,84351,88045,88179,88185,88540-88541,88546,88777,88779,88787,89359,89984,89988,89993-89994,90000,90002,90004,90010,90020
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
+ /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692,79750,79762,79771-79774,79782,79787,79864,79943,80069,80088,80178,80220,80222,80224,80226,80229,80245,80287,80335,80443,80581,80583,80586,80779,80797-80798,80894,80928,80932,80934,80969,80971,81005,81119,81146,81171,81234,81269,81361,81371,81414-81415,81454,81464,81467,81475,81522,81556-81558,81562,81565,81567,81577,81630,81657,81830-81832,82111,82135,82767,82921,82924,82947,83136,83149,83267,83270-83271,83391,83395,83443,83471,83537,84351,88045,88179,88185,88540-88541,88546,88777,88779,88787,89359,89970-89972,89984,89988,89993-89994,89996,89999-90000,90002-90010,90018-90020,90024
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
Modified: branches/release_2_0/base/src/macports1.0/macports.tcl
===================================================================
--- branches/release_2_0/base/src/macports1.0/macports.tcl 2012-02-20 00:41:58 UTC (rev 90030)
+++ branches/release_2_0/base/src/macports1.0/macports.tcl 2012-02-20 00:43:59 UTC (rev 90031)
@@ -62,7 +62,7 @@
# deferred options are only computed when needed.
# they are not exported to the trace thread.
# they are not exported to the interpreter in system_options array.
- variable portinterp_deferred_options "xcodeversion xcodebuildcmd"
+ variable portinterp_deferred_options "xcodeversion xcodebuildcmd developer_dir"
variable open_mports {}
@@ -362,7 +362,7 @@
trace remove variable macports::xcodeversion read macports::setxcodeinfo
trace remove variable macports::xcodebuildcmd read macports::setxcodeinfo
- if {[catch {set xcodebuild [binaryInPath "xcodebuild"]}] == 0} {
+ if {![catch {findBinary xcodebuild /usr/bin/xcodebuild} xcodebuild]} {
if {![info exists xcodeversion]} {
# Determine xcode version
set macports::xcodeversion "2.0orlower"
@@ -414,6 +414,85 @@
}
}
+# deferred calculation of developer_dir
+proc macports::set_developer_dir {name1 name2 op} {
+ global macports::developer_dir macports::os_major macports::xcodeversion
+
+ trace remove variable macports::developer_dir read macports::set_developer_dir
+
+ # Look for xcodeselect, and make sure it has a valid value
+ if {![catch {findBinary xcode-select /usr/bin/xcode-select} xcodeselect]} {
+
+ # We have xcode-select: ask it where xcode is
+ set devdir [exec $xcodeselect -print-path 2> /dev/null]
+
+ # If the directory is valid, use it
+ if {[_is_valid_developer_dir $devdir]} {
+ set macports::developer_dir $devdir
+ return
+ }
+
+ # The directory from xcode-select isn't correct.
+ # Ask mdfind where Xcode is and make some suggestions for the user,
+ # searching by bundle identifier for various Xcode versions (3.x and 4.x)
+ set installed_xcodes {}
+ if {![catch {findBinary mdfind /usr/bin/mdfind} mdfind]} {
+ set installed_xcodes [concat \
+ [exec $mdfind "kMDItemCFBundleIdentifier == 'com.apple.Xcode'"] \
+ [exec $mdfind "kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'"] \
+ ]
+ }
+ if {[llength $installed_xcodes] > 0 && ![catch {findBinary mdls /usr/bin/mdls} mdls]} {
+ # One, or more than one, Xcode installations found
+ ui_error "No valid Xcode installation is properly selected."
+
+ ui_error
+ ui_error "Please use xcode-select to select an Xcode installation:"
+ foreach xcode $installed_xcodes {
+ set vers [exec $mdls -raw -name kMDItemVersion $xcode]
+ if { $vers == "(null)" } { set vers "unknown" }
+ if {[vercmp $vers 4.3] >= 0 || [_is_valid_developer_dir "${xcode}/Contents/Developer"]} {
+ ui_error " sudo xcode-select -switch ${xcode} # version ${vers}"
+ } elseif {[_is_valid_developer_dir "${xcode}/../.."]} {
+ ui_error " sudo xcode-select -switch [file normalize ${xcode}/../..] # version ${vers}"
+ } else {
+ ui_error " # malformed xcode at ${xcode}, version ${vers}"
+ }
+ }
+ ui_error
+ }
+ }
+
+ # Try the default
+ if {$os_major >= 11 && [vercmp $xcodeversion 4.3] >= 0} {
+ set devdir "/Applications/Xcode.app/Contents/Developer"
+ } else {
+ set devdir "/Developer"
+ }
+
+ set macports::developer_dir $devdir
+}
+
+proc macports::_is_valid_developer_dir {dir} {
+ # Check whether specified directory looks valid for an Xcode installation
+
+ # Verify that the directory exists
+ if {![file isdirectory $dir]} {
+ return 0
+ }
+
+ # Verify that the directory has some key subdirectories
+ foreach subdir {Headers Library usr} {
+ if {![file isdirectory "${dir}/${subdir}"]} {
+ return 0
+ }
+ }
+
+ # The specified directory seems valid for Xcode
+ return 1
+}
+
+
proc mportinit {{up_ui_options {}} {up_options {}} {up_variations {}}} {
if {$up_ui_options eq ""} {
array set macports::ui_options {}
@@ -671,8 +750,8 @@
set macports::portautoclean "yes"
global macports::portautoclean
}
- # whether to keep logs after successful builds
- if {![info exists keeplogs]} {
+ # whether to keep logs after successful builds
+ if {![info exists keeplogs]} {
set macports::keeplogs "no"
global macports::keeplogs
}
@@ -897,7 +976,15 @@
trace add variable macports::xcodebuildcmd read macports::setxcodeinfo
}
- if {[vercmp $xcodeversion 4.3] >= 0} {
+ if {![info exists developer_dir]} {
+ if {$os_platform == "darwin"} {
+ trace add variable macports::developer_dir read macports::set_developer_dir
+ } else {
+ set macports::developer_dir ""
+ }
+ }
+
+ if {$os_major >= 11 && $os_platform == "darwin" && [vercmp $xcodeversion 4.3] >= 0} {
macports::copy_xcode_plist $env(HOME)
}
Modified: branches/release_2_0/base/src/port1.0/portmain.tcl
===================================================================
--- branches/release_2_0/base/src/port1.0/portmain.tcl 2012-02-20 00:41:58 UTC (rev 90030)
+++ branches/release_2_0/base/src/port1.0/portmain.tcl 2012-02-20 00:43:59 UTC (rev 90031)
@@ -44,6 +44,8 @@
namespace eval portmain {
}
+set_ui_prefix
+
# define options
options prefix name version revision epoch categories maintainers \
long_description description homepage notes license \
@@ -89,7 +91,6 @@
default prefix /opt/local
default applications_dir /Applications/MacPorts
default frameworks_dir {${prefix}/Library/Frameworks}
-default developer_dir {[portmain::get_developer_dir]}
default destdir destroot
default destpath {${workpath}/${destdir}}
# destroot is provided as a clearer name for the "destpath" variable
@@ -144,20 +145,6 @@
default compiler.cpath {${prefix}/include}
default compiler.library_path {${prefix}/lib}
-proc portmain::get_developer_dir {} {
- if {![catch {binaryInPath xcode-select}]
- && ![catch {exec xcode-select -print-path 2> /dev/null} result]
- && [file isdirectory $result]} {
- return $result
- }
- global xcodeversion
- if {[vercmp $xcodeversion 4.3] >= 0} {
- return "/Applications/Xcode.app/Contents/Developer"
- } else {
- return "/Developer"
- }
-}
-
# start gsoc08-privileges
# Record initial euid/egid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120219/7fb768ca/attachment.html>
More information about the macports-changes
mailing list