Add cxxstdlib_check method to request changing C++ stdlib checking.
* In certain cases, a C++ software may result in linking to a different and incompatible C++ standard library than its dependencies and still works fine because it is by design. Examples include GCC, which will bootstrap itself and self-host after finish. * Add a cxxstdlib_check method to formula to request changing the C++ standard library checking. Currently using "cxxstdlib_check :skip" will let a formula skip such checking. This should only be used on rare occasions and be very careful. Closes Homebrew/homebrew#23687.
This commit is contained in:
parent
6fc6dd791b
commit
917b94df98
@ -33,14 +33,17 @@ class CxxStdlib
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_dependencies(formula, deps)
|
def check_dependencies(formula, deps)
|
||||||
deps.each do |dep|
|
unless formula.cxxstdlib.include? :skip
|
||||||
# Software is unlikely to link against anything from its buildtime deps,
|
deps.each do |dep|
|
||||||
# so it doesn't matter at all if they link against different C++ stdlibs
|
# Software is unlikely to link against anything from its
|
||||||
next if dep.tags.include? :build
|
# buildtime deps, so it doesn't matter at all if they link
|
||||||
|
# against different C++ stdlibs
|
||||||
|
next if dep.tags.include? :build
|
||||||
|
|
||||||
dep_stdlib = Tab.for_formula(dep.to_formula).cxxstdlib
|
dep_stdlib = Tab.for_formula(dep.to_formula).cxxstdlib
|
||||||
if !compatible_with? dep_stdlib
|
if !compatible_with? dep_stdlib
|
||||||
raise IncompatibleCxxStdlibs.new(formula, dep, dep_stdlib, self)
|
raise IncompatibleCxxStdlibs.new(formula, dep, dep_stdlib, self)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -25,6 +25,10 @@ class Formula
|
|||||||
|
|
||||||
attr_accessor :local_bottle_path
|
attr_accessor :local_bottle_path
|
||||||
|
|
||||||
|
# Flag for marking whether this formula needs C++ standard library
|
||||||
|
# compatibility check
|
||||||
|
attr_reader :cxxstdlib
|
||||||
|
|
||||||
# Homebrew determines the name
|
# Homebrew determines the name
|
||||||
def initialize name='__UNKNOWN__', path=nil
|
def initialize name='__UNKNOWN__', path=nil
|
||||||
@name = name
|
@name = name
|
||||||
@ -52,6 +56,8 @@ class Formula
|
|||||||
@build = determine_build_options
|
@build = determine_build_options
|
||||||
|
|
||||||
@pin = FormulaPin.new(self)
|
@pin = FormulaPin.new(self)
|
||||||
|
|
||||||
|
@cxxstdlib ||= Set.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_spec(name)
|
def set_spec(name)
|
||||||
@ -643,6 +649,12 @@ class Formula
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Explicitly request changing C++ standard library compatibility check
|
||||||
|
# settings. Use with caution!
|
||||||
|
def cxxstdlib_check check_type
|
||||||
|
@cxxstdlib << check_type
|
||||||
|
end
|
||||||
|
|
||||||
def self.method_added method
|
def self.method_added method
|
||||||
case method
|
case method
|
||||||
when :brew
|
when :brew
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user