# Maintainer: Frank Tackitt <frank@tackitt.net>
# Maintainer: boltgolt <boltgolt@gmail.com>
# Co-Maintainer: Raymo111 <hi@raymond.li>
# Contributor: Kelley McChesney <kelley@kelleymcchesney.us>

pkgname=howdy
pkgver=2.6.1
pkgrel=3
pkgdesc="Windows Hello for Linux"
arch=('x86_64')
url="https://github.com/boltgolt/${pkgname}"
license=('MIT')
depends=(
	'opencv'
	'hdf5'
	'pam-python'
	'python'
	'python-pillow'
	'python-dlib'
	'python-face_recognition'
	'python-face_recognition_models'
	'python-click'
	'python-numpy'
	'python-opencv'
)
makedepends=(
	'cmake'
	'pkgfile'
)
backup=("usr/lib/security/${pkgname}/config.ini")
source=(
	"https://github.com/boltgolt/${pkgname}/archive/v${pkgver}.tar.gz"
	"https://github.com/davisking/dlib-models/raw/master/dlib_face_recognition_resnet_model_v1.dat.bz2"
	"https://github.com/davisking/dlib-models/raw/master/mmod_human_face_detector.dat.bz2"
	"https://github.com/davisking/dlib-models/raw/master/shape_predictor_5_face_landmarks.dat.bz2"
)
sha256sums=('f3f48599f78fd82b049539fcfc34de25c9435cad732697bdda94e85352964794'
            'abb1f61041e434465855ce81c2bd546e830d28bcbed8d27ffbe5bb408b11553a'
            'db9e9e40f092c118d5eb3e643935b216838170793559515541c56a2b50d9fc84'
            '6e787bbebf5c9efdb793f6cd1f023230c4413306605f24f299f12869f95aa472')

package() {
	cd "${pkgname}-${pkgver}/"

	# Install the license files and the rest of howdy
	install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}/"

	install -d "${pkgdir}/usr/lib/security/${pkgname}/"
	cp -r src/* "${pkgdir}/usr/lib/security/${pkgname}/"

	install -Dm644 ${srcdir}/{dlib_face_recognition_resnet_model_v1.dat,mmod_human_face_detector.dat,shape_predictor_5_face_landmarks.dat} \
		-t "${pkgdir}/usr/lib/security/${pkgname}/dlib-data/"

	install -d "${pkgdir}/usr/bin/"
	ln -s "/lib/security/${pkgname}/cli.py" "${pkgdir}/usr/bin/${pkgname}"
	chmod +x "${pkgdir}/usr/lib/security/${pkgname}/cli.py"

	install -Dm755 "autocomplete/${pkgname}" -t "${pkgdir}/usr/share/bash-completion/completions/"
}
