summaryrefslogtreecommitdiff
path: root/opt/fcgiwrap/MAKEPKG
diff options
context:
space:
mode:
Diffstat (limited to 'opt/fcgiwrap/MAKEPKG')
-rw-r--r--opt/fcgiwrap/MAKEPKG84
1 files changed, 84 insertions, 0 deletions
diff --git a/opt/fcgiwrap/MAKEPKG b/opt/fcgiwrap/MAKEPKG
new file mode 100644
index 0000000..0a56948
--- /dev/null
+++ b/opt/fcgiwrap/MAKEPKG
@@ -0,0 +1,84 @@
+#!/bin/mkpkg
+# description: Simple FastCGI wrapper for CGI scripts
+# url: https://github.com/gnosek/fcgiwrap
+
+name=fcgiwrap
+version=1.1.0
+release=1
+depends=(fcgi2)
+makedeps=(autoconf automake libtool m4)
+groups=(fcgiwrap:user:fcgiwrap:/var/run/fcgiwrap:755)
+services=(fcgiwrap)
+source=(https://github.com/gnosek/fcgiwrap/archive/refs/tags/$version.tar.gz)
+sha256sums=(
+ "4c7de0db2634c38297d5fcef61ab4a3e21856dd7247d49c33d9b19542bd1c61f"
+)
+
+build() {
+ cd $name-$version
+
+ autoreconf -i
+
+ ./configure \
+ --prefix=/usr \
+ --mandir=/share/man
+
+ make
+ make DESTDIR=$PKG install
+
+ # rawnix uses unified /usr/bin
+ # install -d $PKG/usr/bin
+ # mv $PKG/usr/sbin/fcgiwrap $PKG/usr/bin/
+ # rmdir $PKG/usr/sbin
+}
+
+post_build() {
+ install -d $PKG/etc/sv/fcgiwrap/log
+
+ # Listen on a unix socket; nginx (running as http) needs to reach it.
+ # We start fcgiwrap as fcgiwrap user, then chmod the socket so http can connect.
+ printf '%s\n' \
+ '#!/bin/sh' \
+ 'exec 2>&1' \
+ '' \
+ 'mkdir -p /run/fcgiwrap' \
+ 'rm -f /run/fcgiwrap/sock' \
+ '' \
+ 'chpst -u fcgiwrap:fcgiwrap \' \
+ ' fcgiwrap -c 4 -s unix:/run/fcgiwrap/sock &' \
+ 'pid=$!' \
+ '' \
+ '# Wait briefly for the socket, then make it accessible to http' \
+ 'i=0' \
+ 'while [ ! -S /run/fcgiwrap/sock ] && [ $i -lt 50 ]; do' \
+ ' sleep 0.1' \
+ ' i=$((i+1))' \
+ 'done' \
+ 'chgrp http /run/fcgiwrap/sock 2>/dev/null || true' \
+ 'chmod 660 /run/fcgiwrap/sock' \
+ '' \
+ 'wait $pid' \
+ > $PKG/etc/sv/fcgiwrap/run
+
+ printf '%s\n' \
+ '#!/bin/sh' \
+ 'mkdir -p /var/log/fcgiwrap' \
+ 'exec svlogd -tt /var/log/fcgiwrap' \
+ > $PKG/etc/sv/fcgiwrap/log/run
+
+ printf '%s\n' \
+ '#!/bin/sh' \
+ 'rm -f /run/fcgiwrap/sock' \
+ > $PKG/etc/sv/fcgiwrap/finish
+
+ chmod 755 $PKG/etc/sv/fcgiwrap/run
+ chmod 755 $PKG/etc/sv/fcgiwrap/log/run
+ chmod 755 $PKG/etc/sv/fcgiwrap/finish
+}
+
+signify() {
+ untrusted comment: public key
+ RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3
+}
+
+# vim: filetype=sh