# cryptsetup - LUKS disk encryption
# Generated from manifest.tsv by gen-ports.py. Edit the manifest, not this file,
# unless the package needs something the template cannot express - in which case
# drop a `recipe.local` beside it and it will be preserved.
name=cryptsetup
version=2.8.1
release=1
desc="LUKS disk encryption"
url="https://gitlab.com/cryptsetup/cryptsetup"
license="GPL-2.0-or-later"
depend="glibc libressl util-linux-libs json-c argon2 popt"
makedepend=""
source="https://kernel.org/pub/linux/utils/cryptsetup/v2.8/cryptsetup-2.8.1.tar.xz"
sha256="SKIP"

build() {
	cd "cryptsetup-2.8.1"
	# Not every configure script accepts the same options - sqlite rejects
	# --disable-nls outright, for instance - so only pass the ones this one
	# actually advertises. Guessing wrong fails the whole build.
	_opts="--prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib"
	_help=$(./configure --help 2>/dev/null)
	case "$_help" in *--disable-static*)  _opts="$_opts --disable-static" ;; esac
	case "$_help" in *--disable-nls*)     _opts="$_opts --disable-nls" ;; esac
	# No asciidoctor here, so the default (build man pages from asciidoc)
	# fails configure outright rather than just skipping them.
	case "$_help" in *--disable-asciidoc*) _opts="$_opts --disable-asciidoc" ;; esac
	# libssh is only for the optional LUKS2 ssh-token (fetching a passphrase
	# from a remote server) - Arctic does not build libssh, and the base
	# LUKS functionality this is here for does not need it.
	case "$_help" in *--disable-ssh-token*) _opts="$_opts --disable-ssh-token" ;; esac
	# shellcheck disable=SC2086
	./configure $_opts
	make -j"$JOBS"
}

package() {
	cd "cryptsetup-2.8.1"
	make DESTDIR="$pkgdir" install
}
