forked from rjocoleman/homebrew-apache
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #68. Signed-off-by: Jan Viljanen <[email protected]>
- Loading branch information
1 parent
10a27d7
commit 8a98a04
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
class ModRpaf < 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 "Sets env vars to the values provided by an upstream proxy." | ||
homepage "https://github.com/gnif/mod_rpaf" | ||
url "https://github.com/gnif/mod_rpaf/archive/v0.8.4.tar.gz" | ||
sha256 "b78f292d7336f839527d6fb2213116c995a525ad9aa38c344c485abbd76848f5" | ||
|
||
option "with-homebrew-httpd22", "Use Homebrew Apache httpd 2.2" | ||
option "with-homebrew-httpd24", "Use Homebrew Apache httpd 2.4" | ||
|
||
deprecated_option "with-brewed-httpd22" => "with-homebrew-httpd22" | ||
deprecated_option "with-brewed-httpd24" => "with-homebrew-httpd24" | ||
|
||
depends_on "httpd22" if build.with? "homebrew-httpd22" | ||
depends_on "httpd24" if build.with? "homebrew-httpd24" | ||
depends_on CLTRequirement if build.without?("homebrew-httpd22") && build.without?("homebrew-httpd24") | ||
|
||
if build.with?("homebrew-httpd22") && build.with?("homebrew-httpd24") | ||
onoe "Cannot build for http22 and httpd24 at the same time" | ||
exit 1 | ||
end | ||
|
||
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 | ||
system "make" | ||
|
||
libexec.install ".libs/mod_rpaf.so" | ||
end | ||
|
||
def caveats; <<-EOS.undent | ||
You must manually edit #{apache_configdir}/httpd.conf to include | ||
LoadModule rpaf_module #{libexec}/mod_rpaf.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 |