File apache2-mod_fastcgi.spec of Package apache2-mod_fastcgi

#
# spec file for package apache2-mod_fastcgi
#
# Copyright (c) 2015 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/
#


%define modname mod_fastcgi
%define pre SNAP-0910052141
%define apxs /usr/sbin/apxs2
%define apache apache2
%define apache_libexecdir %(%{apxs} -q LIBEXECDIR)
%define apache_sysconfdir %(%{apxs} -q SYSCONFDIR)
%define apache_includedir %(%{apxs} -q INCLUDEDIR)
%define apache_serverroot %(%{apxs} -q PREFIX)
%define apache_localstatedir %(%{apxs} -q LOCALSTATEDIR)
%define apache_mmn        %(MMN=$(%{apxs} -q LIBEXECDIR)_MMN; test -x $MMN && $MMN)

#################################################################################
# common
#################################################################################
Name:           apache2-mod_fastcgi
Version:        2.4.7
Release:        0
Summary:        A FastCGI Module for Apache 2
License:        OML
Group:          Productivity/Networking/Web/Servers
Url:            http://www.fastcgi.com/
Source:         http://www.fastcgi.com/dist/%{modname}-%{pre}.tar.gz
Source99:       update_git.sh
Patch999:       mod_fastcgi-byte-compile-against-apache24.patch
Patch998:       libapache-mod-fastcgi_2.4.7~0910052141-1.1.patch
Requires:       %{apache_mmn}
Requires:       %{apache_suse_maintenance_mmn}
Requires:       apache2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  apache-rpm-macros
BuildRequires:  apache2-devel
Patch0001:      0001-handle-expect-100-continue-differen.patch
Patch0002:      0002-configurable-max-failed-starts.patch
Patch0003:      0003-fix-expect-100-continue-identificat.patch
Patch0004:      0004-fix-broken-check.patch
Patch0005:      0005-propagate-client-side-errors-to-ser.patch
Patch0006:      0006-enable-chunked-input.patch
Patch0007:      0007-Update-changelog-for-Ceph-changes.patch
Patch0008:      0008-mod_fastcgi-reduce-amount-of-loggin.patch
Patch0009:      0009-Remove-one-more-stray-debug-logging.patch

%description
FastCGI is a language independent, scalable, and open extension to CGI
that provides high performance without the limitations of server
specific APIs.

mod_fastcgi is a free open-source Apache HTTPD module.

FastCGI applications are very fast because they are persistent. There
is no per-request startup and initialization overhead.

%prep
%setup -q -n %{modname}-%{pre}
%if 0%{suse_version} >= 1310
# patch for building against apache 2.4
%patch999 -p1
%endif
%patch998 -p1
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%patch0004 -p1
%patch0005 -p1
%patch0006 -p1
%patch0007 -p1
%patch0008 -p1
%patch0009 -p1

%build
cp -p Makefile.AP2 Makefile
export CFLAGS="%{optflags} -g"
make top_dir=/usr/share/apache2 INCLUDES="-I/usr/include/apache2 -I/usr/include/apache2-prefork" %{?jobs:-j%{jobs}}

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{apache_libexecdir}
cp -p .libs/mod_fastcgi.so %{buildroot}%{apache_libexecdir}
mkdir -p %{buildroot}%{apache_sysconfdir}/conf.d
cat > %{buildroot}%{apache_sysconfdir}/conf.d/fastcgi.conf <<EOF
# protect the fcgi-bin directory if mod_fastcgi is not loaded
<IfModule !mod_fastcgi.c>
	<Directory "%{apache_serverroot}/fcgi-bin">
		AllowOverride None
		Options None
		<IfModule !mod_authz_host.c>
			Order allow,deny
			Deny from all
		</IfModule>
		<IfModule mod_authz_host.c>
			Require all granted
		</IfModule>
	</Directory>
</IfModule>

<IfModule mod_fastcgi.c>

	ScriptAlias /fcgi-bin/ %{apache_serverroot}/fcgi-bin/
	FastCgiIpcDir %{apache_localstatedir}/fastcgi
	# FastCGI applications can be static, dynamic, or external.

	# Dynamic FastCGI applications can be put in this directory.
	# Use the FastCgiConfig directive in your httpd.conf.local
	# to change the defaults for them.
	# http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiConfig
	<Directory "%{apache_serverroot}/fcgi-bin">
		AllowOverride None
		Options +ExecCGI -Includes
		SetHandler fastcgi-script
		<IfModule !mod_authz_host.c>
			Order allow,deny
			Deny from all
		</IfModule>
		<IfModule mod_authz_host.c>
			Require all granted
		</IfModule>
	</Directory>
	AddHandler fastcgi-script fcg fcgi fpl

	# Static or external FastCGI applications are started when apache
	# is started. They are configured with the
	# FastCgiServer and FastCgiExternalServer directives:
	# http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiServer
	# http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiExternalServer
	# which can be put into httpd.conf.local.
	#
	# Examples:
	#FastCgiServer %{apache_serverroot}/fcgi-bin/echo -processes 5
	#FastCgiServer %{apache_serverroot}/htdocs/some/path/echo.fcgi

	# see http://www.FastCGI.com/docs/faq.html#typical_httpd.conf for more
	# information...

</IfModule>

# vim: ft=apache
EOF
mkdir -p %{buildroot}%{apache_serverroot}/fcgi-bin
mkdir -p %{buildroot}%{apache_localstatedir}/fastcgi

%files
%defattr(-,root,root)
%doc CHANGES docs/*
%{apache_libexecdir}/%{modname}.so
%dir %{apache_serverroot}/fcgi-bin
%config(noreplace) %{apache_sysconfdir}/conf.d/fastcgi.conf
%attr(700,wwwrun,root) %dir %{apache_localstatedir}/fastcgi

%changelog