# Contributor: Alan Lacerda <alacerda@alpinelinux.org>
# Maintainer: Alan Lacerda <alacerda@alpinelinux.org>
pkgname=darkhttpd
pkgver=1.16
pkgrel=0
pkgdesc="A simple, single-threaded, static content webserver"
url="https://unix4lyfe.org/darkhttpd/"
arch="all"
license="ISC"
options="!check" # no tests
install="$pkgname.pre-install"
subpackages="$pkgname-openrc"
source="darkhttpd-$pkgver.tar.gz::https://github.com/emikulic/darkhttpd/archive/v$pkgver.tar.gz
	darkhttpd.logrotate
	darkhttpd.initd
	darkhttpd.confd
	"

# secfixes:
#   1.15-r0:
#     - CVE-2024-23771
#     - CVE-2024-23770
#   1.14-r0:
#     - CVE-2020-25691

build() {
	make
}

package() {
	install -Dm755 darkhttpd "$pkgdir"/usr/bin/darkhttpd
	install -d "$pkgdir"/var/www/localhost/htdocs \
		"$pkgdir"/var/log/darkhttpd

	install -Dm755 "$srcdir"/darkhttpd.initd "$pkgdir"/etc/init.d/darkhttpd
	install -Dm644 "$srcdir"/darkhttpd.confd "$pkgdir"/etc/conf.d/darkhttpd
}

sha512sums="
05abf8144d5a14ff455e2878eed4fddaca54d3fa6576b6a01d6547bcca94a0222d02742b80532519aba5202dd7df2d816e1dd057816506005894b42f570a4fe3  darkhttpd-1.16.tar.gz
bb95277a9f8f227aeec8bfe6ef54f52a2f034ed0dd25258b996c17f9ce9dd4ad220366b10490246b25bb6b18ccde7bda0d52eeb88667941cf2fdab15c940dbbc  darkhttpd.logrotate
dd792892588e03cef4a36bb8e81297990884298d8a2bc1c14ae2d8986a0a17af8d15bf3fb4e1830d22b154dc00591d884e20da915f51fd8ecf3b05b6c92dc7d4  darkhttpd.initd
79ecdbc751e8b5497a1afee294cf0addb4261f041a58a382e7fb51dd698dd99625a369173542c905e1e4eac7c68dfa1d8d778f4777ebe74d5031817a6ec437ad  darkhttpd.confd
"
