File rubygem-passenger.spec of Package rubygem-passenger.6150

#
# spec file for package rubygem-passenger
#
# Copyright (c) 2016 SUSE LINUX 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/
#


#
# This file was generated with a gem2rpm.yml and not just plain gem2rpm.
# All sections marked as MANUAL, license headers, summaries and descriptions
# can be maintained in that file. Please consult this file before editing any
# of those fields
#

Name:           rubygem-passenger
Version:        5.0.18
Release:        0
%define mod_name passenger
%define mod_full_name %{mod_name}-%{version}
# MANUAL
%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} > 1220
%bcond_without systemd
%define passenger_tempdir /run/passenger
%else
%bcond_with    systemd
%define passenger_tempdir /var/run/passenger
%endif
%bcond_without systemlibs
BuildRequires:  apache2-devel
BuildRequires:  boost-devel
BuildRequires:  gcc-c++
%if 0%{?suse_version} >= 1110
BuildRequires:  libcurl-devel
%else
BuildRequires:  curl-devel
%endif
BuildRequires:  zlib-devel
%if %{with systemlibs}
#BuildRequires:  libeio-devel
#BuildRequires:  libev-devel
%endif
BuildRequires:  %{rubygem rake}
# TODO: move to subpackage
Recommends:     packageand(apache2:rubygem-passenger-apache2)
Recommends:     packageand(nginx:rubygem-passenger-nginx)
Requires:       rubygem(passenger) = %{version}
Recommends:     rubygem(%{rb_default_ruby_abi}:passenger) = %{version}
# /MANUAL
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  ruby-macros >= 5
BuildRequires:  %{rubydevel}
BuildRequires:  %{rubygem gem2rpm}
BuildRequires:  update-alternatives
Url:            https://www.phusionpassenger.com/
Source:         http://rubygems.org/gems/%{mod_full_name}.gem
Source1:        mod_passenger.conf
Source2:        mod_passenger_root.include
Source3:        nginx_passenger.conf
Source4:        nginx_passenger_root.include
Source5:        passenger.systemd.conf
Source6:        gem2rpm.yml
# MANUAL
Patch0:  passenger-4.0.50_fix_shebang.patch
Patch1:  passenger-4.0.50_load_system_passenger_libs.patch
Patch2:  passenger-4.0.50_paths.patch
Patch3:  passenger-4.0.53_fix-default-temp-dir.patch
Patch4:  CVE-2015-7519.patch
Patch5:  disable_mod_autoindex.patch
Patch6:  warning_weak_root_directory_permissions.patch
Patch7:  CVE-2017-16355.patch
# /MANUAL
Summary:        A fast and robust web server and application server for Ruby, Python
License:        MIT and GPL-2.0
Group:          Development/Languages/Ruby
PreReq:         update-alternatives

%description
A modern web server and application server for Ruby, Python and Node.js,
optimized for performance, low memory usage and ease of use.

%prep
%gem_unpack
%patch0 -p0
%patch1 -p0
%patch2 -p1
%patch3 -p0
%patch4 -p1
%patch5 -p1
%patch6 -p2
%patch7 -p2
find -type f -print0 | xargs -0 touch -r %{S:0}
%gem_build

%build

%install
# MANUAL
# TODO:
# currently -lev gets lost when using system libev
%if %{with systemlibs}
export USE_VENDORED_LIBEV="yes"
export USE_VENDORED_LIBEIO="yes"
%endif
# /MANUAL
%gem_install \
  --symlink-binaries \
  --doc-files="CHANGELOG LICENSE README.md" \
  -f
