diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 7af9d17b6f..440554651b 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1131,6 +1131,13 @@ class Formula end end + # Whether this {Formula} is allowed to have broken linkage. + # Defaults to false. + # @return [Boolean] + def allow_missing_libs? + false + end + # Whether this {Formula} is deprecated (i.e. warns on installation). # Defaults to false. # @method deprecated? @@ -2596,6 +2603,10 @@ class Formula @skip_clean_paths ||= Set.new end + def allow_missing_libs + define_method(:allow_missing_libs?) { true } + end + # Software that will not be symlinked into the `brew --prefix` will only # live in its Cellar. Other formulae can depend on it and then brew will # add the necessary includes and libs (etc.) during the brewing of that diff --git a/Library/Homebrew/linkage_checker.rb b/Library/Homebrew/linkage_checker.rb index a654a83701..220b04bfac 100644 --- a/Library/Homebrew/linkage_checker.rb +++ b/Library/Homebrew/linkage_checker.rb @@ -59,14 +59,20 @@ class LinkageChecker display_items "Broken dependencies", @broken_deps, puts_output: puts_output display_items "Unwanted system libraries", @unwanted_system_dylibs, puts_output: puts_output display_items "Conflicting libraries", @version_conflict_deps, puts_output: puts_output - puts "No broken library linkage" unless broken_library_linkage? + if got_library_issues? + puts "Broken library linkage ignored" if @formula.allow_missing_libs? + else + puts "No broken library linkage" + end end def broken_library_linkage? - !@broken_dylibs.empty? || - !@broken_deps.empty? || - !@unwanted_system_dylibs.empty? || - !@version_conflict_deps.empty? + !@formula.allow_missing_libs? && got_library_issues? + end + + def got_library_issues? + issues = [@broken_dylibs, @broken_deps, @unwanted_system_dylibs, @version_conflict_deps] + issues.any?(&:present?) end private