[packages/fcgiwrap] Raw

arekm arekm at pld-linux.org
Thu Sep 15 14:43:43 CEST 2022


commit 99e77ebd5dd3bcb78b679897274df8722e7a9bff
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Sep 15 14:42:05 2022 +0200

    Raw

 fcgiwrap-1.1.0-declare_cgi_error_noreturn.patch | 27 +++++++
 fcgiwrap-1.1.0-fix_kill_param_sequence.patch    | 22 ++++++
 fcgiwrap-1.1.0-use_pkg-config_libsystemd.patch  | 25 +++++++
 fcgiwrap.spec                                   | 93 +++++++++++++++++++++++++
 fcgiwrap.sysconfig                              |  8 +++
 fcgiwrap at .socket                                | 11 +++
 6 files changed, 186 insertions(+)
---
diff --git a/fcgiwrap.spec b/fcgiwrap.spec
new file mode 100644
index 0000000..a5af725
--- /dev/null
+++ b/fcgiwrap.spec
@@ -0,0 +1,93 @@
+%global commit 99c942c90063c73734e56bacaa65f947772d9186
+
+Summary:	Simple FastCGI wrapper for CGI scripts
+Name:		fcgiwrap
+Version:	1.1.0
+Release:	0.1
+License:	MIT
+URL:		https://github.com/gnosek/fcgiwrap
+Source0:	https://github.com/gnosek/fcgiwrap/archive/%{commit}/%{name}-%{commit}.tar.gz
+# Source0-md5:	b092e95b676e23407732b4a2fbf800ae
+Source1:	%{name}@.service
+Source2:	%{name}@.socket
+Source3:	%{name}.sysconfig
+# https://github.com/gnosek/fcgiwrap/pull/39
+Patch0:		%{name}-1.1.0-use_pkg-config_libsystemd.patch
+# https://github.com/gnosek/fcgiwrap/pull/43
+Patch1:		%{name}-1.1.0-declare_cgi_error_noreturn.patch
+# https://github.com/gnosek/fcgiwrap/pull/44
+Patch2:		%{name}-1.1.0-fix_kill_param_sequence.patch
+BuildRequires:	autoconf
+BuildRequires:	automake
+BuildRequires:	coreutils
+BuildRequires:	fcgi-devel
+BuildRequires:	gcc
+BuildRequires:	systemd-devel
+
+%description
+This package provides a simple FastCGI wrapper for CGI scripts with/
+following features:
+ - very lightweight (84KB of private memory per instance)
+ - fixes broken CR/LF in headers
+ - handles environment in a sane way (CGI scripts get HTTP-related
+   environment vars from FastCGI parameters and inherit all the others
+   from environment of fcgiwrap )
+ - no configuration, so you can run several sites off the same fcgiwrap
+   pool
+ - passes CGI std error output to std error stream of cgiwrap or
+   FastCGI
+ - support systemd socket activation, launcher program like spawn-fcgi
+   is no longer required on systemd-enabled distributions
+
+%prep
+%setup -q -n %{name}-%{commit}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+
+%build
+autoreconf -i
+%configure \
+    CFLAGS="-I%{_includedir}/fastcgi %{rpmcflags}" \
+    --prefix="" \
+    --with-systemd
+
+%{__make}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
+
+%{__make} install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+# Remove the default systemd files
+rm -f $RPM_BUILD_ROOT%{systemdunitdir}/fcgiwrap.service
+rm -f $RPM_BUILD_ROOT%{systemdunitdir}/fcgiwrap.socket
+
+# Install our own systemd config files
+install -Dm 644 %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}@.service
+install -Dm 644 %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}@.socket
+install -Dm 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
+
+%post
+%systemd_post %{name}@.service %{name}@.socket
+
+%preun
+%systemd_preun %{name}@.service %{name}@.socket
+
+%postun
+%systemd_postun_with_restart %{name}@.service %{name}@.socket
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc README.rst COPYING
+%attr(755,root,root) %{_sbindir}/%{name}
+%{_mandir}/man8/%{name}.8*
+%{systemdunitdir}/%{name}@.service
+%{systemdunitdir}/%{name}@.socket
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
diff --git a/fcgiwrap-1.1.0-declare_cgi_error_noreturn.patch b/fcgiwrap-1.1.0-declare_cgi_error_noreturn.patch
new file mode 100644
index 0000000..2c61a70
--- /dev/null
+++ b/fcgiwrap-1.1.0-declare_cgi_error_noreturn.patch
@@ -0,0 +1,27 @@
+From bd00af48ca0b0165eea66f47cd9556ac4cee7219 Mon Sep 17 00:00:00 2001
+From: Peter Colberg <peter at colberg.org>
+Date: Sat, 5 Aug 2017 11:58:26 -0400
+Subject: [PATCH] Declare cgi_error noreturn
+
+This declares the function cgi_error with the attribute __noreturn__ to
+hint to GCC/Clang that the function exits the program and to prevent
+implicit-fallthrough warnings in the function handle_fcgi_request.
+---
+ fcgiwrap.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/fcgiwrap.c b/fcgiwrap.c
+index b44d8aa..751c100 100644
+--- a/fcgiwrap.c
++++ b/fcgiwrap.c
+@@ -500,6 +500,7 @@ static bool is_allowed_program(const char *program) {
+ 	return false;
+ }
+ 
++__attribute__((__noreturn__))
+ static void cgi_error(const char *message, const char *reason, const char *filename)
+ {
+ 	printf("Status: %s\r\nContent-Type: text/plain\r\n\r\n%s\r\n",
+-- 
+2.13.5
+
diff --git a/fcgiwrap-1.1.0-fix_kill_param_sequence.patch b/fcgiwrap-1.1.0-fix_kill_param_sequence.patch
new file mode 100644
index 0000000..de187a3
--- /dev/null
+++ b/fcgiwrap-1.1.0-fix_kill_param_sequence.patch
@@ -0,0 +1,22 @@
+From dc0c3b14f0d7bb014a9a4c6c17eb55a123496365 Mon Sep 17 00:00:00 2001
+From: "D.pz" <xpz91 at 126.me>
+Date: Mon, 28 Aug 2017 23:54:08 +0800
+Subject: [PATCH] 1.fix: kill() parameter sequence wrong
+
+---
+ fcgiwrap.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fcgiwrap.c b/fcgiwrap.c
+index b44d8aa..bfd9a90 100644
+--- a/fcgiwrap.c
++++ b/fcgiwrap.c
+@@ -205,7 +205,7 @@ static void fcgi_finish(struct fcgi_context *fc, const char* msg)
+ 	if (fc->fd_stderr >= 0) close(fc->fd_stderr);
+ 
+ 	if (fc->cgi_pid)
+-		kill(SIGTERM, fc->cgi_pid);
++		kill(fc->cgi_pid, SIGTERM);
+ }
+ 
+ static const char * fcgi_pass_fd(struct fcgi_context *fc, int *fdp, FCGI_FILE *ffp, char *buf, size_t bufsize)
diff --git a/fcgiwrap-1.1.0-use_pkg-config_libsystemd.patch b/fcgiwrap-1.1.0-use_pkg-config_libsystemd.patch
new file mode 100644
index 0000000..1d1793b
--- /dev/null
+++ b/fcgiwrap-1.1.0-use_pkg-config_libsystemd.patch
@@ -0,0 +1,25 @@
+From 99e1976b5dbe8379457bd3cd3115208b688f0c9c Mon Sep 17 00:00:00 2001
+From: Juan Orti Alcaine <j.orti.alcaine at gmail.com>
+Date: Wed, 9 Nov 2016 16:29:10 +0100
+Subject: [PATCH] pkg-config libsystemd-daemon has been renamed to libsystemd
+
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index bb3674e..2b02ef4 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -28,7 +28,7 @@ AC_ARG_WITH([systemd],
+   [], [with_systemd=check])
+ have_systemd=no
+ if test "x$with_systemd" != "xno"; then
+-  PKG_CHECK_MODULES(systemd, [libsystemd-daemon],
++  PKG_CHECK_MODULES(systemd, [libsystemd],
+     [AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd is available])
+     have_systemd=yes],
+   have_systemd=no)
+-- 
+2.9.3
+
diff --git a/fcgiwrap.sysconfig b/fcgiwrap.sysconfig
new file mode 100644
index 0000000..aa2933b
--- /dev/null
+++ b/fcgiwrap.sysconfig
@@ -0,0 +1,8 @@
+# fcgiwrap configuration parameters
+
+# Specify the number of fcgiwrap processes to prefork
+DAEMON_PROCS=1
+
+# Specify additional daemon options. See man fcgiwrap.
+DAEMON_OPTS=-f
+
diff --git a/fcgiwrap at .socket b/fcgiwrap at .socket
new file mode 100644
index 0000000..0130afc
--- /dev/null
+++ b/fcgiwrap at .socket
@@ -0,0 +1,11 @@
+[Unit]
+Description=fcgiwrap Socket
+
+[Socket]
+ListenStream=/run/fcgiwrap/fcgiwrap-%i.sock
+RuntimeDirectory=fcgiwrap
+SocketUser=%i
+SocketMode=0660
+
+[Install]
+WantedBy=sockets.target
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/fcgiwrap.git/commitdiff/99e77ebd5dd3bcb78b679897274df8722e7a9bff



More information about the pld-cvs-commit mailing list