Merge pull request #13722 from carlocab/rpath-args
formula: add optional `source` and `target` args to `#rpath`
This commit is contained in:
		
						commit
						9db6f0df4a
					
				@ -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