# Contributor: Lindsay Zhou <i@lin.moe>
# Maintainer: Lindsay Zhou <i@lin.moe>
pkgname=fcitx5-bamboo
pkgver=1.0.6
pkgrel=1
_bamboo_core=f0ca534819fa84ee37df9277ff2449d82ed1ec3e
pkgdesc="bamboo input method support for fcitx5"
url="https://github.com/fcitx/fcitx5-bamboo"
arch="all"
license="LGPL-2.1-or-later AND MIT"
makedepends="
	cmake
	extra-cmake-modules
	fcitx5-dev
	gettext-dev
	go
	samurai
	"
subpackages="$pkgname-lang"
source="$pkgname-$pkgver.tar.gz::https://github.com/fcitx/fcitx5-bamboo/archive/refs/tags/$pkgver.tar.gz
	bamboo-core-$_bamboo_core.tar.gz::https://github.com/BambooEngine/bamboo-core/archive/$_bamboo_core.tar.gz
	"
options="!check net" # !check:no tests, net:go modules

prepare() {
	default_prepare

	rmdir bamboo/bamboo-core
	ln -sfv "$srcdir"/bamboo-core-$_bamboo_core bamboo/bamboo-core
}

build() {
	CFLAGS="$CFLAGS -flto=auto" \
	CXXFLAGS="$CXXFLAGS -flto=auto" \
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
3e8b826af070da6e5b93dc64041bf07e206670ccd3688a523ae843920e3803c8876383cbff1dc3921e2f2020b800be8d33cbcb6f700ba2009b89246e56167251  fcitx5-bamboo-1.0.6.tar.gz
3d8034b20c1001500216f94c6e03d07831ce762fcf57cb7b8d238efeb17f8ed40cd5aa6965793384bd0e8f20dac82c74bc2e08d89b4e91ccf3a494d7b9da4ae7  bamboo-core-f0ca534819fa84ee37df9277ff2449d82ed1ec3e.tar.gz
"
