2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-09-01 20:23:31 +00:00
|
|
|
|
2009-09-23 06:58:03 +00:00
|
|
|
class Nginx < Formula
|
2010-06-15 15:23:29 +00:00
|
|
|
url 'http://nginx.org/download/nginx-0.7.67.tar.gz'
|
2010-08-25 18:20:05 +00:00
|
|
|
head 'http://nginx.org/download/nginx-0.8.49.tar.gz'
|
2010-04-30 15:57:12 +00:00
|
|
|
homepage 'http://nginx.org/'
|
|
|
|
|
2010-07-16 23:45:32 +00:00
|
|
|
unless ARGV.build_head?
|
2010-07-09 19:40:41 +00:00
|
|
|
md5 'b6e175f969d03a4d3c5643aaabc6a5ff'
|
2010-04-30 15:57:12 +00:00
|
|
|
else
|
2010-08-25 18:20:05 +00:00
|
|
|
md5 '1d335c28f35b0517211e4284a32fb2d5'
|
2010-04-30 15:57:12 +00:00
|
|
|
end
|
2009-09-01 20:23:31 +00:00
|
|
|
|
2010-07-09 06:06:29 +00:00
|
|
|
depends_on 'pcre'
|
2010-07-08 17:03:02 +00:00
|
|
|
|
2010-02-01 18:48:01 +00:00
|
|
|
skip_clean 'logs'
|
2009-10-03 09:00:44 +00:00
|
|
|
|
|
|
|
def patches
|
2010-02-01 18:48:01 +00:00
|
|
|
# Changes default port to 8080
|
2010-07-09 06:06:29 +00:00
|
|
|
# Set configure to look in homebrew prefix for pcre
|
2009-10-03 09:00:44 +00:00
|
|
|
DATA
|
|
|
|
end
|
|
|
|
|
2009-09-23 13:23:48 +00:00
|
|
|
def options
|
|
|
|
[
|
|
|
|
['--with-passenger', "Compile with support for Phusion Passenger module"]
|
|
|
|
]
|
|
|
|
end
|
2010-06-22 21:27:22 +00:00
|
|
|
|
2010-02-01 18:48:01 +00:00
|
|
|
def passenger_config_args
|
|
|
|
passenger_root = `passenger-config --root`.chomp
|
2010-06-22 21:27:22 +00:00
|
|
|
|
2010-02-01 18:48:01 +00:00
|
|
|
if File.directory?(passenger_root)
|
|
|
|
return "--add-module=#{passenger_root}/ext/nginx"
|
|
|
|
end
|
2010-06-22 21:27:22 +00:00
|
|
|
|
2010-02-01 18:48:01 +00:00
|
|
|
puts "Unable to install nginx with passenger support. The passenger"
|
|
|
|
puts "gem must be installed and passenger-config must be in your path"
|
|
|
|
puts "in order to continue."
|
|
|
|
exit
|
|
|
|
end
|
2010-06-22 21:27:22 +00:00
|
|
|
|
2009-09-01 20:23:31 +00:00
|
|
|
def install
|
2010-07-12 04:13:26 +00:00
|
|
|
args = ["--prefix=#{prefix}", "--with-http_ssl_module", "--with-pcre",
|
|
|
|
"--conf-path=#{etc}/nginx/nginx.conf", "--pid-path=#{var}/run/nginx.pid",
|
|
|
|
"--lock-path=#{var}/nginx/nginx.lock"]
|
2010-06-25 17:06:33 +00:00
|
|
|
args << passenger_config_args if ARGV.include? '--with-passenger'
|
2010-06-22 21:27:22 +00:00
|
|
|
|
2010-06-25 17:06:33 +00:00
|
|
|
system "./configure", *args
|
2009-09-01 20:23:31 +00:00
|
|
|
system "make install"
|
2009-12-14 06:16:24 +00:00
|
|
|
end
|
2010-06-22 21:27:22 +00:00
|
|
|
|
2009-12-14 06:16:24 +00:00
|
|
|
def caveats
|
|
|
|
<<-CAVEATS
|
2010-06-22 21:27:22 +00:00
|
|
|
In the interest of allowing you to run `nginx` without `sudo`, the default
|
2010-02-01 18:48:01 +00:00
|
|
|
port is set to localhost:8080.
|
|
|
|
|
|
|
|
If you want to host pages on your local machine to the public, you should
|
|
|
|
change that to localhost:80, and run `sudo nginx`. You'll need to turn off
|
|
|
|
any other web servers running port 80, of course.
|
2009-12-14 06:16:24 +00:00
|
|
|
CAVEATS
|
|
|
|
end
|
2009-09-01 20:23:31 +00:00
|
|
|
end
|
2009-10-03 09:00:44 +00:00
|
|
|
|
|
|
|
__END__
|
2010-07-09 06:06:29 +00:00
|
|
|
--- a/auto/lib/pcre/conf
|
|
|
|
+++ b/auto/lib/pcre/conf
|
|
|
|
@@ -155,6 +155,22 @@ else
|
|
|
|
. auto/feature
|
|
|
|
fi
|
|
|
|
|
|
|
|
+ if [ $ngx_found = no ]; then
|
|
|
|
+
|
|
|
|
+ # Homebrew
|
|
|
|
+ HOMEBREW_PREFIX=${NGX_PREFIX%Cellar*}
|
|
|
|
+ ngx_feature="PCRE library in ${HOMEBREW_PREFIX}"
|
|
|
|
+ ngx_feature_path="${HOMEBREW_PREFIX}/include"
|
|
|
|
+
|
|
|
|
+ if [ $NGX_RPATH = YES ]; then
|
|
|
|
+ ngx_feature_libs="-R${HOMEBREW_PREFIX}/lib -L${HOMEBREW_PREFIX}/lib -lpcre"
|
|
|
|
+ else
|
|
|
|
+ ngx_feature_libs="-L${HOMEBREW_PREFIX}/lib -lpcre"
|
|
|
|
+ fi
|
|
|
|
+
|
|
|
|
+ . auto/feature
|
|
|
|
+ fi
|
|
|
|
+
|
|
|
|
if [ $ngx_found = yes ]; then
|
|
|
|
CORE_DEPS="$CORE_DEPS $REGEX_DEPS"
|
|
|
|
CORE_SRCS="$CORE_SRCS $REGEX_SRCS"
|
2009-12-14 06:16:24 +00:00
|
|
|
--- a/conf/nginx.conf
|
|
|
|
+++ b/conf/nginx.conf
|
|
|
|
@@ -33,7 +33,7 @@
|
|
|
|
#gzip on;
|
2010-06-22 21:27:22 +00:00
|
|
|
|
2009-12-14 06:16:24 +00:00
|
|
|
server {
|
|
|
|
- listen 80;
|
|
|
|
+ listen 8080;
|
|
|
|
server_name localhost;
|
2010-06-22 21:27:22 +00:00
|
|
|
|
2009-12-14 06:16:24 +00:00
|
|
|
#charset koi8-r;
|