Merge pull request #7278 from Bo98/libxml2-10.15.4

ENV: don't help include libxml2 on macOS SDK 10.15.4 and later
This commit is contained in:
Mike McQuaid 2020-04-05 16:28:58 +01:00 committed by GitHub
commit e2cfc2b50f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 5 deletions

View File

@ -93,12 +93,14 @@ module Stdenv
end end
# Some configure scripts won't find libxml2 without help # Some configure scripts won't find libxml2 without help
# This is a no-op with macOS SDK 10.15.4 and later
def libxml2 def libxml2
if !MacOS.sdk_path_if_needed sdk = MacOS.sdk_path_if_needed
if !sdk
append "CPPFLAGS", "-I/usr/include/libxml2" append "CPPFLAGS", "-I/usr/include/libxml2"
else elsif !(sdk/"usr/include/libxml").directory?
# Use the includes form the sdk # Use the includes form the sdk
append "CPPFLAGS", "-I#{MacOS.sdk_path}/usr/include/libxml2" append "CPPFLAGS", "-I#{sdk}/usr/include/libxml2"
end end
end end

View File

@ -42,9 +42,17 @@ module Superenv
paths paths
end end
# @private
def libxml2_include_needed?
return false if deps.any? { |d| d.name == "libxml2" }
return false if Pathname("#{self["HOMEBREW_SDKROOT"]}/usr/include/libxml").directory?
true
end
def homebrew_extra_isystem_paths def homebrew_extra_isystem_paths
paths = [] paths = []
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/include/libxml2" unless deps.any? { |d| d.name == "libxml2" } 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"]}/usr/include/apache2" if MacOS::Xcode.without_clt?
paths << MacOS::X11.include.to_s << "#{MacOS::X11.include}/freetype2" if x11? paths << MacOS::X11.include.to_s << "#{MacOS::X11.include}/freetype2" if x11?
paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers" paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers"
@ -64,7 +72,7 @@ module Superenv
def homebrew_extra_cmake_include_paths def homebrew_extra_cmake_include_paths
paths = [] paths = []
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/include/libxml2" unless deps.any? { |d| d.name == "libxml2" } 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"]}/usr/include/apache2" if MacOS::Xcode.without_clt?
paths << MacOS::X11.include.to_s << "#{MacOS::X11.include}/freetype2" if x11? paths << MacOS::X11.include.to_s << "#{MacOS::X11.include}/freetype2" if x11?
paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers" paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers"