# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=rofi-emoji
pkgver=3.3.0
pkgrel=1
pkgdesc="Emoji selector plugin for Rofi"
url="https://github.com/Mange/rofi-emoji"
arch="all"
license="MIT"
depends="cmd:rofi"
makedepends="
	autoconf
	automake
	libtool
	rofi-dev
	"
checkdepends="check-dev"
subpackages="
	$pkgname-wayland::noarch
	$pkgname-x11::noarch
	"
source="https://github.com/Mange/rofi-emoji/archive/v$pkgver/rofi-emoji-$pkgver.tar.gz"

prepare() {
	default_prepare

	autoreconf -i
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		$(want_check && echo '--with-check')
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	cd "$pkgdir"
	rm usr/share/$pkgname/README.md
	rm usr/share/$pkgname/LICENSE
}

wayland() {
	pkgdesc="$pkgdesc - dependencies for clipboard adapter on Wayland"
	depends="cmd:wl-copy"
	install_if="wayland-libs-server $pkgname=$pkgver-r$pkgrel"

	mkdir -p "$subpkgdir"
}

x11() {
	pkgdesc="$pkgdesc - dependencies for clipboard adapter on X11"
	depends="cmd:xsel"
	install_if="xorg-server $pkgname=$pkgver-r$pkgrel"

	mkdir -p "$subpkgdir"
}

sha512sums="
60d0904ec2099e2651441177a735536d11f13dacd6cafe8ec0bbc14b707b237d807f2655fea05f842d86d74bb1957a00a089b1119c3f7c8fb2b0a5d944ddad72  rofi-emoji-3.3.0.tar.gz
"
