Nginx with support passenger.

atratsevskiy
root 13 years ago committed by Mike Hiretsky
parent 0768824d71
commit b7bb3238ef

File diff suppressed because it is too large Load Diff

@ -0,0 +1,15 @@
AUX nginx.conf-r4 1358 RMD160 a948df249a16be86c114d587cfa5ee570d84a356 SHA1 e9db0447a1beb326a0858cf8189328229d1d3edf SHA256 6ff6c9301ea2a4d74a335b9119d7f9dba87d4e83793cf22d837d49f061763096
AUX nginx.init-r2 1827 RMD160 2ece9278fd4a3ca948106e024c2607fca02e2599 SHA1 76af70e8fcad8b298851382d18160d11dc3e2cca SHA256 89801c2e0ea3480380dedfbc84b0cc993ab6b93768886246a22e650ba0a61798
AUX nginx.logrotate 364 RMD160 9fdfd2ea2f49b8dba20a030d893e34779bb32364 SHA1 4ab07992fa5c64f753e3643e1b51fcab4dec6ccf SHA256 9e3e090dfd10861d5f9b279e19113ce8d05caf9f33d488f6aabf9f19ac0cf925
AUX passenger-CFLAGS-headers.patch 3685 RMD160 7d5fff162baa926e85e58f54dab57ca42223d253 SHA1 c20db105461dc25ddc5faa90611d56226396027f SHA256 8268e78780322acc6af90b03a1f3d1ff60d073dcdc90086ec17b14696ad3b1f5
DIST nginx-1.1.2.tar.gz 674101 RMD160 54a1554a894cdd7e041da2a5cbf0876ee6092e88 SHA1 a8214bff7452c39c44f91853c104879b67849809 SHA256 cc64476ae800c45d2ba810274387139e5d8cbb8c1e45e8701416eea2a377151b
DIST nginx_http_push_module-0.692.tar.gz 29119 RMD160 9d2be16074cf28115af0f1d8f3646937cda649ad SHA1 72103084cad8f4d3d9a49a6b04cf780e4541605d SHA256 64868708071aa21dbc4c7a07d149dd6ec9108fb7eaf2aad5ad069406151f17fe
DIST nginx_upload_module-2.2.0.tar.gz 25796 RMD160 5734af837be3fe8ec444a7e5e7f6707118594098 SHA1 93d6e83e613a0ce2ed057a434b344fa1b6609b47 SHA256 b1c26abe0427180602e257627b4ed21848c93cc20cefc33af084983767d65805
DIST ngx_cache_purge-1.3.tar.gz 6434 RMD160 d9f5d225b99f3164e80a85b7c7b4bee8bb16ea0e SHA1 ec52989ed545ef2be58414e747e592004794eba6 SHA256 256eec780f0f8f09ed10d5b0e4c3c32883a55d96e814fa0390b880d20745fcdb
DIST ngx_http_headers_more-0.15.tar.gz 22738 RMD160 2200ab529a086dd6bcf11a9a0470a4d05de7c824 SHA1 12bab1bbcecf57c410a812f5a7eebac49ff317f8 SHA256 d5ada29c15ff112c39599e3b245450ef785bb096c6724ecd8eaf1699b06e10e2
DIST ngx_slowfs_cache-1.6.tar.gz 10972 RMD160 e1d10851db4a55fc465665caa3f6989d142af2d3 SHA1 072d06b7547629b244bebeef7df7425567f264c9 SHA256 cc0505dbba30153691ff7b3a7353804d5ceb9a519a407b938cae49e9913a7bcc
DIST ngx_upload_progress-0.8.2.tar.gz 16559 RMD160 3aadb9bf9b15b3810d1acb466d331ea5bdae6062 SHA1 cbff2734cccc3ac93b3422a9a01547af29f9c11d SHA256 cab70d2e300cfa0d9d7d3b34bf27810533ecbf11dddcd5078a4754cfab337c95
DIST passenger-3.0.8.tar.gz 2362561 RMD160 1264b76a3440492b3d435050007611735a627c72 SHA1 265d1dcb66a29b944fa475f7d6831ce16ac37e2e SHA256 ccef21dc97b54de17c1d44644b2bc67b7732a860ff67206a4c557727311a8349
EBUILD nginx-1.1.2-r9.ebuild 11374 RMD160 b0e9eb2808fecb37f7ef4c5fdefa0238e4f47f25 SHA1 479b0ddb2aa74a718e1abebc3d61efbe9f65fe88 SHA256 68f93347c5187135440b5f508591a313237cf93239b291fbb575962c5df8883e
MISC ChangeLog 47676 RMD160 77221c0060c7e6bf1d02290145517193ed6bdcd1 SHA1 9be4db1091b898f3dedb289f63b576f244f0b04f SHA256 6ed957a5af7e77cfde597332edcd1bc66b2c8a857cd1431fa59c4bba2e1ba1dc
MISC metadata.xml 2402 RMD160 fee632a79ad08ef0fe36cd73d718a81348d71370 SHA1 12b7d3eac7a8e9f99dbe2b64bc288aa5e3f4608c SHA256 f133dca88780f2716797c5d2fc309466013d35b3dccf752ab27fb4ee399c6e47

