File apache2-mod_fastcgi.spec of Package apache2-mod_fastcgi2
#
# 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
%if %{?sles_version:1}0
BuildRequires: apache2-devel
BuildRequires: apache-rpm-macros
BuildRequires: zypper
Requires: %{apache_mmn}
Requires: %{apache_suse_maintenance_mmn}
Requires: apache2
%endif
%if %{?centos_version:1}0
BuildRequires: httpd-devel httpd
#BuildRequires: apache-rpm-macros
Requires: httpd httpd-devel
%define apache_libexecdir /usr/lib64/httpd/modules
%define apache_serverroot /var/www/html
%define apache_sysconfdir /etc/httpd
%define apache_localstatedir /var/lib/httpd
%endif
#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 %{?sles_version:1}0
%if %{apache_branch} >= 204
# patch for building against apache 2.4
%patch1 -p1
%endif
%endif
%if %{?centos_version:1}0
# patch for building against apache 2.4
%patch1 -p1
%endif
%build
cp -p Makefile.AP2 Makefile
export CFLAGS="%{optflags} -g"
%if %{?sles_version:1}0
make top_dir=%{_datadir}/apache2 INCLUDES="-I%{_includedir}/apache2 -I%{_includedir}/apache2-prefork" %{?_smp_mflags}
%endif
%if %{?centos_version:1}0
# Makefile.AP2 ${top_builddir}/build/special.mk
# Makefile:
sed -i 's/\/usr\/local\/apache2/\/usr\/lib64\/httpd/g' Makefile
cat Makefile
make top_dir=/usr/lib64/httpd INCLUDES="-I%{_includedir}/httpd" %{?_smp_mflags}
%endif
%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
<<<<<<< .mine
%check
%if %{?sles_version:1}0
# need to modify %{modname}.conf for testing
mkdir -p %{apache_test_module_dir}
cp %{buildroot}%{apache_sysconfdir}/conf.d/%{modname}.conf %{apache_test_module_dir}/%{modname}-test.conf
set +x
#redirect /var/lib/apache2/fastcgi to writable %{apache_teset_module_dir}/var/lib/apache2/fastcgi
mkdir -p %{apache_test_module_dir}/var/lib/apache2/fastcgi
sed -i "s:/var/lib:%{apache_test_module_dir}/var/lib:" %{apache_test_module_dir}/%{modname}-test.conf
# run test
%apache_test_module_load -m fastcgi:alias:mime -i %{modname}-test.conf
set -x
%endif
%post
%if %{?centos_version:1}0
sed -i "s/Order allow,deny//g" /etc/httpd/conf.d/mod_fastcgi.conf
sed -i "s/Deny from all/Require all denied/g" /etc/httpd/conf.d/mod_fastcgi.conf
sed -i "s/Allow from all/Require all granted/g" /etc/httpd/conf.d/mod_fastcgi.conf
%endif
=======
>>>>>>> .new
%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