# Template file for 'unison'
pkgname=unison
version=2.54.0
revision=1
hostmakedepends="ocaml"
short_desc="File-synchronization tool"
maintainer="Andrew J. Hesford <ajh@sideband.org>"
license="GPL-3.0-or-later"
homepage="https://www.cis.upenn.edu/~bcpierce/unison/"
distfiles="https://github.com/bcpierce00/unison/archive/v${version}.tar.gz"
checksum=0f14154611a2dfebb8c229be85ceda29a750eace4fb75d06e0d43fe5b58a6e87
nocross="OCaml does not cross compile"
nostrip="$(vopt_if native '' yes)"

build_options="native"
desc_option_native="Use ocamlopt for native compilation"

case "$XBPS_TARGET_MACHINE" in
	x86_64*) build_options_default="native" ;;
esac

do_build() {
	local _native="$(vopt_if native true)"
	CFLAGS= make ${makejobs} DEBUGGING=false THREADS=true NATIVE="${_native}"
}

do_check() {
	mkdir -p ./tmp
	HOME="${PWD}/tmp" TMPDIR="${PWD}/tmp" ./src/unison -selftest
}

do_install() {
	vbin src/unison
	vbin src/unison-fsmonitor
	vman man/unison.1
}
