Merge pull request #782 from MikeMcQuaid/weak-imports-opt-in

Make -no_weak_imports opt-in.
This commit is contained in:
Mike McQuaid 2016-08-22 12:02:16 +01:00 committed by GitHub
commit 31052a924f
5 changed files with 6 additions and 19 deletions

View File

@ -79,11 +79,6 @@ class Build
ENV.activate_extensions! ENV.activate_extensions!
# Go makes extensive use of weak imports.
if formula_deps.any? { |f| f.name == "go" }
ENV.permit_weak_imports
end
if superenv? if superenv?
ENV.keg_only_deps = keg_only_deps ENV.keg_only_deps = keg_only_deps
ENV.deps = formula_deps ENV.deps = formula_deps

View File

@ -293,6 +293,7 @@ module SharedEnvExtension
def permit_arch_flags; end def permit_arch_flags; end
# A no-op until we enable this by default again (which we may never do).
def permit_weak_imports; end def permit_weak_imports; end
private private

View File

@ -1,5 +1,5 @@
module SharedEnvExtension module SharedEnvExtension
def no_weak_imports? def no_weak_import_support?
return false unless compiler == :clang return false unless compiler == :clang
if MacOS::Xcode.version && MacOS::Xcode.version < "8.0" if MacOS::Xcode.version && MacOS::Xcode.version < "8.0"

View File

@ -28,11 +28,6 @@ module Stdenv
# depend on it already being installed to build itself. # depend on it already being installed to build itself.
ld64 if Formula["ld64"].installed? ld64 if Formula["ld64"].installed?
end end
# Xcode 8 should be told to fail to link against weak links
# Issue from Apple engineer:
# https://github.com/Homebrew/homebrew-core/issues/3727
append "LDFLAGS", "-Wl,-no_weak_imports" if no_weak_imports?
end end
def homebrew_extra_pkg_config_paths def homebrew_extra_pkg_config_paths
@ -147,7 +142,7 @@ module Stdenv
append "CFLAGS", "-I#{MacOS::X11.include}" unless MacOS::CLT.installed? append "CFLAGS", "-I#{MacOS::X11.include}" unless MacOS::CLT.installed?
end end
def permit_weak_imports def no_weak_imports
remove "LDFLAGS", "-Wl,-no_weak_imports" append "LDFLAGS", "-Wl,-no_weak_imports"
end end
end end

View File

@ -81,10 +81,6 @@ module Superenv
s << "s" if MacOS.version >= :mountain_lion s << "s" if MacOS.version >= :mountain_lion
# Fix issue with >= 10.8 apr-1-config having broken paths # Fix issue with >= 10.8 apr-1-config having broken paths
s << "a" if MacOS.version >= :mountain_lion s << "a" if MacOS.version >= :mountain_lion
# Xcode 8 should be told to fail to link against weak links
# Issue from Apple engineer:
# https://github.com/Homebrew/homebrew-core/issues/3727
s << "w" if no_weak_imports?
s s
end end
@ -107,8 +103,8 @@ module Superenv
ENV.x11 = MacOS::X11.installed? ENV.x11 = MacOS::X11.installed?
end end
def permit_weak_imports def no_weak_imports
remove "HOMEBREW_CCCFG", "w" add "HOMEBREW_CCCFG", "w"
end end
# These methods are no longer necessary under superenv, but are needed to # These methods are no longer necessary under superenv, but are needed to