formula: add optional source and target args to #rpath
There are about 10 formulae which need a bit more flexibility from `#rpath`. Most of them use `Pathname#relative_path_from`, so we can replace those instances with a call to `#rpath` instead once `#rpath` knows how to handle this.
This commit is contained in:
parent
6eca55a60d
commit
c7030eaba0
@ -3,7 +3,7 @@
|
||||
|
||||
class Formula
|
||||
undef shared_library
|
||||
undef rpath
|
||||
undef loader_path
|
||||
undef deuniversalize_machos
|
||||
|
||||
sig { params(name: String, version: T.nilable(T.any(String, Integer))).returns(String) }
|
||||
@ -17,8 +17,8 @@ class Formula
|
||||
end
|
||||
|
||||
sig { returns(String) }
|
||||
def rpath
|
||||
"'$ORIGIN/../lib'"
|
||||
def loader_path
|
||||
"$ORIGIN"
|
||||
end
|
||||
|
||||
sig { params(targets: T.nilable(T.any(Pathname, String))).void }
|
||||
|
||||
@ -1572,9 +1572,23 @@ class Formula
|
||||
end
|
||||
|
||||
# Executable/Library RPATH according to platform conventions.
|
||||
#
|
||||
# Optionally specify a `source` or `target` depending on the location
|
||||
# of the file containing the RPATH command and where its target is located.
|
||||
#
|
||||
# <pre>
|
||||
# rpath #=> "@loader_path/../lib"
|
||||
# rpath(target: frameworks) #=> "@loader_path/../Frameworks"
|
||||
# rpath(source: libexec/"bin") #=> "@loader_path/../../lib"
|
||||
# </pre>
|
||||
sig { params(source: Pathname, target: Pathname).returns(String) }
|
||||
def rpath(source: bin, target: lib)
|
||||
"#{loader_path}/#{target.relative_path_from(source)}"
|
||||
end
|
||||
|
||||
sig { returns(String) }
|
||||
def rpath
|
||||
"@loader_path/../lib"
|
||||
def loader_path
|
||||
"@loader_path"
|
||||
end
|
||||
|
||||
# Creates a new `Time` object for use in the formula as the build time.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user