aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/requirements.rb
blob: 0aafc0a8cae1ef59db8cecb635d0680f4dfe05f9 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
require 'requirement'
require 'requirements/language_module_dependency'
require 'requirements/x11_dependency'
require 'requirements/mpi_dependency'
require 'requirements/python_dependency'

class XcodeDependency < Requirement
  fatal true
  build true

  satisfy(:build_env => false) { MacOS::Xcode.installed? }

  def message; <<-EOS.undent
    A full installation of Xcode.app is required to compile this software.
    Installing just the Command Line Tools is not sufficent.
    EOS
  end
end

class MysqlDependency < Requirement
  fatal true
  default_formula 'mysql'

  satisfy { which 'mysql_config' }

  def message; <<-EOS.undent
    MySQL is required to install.

    You can install this with Homebrew using:
      brew install mysql-connector-c
        For MySQL client libraries only.

      brew install mysql
        For MySQL server.

    Or you can use an official installer from:
      http://dev.mysql.com/downloads/mysql/
    EOS
  end
end

class PostgresqlDependency < Requirement
  fatal true
  default_formula 'postgresql'

  satisfy { which 'pg_config' }

  def message
    <<-EOS.undent
      Postgres is required to install.

      You can install this with Homebrew using:
        brew install postgres

      Or you can use an official installer from:
        http://www.postgresql.org/download/macosx/
    EOS
  end
end

class TeXDependency < Requirement
  fatal true

  satisfy { which('tex') || which('latex') }

  def message; <<-EOS.undent
    A LaTeX distribution is required to install.

    You can install MacTeX distribution from:
      http://www.tug.org/mactex/

    Make sure that its bin directory is in your PATH before proceeding.

    You may also need to restore the ownership of Homebrew install:
      sudo chown -R $USER `brew --prefix`
    EOS
  end
end

class CLTDependency < Requirement
  fatal true
  build true

  satisfy(:build_env => false) { MacOS::CLT.installed? }

  def message; <<-EOS.undent
    The Command Line Tools for Xcode are required to compile this software.
    The standalone package can be obtained from http://connect.apple.com,
    or it can be installed via Xcode's preferences.
    EOS
  end
end

class ArchRequirement < Requirement
  fatal true

  def initialize(arch)
    @arch = arch.pop
    super
  end

  satisfy do
    case @arch
    when :x86_64 then MacOS.prefer_64_bit?
    end
  end

  def message
    "This formula requires an #{@arch} architecture."
  end
end

class MercurialDependency < Requirement
  fatal true
  default_formula 'mercurial'

  satisfy { which('hg') }

  def message; <<-EOS.undent
    Mercurial is needed to install this software.

    You can install this with Homebrew using:
      brew install mercurial
    EOS
  end
end