### this file is sourced not run
PKGVER=1.10
PKGBUILD=1
PKGARCH=x86_64

# recipe: james
TARBALL=civetweb-$PKGVER.tar.gz
MD5SUM=5fd48ec3b104c213e34309951dbc7834
SRC_URL=https://github.com/civetweb/civetweb/archive/v${PKGVER}.tar.gz
BUNDLE=

SLACKREQ=
SLACKSUG=openssl
SLACKDESC="civetweb: civetweb $PKGVER (Civetweb Web Server)
civetweb: 
civetweb: CivetWeb is a minimalist web server with CGI and SSL support. 
civetweb: Originally forked from mongoose in 2013 (due to license changes), 
civetweb: civetweb has been actively developed independently.
civetweb: 
civetweb: https://github.com/civetweb/civetweb
civetweb: 
civetweb: 
civetweb: 
civetweb:
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/civetweb* &&
	patch -Np1 -i ../pkg/upstream-pathlen-fix.patch
}

### default pkg_package

### build
pkg_build() {
	cd /tmp/civetweb*
	make $MAKEFLAGS WITH_IPV6=1 build COPT='-DOPENSSL_API_1_1' &&
	cp civetweb /usr/bin &&
	install -d 755 /usr/share/doc/civetweb-$PKGVER/examples &&
	install -m 644 docs/{UserManual,README,OpenSSL}.md /usr/share/doc/civetweb-$PKGVER &&
	cp -a examples/https /usr/share/doc/civetweb-$PKGVER/examples &&
	pkg_build_slackdesc &&

	# fatdog startup files and sample config
	mkdir -p /etc/init.d &&
	install -m644 /tmp/pkg/60-civetweb /etc/init.d &&
	install -m644 /tmp/pkg/{civetweb.conf,civetweb-localhost.pem} /etc	
}
