forked from rjocoleman/homebrew-apache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod_wsgi.rb
97 lines (82 loc) · 3.28 KB
/
mod_wsgi.rb
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
class ModWsgi < Formula
class CLTRequirement < Requirement
fatal true
satisfy { MacOS.version < :mavericks || MacOS::CLT.installed? }
def message; <<-EOS.undent
Xcode Command Line Tools required, even if Xcode is installed, on OS X 10.9 or
10.10 and not using Homebrew httpd22 or httpd24. Resolve by running
xcode-select --install
EOS
end
end
desc "Host Python web apps supporting the Python WSGI spec"
homepage "http://modwsgi.readthedocs.org/en/latest/"
url "https://github.com/GrahamDumpleton/mod_wsgi/archive/4.4.11.tar.gz"
sha256 "e1d6b95f696af49a334419b60e1271872f8d446027acc481ef5c9c912cbb0328"
head "https://github.com/GrahamDumpleton/mod_wsgi.git"
bottle do
cellar :any_skip_relocation
sha256 "d831b59df04e0b46abc09d3635887f9fb909026e0acbd93224913fc0e2f715c7" => :el_capitan
sha256 "9c01d90cecf68699001a0525fc3b4bb6ae9c2f46b9bf2cfc200c434e819fb7ed" => :yosemite
sha256 "584f0b8891a4eda86bac22941edb6529cda1101a3005afdde1ddd6f9eb0065bb" => :mavericks
end
option "with-homebrew-httpd22", "Use Homebrew Apache httpd 2.2"
option "with-homebrew-httpd24", "Use Homebrew Apache httpd 2.4"
option "with-homebrew-python", "Use Homebrew python"
deprecated_option "with-brewed-httpd22" => "with-homebrew-httpd22"
deprecated_option "with-brewed-httpd24" => "with-homebrew-httpd24"
deprecated_option "with-brewed-python" => "with-homebrew-python"
depends_on "httpd22" if build.with? "homebrew-httpd22"
depends_on "httpd24" if build.with? "homebrew-httpd24"
depends_on "python" if build.with? "homebrew-python"
depends_on CLTRequirement if build.without?("homebrew-httpd22") && build.without?("homebrew-httpd24")
def apache_apxs
if build.with? "homebrew-httpd22"
%W[sbin bin].each do |dir|
if File.exist?(location = "#{Formula["httpd22"].opt_prefix}/#{dir}/apxs")
return location
end
end
elsif build.with? "homebrew-httpd24"
%W[sbin bin].each do |dir|
if File.exist?(location = "#{Formula["httpd24"].opt_prefix}/#{dir}/apxs")
return location
end
end
else
"/usr/sbin/apxs"
end
end
def apache_configdir
if build.with? "homebrew-httpd22"
"#{etc}/apache2/2.2"
elsif build.with? "homebrew-httpd24"
"#{etc}/apache2/2.4"
else
"/etc/apache2"
end
end
def install
if build.with?("homebrew-httpd22") && build.with?("homebrew-httpd24")
odie "Cannot build for http22 and httpd24 at the same time"
end
args = %W[
--prefix=#{prefix}
--disable-framework
--with-apxs=#{apache_apxs}
]
args << "--with-python=#{HOMEBREW_PREFIX}/bin/python" if build.with? "homebrew-python"
system "./configure", *args
system "make", "LIBEXECDIR=#{libexec}", "install"
(share/"mod_wsgi").install "tests"
doc.install "README.rst"
end
def caveats; <<-EOS.undent
You must manually edit #{apache_configdir}/httpd.conf to include
LoadModule wsgi_module #{libexec}/mod_wsgi.so
NOTE: If you're _NOT_ using --with-homebrew-httpd22 or --with-homebrew-httpd24 and having
installation problems relating to a missing `cc` compiler and `OSX#{MacOS.version}.xctoolchain`,
read the "Troubleshooting" section of https://github.com/Homebrew/homebrew-apache
EOS
end
end