summaryrefslogtreecommitdiffstats
path: root/network
diff options
context:
space:
mode:
author Zhu Qun-Ying <zhu.qunying@gmail.com>2014-11-08 02:13:47 +0700
committer Willy Sudiarto Raharjo <willysr@slackbuilds.org>2014-11-08 06:30:19 +0700
commit79a8f439b6090adb9770a78d173f7ed5bdcf570a (patch)
treec3e110abdcc6c3a566e5d736980d3099724ff636 /network
parent0e6711fd438e1218dcf944ba81cc969dd77c13be (diff)
downloadslackbuilds-79a8f439b6090adb9770a78d173f7ed5bdcf570a.tar.gz
slackbuilds-79a8f439b6090adb9770a78d173f7ed5bdcf570a.tar.xz
network/fcgiwrap: Added (Simple FastCGI wrapper).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network')
-rw-r--r--network/fcgiwrap/README5
-rw-r--r--network/fcgiwrap/fcgiwrap.SlackBuild104
-rw-r--r--network/fcgiwrap/fcgiwrap.info10
-rw-r--r--network/fcgiwrap/rc.spawn-fcgi29
-rw-r--r--network/fcgiwrap/slack-desc19
-rw-r--r--network/fcgiwrap/spawn-fcgi29
6 files changed, 196 insertions, 0 deletions
diff --git a/network/fcgiwrap/README b/network/fcgiwrap/README
new file mode 100644
index 0000000000..4f8f45ab6e
--- /dev/null
+++ b/network/fcgiwrap/README
@@ -0,0 +1,5 @@
+Simple FastCGI wrapper for CGI scripts
+
+fcgiwrap is a simple server for running CGI applications over
+FastCGI. It hopes to provide clean CGI support to Nginx
+(and other web servers that may need it).
diff --git a/network/fcgiwrap/fcgiwrap.SlackBuild b/network/fcgiwrap/fcgiwrap.SlackBuild
new file mode 100644
index 0000000000..9d64052b68
--- /dev/null
+++ b/network/fcgiwrap/fcgiwrap.SlackBuild
@@ -0,0 +1,104 @@
+#!/bin/sh
+
+# Slackware build script for fcgiwrap
+
+# Copyright 2014 Zhu Qun-Ying
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+PRGNAM=fcgiwrap
+VERSION=${VERSION:-1.1.0}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz || tar xvf $CWD/$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+autoreconf -i
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --docdir=/usr/doc/$PRGNAM-$VERSION \
+ --build=$ARCH-slackware-linux
+
+make
+make install DESTDIR=$PKG
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a README.rst $PKG/usr/doc/$PRGNAM-$VERSION
+cp $CWD/spawn-fcgi $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/etc/rc.d
+install -m 0644 $CWD/rc.spawn-fcgi $PKG/etc/rc.d/
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/network/fcgiwrap/fcgiwrap.info b/network/fcgiwrap/fcgiwrap.info
new file mode 100644
index 0000000000..ded9961f9e
--- /dev/null
+++ b/network/fcgiwrap/fcgiwrap.info
@@ -0,0 +1,10 @@
+PRGNAM="fcgiwrap"
+VERSION="1.1.0"
+HOMEPAGE="https://nginx.localdomain.pl/wiki/FcgiWrap"
+DOWNLOAD="https://github.com/gnosek/fcgiwrap/archive/1.1.0.tar.gz"
+MD5SUM="d14f56bda6758a6e02aa7b3fb125cbce"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES="fcgi"
+MAINTAINER="Zhu Qun-Ying"
+EMAIL="zhu.qunying@gmail.com"
diff --git a/network/fcgiwrap/rc.spawn-fcgi b/network/fcgiwrap/rc.spawn-fcgi
new file mode 100644
index 0000000000..588a47f9ff
--- /dev/null
+++ b/network/fcgiwrap/rc.spawn-fcgi
@@ -0,0 +1,29 @@
+#!/bin/bash
+C_SCRIPT=/usr/sbin/spawn-fcgi
+USER=nobody
+GROUP=nogroup
+RETVAL=0
+case "$1" in
+ start)
+ echo "Starting fastcgi"
+ sudo -u $USER $C_SCRIPT /tmp/cgi.sock 2
+ chown $USER:$GROUP /tmp/cgi.sock
+ RETVAL=$?
+ ;;
+ stop)
+ echo "Stopping fastcgi"
+ killall -9 fcgiwrap
+ RETVAL=$?
+ ;;
+ restart)
+ echo "Restarting fastcgi"
+ killall -9 fcgiwrap
+ sudo -u $USER $C_SCRIPT
+ RETVAL=$?
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+ ;;
+esac
+exit $RETVAL
diff --git a/network/fcgiwrap/slack-desc b/network/fcgiwrap/slack-desc
new file mode 100644
index 0000000000..ce9525e717
--- /dev/null
+++ b/network/fcgiwrap/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+fcgiwrap: fcgiwrap (Simple FastCGI wrapper for CGI scripts)
+fcgiwrap:
+fcgiwrap: fcgiwrap is a simple server for running CGI applications over
+fcgiwrap: FastCGI. It hopes to provide clean CGI support to Nginx
+fcgiwrap: (and other web servers that may need it).
+fcgiwrap:
+fcgiwrap:
+fcgiwrap:
+fcgiwrap: home: https://nginx.localdomain.pl/wiki/FcgiWrap
+fcgiwrap: source: https://github.com/gnosek/fcgiwrap
+fcgiwrap:
diff --git a/network/fcgiwrap/spawn-fcgi b/network/fcgiwrap/spawn-fcgi
new file mode 100644
index 0000000000..829d05504a
--- /dev/null
+++ b/network/fcgiwrap/spawn-fcgi
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings FATAL => qw( all );
+
+use IO::Socket::UNIX;
+
+my $bin_path = '/usr/sbin/fcgiwrap';
+my $socket_path = $ARGV[0] || '/tmp/cgi.sock';
+my $num_children = $ARGV[1] || 1;
+
+close STDIN;
+
+unlink $socket_path;
+my $socket = IO::Socket::UNIX->new(
+ Local => $socket_path,
+ Listen => 100,
+);
+
+die "Cannot create socket at $socket_path: $!\n" unless $socket;
+
+for (1 .. $num_children) {
+ my $pid = fork;
+ die "Cannot fork: $!" unless defined $pid;
+ next if $pid;
+
+ exec $bin_path;
+ die "Failed to exec $bin_path: $!\n";
+}