@ -0,0 +1,72 @@
user nginx nginx;
worker_processes 1;
error_log /var/log/nginx/error_log info;
events {
worker_connections 1024;
use epoll;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main
'$remote_addr - $remote_user [$time_local] '
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" '
'"$gzip_ratio"';
client_header_timeout 10m;
client_body_timeout 10m;
send_timeout 10m;
connection_pool_size 256;
client_header_buffer_size 1k;
large_client_header_buffers 4 2k;
request_pool_size 4k;
gzip on;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_types text/plain;
output_buffers 1 32k;
postpone_output 1460;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 75 20;
ignore_invalid_headers on;
index index.html;
server {
listen 127.0.0.1;
server_name localhost;
access_log /var/log/nginx/localhost.access_log main;
error_log /var/log/nginx/localhost.error_log info;
root /var/www/localhost/htdocs;
}
# SSL example
#server {
# listen 127.0.0.1:443;
# server_name localhost;
# ssl on;
# ssl_certificate /etc/ssl/nginx/nginx.pem;
# ssl_certificate_key /etc/ssl/nginx/nginx.key;
# access_log /var/log/nginx/localhost.ssl_access_log main;
# error_log /var/log/nginx/localhost.ssl_error_log info;
# root /var/www/localhost/htdocs;
#}
}

@ -0,0 +1,82 @@
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/files/nginx.init-r2,v 1.2 2011/09/07 08:34:34 hollow Exp $
opts="${opts} upgrade reload configtest"
depend() {
need net
use dns logger netmount
}
start() {
if [ "${RC_CMD}" != "restart" ]; then
configtest || return 1
fi
ebegin "Starting nginx"
start-stop-daemon --start --pidfile /var/run/nginx.pid \
--exec /usr/sbin/nginx -- -c /etc/nginx/nginx.conf
eend $? "Failed to start nginx"
}
stop() {
if [ "${RC_CMD}" = "restart" ]; then
configtest || return 1
fi
ebegin "Stopping nginx"
start-stop-daemon --stop --pidfile /var/run/nginx.pid
eend $? "Failed to stop nginx"
rm -f /var/run/nginx.pid
}
reload() {
configtest || return 1
ebegin "Refreshing nginx' configuration"
kill -HUP `cat /var/run/nginx.pid` &>/dev/null
eend $? "Failed to reload nginx"
}
upgrade() {
configtest || return 1
ebegin "Upgrading nginx"
einfo "Sending USR2 to old binary"
kill -USR2 `cat /var/run/nginx.pid` &>/dev/null
einfo "Sleeping 3 seconds before pid-files checking"
sleep 3
if [ ! -f /var/run/nginx.pid.oldbin ]; then
eerror "File with old pid not found"
return 1
fi
if [ ! -f /var/run/nginx.pid ]; then
eerror "New binary failed to start"
return 1
fi
einfo "Sleeping 3 seconds before WINCH"
sleep 3 ; kill -WINCH `cat /var/run/nginx.pid.oldbin`
einfo "Sending QUIT to old binary"
kill -QUIT `cat /var/run/nginx.pid.oldbin`
einfo "Upgrade completed"
eend $? "Upgrade failed"
}
configtest() {
ebegin "Checking nginx' configuration"
/usr/sbin/nginx -c /etc/nginx/nginx.conf -t -q
if [ $? -ne 0 ]; then
/usr/sbin/nginx -c /etc/nginx/nginx.conf -t
fi
eend $? "failed, please correct errors above"
}

