Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating to the MacOSX11.sdk symlink #10769

Merged
merged 3 commits into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions Library/Homebrew/extend/os/mac/diagnostic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,13 @@ def check_if_supported_sdk_available
locator = MacOS.sdk_locator

source = if locator.source == :clt
return if MacOS::CLT.below_minimum_version? # Handled by other diagnostics.

update_instructions = MacOS::CLT.update_instructions
"Command Line Tools (CLT)"
else
return if MacOS::Xcode.below_minimum_version? # Handled by other diagnostics.

update_instructions = MacOS::Xcode.update_instructions
"Xcode"
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/os/mac/pkgconfig/11/expat.pc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/os/mac/pkgconfig/11/libcurl.pc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# This should most probably benefit from getting a "Requires:" field added
# dynamically by configure.
#
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/os/mac/pkgconfig/11/libedit.pc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/os/mac/pkgconfig/11/libexslt.pc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/os/mac/pkgconfig/11/libffi.pc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/os/mac/pkgconfig/11/libxml-2.0.pc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/os/mac/pkgconfig/11/libxslt.pc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/os/mac/pkgconfig/11/ncurses.pc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/os/mac/pkgconfig/11/ncursesw.pc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/os/mac/pkgconfig/11/sqlite3.pc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/os/mac/pkgconfig/11/uuid.pc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/os/mac/pkgconfig/11/zlib.pc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
Expand Down
22 changes: 11 additions & 11 deletions Library/Homebrew/os/mac/sdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ module Mac
#
# @api private
class SDK
VERSIONED_SDK_REGEX = /MacOSX(\d+\.\d+)\.sdk$/.freeze
# 11.x SDKs are explicitly excluded - we want the MacOSX11.sdk symlink instead.
VERSIONED_SDK_REGEX = /MacOSX(10\.\d+|\d+)\.sdk$/.freeze

attr_reader :version, :path, :source

Expand Down Expand Up @@ -41,24 +42,23 @@ def all_sdks
# Bail out if there is no SDK prefix at all
return @all_sdks unless File.directory? sdk_prefix

# Use unversioned SDK path on Big Sur to avoid issues such as:
# https://github.com/Homebrew/homebrew-core/issues/67075
unversioned_sdk_path = Pathname.new("#{sdk_prefix}/MacOSX.sdk")
version = read_sdk_version(unversioned_sdk_path)
if version && version >= :big_sur
unversioned_sdk_version = version
@all_sdks << SDK.new(unversioned_sdk_version, unversioned_sdk_path, source)
end

Dir["#{sdk_prefix}/MacOSX*.sdk"].each do |sdk_path|
next unless sdk_path.match?(SDK::VERSIONED_SDK_REGEX)

version = read_sdk_version(Pathname.new(sdk_path))
next if version.nil? || version == unversioned_sdk_version
next if version.nil?

@all_sdks << SDK.new(version, sdk_path, source)
end

# Fall back onto unversioned SDK if we've not found a suitable SDK
if @all_sdks.empty?
sdk_path = Pathname.new("#{sdk_prefix}/MacOSX.sdk")
if (version = read_sdk_version(sdk_path))
@all_sdks << SDK.new(version, sdk_path, source)
end
end

@all_sdks
end

Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/os/mac/xcode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def latest_clang_version
def minimum_version
case MacOS.version
when "12" then "13.0.0"
when "11" then "12.0.0"
when "11" then "12.5.0"
MikeMcQuaid marked this conversation as resolved.
Show resolved Hide resolved
when "10.15" then "11.0.0"
when "10.14" then "10.0.0"
when "10.13" then "9.0.0"
Expand Down
2 changes: 2 additions & 0 deletions Library/Homebrew/test/os/mac/diagnostic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
before do
allow(DevelopmentTools).to receive(:installed?).and_return(true)
allow(OS::Mac).to receive(:version).and_return(macos_version)
allow(OS::Mac::CLT).to receive(:below_minimum_version?).and_return(false)
allow(OS::Mac::Xcode).to receive(:below_minimum_version?).and_return(false)
end

it "doesn't trigger when SDK root is not needed" do
Expand Down