# Template file for '66'
pkgname=66
version=0.8.2.1
revision=1
build_style=configure
configure_args="--prefix=/usr
 --with-sysdeps=${XBPS_CROSS_BASE}/usr/lib/skalibs/sysdeps
 --with-lib=${XBPS_CROSS_BASE}/usr/lib
 --with-s6-log-timestamp=iso
 --with-s6-log-user=_s6log
 --with-system-dir=/etc/66/lib"
hostmakedepends="pkg-config lowdown"
makedepends="oblibs-devel skalibs-devel execline-devel s6-devel"
depends="s6"
short_desc="Small tools built around s6 and s6-rc programs"
maintainer="mobinmob <mobinmob@disroot.org>"
license="ISC"
homepage="http://web.obarun.org/software/"
changelog="https://git.obarun.org/Obarun/66/-/raw/master/doc/66-upgrade.md"
distfiles="https://git.obarun.org/Obarun/66/-/archive/${version}/66-${version}.tar.bz2"
checksum=89e45665e44e0d20d623283448ed52cd1377ce04e84081a6a831b36ac5a18d51

pre_check() {
	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
		ln -sv $wrksrc/lib66.so.xyzzy $wrksrc/lib66.so.0.8
	fi
}

post_install() {
	mv "${PKGDESTDIR}/usr/bin/init" "${PKGDESTDIR}/usr/bin/66-init"
	vdoc README.md
	vlicense LICENSE
}

66-init_package() {
	short_desc+=" - init system"
	depends="${sourcepkg}-${version}_${revision}"
	conflicts="s6-linux-init s6-rc runit-void"
	pkg_install() {
		vmove usr/bin/66-init
		vmove etc/66
	}
}

66-doc_package() {
	short_desc+=" - documentation"
	depends="${sourcepkg}-${version}_${revision}"
	pkg_install() {
		vmove usr/share/doc
		vmove usr/share/man
	}
}

66-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}-${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/lib
	}
}
