From 99b91e604816abe5187beb2f8fa8ba46d7fc2c6f Mon Sep 17 00:00:00 2001 From: Joshua Root Date: Mon, 2 Oct 2023 04:19:44 +1100 Subject: [PATCH] port diagnose: fix multiple issues with check_for_clt OS versions newer than 10.9 also use /Library/Developer/CommandLineTools. `xcode-select --install` doesn't work on pre-10.9. There is no xcode-select on Tiger. Also check for missing CLTs receipt. Closes: https://trac.macports.org/ticket/53909 --- src/macports1.0/diagnose.tcl | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/macports1.0/diagnose.tcl b/src/macports1.0/diagnose.tcl index c90bdaaccf..f78d413ffb 100644 --- a/src/macports1.0/diagnose.tcl +++ b/src/macports1.0/diagnose.tcl @@ -138,8 +138,8 @@ namespace eval diagnose { proc check_for_clt {} { # Checks to see if the Xcode Command Line Tools are installed by checking if the file - # /Library/Developer/CommandLineTools exists if the system is running 10.9, or if they're - # running an older version, if the command xcode-select -p outputs something. + # /Library/Developer/CommandLineTools exists if the system is running 10.9+, or if they're + # running an older version, if /usr/include exists. # # Args: # None @@ -148,26 +148,29 @@ namespace eval diagnose { output "command line tools" - if {${macports::macos_version_major} eq "10.9"} { + if {[vercmp ${macports::macos_version_major} >= "10.9"]} { if {![file exists "/Library/Developer/CommandLineTools/"]} { - ui_warn "Xcode Command Line Tools are not installed! To install them, please enter the command: + ui_warn "Xcode Command Line Tools do not appear to be installed. To install them, please enter the command: xcode-select --install" success_fail 0 return + } elseif {$macports::xcodecltversion eq "none"} { + ui_warn "The Xcode Command Line Tools package appears to be installed, but its receipt appears to be missing." + ui_warn "The Command Line Tools may be outdated, which can cause problems." + ui_warn "Please see: " } success_fail 1 return } else { - set xcode_select [exec xcode-select -print-path] + if {![file exists "/usr/include"]} { - if {$xcode_select eq ""} { - - ui_warn "Xcode Command Line Tools are not installed! To install them, please enter the command: - xcode-select --install" + ui_warn "Xcode Command Line Tools do not appear to be installed. \ + To install them, please follow the instructions for your OS version at: + " success_fail 0 return }