Browse Source

nginx:
- add passenger sub package
- use alternatives to select nginx with or without passenger
- add BR: ruby, rubygems, rubygem-rake to nginx-passenger


git-svn-id: http://trac.vinelinux.org/repos/projects/specs@3847 ec354946-7b23-47d6-9f5a-488ba84defc7

daisuke 13 years ago
parent
commit
3326057d5c
1 changed files with 100 additions and 12 deletions
  1. 100 12
      n/nginx/nginx-vl.spec

+ 100 - 12
n/nginx/nginx-vl.spec

@@ -1,7 +1,3 @@
-# build with passenger
-# need rake.gem to build with this option
-%bcond_with passenger
-
 # build mod_wsgi
 %bcond_with wsgi
 
@@ -19,7 +15,7 @@ Summary:        Robust, small and high performance http and reverse proxy server
 Summary(ja):    堅牢・軽量・高性能な HTTP およびリバースプロキシサーバ
 Name:           nginx
 Version:        1.0.2
-Release:        1%{?_dist_release}
+Release:        2%{?_dist_release}
 
 Group:          System Environment/Daemons   
 # BSD License (two clause)
@@ -67,9 +63,6 @@ BuildRequires:      perl
 BuildRequires:      perl(ExtUtils::Embed)
 BuildRequires:	    libxml2-devel
 BuildRequires:	    libxslt-devel
-%if %{with passenger}
-BuildRequires:      ruby, rubygems
-%endif
 
 
 %if "%{?_dist_release}" == "vl4"
@@ -101,8 +94,27 @@ Nginx [engine x/エンジンX] は Igor Sysoev により開発された以下の
  - HTTP(S) リバースプロキシサーバ
  - IMAP/POP3 プロキシサーバ
 
+%package passenger
+Summary: Nginx with mod_passenger support
+Summary(ja): Passenger サポート入りの Nginx 
+Group: System Environment/Daemons   
+BuildRequires: ruby, rubygems, rubygem-rake
+Requires: nginx
+
+%description passenger
+Nginx [engine x] is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3
+This package contains nginx server with passenger support.
+
+%description -l ja passenger
+Nginx [engine x/エンジンX] は Igor Sysoev により開発された以下の機能をもつ
+堅牢・軽量・高性能なHTTPサーバかつリバースプロキシサーバです。
+ - HTTP(S) サーバ
+ - HTTP(S) リバースプロキシサーバ
+ - IMAP/POP3 プロキシサーバ
+このパッケージには Passenger サポートを含んだ nginxサーバが入っています。
+
 %prep
-%setup -q -a 1000 -a 1010 %{?with_wsgi:-a 1020} %{?with_passenger:-a 1030}
+%setup -q -a 1000 -a 1010 -a 1030 %{?with_wsgi:-a 1020}
 
 %patch0 -p0
 %patch1 -p1
@@ -113,7 +125,10 @@ Nginx [engine x/エンジンX] は Igor Sysoev により開発された以下の
 # to error out.  This is is also the reason for the DESTDIR environment
 # variable.  The configure script(s) have been patched (Patch1 and
 # Patch2) in order to support installing into a build environment.
+
 export DESTDIR=%{buildroot}
+
+## build with passenger
 ./configure \
     --user=%{nginx_user} \
     --group=%{nginx_group} \
@@ -149,8 +164,52 @@ export DESTDIR=%{buildroot}
 %if %{with wsgi}
     --add-module=lifeeth-mod_wsgi-%{mod_wsgi_version} \
 %endif
-%if %{with passenger}
     --add-module=passenger-%{passenger_version}/ext/nginx \
