2020-04-07 21:23:12 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Formula
|
2020-06-16 18:25:13 +02:00
|
|
|
undef shared_library
|
|
|
|
|
|
|
|
def shared_library(name, version = nil)
|
|
|
|
"#{name}.so#{"." unless version.nil?}#{version}"
|
|
|
|
end
|
|
|
|
|
2020-07-10 21:20:46 +00:00
|
|
|
undef allowed_missing_lib?
|
|
|
|
def allowed_missing_lib?(lib)
|
|
|
|
# lib: Full path to the missing library
|
|
|
|
# Ex.: /home/linuxbrew/.linuxbrew/lib/libsomething.so.1
|
|
|
|
# x - Name of or a pattern for a library, linkage to which is allowed to be missing.
|
|
|
|
# Ex. 1: "libONE.so.1"
|
|
|
|
# Ex. 2: %r{(libONE|libTWO)\.so}
|
|
|
|
self.class.allowed_missing_libraries.any? do |x|
|
|
|
|
if x.is_a? Regexp
|
|
|
|
x.match? lib
|
|
|
|
elsif x.is_a? String
|
|
|
|
lib.include? x
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-04-07 21:23:12 +02:00
|
|
|
class << self
|
|
|
|
undef on_linux
|
|
|
|
|
|
|
|
def on_linux(&_block)
|
|
|
|
yield
|
|
|
|
end
|
2020-07-10 21:20:46 +00:00
|
|
|
|
|
|
|
def ignore_missing_libraries(*libs)
|
|
|
|
libs.flatten!
|
|
|
|
allowed_missing_libraries.merge(libs)
|
|
|
|
end
|
|
|
|
|
|
|
|
# @private
|
|
|
|
def allowed_missing_libraries
|
|
|
|
@allowed_missing_libraries ||= Set.new
|
|
|
|
end
|
2020-04-07 21:23:12 +02:00
|
|
|
end
|
|
|
|
end
|