# Contributor: Ted Trask <ttrask01@yahoo.com>
# Maintainer: Ted Trask <ttrask01@yahoo.com>
_luaversion="5.4"
pkgname=acf-core
pkgver=0.24.0
pkgrel=0
pkgdesc="Web-based system administration interface framework"
url="https://gitlab.alpinelinux.org/acf/acf-core"
arch="noarch"
license="GPL-2.0-only"
options="!check" # no test suite
install="$pkgname.post-upgrade"
depends="acf-jquery acf-lib acf-skins haserl-lua$_luaversion lua$_luaversion
	lua$_luaversion-posix lua$_luaversion-md5 lua-json4
	lua$_luaversion-subprocess"
source="https://gitlab.alpinelinux.org/acf/acf-core/-/archive/v$pkgver/acf-core-v$pkgver.tar.gz
	"
builddir="$srcdir/$pkgname-v$pkgver"

package() {
	sed "s~luadir=.*~luadir=\${prefix}/share/lua/$_luaversion/acf~" -i config.mk

	# fix shebang
	sed -i -e "1s:#!/usr/bin/haserl[^ ]* :#!/usr/bin/haserl-lua$_luaversion :" \
		www/cgi-bin/acf

	sed -i -e "1s:#!/usr/bin/lua.*:#!/usr/bin/lua$_luaversion:" \
		bin/acf-cli

	make DESTDIR="$pkgdir" install
	mkdir -p "$pkgdir"/etc/acf/skins
}

sha512sums="
66f184c156f1306f20fb2219f25447c757c883e8a05adbdd149c3c97e8f16b7613cbe44d4e211deaa74a34dd422e20f0b52c73c77f7b24931949a959d2cd234e  acf-core-v0.24.0.tar.gz
"
