File apache2-mod_fastcgi.spec of Package apache2-mod_fastcgi

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


%define modname mod_fastcgi
%define pre SNAP-0910052141
Name:           apache2-mod_fastcgi
Version:        2.4.7
Release:        0
# Autoreqprov:    on
Summary:        A FastCGI Module for Apache 2
License:        OML
Group:          Productivity/Networking/Web/Servers
Url:            http://www.fastcgi.com/
Source:         %{modname}-%pre.tar.bz2
Patch1:         mod_fastcgi-byte-compile-against-apache24.patch
BuildRequires:  apache2-devel
BuildRequires:  apache-rpm-macros
BuildRequires:  zypper
Requires:       %{apache_mmn}
Requires:       %{apache_suse_maintenance_mmn}
Requires:       apache2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%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 %{apache_branch} >= 204
# patch for building against apache 2.4
%patch1 -p1
%endif

%build
cp -p Makefile.AP2 Makefile
export CFLAGS="%{optflags} -g"
make top_dir=%{_datadir}/apache2 INCLUDES="-I%{_includedir}/apache2 -I%{_includedir}/apache2-prefork" %{?_smp_mflags}

%install
mkdir -p %{buildroot}%{apache_libexecdir}
#make top_dir=/usr/share/apache2 DESTDIR=%%{buildroot} install
cp -p .libs/mod_fastcgi.so %{buildroot}%{apache_libexecdir}
mkdir -p %{buildroot}%{apache_sysconfdir}/conf.d
cat > %{buildroot}%{apache_sysconfdir}/conf.d/%{modname}.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_access_compat.c>
			Require all denied
		</IfModule>
		<IfModule mod_access_compat.c>
			Order allow,deny
			Deny from all
		</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_access_compat.c>
			Require all granted
		</IfModule>
		<IfModule mod_access_compat.c>
			Order allow,deny
			Allow from all
		</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/%{modname}.conf
%attr(700,wwwrun,root) %dir %{apache_localstatedir}/fastcgi

%changelog
openSUSE Build Service is sponsored by