forked from rjocoleman/homebrew-apache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod_bonjour.rb
66 lines (55 loc) · 2 KB
/
mod_bonjour.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
require 'formula'
class ModBonjour < Formula
homepage 'http://www.opensource.apple.com/source/apache_mod_bonjour/apache_mod_bonjour-23/'
url 'http://www.opensource.apple.com/tarballs/apache_mod_bonjour/apache_mod_bonjour-23.tar.gz'
sha1 '597ad957a6524ba05e03e2679fe622abdb2662f8'
version '2.3'
option 'with-brewed-httpd22', 'Use Homebrew Apache httpd 2.2'
option 'with-brewed-httpd24', 'Use Homebrew Apache httpd 2.4'
depends_on 'httpd22' if build.with? 'brewed-httpd22'
depends_on 'httpd24' if build.with? 'brewed-httpd24'
def apache_apxs
if build.with? 'brewed-httpd22'
['sbin', 'bin'].each do |dir|
if File.exist?(location = "#{Formula['httpd22'].opt_prefix}/#{dir}/apxs")
return location
end
end
elsif build.with? 'brewed-httpd24'
['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? 'brewed-httpd22'
"#{etc}/apache2/2.2"
elsif build.with? 'brewed-httpd24'
"#{etc}/apache2/2.4"
else
'/etc/apache2'
end
end
def install
system "#{apache_apxs} -o mod_bonjour.so -c *.c"
libexec.install '.libs/mod_bonjour.so'
end
def caveats
<<-EOS.undent
You must manually edit #{apache_configdir}/httpd.conf to include
LoadModule bonjour_module #{libexec}/mod_bonjour.so
Add the following to your virtual host conf files to advertise them on bonjour. The
last number is whatever port the virtual host is listening on.
<IfModule bonjour_module>
RegisterResource "Site Title" / 80
</IfModule>
NOTE: If you're _NOT_ using --with-brewed-httpd22 or --with-brewed-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