# Contributor: Eivind Uggedal <eu@eju.no>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=fcgiwrap
pkgver=1.1.0
pkgrel=8
pkgdesc="Simple server for running CGI applications over FastCGI"
url="https://github.com/gnosek/fcgiwrap"
arch="all"
license="MIT"
pkgusers="fcgiwrap"
pkggroups="www-data"
install="$pkgname.pre-install"
makedepends="$depends_dev autoconf libtool automake fcgi-dev"
subpackages="$pkgname-doc $pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/gnosek/fcgiwrap/archive/$pkgver.tar.gz
	no-buffering.patch
	$pkgname.initd
	$pkgname.confd"
options="!check"

build() {
	autoreconf --install
	CFLAGS="$CFLAGS -Wno-implicit-fallthrough" \
	./configure --prefix=/usr \
		--mandir=/share/man \
		--sbindir=/bin
	make
}

package() {
	install -d -m2775 -o fcgiwrap -g www-data  "$pkgdir"/run/fcgiwrap
	make DESTDIR="$pkgdir" install
	install -Dm755 $srcdir/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm644 $srcdir/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}

sha512sums="
b8d35762d1d3c94a67602290b0092f0c38cffbbcd3dbc16597abf8b92172909b04450c238de2e430e841a17dd47fdd48d6a001f77539966980ef1af61e447ddc  fcgiwrap-1.1.0.tar.gz
72ba8a0d044c86cc41358002b1cbb94e77dc81e56669032b474b94d7cde80e6cc5d041a064d79ed98b7db8aee9ffcc8830df88491f14afa251781487a57fd429  no-buffering.patch
e6111da1089df43f8656e598edf4e658cd2d70e6066833a2c7a465229723e1edce144cf214bd8f771298d54948b8128012c4ce4d509c9d9307a54e8ef90ff2d8  fcgiwrap.initd
893e9afa92c20c9d0dab68fffc806a1be1f2e28a7e73bbb497316386a9ee083be4bad68a90f660e489311a9812a512b50fb0edb8b9c49b12f6cd266ba53b01a6  fcgiwrap.confd
"