%gem_cleanup
# MANUAL
# avoid BUILDROOT leaking into the binaries
pushd %{mod_full_name}
  export PATH="%{_sbindir}:$PATH"

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

  #compiling apache2 stuff
  rake apache2 CACHING="no"
  install -D -m 0755 buildout/apache2/mod_passenger.so %{buildroot}%{apache_libexecdir}/mod_passenger.so

  for i in $(/usr/bin/ruby-find-versioned) ; do
    rubysuffix="${i#/usr/bin/ruby}"
    /usr/bin/rake$rubysuffix native_support
    # we dont calculate the arch here as passenger build seems to use the running host arch and not the arch that ruby was build with.
    rubydir=$($i -r rubygems -e 'puts "#{Gem.ruby_engine}-#{RUBY_VERSION}-"')
    gemdir="%{buildroot}$(/usr/bin/gem$rubysuffix env gemdir)/gems/%{mod_full_name}/lib"
    cp -v buildout/ruby/$rubydir*/*.so $gemdir
    /usr/bin/rake$rubysuffix native_support:clean
  done
  find buildout -name \*.o -print -delete
  mkdir -p %{buildroot}%{_libdir}/passenger/%{version}/buildout/
  cp -av buildout/support-binaries/ %{buildroot}%{_libdir}/passenger/%{version}/buildout/
  cp -av helper-scripts/ bin/ resources/ %{buildroot}%{_libdir}/passenger/%{version}/
popd
#
# webserver configs
install -D -m 0644 %{S:1} %{buildroot}%{apache_sysconfdir}/conf.d/mod_passenger.conf
install -D -m 0644 %{S:2} %{buildroot}%{apache_sysconfdir}/conf.d/mod_passenger_root.include
install -D -m 0644 %{S:3} %{buildroot}/etc/nginx/conf.d/passenger.conf
install -D -m 0644 %{S:4} %{buildroot}/etc/nginx/conf.d/passenger_root.include
#
sed -i -e "s,@passengertmpdir@,%{passenger_tempdir},"           %{buildroot}%{apache_sysconfdir}/conf.d/mod_passenger.conf
sed -i -e "s,@PassengerRoot@,%{_libdir}/passenger/%{version}/," %{buildroot}%{apache_sysconfdir}/conf.d/mod_passenger_root.include

sed -i -e "s,@passengertmpdir@,%{passenger_tempdir},"           %{buildroot}/etc/nginx/conf.d/passenger.conf
sed -i -e "s,@PassengerRoot@,%{_libdir}/passenger/%{version}/," %{buildroot}/etc/nginx/conf.d/passenger_root.include
#
%if %{with systemd}
install -D -m 0644 %{S:5} %{buildroot}/usr/lib/tmpfiles.d/passenger.conf
%endif
# /MANUAL


%files
%defattr(-,root,root,-)
%if %{with systemd}
/usr/lib/tmpfiles.d/passenger.conf
%endif
%dir %{_libdir}/passenger/
%{_libdir}/passenger/%{version}/

%post
%if %{with systemd}
systemd-tmpfiles --create /usr/lib/tmpfiles.d/passenger.conf || true
%endif

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

# Requires:      rubygem-passenger = 5.0.18
%description apache2

A modern web server and application server for Ruby, Python and Node.js,
optimized for performance, low memory usage and ease of use.

This package holds the apache2 sub package for passenger
%files apache2
%defattr(-,root,root,-)
%config(noreplace) %{apache_sysconfdir}/conf.d/mod_passenger.conf
%config            %{apache_sysconfdir}/conf.d/mod_passenger_root.include
%{apache_libexecdir}/mod_passenger.so


%package nginx
Requires:       nginx
Requires:       rubygem-passenger = %{version}
Summary:        Passenger Nginx module
Group:          Development/Languages/Ruby

# Requires:      rubygem-passenger = 5.0.18
%description nginx

A modern web server and application server for Ruby, Python and Node.js,
optimized for performance, low memory usage and ease of use.

This package holds the nginx sub package for passenger
%files nginx
%defattr(-,root,root,-)
%dir /etc/nginx/
%dir /etc/nginx/conf.d/
%config(noreplace) /etc/nginx/conf.d/passenger.conf
%config            /etc/nginx/conf.d/passenger_root.include


%gem_packages

%changelog
openSUSE Build Service is sponsored by