+%ifarch i686
+    --with-cpu-opt=pentiumpro \
+    --with-zlib-asm=pentiumpro \
+    --with-md5-asm \
+    --with-sha1-asm \
+%endif
+    --with-cc-opt="-O6 %{optflags} $(pcre-config --cflags)"
+make %{?_smp_mflags} 
+mv objs/nginx objs/nginx.passenger
+
+## build without passenger
+./configure \
+    --user=%{nginx_user} \
+    --group=%{nginx_group} \
+    --prefix=%{nginx_datadir} \
+    --sbin-path=%{_sbindir}/%{name} \
+    --conf-path=%{nginx_confdir}/%{name}.conf \
+    --error-log-path=%{nginx_logdir}/error.log \
+    --http-log-path=%{nginx_logdir}/access.log \
+    --http-client-body-temp-path=%{nginx_home_tmp}/client_body \
+    --http-proxy-temp-path=%{nginx_home_tmp}/proxy \
+    --http-fastcgi-temp-path=%{nginx_home_tmp}/fastcgi \
+    --pid-path=%{_localstatedir}/run/%{name}.pid \
+    --lock-path=%{_localstatedir}/lock/subsys/%{name} \
+    --with-file-aio \
+    --with-ipv6 \
+    --with-http_ssl_module \
+    --with-http_realip_module \
+    --with-http_addition_module \
+    --with-http_xslt_module \
+    --with-http_image_filter_module \
+    --with-http_sub_module \
+    --with-http_dav_module \
+    --with-http_flv_module \
+    --with-http_gzip_static_module \
+    --with-http_random_index_module \
+    --with-http_secure_link_module \
+    --with-http_stub_status_module \
+    --with-http_perl_module \
+    --with-mail \
+    --with-mail_ssl_module \
+    --add-module=ngx-fancyindex-%{ngx_fancyindex_version} \
+    --add-module=giom-nginx_accept_language_module-%{nginx_accept_language_module_version} \
+%if %{with wsgi}
+    --add-module=lifeeth-mod_wsgi-%{mod_wsgi_version} \
 %endif
 %ifarch i686
     --with-cpu-opt=pentiumpro \
@@ -169,7 +228,9 @@ find %{buildroot} -type f -name perllocal.pod -exec rm -f {} \;
 find %{buildroot} -type f -empty -exec rm -f {} \;
 find %{buildroot} -type f -exec chmod 0644 {} \;
 find %{buildroot} -type f -name '*.so' -exec chmod 0755 {} \;
-chmod 0755 %{buildroot}%{_sbindir}/nginx
+mv  %{buildroot}%{_sbindir}/nginx %{buildroot}%{_sbindir}/nginx.normal
+%{__install} -m 0755 objs/nginx.passenger %{buildroot}%{_sbindir}/
+chmod 0755 %{buildroot}%{_sbindir}/nginx.*
 %{__install} -p -D -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name}
 %{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
 %{__install} -p -D -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
@@ -220,13 +281,24 @@ fi
 if [ $1 == 1 ]; then
     /sbin/chkconfig --add %{name}
 fi
+update-alternatives --install %{_sbindir}/nginx nginx %{_sbindir}/nginx.normal 20
+
+%post passenger
+update-alternatives --install %{_sbindir}/nginx nginx %{_sbindir}/nginx.passenger 30
 
 %preun
 if [ $1 = 0 ]; then
     /sbin/service %{name} stop >/dev/null 2>&1
     /sbin/chkconfig --del %{name}
+    update-alternatives --remove nginx %{_sbindir}/nginx.normal
+fi
+
+%preun passenger
+if [ $1 = 0 ]; then
+    update-alternatives --remove nginx %{_sbindir}/nginx.passenger
 fi
 
+
 %postun
 if [ $1 == 2 ]; then
     /sbin/service %{name} upgrade || :
@@ -236,7 +308,7 @@ fi
 %defattr(-,root,root,-)
 %doc LICENSE CHANGES README %{?with_wsgi:README.mod_wsgi}
 %{nginx_datadir}/
-%{_sbindir}/%{name}
+%{_sbindir}/%{name}.normal
 %{_mandir}/man3/%{name}.3pm.gz
 %{_initrddir}/%{name}
 %dir %{nginx_confdir}
@@ -272,8 +344,24 @@ fi
 %attr(-,%{nginx_user},%{nginx_group}) %dir %{nginx_home_cache}
 %attr(-,%{nginx_user},%{nginx_group}) %dir %{nginx_logdir}
 
+%files passenger
+%defattr(-,root,root,-)
+%doc passenger-%{passenger_version}/doc/Users\ guide\ Nginx.*
+%doc passenger-%{passenger_version}/doc/ApplicationPool\ algorithm.txt
+%doc passenger-%{passenger_version}/doc/Architectural\ overview.*
+%doc passenger-%{passenger_version}/doc/Security\ of\ user\ switching\ support.*
+%doc passenger-%{passenger_version}/doc/template
+%doc passenger-%{passenger_version}/doc/users_guide_snippets
+%doc passenger-%{passenger_version}/doc/images
+%{_sbindir}/%{name}.passenger
+
 
 %changelog
+* Wed May 11 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.2-2
+- add nginx-passenger sub pakckage
+  - use alternatives to choose nginx with or without passenger
+  - add BR: ruby, rubygems, rubygem-rake
+
 * Wed May 11 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.2-1
 - update to 1.0.2