@ -0,0 +1,11 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/files/nginx.logrotate,v 1.2 2011/04/08 08:32:20 hollow Exp $
/var/log/nginx/*_log {
missingok
sharedscripts
postrotate
test -r /var/run/nginx.pid && kill -USR1 `cat /var/run/nginx.pid`
endscript
}

@ -0,0 +1,92 @@
diff --git a/build/config.rb b/build/config.rb
index 8905bd8..fb0105e 100644
--- a/build/config.rb
+++ b/build/config.rb
@@ -24,11 +24,7 @@
CC = string_option("CC", "gcc")
CXX = string_option("CXX", "g++")
# TODO: consider -fcommon
-if OPTIMIZE
- OPTIMIZATION_FLAGS = "#{PlatformInfo.debugging_cflags} -O2 -DBOOST_DISABLE_ASSERTS".strip
-else
- OPTIMIZATION_FLAGS = "#{PlatformInfo.debugging_cflags} -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS".strip
-end
+OPTIMIZATION_FLAGS = "#{ENV['CXXFLAGS']} -DNDEBUG -DBOOST_DISABLE_ASSERTS".strip
# Extra compiler flags that should always be passed to the C/C++ compiler.
# Should be included last in the command string, even after PlatformInfo.portability_cflags.
@@ -39,4 +35,4 @@ EXTRA_CXXFLAGS = "-Wall #{OPTIMIZATION_FLAGS}".strip
EXTRA_LDFLAGS = ""
# Whether to use the vendored libev or the system one.
-USE_VENDORED_LIBEV = boolean_option("USE_VENDORED_LIBEV", true)
\ No newline at end of file
+USE_VENDORED_LIBEV = boolean_option("USE_VENDORED_LIBEV", true)
diff --git a/ext/nginx/ContentHandler.c b/ext/nginx/ContentHandler.c
index fce37bd..455e36a 100644
--- a/ext/nginx/ContentHandler.c
+++ b/ext/nginx/ContentHandler.c
@@ -1215,7 +1215,7 @@ process_header(ngx_http_request_t *r)
h->key.len = sizeof("Server") - 1;
h->key.data = (u_char *) "Server";
- h->value.data = (u_char *) (NGINX_VER " + Phusion Passenger " PASSENGER_VERSION " (mod_rails/mod_rack)");
+ h->value.data = (u_char *) ("nginx");
h->value.len = ngx_strlen(h->value.data);
h->lowcase_key = (u_char *) "server";
}
diff --git a/lib/phusion_passenger/abstract_request_handler.rb b/lib/phusion_passenger/abstract_request_handler.rb
index c08f33b..1b6d56d 100644
--- a/lib/phusion_passenger/abstract_request_handler.rb
+++ b/lib/phusion_passenger/abstract_request_handler.rb
@@ -199,7 +199,6 @@ class AbstractRequestHandler
@processed_requests = 0
@soft_termination_linger_time = 3
@main_loop_running = false
- @passenger_header = determine_passenger_header
@debugger = @options["debugger"]
if @debugger
@@ -639,18 +638,6 @@ private
output.write("pong")
end
- def determine_passenger_header
- header = "Phusion Passenger (mod_rails/mod_rack)"
- if @options["show_version_in_header"]
- header << " #{VERSION_STRING}"
- end
- if File.exist?("#{SOURCE_ROOT}/enterprisey.txt") ||
- File.exist?("/etc/passenger_enterprisey.txt")
- header << ", Enterprise Edition"
- end
- return header
- end
-
def prepare_request(headers)
if @analytics_logger && headers[PASSENGER_TXN_ID]
txn_id = headers[PASSENGER_TXN_ID]
diff --git a/lib/phusion_passenger/classic_rails/request_handler.rb b/lib/phusion_passenger/classic_rails/request_handler.rb
index e925f75..b0dc3ce 100644
--- a/lib/phusion_passenger/classic_rails/request_handler.rb
+++ b/lib/phusion_passenger/classic_rails/request_handler.rb
@@ -62,7 +62,6 @@ private
alias passenger_orig_perform_action perform_action
def perform_action(*whatever)
- headers[X_POWERED_BY] = @passenger_header
passenger_orig_perform_action(*whatever)
end
private :perform_action
diff --git a/lib/phusion_passenger/rack/request_handler.rb b/lib/phusion_passenger/rack/request_handler.rb
index ec9bc25..176fb32 100644
--- a/lib/phusion_passenger/rack/request_handler.rb
+++ b/lib/phusion_passenger/rack/request_handler.rb
@@ -101,7 +101,6 @@ protected
end
headers_output = [
STATUS, status.to_i.to_s, CRLF,
- X_POWERED_BY, @passenger_header, CRLF
]
headers.each do |key, values|
if values.is_a?(String)

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer>
<email>hollow@gentoo.org</email>
<name>Benedikt Böhm</name>
</maintainer>
<maintainer>
<email>dev-zero@gentoo.org</email>
<name>Tiziano Müller</name>
</maintainer>
<use>
<flag name='aio'>Enables file AIO support</flag>
<flag name='http'>Enable HTTP core support</flag>
<flag name='http-cache'>Enable HTTP cache support</flag>
<flag name='libatomic'>Use libatomic instead of builtin atomic operations</flag>
<flag name='nginx_modules_http_addition'>This module adds contents of
other locations before and after the current location's
content.</flag>
<flag name='nginx_modules_http_dav'>This module adds the HTTP and WebDAV
methods PUT, DELETE, MKCOL, COPY and MOVE.</flag>
<flag name='nginx_modules_http_flv'>This module provides the ability to
seek within FLV (Flash) files using time-based offsets.</flag>
<flag name='nginx_modules_http_random_index'>Pick a random directory
index from a directory.</flag>
<flag name='nginx_modules_http_realip'>This module allows to change the
client's IP address to value from request header (e. g. X-Real-IP or
X-Forwarded-For).</flag>
<flag name='nginx_modules_http_gzip_static'>Enables support for gzipping
static content on disk</flag>
<flag name='nginx_modules_http_stub_status'>This module provides the
ability to get some status from nginx</flag>
<flag name='nginx_modules_http_sub'>Enable support for search and
replace text in the nginx response</flag>
<flag name='nginx_modules_http_upload'>Enable support for handling file
uploads using multipart/form-data encoding</flag>
<flag name='nginx_modules_http_ey_balancer'>This module adds an upstream
connection queue to nginx</flag>
<flag name='nginx_modules_http_slowfs_cache'>This module adds the
ability to cache static files</flag>
<flag name='nginx_modules_http_upload_progress'>This module adds the
ability to track POST upload progress via JSON API</flag>
<flag name='nginx_modules_mail_imap'>Enables IMAP proxy support</flag>
<flag name='nginx_modules_mail_pop3'>Enables POP3 proxy support</flag>
<flag name='nginx_modules_mail_smtp'>Enables SMTP proxy support</flag>
</use>
<upstream>
<changelog>http://nginx.org/en/CHANGES</changelog>
</upstream>
</pkgmetadata>

@ -0,0 +1,354 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/nginx-1.1.2.ebuild,v 1.2 2011/09/09 16:44:14 hollow Exp $
EAPI="4"
USE_RUBY="ruby18"
# Maintainer notes:
# - http_rewrite-independent pcre-support makes sense for matching locations without an actual rewrite
# - any http-module activates the main http-functionality and overrides USE=-http
# - keep the following requirements in mind before adding external modules:
# * alive upstream
# * sane packaging
# * builds cleanly
# * does not need a patch for nginx core
# - TODO: test the google-perftools module (included in vanilla tarball)
# prevent perl-module from adding automagic perl DEPENDs
GENTOO_DEPEND_ON_PERL="no"
# http_uploadprogress (https://github.com/masterzen/nginx-upload-progress-module, BSD-2 license)
HTTP_UPLOAD_PROGRESS_MODULE_PV="0.8.2"
HTTP_UPLOAD_PROGRESS_MODULE_P="ngx_upload_progress-${HTTP_UPLOAD_PROGRESS_MODULE_PV}"
HTTP_UPLOAD_PROGRESS_MODULE_SHA1="8b55a34"
HTTP_UPLOAD_PROGRESS_MODULE_URI="http://github.com/masterzen/nginx-upload-progress-module/tarball/v${HTTP_UPLOAD_PROGRESS_MODULE_PV}"
# http_headers_more (http://github.com/agentzh/headers-more-nginx-module, BSD license)
HTTP_HEADERS_MORE_MODULE_PV="0.15"
HTTP_HEADERS_MORE_MODULE_P="ngx_http_headers_more-${HTTP_HEADERS_MORE_MODULE_PV}"
HTTP_HEADERS_MORE_MODULE_SHA1="137855d"
HTTP_HEADERS_MORE_MODULE_URI="http://github.com/agentzh/headers-more-nginx-module/tarball/v${HTTP_HEADERS_MORE_MODULE_PV}"
# http_push (http://pushmodule.slact.net/, MIT license)
HTTP_PUSH_MODULE_PV="0.692"
HTTP_PUSH_MODULE_P="nginx_http_push_module-${HTTP_PUSH_MODULE_PV}"
HTTP_PUSH_MODULE_URI="http://pushmodule.slact.net/downloads/${HTTP_PUSH_MODULE_P}.tar.gz"
# http_cache_purge (http://labs.frickle.com/nginx_ngx_cache_purge/, BSD-2 license)
HTTP_CACHE_PURGE_MODULE_PV="1.3"
HTTP_CACHE_PURGE_MODULE_P="ngx_cache_purge-${HTTP_CACHE_PURGE_MODULE_PV}"
HTTP_CACHE_PURGE_MODULE_URI="http://labs.frickle.com/files/${HTTP_CACHE_PURGE_MODULE_P}.tar.gz"
# HTTP Upload module from Valery Kholodkov
# (http://www.grid.net.ru/nginx/upload.en.html, BSD license)
HTTP_UPLOAD_MODULE_PV="2.2.0"
HTTP_UPLOAD_MODULE_P="nginx_upload_module-${HTTP_UPLOAD_MODULE_PV}"
HTTP_UPLOAD_MODULE_URI="http://www.grid.net.ru/nginx/download/${HTTP_UPLOAD_MODULE_P}.tar.gz"
# http_slowfs_cache (http://labs.frickle.com/nginx_ngx_slowfs_cache/, BSD-2 license)
HTTP_SLOWFS_CACHE_MODULE_PV="1.6"
HTTP_SLOWFS_CACHE_MODULE_P="ngx_slowfs_cache-${HTTP_SLOWFS_CACHE_MODULE_PV}"
HTTP_SLOWFS_CACHE_MODULE_URI="http://labs.frickle.com/files/${HTTP_SLOWFS_CACHE_MODULE_P}.tar.gz"
HTTP_PASSENGER_MODULE_PV="3.0.8"
HTTP_PASSENGER_MODULE_P="passenger-${HTTP_PASSENGER_MODULE_PV}"
HTTP_PASSENGER_MODULE_URI="mirror://rubyforge/passenger/${HTTP_PASSENGER_MODULE_P}.tar.gz"
inherit eutils ssl-cert toolchain-funcs perl-module flag-o-matic ruby-ng
DESCRIPTION="Robust, small and high performance http and reverse proxy server"
HOMEPAGE="http://nginx.org"
SRC_URI="http://nginx.org/download/${P}.tar.gz
nginx_modules_http_upload_progress? ( ${HTTP_UPLOAD_PROGRESS_MODULE_URI} -> ${HTTP_UPLOAD_PROGRESS_MODULE_P}.tar.gz )
nginx_modules_http_headers_more? ( ${HTTP_HEADERS_MORE_MODULE_URI} -> ${HTTP_HEADERS_MORE_MODULE_P}.tar.gz )
nginx_modules_http_push? ( ${HTTP_PUSH_MODULE_URI} )
nginx_modules_http_cache_purge? ( ${HTTP_CACHE_PURGE_MODULE_URI} )
nginx_modules_http_passenger? ( ${HTTP_PASSENGER_MODULE_URI} )
nginx_modules_http_upload? ( ${HTTP_UPLOAD_MODULE_URI} )
nginx_modules_http_slowfs_cache? ( ${HTTP_SLOWFS_CACHE_MODULE_URI} )"
LICENSE="as-is BSD BSD-2 GPL-2 MIT"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86 ~x86-fbsd"
NGINX_MODULES_STD="access auth_basic autoindex browser charset empty_gif fastcgi
geo gzip limit_req limit_zone map memcached proxy referer rewrite scgi ssi
split_clients upstream_ip_hash userid uwsgi"
NGINX_MODULES_OPT="addition dav degradation flv geoip gzip_static image_filter
perl random_index realip secure_link stub_status sub xslt"
NGINX_MODULES_MAIL="imap pop3 smtp"
NGINX_MODULES_3RD="
http_upload_progress
http_headers_more
http_passenger
http_push
http_cache_purge
http_upload
http_slowfs_cache"
IUSE="aio debug +http +http-cache ipv6 libatomic +pcre ssl vim-syntax"
for mod in $NGINX_MODULES_STD; do
IUSE="${IUSE} +nginx_modules_http_${mod}"
done
for mod in $NGINX_MODULES_OPT; do
IUSE="${IUSE} nginx_modules_http_${mod}"
done
for mod in $NGINX_MODULES_MAIL; do
IUSE="${IUSE} nginx_modules_mail_${mod}"
done
for mod in $NGINX_MODULES_3RD; do
IUSE="${IUSE} nginx_modules_${mod}"
done
CDEPEND="
pcre? ( >=dev-libs/libpcre-4.2 )
ssl? ( dev-libs/openssl )
http-cache? ( userland_GNU? ( dev-libs/openssl ) )
nginx_modules_http_geo? ( dev-libs/geoip )
nginx_modules_http_gzip? ( sys-libs/zlib )
nginx_modules_http_gzip_static? ( sys-libs/zlib )
nginx_modules_http_image_filter? ( media-libs/gd[jpeg,png] )
nginx_modules_http_perl? ( >=dev-lang/perl-5.8 )
nginx_modules_http_rewrite? ( >=dev-libs/libpcre-4.2 )
nginx_modules_http_secure_link? ( userland_GNU? ( dev-libs/openssl ) )
nginx_modules_http_xslt? ( dev-libs/libxml2 dev-libs/libxslt )
nginx_modules_http_passenger? (
$(ruby_implementation_depend ruby18)
=www-servers/${HTTP_PASSENGER_MODULE_P}
>=dev-ruby/rubygems-0.9.0
>=dev-ruby/rake-0.8.1
>=dev-ruby/fastthread-1.0.1
>=dev-ruby/rack-1.0.0
)"
RDEPEND="${CDEPEND}"
DEPEND="${CDEPEND}
arm? ( dev-libs/libatomic_ops )
libatomic? ( dev-libs/libatomic_ops )"
PDEPEND="vim-syntax? ( app-vim/nginx-syntax )"
S="${WORKDIR}/all/${P}"
pkg_setup() {
ebegin "Creating nginx user and group"
enewgroup ${PN}
enewuser ${PN} -1 -1 -1 ${PN}
eend $?
if use libatomic; then
ewarn "GCC 4.1+ features built-in atomic operations."
ewarn "Using libatomic_ops is only needed if using"
ewarn "a different compiler or a GCC prior to 4.1"
fi
if [[ -n $NGINX_ADD_MODULES ]]; then
ewarn "You are building custom modules via \$NGINX_ADD_MODULES!"
ewarn "This nginx installation is not supported!"
ewarn "Make sure you can reproduce the bug without those modules"
ewarn "_before_ reporting bugs."
fi
if use !http; then
ewarn "To actually disable all http-functionality you also have to disable"
ewarn "all nginx http modules."
fi
if use nginx_modules_http_passenger; then
ruby-ng_pkg_setup
use debug && append-flags -DPASSENGER_DEBUG
fi
}
src_prepare() {
sed -i 's/ make/ \\$(MAKE)/' "${S}"/auto/lib/perl/make
if use nginx_modules_http_passenger; then
cd "${WORKDIR}/all/${HTTP_PASSENGER_MODULE_P}"
pwd
epatch "${FILESDIR}/passenger-CFLAGS-headers.patch"
fi
}
src_configure() {
local myconf= http_enabled= mail_enabled=
use aio && myconf+=" --with-file-aio --with-aio_module"
use debug && myconf+=" --with-debug"
use ipv6 && myconf+=" --with-ipv6"
use libatomic && myconf+=" --with-libatomic"
use pcre && myconf+=" --with-pcre"
# HTTP modules
for mod in $NGINX_MODULES_STD; do
if use nginx_modules_http_${mod}; then
http_enabled=1
else
myconf+=" --without-http_${mod}_module"
fi
done
for mod in $NGINX_MODULES_OPT; do
if use nginx_modules_http_${mod}; then
http_enabled=1
myconf+=" --with-http_${mod}_module"
fi
done
if use nginx_modules_http_fastcgi; then
myconf+=" --with-http_realip_module"
fi
# third-party modules
if use nginx_modules_http_upload_progress; then
http_enabled=1
myconf+=" --add-module=${WORKDIR}/masterzen-nginx-upload-progress-module-${HTTP_UPLOAD_PROGRESS_MODULE_SHA1}"
fi
if use nginx_modules_http_headers_more; then
http_enabled=1
myconf+=" --add-module=${WORKDIR}/agentzh-headers-more-nginx-module-${HTTP_HEADERS_MORE_MODULE_SHA1}"
fi
if use nginx_modules_http_push; then
http_enabled=1
myconf+=" --add-module=${WORKDIR}/${HTTP_PUSH_MODULE_P}"
fi
if use nginx_modules_http_cache_purge; then
http_enabled=1
myconf+=" --add-module=${WORKDIR}/${HTTP_CACHE_PURGE_MODULE_P}"
fi
if use nginx_modules_http_upload; then
http_enabled=1
myconf+=" --add-module=${WORKDIR}/${HTTP_UPLOAD_MODULE_P}"
fi
if use nginx_modules_http_slowfs_cache; then
http_enabled=1
myconf+=" --add-module=${WORKDIR}/${HTTP_SLOWFS_CACHE_MODULE_P}"
fi
if use nginx_modules_http_passenger; then
http_enabled=1
myconf="${myconf} --add-module=${WORKDIR}/all/${HTTP_PASSENGER_MODULE_P}/ext/nginx"
fi
if use http || use http-cache; then
http_enabled=1
fi
if [ $http_enabled ]; then
use http-cache || myconf+=" --without-http-cache"
use ssl && myconf+=" --with-http_ssl_module"
else
myconf+=" --without-http --without-http-cache"
fi
# MAIL modules
for mod in $NGINX_MODULES_MAIL; do
if use nginx_modules_mail_${mod}; then
mail_enabled=1
else
myconf+=" --without-mail_${mod}_module"
fi
done
if [ $mail_enabled ]; then
myconf+=" --with-mail"
use ssl && myconf+=" --with-mail_ssl_module"
fi
# custom modules
for mod in $NGINX_ADD_MODULES; do
myconf+=" --add-module=${mod}"
done
# https://bugs.gentoo.org/286772
export LANG=C LC_ALL=C
tc-export CC
./configure \
--prefix=/usr \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/${PN}/${PN}.conf \
--error-log-path=/var/log/${PN}/error_log \
--pid-path=/var/run/${PN}.pid \
--lock-path=/var/lock/nginx.lock \
--user=${PN} --group=${PN} \
--with-cc-opt="-I${ROOT}usr/include" \
--with-ld-opt="-L${ROOT}usr/lib" \
--http-log-path=/var/log/${PN}/access_log \
--http-client-body-temp-path=/var/tmp/${PN}/client \
--http-proxy-temp-path=/var/tmp/${PN}/proxy \
--http-fastcgi-temp-path=/var/tmp/${PN}/fastcgi \
--http-scgi-temp-path=/var/tmp/${PN}/scgi \
--http-uwsgi-temp-path=/var/tmp/${PN}/uwsgi \
${myconf} || die "configure failed"
}
src_compile() {
# https://bugs.gentoo.org/286772
export LANG=C LC_ALL=C
emake LINK="${CC} ${LDFLAGS}" OTHERLDFLAGS="${LDFLAGS}" || die "emake failed"
}
src_install() {
keepdir /var/log/${PN} /var/tmp/${PN}/{client,proxy,fastcgi,scgi,uwsgi}
keepdir /var/www/localhost/htdocs
dosbin objs/nginx
newinitd "${FILESDIR}"/nginx.init-r2 nginx
cp "${FILESDIR}"/nginx.conf-r4 conf/nginx.conf
rm conf/win-utf conf/koi-win conf/koi-utf
dodir /etc/${PN}
insinto /etc/${PN}
doins conf/*
doman man/nginx.8
dodoc CHANGES* README
# logrotate
insinto /etc/logrotate.d
newins "${FILESDIR}"/nginx.logrotate nginx
if use nginx_modules_http_perl; then
cd "objs/src/http/modules/perl/"
einstall DESTDIR="${D}" INSTALLDIRS=vendor || die "failed to install perl stuff"
fixlocalpod
fi
if use nginx_modules_http_push; then
docinto ${HTTP_PUSH_MODULE_P}
dodoc "${WORKDIR}"/${HTTP_PUSH_MODULE_P}/{changelog.txt,protocol.txt,README}
fi
if use nginx_modules_http_cache_purge; then
docinto ${HTTP_CACHE_PURGE_MODULE_P}
dodoc "${WORKDIR}"/${HTTP_CACHE_PURGE_MODULE_P}/{CHANGES,README}
fi
if use nginx_modules_http_upload; then
docinto ${HTTP_UPLOAD_MODULE_P}
dodoc "${WORKDIR}"/${HTTP_UPLOAD_MODULE_P}/{Changelog,README}
fi
if use nginx_modules_http_slowfs_cache; then
docinto ${HTTP_SLOWFS_CACHE_MODULE_P}
dodoc "${WORKDIR}"/${HTTP_SLOWFS_CACHE_MODULE_P}/{CHANGES,README}
fi
}
pkg_postinst() {
if use ssl; then
if [ ! -f "${ROOT}"/etc/ssl/${PN}/${PN}.key ]; then
install_cert /etc/ssl/${PN}/${PN}
chown ${PN}:${PN} "${ROOT}"/etc/ssl/${PN}/${PN}.{crt,csr,key,pem}
fi
fi
}
Loading…
Cancel
Save