# Contributor: Robert Sacks <robert@sacks.email>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=wl-clipboard
pkgver=2.2.1
pkgrel=0
pkgdesc="Command-line copy/paste utilities for Wayland"
url="https://github.com/bugaevc/wl-clipboard"
arch="all"
license="GPL-3.0-or-later"
options="!check" # No test suite
makedepends="
	meson
	ninja
	wayland-dev
	wayland-protocols
	"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-zsh-completion
	$pkgname-fish-completion
	"
source="https://github.com/bugaevc/wl-clipboard/archive/v$pkgver/wl-clipboard-$pkgver.tar.gz
	fix-assertion-failure.patch
	fix-wrong-flushing-issue.patch
	"

build() {
	abuild-meson -Db_lto=true . build
	meson compile -C build
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C build

	# Install fish completion files into the correct directory
	rm -r "$pkgdir"/usr/share/fish/vendor_completions.d
	install -Dm644 completions/fish/wl-copy.fish \
		"$pkgdir"/usr/share/fish/vendor_completions.d/wl-copy.fish
	install -Dm644 completions/fish/wl-paste.fish \
		"$pkgdir"/usr/share/fish/vendor_completions.d/wl-paste.fish
}

sha512sums="
fdda519df42e1dbfb112ab7d8195a0f36cf5cf18fffffa8f32ac4688a08009e206b96a169da641f909c9acf244eb6a5201811842b4d3111e1ccdb1ce8fb4db43  wl-clipboard-2.2.1.tar.gz
2365e297ee96b0dc207fa3e3230d1061d2339edcd7dbbea077aa20b27e0e2850894a59e7ff148d6262d612da16a40473cfd9bb51892bea3eb5f1eb7c98b0d652  fix-assertion-failure.patch
a5e3f36da2470d721096e655c17d7466172f3e71ebec7ae7789b9aa7811feec9c831d10b603786f0b8bdb7663eb28cba901e53f90995e0e1159a04e935935828  fix-wrong-flushing-issue.patch
"
