Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Library/Homebrew/extend/ENV/std.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_a
append_path "PATH", gcc_formula.opt_bin.to_s
end

sig { void }
def libxml2
odeprecated "ENV.libxml2", "`pkg-config` or explicit include paths"
end

sig { returns(T.nilable(PATH)) }
def determine_pkg_config_libdir
PATH.new(
Expand Down
18 changes: 10 additions & 8 deletions Library/Homebrew/extend/os/linux/diagnostic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,16 @@ def check_linux_sandbox

::Homebrew::Diagnostic::Finding.new(
::Sandbox.failure_reason || "The Linux sandbox is not available.",
remediation: if state == :missing_fiddle
"Run Homebrew with its vendored Ruby, which includes Fiddle."
else
<<~EOS.chomp
Homebrew's Linux sandbox requires a kernel with Landlock enabled.
Upgrade to a Linux kernel with Landlock enabled.
EOS
end,
remediation: (
if state == :missing_fiddle
"Run Homebrew with its vendored Ruby, which includes Fiddle."
else
<<~EOS.chomp
Homebrew's Linux sandbox requires a kernel with Landlock enabled.
Upgrade to a Linux kernel with Landlock enabled.
EOS
end
),
)
end

Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/extend/os/linux/extend/ENV/std.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_a

sig { void }
def libxml2
super
append "CPPFLAGS", "-I#{::Formula["libxml2"].include/"libxml2"}"
rescue FormulaUnavailableError
nil
Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/extend/os/mac/extend/ENV/std.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def macosxsdk(version = nil, formula: nil, testing_formula: false)
# This is a no-op with all supported macOS SDKs.
sig { void }
def libxml2
super
sdk = self["SDKROOT"] || MacOS.sdk_path
# Use the includes from the sdk
append "CPPFLAGS", "-I#{sdk}/usr/include/libxml2" unless Pathname("#{sdk}/usr/include/libxml").directory?
Expand Down
10 changes: 0 additions & 10 deletions Library/Homebrew/extend/os/mac/extend/ENV/super.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,9 @@ def homebrew_extra_pkg_config_paths
].map { |p| ::Pathname.new(p) }
end

sig { returns(T::Boolean) }
def libxml2_include_needed?
return false if deps.any? { |d| d.name == "libxml2" }
return false if ::Pathname.new("#{self["HOMEBREW_SDKROOT"]}/usr/include/libxml").directory?

true
end

sig { returns(T::Array[::Pathname]) }
def homebrew_extra_isystem_paths
paths = []
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/include/libxml2" if libxml2_include_needed?
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/include/apache2" if MacOS::Xcode.without_clt?
paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers"
paths.map { |p| ::Pathname.new(p) }
Expand All @@ -64,7 +55,6 @@ def homebrew_extra_library_paths
sig { returns(T::Array[::Pathname]) }
def homebrew_extra_cmake_include_paths
paths = []
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/include/libxml2" if libxml2_include_needed?
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/include/apache2" if MacOS::Xcode.without_clt?
paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers"
paths.map { |p| ::Pathname.new(p) }
Expand Down
9 changes: 9 additions & 0 deletions Library/Homebrew/test/ENV_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,15 @@

describe Stdenv do
include_examples EnvActivation

describe "#libxml2" do
it "is deprecated" do
expect(env).to receive(:odeprecated)
.with("ENV.libxml2", "`pkg-config` or explicit include paths")

env.libxml2
end
end
end

describe Superenv do
Expand Down
Loading