### 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-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: 
civetweb-full: https://github.com/civetweb/civetweb
civetweb-full:
"

### 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' \
		WITH_LUA=1 WITH_DUKTAPE=1 WITH_WEBSOCKET=1 WITH_SERVER_STATS=1 \
		WITH_ZLIB=1 WITH_DAEMONIZE=1 &&
	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 &&

 


	# 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	
}
