File rubygem-passenger.spec of Package rubygem-passenger

#
# spec file for package rubygem-passenger
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           rubygem-passenger
Version:        3.0.2
Release:        1
%define mod_name passenger
%define apxs /usr/sbin/apxs2
%define apache_libexecdir %(%{apxs} -q LIBEXECDIR)
%define apache_sysconfdir %(%{apxs} -q SYSCONFDIR)
%define apache_mmn        %(MMN=$(%{apxs} -q LIBEXECDIR)_MMN; test -x $MMN && $MMN)
%if 0%{?suse_version} > 1100
%define with_system_boost 1
%endif
#
Group:          Development/Languages/Ruby
License:        MIT GPLv2
#
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  rubygems_with_buildroot_patch
%rubygems_requires
BuildRequires:  rubygem-rake >= 0.8.1
Requires:       rubygem-rake >= 0.8.1
BuildRequires:  rubygem-fastthread >= 1.0.1
Requires:       rubygem-fastthread >= 1.0.1
BuildRequires:  rubygem-daemon_controller >= 0.2.5
Requires:       rubygem-daemon_controller >= 0.2.5
BuildRequires:  rubygem-file-tail
Requires:       rubygem-file-tail
BuildRequires:  rubygem-rack
Requires:       rubygem-rack
BuildRequires:  apache2-devel
BuildRequires:  boost-devel
BuildRequires:  gcc-c++
BuildRequires:  libcurl-devel
%if 0%{?use_system_libev}
BuildRequires:  libev-devel
%endif
Requires:       apache2 %{apache_mmn}
Recommends:     packageand(apache2:rubygem-passenger-apache2)
Recommends:     packageand(nginx:rubygem-passenger-nginx)

#
Url:            http://www.modrails.com/
Source:         %{mod_name}-%{version}.gem
# patches are just in for the case i find time to forward port them.
# atm we use the static boost library that ships with passenger
Source1:        rubygem-passenger-2.0.5_system_boost.patch
Source2:        rubygem-passenger-2.0.5_boost_exception.patch
Source3:        rubygem-passenger-2.0.5_missing_includes.patch
Source4:        mod_passenger.conf
#
Summary:        Easy and robust Ruby web application deployment

%description
Easy and robust Ruby web application deployment.

%package nginx
License:        MIT GPLv2
Summary:        Passenger Nginx module for Ruby on Rails support
Group:          Development/Languages/Ruby
Requires:       rubygem-passenger = %{version}

%package apache2
License:        MIT GPLv2
Summary:        Passenger apache module
Group:          Development/Languages/Ruby
Requires:       rubygem-passenger = %{version}

%description nginx
Additional rubygem-passenger module for nginx HTTP-server.

%description apache2
Additional rubygem-passenger module for apache2 HTTP-server.

%prep

%build

%install
# TODO:
# currently -lev gets lost when using system libev
#if 0%{?use_system_libev}
# export USE_VENDORED_LIBEV="no"
#endif
%gem_install %{S:0}
pushd %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_name}-%{version}/
  export PATH="%{_sbindir}:$PATH"

  #compiling nginx stuff
  rake nginx:clean nginx CACHING=no

  #compiling apache2 stuff
  rake apache2
  %{__install} -D -m 0755 ext/apache2/mod_passenger.so %{buildroot}%{apache_libexecdir}/mod_passenger.so
  find ext -name \*.a -print -delete
  rm -rv ext/libev/.libs \
         ext/libev/config.{status,log} \
         test/stub/wsgi/passenger_wsgi.pyc
  %{__rm} -vf ext/apache2/mod_passenger.so
  %{__mv} -v ext/ruby/*/passenger_native_support.so lib/
  %{__rm} -rv ext/ruby/ruby-*-linux
popd
%gem_cleanup
find %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_name}-%{version}/ -name dispatch.\* -print0 | \
    xargs -r0 ruby -p -i -e 'gsub(%r{#!.*/bin/ruby.*}, "#!/usr/bin/ruby")'
%{__install} -D -m 0644 %{S:4} %{buildroot}%{apache_sysconfdir}/conf.d/mod_passenger.conf
%{__sed} -i -e "s,@PassengerRoot@,%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_name}-%{version}," %{buildroot}%{apache_sysconfdir}/conf.d/mod_passenger.conf
%{__rm} -v %{buildroot}%{_bindir}/passenger-install-*-module

%clean
%{__rm} -rf %{buildroot}

%files nginx
%defattr(-,root,root)
%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_name}-%{version}/agents/nginx

%files apache2
%defattr(-,root,root)
%{apache_libexecdir}/mod_passenger.so
%config(noreplace) %{apache_sysconfdir}/conf.d/mod_passenger.conf
%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_name}-%{version}/agents/apache2
%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_name}-%{version}/ext/apache2

%files
%defattr(-,root,root,-)
%{_bindir}/passenger
%{_bindir}/passenger-config
%{_bindir}/passenger-status
%{_bindir}/passenger-memory-stats
%{_bindir}/passenger-make-enterprisey
%{_libdir}/ruby/gems/%{rb_ver}/cache/%{mod_name}-%{version}.gem
%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_name}-%{version}/
%{_libdir}/ruby/gems/%{rb_ver}/specifications/%{mod_name}-%{version}.gemspec
%doc %{_libdir}/ruby/gems/%{rb_ver}/doc/%{mod_name}-%{version}/
%exclude %{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_name}-%{version}/agents/nginx
%exclude %{apache_libexecdir}/mod_passenger.so
%exclude %config(noreplace) %{apache_sysconfdir}/conf.d/mod_passenger.conf
%exclude %{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_name}-%{version}/agents/apache2
%exclude %{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_name}-%{version}/ext/apache2

%changelog