formula: add rpath helper method
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.
This commit is contained in:
parent
520b8110e8
commit
309504a32c
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
class Formula
|
class Formula
|
||||||
undef shared_library
|
undef shared_library
|
||||||
|
undef rpath
|
||||||
|
|
||||||
def shared_library(name, version = nil)
|
def shared_library(name, version = nil)
|
||||||
suffix = if version == "*" || (name == "*" && version.blank?)
|
suffix = if version == "*" || (name == "*" && version.blank?)
|
||||||
@ -13,6 +14,10 @@ class Formula
|
|||||||
"#{name}.so#{suffix}"
|
"#{name}.so#{suffix}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def rpath
|
||||||
|
"'$ORIGIN/../lib'"
|
||||||
|
end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
undef ignore_missing_libraries
|
undef ignore_missing_libraries
|
||||||
|
|
||||||
|
|||||||
@ -1523,6 +1523,12 @@ class Formula
|
|||||||
"#{name}#{infix}.dylib"
|
"#{name}#{infix}.dylib"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Executable/Library RPATH according to platform conventions.
|
||||||
|
sig { returns(String) }
|
||||||
|
def rpath
|
||||||
|
"@loader_path/../lib"
|
||||||
|
end
|
||||||
|
|
||||||
# an array of all core {Formula} names
|
# an array of all core {Formula} names
|
||||||
# @private
|
# @private
|
||||||
def self.core_names
|
def self.core_names
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user