Allow setting sysroots to a CLT SDK

This commit is contained in:
Misty De Meo 2018-06-12 15:01:46 -07:00
parent 8450ffa8ad
commit 160534983f
No known key found for this signature in database
GPG Key ID: 76CF846A2F674B2C
2 changed files with 7 additions and 7 deletions

View File

@ -27,7 +27,7 @@ module Stdenv
append_path "ACLOCAL_PATH", "#{MacOS::X11.share}/aclocal" append_path "ACLOCAL_PATH", "#{MacOS::X11.share}/aclocal"
if MacOS::XQuartz.provided_by_apple? && !MacOS::CLT.installed? if MacOS::XQuartz.provided_by_apple? && MacOS.sdk_path
append_path "CMAKE_PREFIX_PATH", "#{MacOS.sdk_path}/usr/X11" append_path "CMAKE_PREFIX_PATH", "#{MacOS.sdk_path}/usr/X11"
end end
@ -93,7 +93,7 @@ module Stdenv
delete("CPATH") delete("CPATH")
remove "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib" remove "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib"
return unless (sdk = MacOS.sdk_path(version)) && !MacOS::CLT.installed? return unless (sdk = MacOS.sdk_path(version))
delete("SDKROOT") delete("SDKROOT")
remove_from_cflags "-isysroot #{sdk}" remove_from_cflags "-isysroot #{sdk}"
remove "CPPFLAGS", "-isysroot #{sdk}" remove "CPPFLAGS", "-isysroot #{sdk}"
@ -115,7 +115,7 @@ module Stdenv
self["CPATH"] = "#{HOMEBREW_PREFIX}/include" self["CPATH"] = "#{HOMEBREW_PREFIX}/include"
prepend "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib" prepend "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib"
return unless (sdk = MacOS.sdk_path(version)) && !MacOS::CLT.installed? return unless (sdk = MacOS.sdk_path(version))
# Extra setup to support Xcode 4.3+ without CLT. # Extra setup to support Xcode 4.3+ without CLT.
self["SDKROOT"] = sdk self["SDKROOT"] = sdk
# Tell clang/gcc where system include's are: # Tell clang/gcc where system include's are:
@ -132,7 +132,7 @@ module Stdenv
# Some configure scripts won't find libxml2 without help # Some configure scripts won't find libxml2 without help
def libxml2 def libxml2
if MacOS::CLT.installed? if !MacOS.sdk_path
append "CPPFLAGS", "-I/usr/include/libxml2" append "CPPFLAGS", "-I/usr/include/libxml2"
else else
# Use the includes form the sdk # Use the includes form the sdk

View File

@ -58,7 +58,7 @@ module Superenv
def homebrew_extra_library_paths def homebrew_extra_library_paths
paths = [] paths = []
if compiler == :llvm_clang if compiler == :llvm_clang
if MacOS::CLT.installed? if !MacOS.sdk_path
paths << "/usr/lib" paths << "/usr/lib"
else else
paths << "#{MacOS.sdk_path}/usr/lib" paths << "#{MacOS.sdk_path}/usr/lib"
@ -102,7 +102,7 @@ module Superenv
end end
def effective_sysroot def effective_sysroot
MacOS.sdk_path.to_s if MacOS::Xcode.without_clt? MacOS.sdk_path&.to_s
end end
def set_x11_env_if_installed def set_x11_env_if_installed
@ -113,7 +113,7 @@ module Superenv
def setup_build_environment(formula = nil) def setup_build_environment(formula = nil)
generic_setup_build_environment(formula) generic_setup_build_environment(formula)
self["HOMEBREW_SDKROOT"] = effective_sysroot self["HOMEBREW_SDKROOT"] = effective_sysroot
self["SDKROOT"] = MacOS.sdk_path if MacOS::Xcode.without_clt? self["SDKROOT"] = MacOS.sdk_path if MacOS.sdk_path
# Filter out symbols known not to be defined since GNU Autotools can't # Filter out symbols known not to be defined since GNU Autotools can't
# reliably figure this out with Xcode 8 and above. # reliably figure this out with Xcode 8 and above.