--- lib/critcl/Config.in.orig +++ lib/critcl/Config.in @@ -81,20 +81,31 @@ threadflags -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 \ # OSX - check if universal binaries supported by the installed toolchain if {[string match macosx-* $platform]} { + if {[info exists ::env(osxmin)] && $::env(osxmin) ne ""} { + set osxmin $::env(osxmin) + } elseif {[info exists ::env(MACOSX_DEPLOYMENT_TARGET)] && $::env(MACOSX_DEPLOYMENT_TARGET) ne ""} { + set osxmin $::env(MACOSX_DEPLOYMENT_TARGET) + } if {[info exists ::env(SDKROOT)] && $::env(SDKROOT) ne ""} { set SDKROOT $::env(SDKROOT) + } elseif {![catch {exec xcrun --show-sdk-path} sdkpath] && $sdkpath ne {} && [file exists $sdkpath]} { + set SDKROOT $sdkpath } else { # look for an SDK supporting universal binaries + set SDKROOT "" set pos [string length MacOSX] set sdklist {} - set base /Developer - catch {set base [exec xcode-select -print-path]} + set bases {/Library/Developer/CommandLineTools /Developer} + catch {lappend bases [exec xcode-select -print-path]} + foreach base $bases { foreach dir [glob -nocomplain -tails \ -directory $base/SDKs MacOSX*] { set ver [string trimright \ [file rootname [string range $dir $pos end]] u] - if {"$ver" != "" && [package vcompare $ver 10.4] >= 0} { - # 10.4 is earliest supporting universal that we support + if {"$ver" != "" && [package vcompare $ver 10.4] >= 0 + && (![info exists osxmin] || [package vcompare $ver $osxmin] >= 0)} { + # 10.4 is earliest supporting universal that we support, and + # the deployment target cannot be newer than the SDK. set path($ver) $dir lappend sdklist $ver } @@ -102,16 +113,21 @@ if {[string match macosx-* $platform]} { if {[llength $sdklist]} { set ver [lindex [lsort -command "package vcompare" $sdklist] 0] set SDKROOT $base/SDKs/$path($ver) - } else { - set SDKROOT "" + break } } + } + if {![info exists osxmin]} { if {$SDKROOT ne ""} { # get the SDKsettings for the min OSX value supported set info "" - if [catch { + if {[catch { + set osxmin [exec plutil -extract DefaultProperties.MACOSX_DEPLOYMENT_TARGET \ + raw $SDKROOT/SDKSettings.plist] + }]} { + if {[catch { set info [exec defaults read $SDKROOT/SDKSettings buildSettings] - }] { + }]} { catch { set info [exec defaults read $SDKROOT/SDKSettings DefaultProperties \ -dict MACOSX_DEPLOYMENT_TARGET] @@ -126,6 +142,7 @@ if {[string match macosx-* $platform]} { regsub -all {[\n"\;=\{\}]+} $info "" info ;#" help emacs hilighting regsub -all {\s+} $info " " info set osxmin [lindex $info 1] + } } else { # use the current platform foreach {v1 v2 v3} [split $::tcl_platform(osVersion) .] break @@ -143,8 +160,10 @@ if {[string match macosx-* $platform]} { # set info [exec lipo -info /usr/lib/libSystem.dylib] # set plats [split [string trim [lindex [split $info :] 2]]] } - if {[info exists ::env(osxmin)] && $::env(osxmin) ne ""} { - set osxmin $::env(osxmin) + } + } + if {$SDKROOT eq ""} { + set SDKROOT / } set universal 0 catch {