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

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

SLACKREQ=
SLACKSUG=openssl
SLACKDESC="civetweb-full: civetweb-full $PKGVER (Civetweb Web Server)
civetweb-full: 
civetweb-full: CivetWeb is a minimalist web server with CGI and SSL support. 
civetweb-full: 
civetweb-full: This is the 'full' version of civetweb with support for server
civetweb-full: side lua and javascript compiled-in. The binary is called 
civetweb-full: civetweb-full. It complements the minimal civetweb package.
civetweb-full: (as in, can be installed side-by-side).
civetweb-full: Compat level: Lua 5.2, duktape 1.8.0
civetweb-full: 
civetweb-full: https://github.com/civetweb/civetweb
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	#cd tmp/civetweb* &&
	#patch -Np1 -i ../pkg/upstream-cgi-lf-fix.patch # fixed in 1.12
	true
}

### default pkg_package

### build
pkg_build() {
	cd /tmp/civetweb*
	make $MAKEFLAGS WITH_IPV6=1 build COPT='-DOPENSSL_API_1_1' \
		WITH_LUA=1 WITH_DUKTAPE=1 WITH_WEBSOCKET=1 WITH_SERVER_STATS=1 \
		WITH_ZLIB=1 WITH_DAEMONIZE=1 WITH_DUKTAPE_VERSION=108 &&
	cp civetweb /usr/bin/civetweb-full &&

	EXAMPLES_DIR=/usr/share/doc/civetweb-full-$PKGVER/examples &&
	install -d 755 $EXAMPLES_DIR &&
	install -m 644 docs/{UserManual,README,OpenSSL}.md $EXAMPLES_DIR &&
	cp -a examples/https $EXAMPLES_DIR &&
	cp -a test $EXAMPLES_DIR &&
	pkg_build_slackdesc
}
