%global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null) %global gemname passenger %global geminstdir %{gemdir}/gems/%{gemname}-%{version} %{!?ruby_sitearch: %global ruby_sitearch %(ruby -rrbconfig -e "puts Config::CONFIG['sitearchdir']")} %{!?ruby_sitelib: %global ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")} %{!?ruby_version: %global ruby_version %(ruby -rrbconfig -e "puts Config::CONFIG['ruby_version']")} %global with_nginx 1 %global nginx_version 1.0.14 %global nginx_user nginx-passenger %global nginx_group %{nginx_user} %global nginx_home %{_localstatedir}/lib/nginx-passenger %global nginx_home_tmp %{nginx_home}/tmp %global nginx_confdir %{_sysconfdir}/nginx-passenger %global nginx_datadir %{_datadir}/nginx-passenger %global nginx_logdir %{_localstatedir}/log/nginx-passenger %global nginx_webroot %{nginx_datadir}/html Summary: Passenger Ruby on Rails deployment system Name: rubygem-%{gemname} Version: 3.0.12 Release: 1%{?dist} Group: Development/Languages License: MIT URL: http://passenger.rubyforge.org Source0: http://rubyforge.org/frs/download.php/76005/%{gemname}-%{version}.tar.gz Source1: mod_passenger.conf # The version of asciidoc available does not support -b html5. # Also, there's no theme 'flask' available, but this is not fatal. # Necessary for 'rake package' which gives us a gem. # Needed until asciidoc version 8.4.6 or 8.4.7 or later ships with Fedora. Patch1: rubygem-passenger-3.0.12-asciidoc-skip-html5.patch Patch2: rubygem-passenger-3.0.12-force-native.patch # Should be upstreamed, huh? Patch3: rubygem-passenger-3.0.12-gcc47-include-sys_types.patch Patch10: rubygem-passenger-3.0.12-spoof-nginx-install.patch # From the Fedora 17 boost-1.48.0 dist-git repository; # See also: https://svn.boost.org/trac/boost/ticket/6165 Patch100: boost-1.48.0-gcc47-pthreads.patch # removes -Werror in upstream build scripts. -Werror conflicts with # -D_FORTIFY_SOURCE=2 causing warnings to turn into errors. Patch200: nginx-auto-cc-gcc.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # Needed for mod_passenger BuildRequires: asciidoc %if 0%{?rhel} >= 6 || 0%{?fedora} >= 15 BuildRequires: libcurl-devel %else BuildRequires: curl-devel %endif BuildRequires: libev-devel BuildRequires: openssl-devel BuildRequires: ruby-devel %if 0%{?rhel} < 6 && 0%{?fedora} < 16 BuildRequires: rubygem(fastthread) >= 1.0.1 %endif BuildRequires: rubygem(rack) BuildRequires: rubygem(rake) >= 0.8.1 %if 0%{?rhel} >= 6 || 0%{?fedora} >= 15 BuildRequires: selinux-policy %else BuildRequires: selinux-policy-devel %endif Requires: rubygems Requires: rubygem(rake) >= 0.8.1 Requires: rubygem(fastthread) >= 1.0.1 Requires: rubygem(file-tail) Requires: rubygem(rack) Provides: rubygem(%{gemname}) = %{version} Provides: bundled(boost) = 1.44.0 %description Phusion Passenger is a deployment system for Ruby on Rails applications on Apache, i.e. a 'mod_rails'. Rails deployment becomes an "upload & done" process %package doc Summary: Documentation for %{name} Group: Documentation Requires: %{name} = %{version}-%{release} %description doc This package contains documentation for %{name}. %package devel Summary: Development files for %{name} Group: Development/Languages Requires: %{name} = %{version}-%{release} %description devel This package contains development files for %{name}. %package -n mod_passenger Summary: Apache2 module for Phusion Passenger Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} Requires: httpd >= 2.2 BuildRequires: httpd-devel %description -n mod_passenger Apache2 Phusion Passenger module, also known as mod_rails or mod_rack %if %{!?with_nginx:0}%{?with_nginx:1} %package -n nginx-passenger Summary: The NGINX web- and reverse proxy server with Phusion Passenger Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} Source200: http://nginx.org/download/nginx-%{nginx_version}.tar.gz Source201: nginx.service Source202: nginx.logrotate Source203: nginx.conf Source204: default.conf Source205: ssl.conf Source206: virtual.conf Source207: nginx.init Source300: index.html Source301: poweredby.png Source302: nginx-logo.png Source303: 404.html Source304: 50x.html BuildRequires: GeoIP-devel BuildRequires: gd-devel BuildRequires: libxslt-devel BuildRequires: openssl-devel BuildRequires: pcre-devel # BuildRequires: perl-devel # BuildRequires: perl(ExtUtils::Embed) BuildRequires: zlib-devel %if 0%{?fedora} > 15 BuildRequires: systemd-units %endif Requires: GeoIP Requires: gd Requires: openssl Requires: pcre # Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) Requires(pre): shadow-utils Requires(post): chkconfig Requires(post): systemd-units Requires(preun):chkconfig Requires(preun):initscripts Requires(preun):systemd-units Requires(postun):initscripts Requires(postun):systemd-units Provides: webserver %description -n nginx-passenger Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP protocols, with a strong focus on high concurrency, performance and low memory usage. This package providex Nginx with Phusion Passenger support. %endif %prep %setup -q -n %{gemname}-%{version} -b200 %patch1 -p1 -b .asciidoc-no-html5 %patch2 -p1 -b .force-native %patch3 -p1 -b .include-sys-types %if 0%{?fedora} >= 17 pushd ext/ %patch100 -p0 -b .gcc47 popd %endif %if %{!?with_nginx:0}%{?with_nginx:1} %patch10 -p1 -b .spoof-nginx pushd ../nginx-%{nginx_version} %patch200 -p0 -b .nginx popd %endif sed -i \ -e 's|%%%%GEM_INSTALL_DIR%%%%|%{geminstdir}|g' \ -e 's|%%%%APACHE_INSTALLED_MOD%%%%|%{_libdir}/httpd/modules/|g' \ lib/phusion_passenger.rb \ lib/phusion_passenger/native_support.rb \ ext/common/ResourceLocator.h %build export CXXFLAGS="%{?optflags}" export USE_VENDORED_LIBEV=false export LIBEV_CFLAGS='-I/usr/include/libev' export LIBEV_LIBS='-lev' rake -v package rake -v apache2 rake -v nginx export PATH=./bin:$PATH echo -en "\n\n" | passenger-install-apache2-module %if %{!?with_nginx:0}%{?with_nginx:1} export DESTDIR=%{buildroot} export NGINX_EXTRA_CONFIGURE_FLAGS='--prefix=%{nginx_datadir} \ --sbin-path=%{_sbindir}/nginx-passenger \ --conf-path=%{nginx_confdir}/nginx.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 \ --http-uwsgi-temp-path=%{nginx_home_tmp}/uwsgi \ --http-scgi-temp-path=%{nginx_home_tmp}/scgi \ --pid-path=/run/nginx-passenger.pid \ --lock-path=/run/lock/subsys/nginx-passenger \ --user=%{nginx_user} \ --group=%{nginx_group} \ --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_geoip_module \ --with-http_sub_module \ --with-http_dav_module \ --with-http_flv_module \ --with-http_mp4_module \ --with-http_gzip_static_module \ --with-http_random_index_module \ --with-http_secure_link_module \ --with-http_degradation_module \ --with-http_stub_status_module \ --with-mail \ --with-mail_ssl_module \ --with-cc-opt="%{optflags} $(pcre-config --cflags)" \ --with-ld-opt="-Wl,-E"' echo -en "\n2\n%{_builddir}/nginx-%{nginx_version}\n\n\n\n\n\n" | passenger-install-nginx-module %endif %install rm -rf %{buildroot} gem install \ --local \ --install-dir %{buildroot}%{gemdir} \ --force \ --rdoc pkg/%{gemname}-%{version}.gem mkdir -p \ %{buildroot}/%{_bindir} \ %{buildroot}/%{geminstdir} # TODO: Install to geminstdir install -pm 755 bin/passenger %{buildroot}/%{_bindir}/ install -pm 755 bin/passenger-config %{buildroot}/%{_bindir}/ install -pm 755 bin/passenger-make-enterprisey %{buildroot}/%{_bindir}/ install -pm 755 bin/passenger-memory-stats %{buildroot}/%{_bindir}/ install -pm 755 bin/passenger-status %{buildroot}/%{_bindir}/ # Install mod_passenger.so to the correct location mkdir -p %{buildroot}/%{_libdir}/httpd/modules/ install -pm 755 ext/apache2/mod_passenger.so %{buildroot}/%{_libdir}/httpd/modules/ # Install man pages mkdir -p %{buildroot}/%{_mandir}/man{1,8}/ install -pm 644 man/passenger-config.1 %{buildroot}/%{_mandir}/man1/ install -pm 644 man/passenger-make-enterprisey.8 %{buildroot}/%{_mandir}/man8/ install -pm 644 man/passenger-memory-stats.8 %{buildroot}/%{_mandir}/man8/ install -pm 644 man/passenger-status.8 %{buildroot}/%{_mandir}/man8/ install -pm 644 man/passenger-stress-test.1 %{buildroot}/%{_mandir}/man1/ # Install the mod_passenger httpd conf mkdir -p %{buildroot}/%{_sysconfdir}/httpd/conf.d/ install -pm 644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/httpd/conf.d/ sed -i -e 's|@GEMINSTDIR@|%{geminstdir}|g' %{buildroot}/%{_sysconfdir}/httpd/conf.d/mod_passenger.conf # Fix anything executable that does not have a shebang for script in `find %{buildroot}/%{geminstdir} -type f -perm /a+x -name "*.rb"`; do [ -z "`head -n 1 $script | grep \"^#!/\"`" ] && chmod -v 644 $script done # Find files with a shebang that do not have executable permissions for script in `find %{buildroot}/%{geminstdir} -type f ! -perm /a+x -name "*.rb"`; do [ ! -z "`head -n 1 $script | grep \"^#!/\"`" ] && chmod -v 755 $script done # Remove zero-length files find %{buildroot}/%{geminstdir} -type f -size 0c -exec rm -rvf {} \; %if %{!?with_nginx:0}%{?with_nginx:1} pushd %{_builddir}/nginx-%{nginx_version} # make install DESTDIR=%{buildroot} INSTALLDIRS=vendor make install DESTDIR=%{buildroot} # find %{buildroot} -type f -name .packlist -exec rm -f '{}' \; # find %{buildroot} -type f -name perllocal.pod -exec rm -f '{}' \; # find %{buildroot} -type f -empty -exec rm -f '{}' \; # find %{buildroot} -type f -iname '*.so' -exec chmod 0755 '{}' \; %if 0%{?fedora} >= 15 install -p -D -m 0644 %{SOURCE201} \ %{buildroot}%{_unitdir}/nginx-passenger.service sed -i \ -e 's|nginx|nginx-passenger|g' \ -e 's|nginx-passenger.conf|nginx.conf|g' \ %{buildroot}%{_unitdir}/nginx-passenger.service %else mkdir -p %{buildroot}%{_initrddir} %{__install} -p -D -m 0755 %{SOURCE207} %{buildroot}%{_initrddir}/nginx-passenger sed -i \ -e 's|nginx|nginx-passenger|g' \ -e 's|nginx-passenger.conf|nginx.conf|g' \ %{buildroot}%{_initrddir}/nginx-passenger %endif install -p -D -m 0644 %{SOURCE202} \ %{buildroot}%{_sysconfdir}/logrotate.d/nginx-passenger sed -i \ -e 's|nginx|nginx-passenger|g' \ -e 's|nginx-passenger.conf|nginx.conf|g' \ %{buildroot}%{_sysconfdir}/logrotate.d/nginx-passenger install -p -d -m 0755 %{buildroot}%{nginx_confdir}/conf.d install -p -d -m 0755 %{buildroot}%{nginx_home_tmp} install -p -d -m 0755 %{buildroot}%{nginx_logdir} install -p -d -m 0755 %{buildroot}%{nginx_webroot} install -p -m 0644 %{SOURCE203} \ %{buildroot}%{nginx_confdir} sed -i \ -e 's/nginx/nginx-passenger/g' \ %{buildroot}%{nginx_confdir}/nginx.conf \ %{buildroot}%{nginx_confdir}/nginx.conf.default install -p -m 0644 %{SOURCE204} %{SOURCE205} %{SOURCE206} \ %{buildroot}%{nginx_confdir}/conf.d install -p -m 0644 %{SOURCE300} \ %{buildroot}%{nginx_webroot} install -p -m 0644 %{SOURCE301} %{SOURCE302} \ %{buildroot}%{nginx_webroot} install -p -m 0644 %{SOURCE303} %{SOURCE304} \ %{buildroot}%{nginx_webroot} popd %endif %if %{!?with_nginx:0}%{?with_nginx:1} %pre -n nginx-passenger if [ $1 -eq 1 ]; then getent group %{nginx_group} > /dev/null || groupadd -r %{nginx_group} getent passwd %{nginx_user} > /dev/null || \ useradd -r -d %{nginx_home} -g %{nginx_group} \ -s /sbin/nologin -c "Nginx Passenger web server" %{nginx_user} exit 0 fi %endif %if %{!?with_nginx:0}%{?with_nginx:1} %post -n nginx-passenger if [ $1 -eq 1 ]; then %if 0%{?fedora} >= 15 /bin/systemctl daemon-reload >/dev/null 2>&1 || : %else /sbin/chkconfig --add %{name} %endif fi %endif %if %{!?with_nginx:0}%{?with_nginx:1} %preun -n nginx-passenger if [ $1 -eq 0 ]; then %if 0%{?fedora} >= 15 /bin/systemctl --no-reload disable nginx-passenger.service >/dev/null 2>&1 || : /bin/systemctl stop nginx-passenger.service >/dev/null 2>&1 || : %else /sbin/service %{name} stop >/dev/null 2>&1 /sbin/chkconfig --del %{name} %endif fi %endif %if %{!?with_nginx:0}%{?with_nginx:1} %postun -n nginx-passenger %if 0%{?fedora} >= 15 /bin/systemctl daemon-reload >/dev/null 2>&1 || : if [ $1 -gt 1 ]; then /bin/systemctl try-restart nginx-passenger.service >/dev/null 2>&1 || : fi %else if [ $1 -eq 2 ]; then /sbin/service %{name} upgrade || : fi %endif %endif %check export CONFIGURE_ARGS="--with-cflags='%{optflags}'" export USE_VENDORED_LIBEV=false export LIBEV_CFLAGS='-I/usr/include/libev' export LIBEV_LIBS='-lev' # I want the output of tests that fail, but let's not have the entire build # fail. Adding --trace does not help here. # # Test failure output: # EventedClientTest: ................[17=F].[19=F].[21=F] # LoggingTest: ..........[12=F].[14=F].............. rake -v test ||: %clean rm -rf %{buildroot} %files %defattr(-, root, root, -) %{_bindir}/passenger %{_bindir}/passenger-config %{_bindir}/passenger-make-enterprisey %{_bindir}/passenger-memory-stats %{_bindir}/passenger-status %dir %{geminstdir} %exclude %{geminstdir}/bin/ %exclude %{geminstdir}/build/ %exclude %{geminstdir}/configure %exclude %{geminstdir}/debian/ %exclude %{geminstdir}/dev/ %exclude %{geminstdir}/doc/ %exclude %{geminstdir}/ext/ %exclude %{geminstdir}/man/ %exclude %{geminstdir}/test/ %doc %{geminstdir}/DEVELOPERS.TXT %doc %{geminstdir}/INSTALL %doc %{geminstdir}/LICENSE %doc %{geminstdir}/NEWS %doc %{geminstdir}/PACKAGING.TXT %doc %{geminstdir}/README %doc %{geminstdir}/Rakefile %{geminstdir}/helper-scripts %{geminstdir}/lib %{geminstdir}/resources %exclude %{gemdir}/bin/passenger %exclude %{gemdir}/bin/passenger-config %exclude %{gemdir}/bin/passenger-install-apache2-module %exclude %{gemdir}/bin/passenger-make-enterprisey %exclude %{gemdir}/bin/passenger-memory-stats %exclude %{gemdir}/bin/passenger-status # Include this for now, as we're not providing it through the package %dir %{gemdir}/bin %{gemdir}/bin/passenger-install-nginx-module %{gemdir}/cache/%{gemname}-%{version}.gem %{gemdir}/specifications/%{gemname}-%{version}.gemspec %{_mandir}/man1/passenger-config.1.gz %{_mandir}/man1/passenger-stress-test.1.gz %{_mandir}/man8/passenger-make-enterprisey.8.gz %{_mandir}/man8/passenger-memory-stats.8.gz %{_mandir}/man8/passenger-status.8.gz %files doc %defattr(-, root, root, -) %doc doc/* %{gemdir}/doc/%{gemname}-%{version} %files devel %defattr(-, root, root, -) %{geminstdir}/build %{geminstdir}/dev %{geminstdir}/ext %{geminstdir}/test %files -n mod_passenger %defattr(-, root, root, -) %config(noreplace) %{_sysconfdir}/httpd/conf.d/mod_passenger.conf %{_libdir}/httpd/modules/mod_passenger.so %if %{!?with_nginx:0}%{?with_nginx:1} %files -n nginx-passenger %doc ../nginx-%{nginx_version}/LICENSE %doc ../nginx-%{nginx_version}/CHANGES %doc ../nginx-%{nginx_version}/README %{nginx_datadir}/ %{_sbindir}/nginx-passenger # %{_mandir}/man3/nginx.3pm.gz %if 0%{?fedora} >= 15 %{_unitdir}/nginx-passenger.service %else %{_initrddir}/nginx-passenger %endif %dir %{nginx_confdir} %dir %{nginx_confdir}/conf.d %dir %{nginx_logdir} %config(noreplace) %{nginx_confdir}/fastcgi.conf %config(noreplace) %{nginx_confdir}/fastcgi.conf.default %config(noreplace) %{nginx_confdir}/fastcgi_params %config(noreplace) %{nginx_confdir}/fastcgi_params.default %config(noreplace) %{nginx_confdir}/koi-utf %config(noreplace) %{nginx_confdir}/koi-win %config(noreplace) %{nginx_confdir}/mime.types %config(noreplace) %{nginx_confdir}/mime.types.default %config(noreplace) %{nginx_confdir}/nginx.conf %config(noreplace) %{nginx_confdir}/nginx.conf.default %config(noreplace) %{nginx_confdir}/scgi_params %config(noreplace) %{nginx_confdir}/scgi_params.default %config(noreplace) %{nginx_confdir}/uwsgi_params %config(noreplace) %{nginx_confdir}/uwsgi_params.default %config(noreplace) %{nginx_confdir}/win-utf %config(noreplace) %{nginx_confdir}/conf.d/*.conf %config(noreplace) %{_sysconfdir}/logrotate.d/nginx-passenger # %exclude %{perl_vendorarch}/auto/nginx # %exclude %{perl_vendorarch}/nginx.pm %attr(-,%{nginx_user},%{nginx_group}) %dir %{nginx_home} %attr(-,%{nginx_user},%{nginx_group}) %dir %{nginx_home_tmp} %endif %changelog * Sat Apr 14 2012 Jeroen van Meeuwen - 3.0.12-1 - Latest upstream version * Sun Apr 18 2010 Jeroen van Meeuwen - 2.2.10-2 - rebuilt * Sat Mar 6 2010 Jeroen van Meeuwen - 2.2.10-1 - New upstream version * Fri Jan 8 2010 Jeroen van Meeuwen - 2.2.9-1 - New upstream version * Tue Dec 15 2009 Jeroen van Meeuwen - 2.2.8-1 - New upstream version * Wed Nov 18 2009 Jeroen van Meeuwen - 2.2.7-1 - New upstream version * Sat Oct 17 2009 Jeroen van Meeuwen - 2.2.5-2 - Fix files in %%{_bindir} - Require rubygem-hawler * Mon Sep 07 2009 Jeroen van Meeuwen - 2.2.5-1 - New upstream version * Wed Aug 05 2009 Jeroen van Meeuwen - 2.2.4-1 - New upstream version * Wed Aug 05 2009 Jeroen van Meeuwen - 2.2.3-1 - New upstream version * Tue May 05 2009 Jeroen van Meeuwen - 2.2.2-1 - New upstream version * Tue Mar 17 2009 Jeroen van Meeuwen - 2.1.2-1 - New upstream version * Sun Mar 15 2009 Jeroen van Meeuwen - 2.0.6-3 - Fix some rpmlint issues * Sun Dec 21 2008 Jeroen van Meeuwen - 2.0.6-2 - New upstream version * Sun Nov 09 2008 Jeroen van Meeuwen - 2.0.3-3 - Fix some packaging issues - Move mod_passenger.so to %%{_libdir}/httpd/modules/ - Improve mod_passenger.conf by including the ifModule statement * Sat Nov 08 2008 Jeroen van Meeuwen - 2.0.3-1 - Initial package