Skip to content

Commit

Permalink
critcl: avoid using an SDK older than osxmin
Browse files Browse the repository at this point in the history
  • Loading branch information
jmroot committed Feb 16, 2025
1 parent 0ffc8b0 commit 574ee31
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 62 deletions.
71 changes: 21 additions & 50 deletions vendor/critcl-3.3.1/lib/critcl/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,23 @@ 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)
} else {
# use the current platform
set v1 [lindex [split $::tcl_platform(osVersion) .] 0]
# Darwin 19 and earlier are macOS 10.x. Darwin 20 and later are macOS
# 11, macOS 12, etc.
if {$v1 >= 20} {
incr v1 -9
set osxmin ${v1}.0
} else {
incr v1 -4
set osxmin 10.$v1
}
}
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]} {
Expand All @@ -97,8 +114,10 @@ if {[string match macosx-* $platform]} {
-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
}
Expand All @@ -110,54 +129,6 @@ if {[string match macosx-* $platform]} {
}
}
}
if {[info exists ::env(MACOSX_DEPLOYMENT_TARGET)] && $::env(MACOSX_DEPLOYMENT_TARGET) ne ""} {
set osxmin $::env(MACOSX_DEPLOYMENT_TARGET)
} elseif {0 && $SDKROOT ne ""} {
# get the SDKsettings for the min OSX value supported
set info ""
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]
}
}
if {$info eq ""} {
puts stderr "SDKROOT isn't configured correctly on this host"
puts stderr "current setting $SDKROOT needs updating"
exit 1
}
set info [string trim $info]
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
# Darwin 19 and earlier are macOS 10.x. Darwin 20 and later are macOS
# 11, macOS 12, etc.
if {$v1 >= 20} {
incr v1 -9
set osxmin ${v1}.0
} else {
incr v1 -4
set osxmin 10.$v1
}
# do we actually need to check if universal is supported, given the
# gcc check below will do it for us?
# 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 /
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
--- lib/critcl/Config.in.orig
+++ lib/critcl/Config.in
@@ -83,12 +83,16 @@ threadflags -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 \
@@ -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]} {
Expand All @@ -19,7 +26,17 @@
foreach dir [glob -nocomplain -tails \
-directory $base/SDKs MacOSX*] {
set ver [string trimright \
@@ -102,16 +106,22 @@ if {[string match macosx-* $platform]} {
[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)
Expand All @@ -28,11 +45,9 @@
+ break
}
}
- if {$SDKROOT ne ""} {
+ }
+ if {[info exists ::env(MACOSX_DEPLOYMENT_TARGET)] && $::env(MACOSX_DEPLOYMENT_TARGET) ne ""} {
+ set osxmin $::env(MACOSX_DEPLOYMENT_TARGET)
+ } elseif {0 && $SDKROOT ne ""} {
+ if {![info exists osxmin]} {
if {$SDKROOT ne ""} {
# get the SDKsettings for the min OSX value supported
set info ""
- if [catch {
Expand All @@ -47,21 +62,24 @@
catch {
set info [exec defaults read $SDKROOT/SDKSettings DefaultProperties \
-dict MACOSX_DEPLOYMENT_TARGET]
@@ -126,6 +136,7 @@ if {[string match macosx-* $platform]} {
@@ -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
@@ -146,6 +157,9 @@ if {[string match macosx-* $platform]} {
if {[info exists ::env(osxmin)] && $::env(osxmin) ne ""} {
set osxmin $::env(osxmin)
@@ -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 {
set ppc [expr {[exec gcc -v -arch ppc > /dev/null 2>@stdout] eq ""}]
File renamed without changes.
73 changes: 73 additions & 0 deletions vendor/patches/critcl/06-default-osxmin.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
--- lib/critcl/Config.in.orig 2025-02-17 00:15:58
+++ lib/critcl/Config.in 2025-02-17 00:27:16
@@ -85,6 +85,18 @@
set osxmin $::env(osxmin)
} elseif {[info exists ::env(MACOSX_DEPLOYMENT_TARGET)] && $::env(MACOSX_DEPLOYMENT_TARGET) ne ""} {
set osxmin $::env(MACOSX_DEPLOYMENT_TARGET)
+ } else {
+ # use the current platform
+ set v1 [lindex [split $::tcl_platform(osVersion) .] 0]
+ # Darwin 19 and earlier are macOS 10.x. Darwin 20 and later are macOS
+ # 11, macOS 12, etc.
+ if {$v1 >= 20} {
+ incr v1 -9
+ set osxmin ${v1}.0
+ } else {
+ incr v1 -4
+ set osxmin 10.$v1
+ }
}
if {[info exists ::env(SDKROOT)] && $::env(SDKROOT) ne ""} {
set SDKROOT $::env(SDKROOT)
@@ -117,51 +129,6 @@
}
}
}
- if {![info exists osxmin]} {
- if {$SDKROOT ne ""} {
- # get the SDKsettings for the min OSX value supported
- set info ""
- 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]
- }
- }
- if {$info eq ""} {
- puts stderr "SDKROOT isn't configured correctly on this host"
- puts stderr "current setting $SDKROOT needs updating"
- exit 1
- }
- set info [string trim $info]
- 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
- # Darwin 19 and earlier are macOS 10.x. Darwin 20 and later are macOS
- # 11, macOS 12, etc.
- if {$v1 >= 20} {
- incr v1 -9
- set osxmin ${v1}.0
- } else {
- incr v1 -4
- set osxmin 10.$v1
- }
- # do we actually need to check if universal is supported, given the
- # gcc check below will do it for us?
- # set info [exec lipo -info /usr/lib/libSystem.dylib]
- # set plats [split [string trim [lindex [split $info :] 2]]]
- }
- }
if {$SDKROOT eq ""} {
set SDKROOT /
}

0 comments on commit 574ee31

Please sign in to comment.