File fcgiwrap.spec of Package fcgiwrap

# spec file for package fcgiwrap
# Copyright (c) 2019 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

%if ! %{defined _fillupdir}
%define _fillupdir %{_localstatedir}/adm/fillup-templates
%if ! %{defined make_build}
%define make_build make %{?_smp_mflags}
Name:           fcgiwrap
Version:        1.1.0+18+g99c942c
Release:        0
Summary:        FastCGI wrapper for CGI scripts
License:        MIT
Group:          Productivity/Networking/Web/Servers
Source0:        fcgiwrap-%{version}.tar.xz
Patch1:         adapt-user-and-group-for-nginx.patch
Patch2:         add-environment-variable-for-number-of-workers.patch
Patch3:         Declare-cgi_error-noreturn.patch
Patch4:         support-p-flag-in-sysconfig.patch
Patch5:         fix-kill-parameter-sequence.patch
Patch6:		fix-run-fcgiwrap-script.patch
Patch7:		Quit-without-listening-socket.patch
BuildRequires:  FastCGI-devel
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(libsystemd)
Requires(post): %fillup_prereq
Suggests:       spawn-fcgi

fcgiwrap is a server for running CGI applications over FastCGI.
It provides CGI support to Nginx (and other web servers
that may need it). Apache and lighthttpd don't need it, as they spawn
FastCGI workers on demand.

%package nginx
Summary:        System services for using fcgiwrap with nginx
Group:          Productivity/Networking/Web/Servers
Requires:       %{name}
# Because of nginx user/group
Requires:       nginx
# fcgiwrap is useful if nginx is to be used with FastCGI scripts
Supplements:    packageand(nginx:%(rpm --qf "%%{name}" -qf $(readlink -f %{_libdir}/

%description nginx
This package provides systemd unit files to run a set of fcgiwrap
processes ready for use with nginx or other web servers.

%setup -q
%autopatch -p1

autoreconf -v -i
%configure --with-systemd --prefix='' CFLAGS="-I/usr/include/fastcgi"

install -d -m 0755 %{buildroot}%{_unitdir}
install -m 0755 -t %{buildroot}%{_sbindir} systemd/run-fcgiwrap
install -m 0644 -t %{buildroot}%{_unitdir} systemd/fcgiwrap.{socket,service}
install -d %{buildroot}%{_fillupdir}
install -m 644 -t %{buildroot}%{_fillupdir} systemd/sysconfig.fcgiwrap

%pre nginx
%service_add_pre fcgiwrap.socket fcgiwrap.service

%post nginx
%service_add_post fcgiwrap.socket fcgiwrap.service

%preun nginx
%service_del_preun fcgiwrap.service fcgiwrap.socket

%postun nginx
%service_del_postun fcgiwrap.service
# restarting the socket fails if service is active
if [ -x /usr/bin/systemctl ] && ! systemctl is-active fcgiwrap.service >/dev/null 2>&1; then
    %service_del_postun fcgiwrap.socket

%doc README.rst
%license COPYING

%files nginx