mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-15 19:56:59 +08:00

We want the apr requirement to act as a build-time requirement in case it is satisfied (that is, the CLT is installed), as the resulting binaries will link to the system libapr which is always present. When it is *not* satisfied by the CLT, and we need to install the formula, we have to treat it as a runtime dependency since the resulting binaries will link to it. Fixes Homebrew/homebrew#36301. Fixes Homebrew/homebrew#36438. Closes Homebrew/homebrew#36443.
26 lines
604 B
Ruby
26 lines
604 B
Ruby
require "requirement"
|
|
|
|
class AprDependency < Requirement
|
|
fatal true
|
|
default_formula "apr-util"
|
|
|
|
satisfy { MacOS::CLT.installed? }
|
|
|
|
env do
|
|
unless MacOS::CLT.installed?
|
|
ENV.prepend_path "PATH", Formula["apr-util"].opt_bin
|
|
ENV.prepend_path "PATH", Formula["apr"].opt_bin
|
|
ENV.prepend_path "PKG_CONFIG_PATH", "#{Formula["apr"].opt_libexec}/lib/pkgconfig"
|
|
ENV.prepend_path "PKG_CONFIG_PATH", "#{Formula["apr-util"].opt_libexec}/lib/pkgconfig"
|
|
end
|
|
end
|
|
|
|
def to_dependency
|
|
super.extend Module.new {
|
|
def tags
|
|
super - [:build]
|
|
end
|
|
}
|
|
end
|
|
end
|