# Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
# Contributor: Saijin-Naib <Saijin-Naib_package-maintenance@outlook.com>
# Contributor: David Demelier <markand@malikania.fr>
pkgname=ardour
pkgver=8.6.0
pkgrel=0
pkgdesc="professional-grade digital audio workstation"
url="https://ardour.org/"
arch="all !ppc64le" # Does not build on ppc64le.
license="GPL-2.0-or-later AND CC0-1.0 AND MIT"
makedepends="
	alsa-lib-dev
	atkmm-dev
	aubio-dev
	boost-dev
	fftw-dev
	fluidsynth-dev
	gtk+2.0-dev
	gtkmm-dev
	hidapi-dev
	itstool
	jack-dev
	libarchive-dev
	liblo-dev
	libpng-dev
	libsamplerate-dev
	libsigc++-dev
	libsndfile-dev
	libusb-dev
	lilv-dev
	lrdf-dev
	lv2-dev
	pulseaudio-dev
	python3
	readline-dev
	redland-dev
	rubberband-dev
	serd-dev
	sratom-dev
	suil-dev
	taglib-dev
	vamp-sdk-dev
	"
source="https://community.ardour.org/src/Ardour-$pkgver.tar.bz2
	0001-Unset-HAVE_GNU_FTW.patch
	"
builddir="$srcdir/Ardour-$pkgver"
ldpath="/usr/lib/ardour8"

build() {
	export LINKFLAGS="$LDFLAGS"
	python3 waf configure \
		--prefix=/usr \
		--cxx11 \
		--keepflags \
		--optimize \
		--freedesktop \
		--no-phone-home \
		--with-backends=pulseaudio,jack,alsa,dummy
		#FIXME: add missing dependencies
		# --use-external-libs
	python3 waf build
}

check() {
	python3 waf test
}

package() {
	python3 waf install --destdir="$pkgdir"

	mkdir -p "$pkgdir"/usr/share/metainfo
	mv "$pkgdir"/usr/share/appdata/*.xml "$pkgdir"/usr/share/metainfo
	rmdir "$pkgdir"/usr/share/appdata
}

sha512sums="
c4a3b6369fe1a1789ba2b5cbcfd23b6ac6b93f819b016aac2c071f1135e32826ca4f5bb99d4c3e4e1d8f91f82719ae17bcf2991eb29072c14e60f282545f934a  Ardour-8.6.0.tar.bz2
3cee45fa222f3a1990b4ba7f936f821ee412e9c5b26f326f107ecb0e6519a0e9c3bd54c9e78f1f7bcfb2a1e79b2733cc4b8bd36fe2fea685a5419735cd0f80fd  0001-Unset-HAVE_GNU_FTW.patch
"
