aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/requirements/apr_dependency.rb
blob: f996b5b79de06ca22306c9f14bd8f4e26cf583d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require "requirement"

class AprDependency < Requirement
  fatal true
  default_formula "apr"

  satisfy { MacOS::CLT.installed? || Formula["apr"].installed? }

  env do
    unless MacOS::CLT.installed?
      ENV.prepend_path "PATH", "#{Formula["apr-util"].opt_prefix}/bin"
      ENV.prepend_path "PKG_CONFIG_PATH", "#{Formula["apr"].opt_prefix}/libexec/lib/pkgconfig"
      ENV.prepend_path "PKG_CONFIG_PATH", "#{Formula["apr-util"].opt_prefix}/libexec/lib/pkgconfig"
    end
  end

  def message
    message = <<-EOS.undent
      Due to packaging problems on Apple's part, software that compiles
      against APR requires the standalone Command Line Tools.
    EOS
    if MacOS.version >= :mavericks
      message += <<-EOS.undent
        Either
        `brew install apr-util`
        or
        `xcode-select --install`
        to install APR.
      EOS
    else
      message += <<-EOS.undent
        The standalone package can be obtained from
        https://developer.apple.com/downloads/,
        or it can be installed via Xcode's preferences.
        Or you can `brew install apr-util`.
      EOS
    end
  end
end