brew/Library/Homebrew/requirements/apr_dependency.rb
Jack Nagel 291e900abc AprRequirement should not generate a build-time dependency
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.
2015-02-02 00:39:04 -05:00

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