From eb0ef1a93821dd8a34f5ae130ab6efca6574df80 Mon Sep 17 00:00:00 2001 From: Bertrand Jacquin Date: Tue, 6 Jul 2010 00:30:37 +0200 Subject: nginx for cross compile --- www-servers/nginx/files/nginx | 40 ++++++++ .../nginx/files/nginx-0.6.32-cross-configure.diff | 22 ++++ www-servers/nginx/files/nginx-r1 | 71 +++++++++++++ www-servers/nginx/files/nginx.conf | 66 ++++++++++++ www-servers/nginx/files/nginx.conf-r1 | 55 ++++++++++ www-servers/nginx/files/nginx.conf-r2 | 58 +++++++++++ www-servers/nginx/files/nginx.conf-r3 | 57 +++++++++++ www-servers/nginx/files/nginx.conf-r4 | 72 +++++++++++++ www-servers/nginx/nginx-0.6.32.ebuild | 111 +++++++++++++++++++++ 9 files changed, 552 insertions(+) create mode 100644 www-servers/nginx/files/nginx create mode 100644 www-servers/nginx/files/nginx-0.6.32-cross-configure.diff create mode 100644 www-servers/nginx/files/nginx-r1 create mode 100644 www-servers/nginx/files/nginx.conf create mode 100644 www-servers/nginx/files/nginx.conf-r1 create mode 100644 www-servers/nginx/files/nginx.conf-r2 create mode 100644 www-servers/nginx/files/nginx.conf-r3 create mode 100644 www-servers/nginx/files/nginx.conf-r4 create mode 100644 www-servers/nginx/nginx-0.6.32.ebuild (limited to 'www-servers') diff --git a/www-servers/nginx/files/nginx b/www-servers/nginx/files/nginx new file mode 100644 index 00000000..7cafac89 --- /dev/null +++ b/www-servers/nginx/files/nginx @@ -0,0 +1,40 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/files/nginx,v 1.3 2005/05/29 14:30:28 voxus Exp $ + +opts="${opts} reload configtest" + +depend() { + need net + use dns logger +} + +start() { + configtest || return 1 + 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() { + configtest || return 1 + 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" +} + +configtest() { + ebegin "Checking nginx' configuration" + /usr/sbin/nginx -c /etc/nginx/nginx.conf -t + eend $? "failed, please correct errors above" +} diff --git a/www-servers/nginx/files/nginx-0.6.32-cross-configure.diff b/www-servers/nginx/files/nginx-0.6.32-cross-configure.diff new file mode 100644 index 00000000..6e5042f2 --- /dev/null +++ b/www-servers/nginx/files/nginx-0.6.32-cross-configure.diff @@ -0,0 +1,22 @@ +--- auto/cc/name.ori 2009-05-02 01:52:53.000000000 +0200 ++++ auto/cc/name 2009-05-02 01:53:09.000000000 +0200 +@@ -6,7 +6,7 @@ + + ngx_feature="C compiler" + ngx_feature_name= +- ngx_feature_run=yes ++ ngx_feature_run=${cx_ngx_feature_run:-yes} + ngx_feature_incs= + ngx_feature_path= + ngx_feature_libs= +--- auto/types/sizeof.ori 2009-05-02 01:58:25.000000000 +0200 ++++ auto/types/sizeof 2009-05-02 01:58:46.000000000 +0200 +@@ -46,7 +46,7 @@ + rm -f $NGX_AUTOTEST + + +-case $ngx_size in ++case ${cx_ngx_size:-$ngx_size} in + 4) + if [ "$ngx_type"="long" ]; then + ngx_max_value=2147483647L diff --git a/www-servers/nginx/files/nginx-r1 b/www-servers/nginx/files/nginx-r1 new file mode 100644 index 00000000..ceea5d84 --- /dev/null +++ b/www-servers/nginx/files/nginx-r1 @@ -0,0 +1,71 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/files/nginx-r1,v 1.1 2006/07/04 16:58:38 voxus Exp $ + +opts="${opts} upgrade reload configtest" + +depend() { + need net + use dns logger +} + +start() { + configtest || return 1 + 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() { + configtest || return 1 + 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 + eend $? "failed, please correct errors above" +} diff --git a/www-servers/nginx/files/nginx.conf b/www-servers/nginx/files/nginx.conf new file mode 100644 index 00000000..526dd2ef --- /dev/null +++ b/www-servers/nginx/files/nginx.conf @@ -0,0 +1,66 @@ +user apache apache; + +worker_processes 5; + +error_log /var/log/nginx/error_log warn; + +events { + connections 2048; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '%addr - - [%time] "%request" %status ' + '%length "%{Referer}i" "%{User-Agent}i" '; + + log_format download '%addr - - [%time] "%request" %status ' + '%length "%{Referer}i" "%{User-Agent}i" ' + '"%{Range}i" "%{Content-Range}o"'; + + post_accept_timeout 60; + client_header_timeout 3m; + client_body_timeout 3m; + send_timeout 3m; + + 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; + + server { + listen 80; + + charset on; + source_charset koi8-r; + + access_log /var/log/nginx/access_log main; + + location / { + root /var/www/localhost/htdocs; + index index.html; + allow all; + } + + location ~* ^.+\.(jpg|jpeg|gif)$ { + root /var/www/localhost/htdocs; + access_log off; + expires 30d; + } + } +} diff --git a/www-servers/nginx/files/nginx.conf-r1 b/www-servers/nginx/files/nginx.conf-r1 new file mode 100644 index 00000000..4ad6a3c1 --- /dev/null +++ b/www-servers/nginx/files/nginx.conf-r1 @@ -0,0 +1,55 @@ +user apache apache; + +worker_processes 1; + +error_log /var/log/nginx/error_log info; + +events { + worker_connections 8192; + 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; + + server { + listen 127.0.0.1; + server_name localhost; + + access_log /var/log/nginx/access_log info; + + root /var/www/localhost/htdocs; + } +} diff --git a/www-servers/nginx/files/nginx.conf-r2 b/www-servers/nginx/files/nginx.conf-r2 new file mode 100644 index 00000000..913e98f3 --- /dev/null +++ b/www-servers/nginx/files/nginx.conf-r2 @@ -0,0 +1,58 @@ +user apache apache; + +worker_processes 1; + +error_log /var/log/nginx/error_log info; + +events { + worker_connections 8192; + 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; + + root /var/www/localhost/htdocs; + } +} diff --git a/www-servers/nginx/files/nginx.conf-r3 b/www-servers/nginx/files/nginx.conf-r3 new file mode 100644 index 00000000..a924424b --- /dev/null +++ b/www-servers/nginx/files/nginx.conf-r3 @@ -0,0 +1,57 @@ +user nginx nginx; +worker_processes 1; + +error_log /var/log/nginx/error_log info; + +events { + worker_connections 8192; + 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; + + root /var/www/localhost/htdocs; + } +} diff --git a/www-servers/nginx/files/nginx.conf-r4 b/www-servers/nginx/files/nginx.conf-r4 new file mode 100644 index 00000000..117c2e55 --- /dev/null +++ b/www-servers/nginx/files/nginx.conf-r4 @@ -0,0 +1,72 @@ +user nginx nginx; +worker_processes 1; + +error_log /var/log/nginx/error_log info; + +events { + worker_connections 8192; + 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 portion + # 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; + # } +} diff --git a/www-servers/nginx/nginx-0.6.32.ebuild b/www-servers/nginx/nginx-0.6.32.ebuild new file mode 100644 index 00000000..842658b7 --- /dev/null +++ b/www-servers/nginx/nginx-0.6.32.ebuild @@ -0,0 +1,111 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/nginx-0.6.32.ebuild,v 1.2 2008/10/25 17:36:52 voxus Exp $ + +inherit eutils ssl-cert + +DESCRIPTION="Robust, small and high performance http and reverse proxy server" + +HOMEPAGE="http://nginx.net/" +SRC_URI="http://sysoev.ru/nginx/${P}.tar.gz" +LICENSE="BSD" +SLOT="0" +KEYWORDS="amd64 ~ppc x86" +IUSE="addition debug fastcgi flv imap pcre perl ssl status sub webdav zlib" + +DEPEND="dev-lang/perl + pcre? ( >=dev-libs/libpcre-4.2 ) + ssl? ( dev-libs/openssl ) + zlib? ( sys-libs/zlib ) + perl? ( >=dev-lang/perl-5.8 )" + +pkg_setup() { + ebegin "Creating nginx user and group" + enewgroup nginx + enewuser nginx -1 -1 /dev/null nginx + eend ${?} +} + +src_unpack () { + unpack ${A} + + cd ${S} + epatch "${FILESDIR}"/${P}-cross-configure.diff +} + +src_compile() { + local myconf + + # threads support is broken atm. + # + # if use threads; then + # einfo + # ewarn "threads support is experimental at the moment" + # ewarn "do not use it on production systems - you've been warned" + # einfo + # myconf="${myconf} --with-threads" + # fi + + use addition && myconf="${myconf} --with-http_addition_module" + use fastcgi || myconf="${myconf} --without-http_fastcgi_module" + use fastcgi && myconf="${myconf} --with-http_realip_module" + use flv && myconf="${myconf} --with-http_flv_module" + use zlib || myconf="${myconf} --without-http_gzip_module" + use pcre || { + myconf="${myconf} --without-pcre --without-http_rewrite_module" + } + use debug && myconf="${myconf} --with-debug" + use ssl && myconf="${myconf} --with-http_ssl_module" + use imap && myconf="${myconf} --with-imap" # pop3/imap4 proxy support + use perl && myconf="${myconf} --with-http_perl_module" + use status && myconf="${myconf} --with-http_stub_status_module" + use webdav && myconf="${myconf} --with-http_dav_module" + use sub && myconf="${myconf} --with-http_sub_module" + + bash -x ./configure \ + --prefix=/usr \ + --conf-path=/etc/${PN}/${PN}.conf \ + --http-log-path=/var/log/${PN}/access_log \ + --error-log-path=/var/log/${PN}/error_log \ + --pid-path=/var/run/${PN}.pid \ + --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 \ + --with-md5-asm --with-md5=/usr/include \ + --with-sha1-asm --with-sha1=/usr/include \ + ${myconf} || die "configure failed" + + emake || die "failed to compile" +} + +src_install() { + keepdir /var/log/${PN} /var/tmp/${PN}/{client,proxy,fastcgi} + + dosbin objs/nginx + cp "${FILESDIR}"/nginx-r1 "${T}"/nginx + doinitd "${T}"/nginx + + cp "${FILESDIR}"/nginx.conf-r4 conf/nginx.conf + + dodir "${ROOT}"/etc/${PN} + insinto "${ROOT}"/etc/${PN} + doins conf/* + + dodoc CHANGES{,.ru} LICENSE README + + use perl && { + cd "${S}"/objs/src/http/modules/perl/ + einstall DESTDIR="${D}"|| die "failed to install perl stuff" + } +} + +pkg_postinst() { + use ssl && { + if [ ! -f "${ROOT}"/etc/ssl/${PN}/${PN}.key ]; then + dodir "${ROOT}"/etc/ssl/${PN} + insinto "${ROOT}"etc/ssl/${PN}/ + insopts -m0644 -o nginx -g nginx + install_cert /etc/ssl/nginx/nginx + fi + } +} -- cgit v1.2.3