# Template file for 'git-annex'
pkgname=git-annex
version=10.20250630
revision=1
build_style=gnu-makefile
build_helper=haskell
make_check_target=test
make_use_env=yes
hostmakedepends="cabal-install"
makedepends="curl file-devel gnupg gnutls-devel gsasl-devel libxml2-devel
 lsof rsync git ncurses-devel bup borg nocache git-remote-gcrypt"
depends="git rsync curl lsof gnupg>=2"
short_desc="Git addon for managing large files"
maintainer="Evan Deaubl <evan@deaubl.name>"
license="AGPL-3.0-or-later, MIT, BSD-2-Clause, GPL-3.0-or-later, custom:Expat, custom:MIT-twitter, GPL-2.0-only, custom:icon-license"
homepage="https://git-annex.branchable.com"
changelog="https://git.joeyh.name/index.cgi/git-annex.git/plain/CHANGELOG"
# The hackage distribution is missing the makefile and build tools
distfiles="https://git.joeyh.name/index.cgi/git-annex.git/snapshot/git-annex-${version}.tar.gz
 https://hackage.haskell.org/package/basement-0.0.16/basement-0.0.16.tar.gz
 https://hackage.haskell.org/package/memory-0.18.0/memory-0.18.0.tar.gz
 https://hackage.haskell.org/package/cborg-0.2.10.0/cborg-0.2.10.0.tar.gz"
checksum="f798e07707ab2eb7c8fe76b9821ba6b2878d4bae2a03ae5a8cac69eb315bcd98
 7fb77e249aef76ba5aed3059d556800ce02b614597c488ba01f0a16449146300
 fd4eb6f638e24b81b4e6cdd68772a531726f2f67686c8969d3407d82f7862e3e
 17fe070c38fc498cab49bcb9d6215b7747d53bedf96502e9bcce9cad73b9c797"
nopie_files="/usr/bin/git-annex"
nocross=yes
skip_extraction="basement-0.0.16.tar.gz memory-0.18.0.tar.gz cborg-0.2.10.0.tar.gz"
disable_parallel_build=yes

if [ "$XBPS_TARGET_MACHINE" = "i686" ]; then
	broken="ghc panic, likely https://gitlab.haskell.org/ghc/ghc/-/issues/25904"
fi

post_extract() {
	vsrcextract -C basement basement-0.0.16.tar.gz
	vsrcextract -C memory memory-0.18.0.tar.gz
	vsrcextract -C cborg cborg-0.2.10.0.tar.gz
}

export BUILDERCOMMONOPTIONS="-f servant --index-state=2025-07-04T05:45:32Z"
export GHC="cabal exec -- ghc"

pre_configure() {
	echo 'packages: ./basement ./memory ./cborg .' > cabal.project
	cabal update
}

post_install() {
	vlicense doc/license/AGPL
}
