
About 40 formulae set `CMAKE_INSTALL_RPATH` to `lib` or `opt_lib`, but this breaks bottle relocatability. The correct solution is to use `@loader_path/../lib`, but this is macOS specific, so it requires some OS-specific logic. Rather than replicating this logic over many formulae, we may as well define a helper method for it. See https://github.com/Homebrew/homebrew-core/issues/75458.
34 lines
724 B
Ruby
34 lines
724 B
Ruby
# typed: true
|
|
# frozen_string_literal: true
|
|
|
|
class Formula
|
|
undef shared_library
|
|
undef rpath
|
|
|
|
def shared_library(name, version = nil)
|
|
suffix = if version == "*" || (name == "*" && version.blank?)
|
|
"{,.*}"
|
|
elsif version.present?
|
|
".#{version}"
|
|
end
|
|
"#{name}.so#{suffix}"
|
|
end
|
|
|
|
def rpath
|
|
"'$ORIGIN/../lib'"
|
|
end
|
|
|
|
class << self
|
|
undef ignore_missing_libraries
|
|
|
|
def ignore_missing_libraries(*libs)
|
|
libraries = libs.flatten
|
|
if libraries.any? { |x| !x.is_a?(String) && !x.is_a?(Regexp) }
|
|
raise FormulaSpecificationError, "#{__method__} can handle Strings and Regular Expressions only"
|
|
end
|
|
|
|
allowed_missing_libraries.merge(libraries)
|
|
end
|
|
end
|
|
end
|