Apocrypha

fcitx-openbangla-2.0.0_p20260718gentoo-zh

# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

# OpenBangla-Keyboard only grows a Fcitx5 backend on the develop branch, so this
# is a snapshot; riti and corrosion are git submodules the archive omits.
OB_COMMIT="f83d5d065f3990287da33e4c9254668ff1b2c440"
RITI_COMMIT="afee54a79e230165d38f6b17161cd8ff971e1c49"
CORROSION_COMMIT="f88df62d022d5a3a51118b0c8871f5d6b38a4771"

CRATES="
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]+wasi-0.2.12
	[email protected]
	[email protected]
	[email protected]
	[email protected]
	[email protected]
"

# wasip2 in the crate graph requires Rust 1.87.
RUST_MIN_VER="1.87.0"

inherit cargo cmake xdg

DESCRIPTION="OpenBangla Bengali (Avro Phonetic) input method engine for Fcitx5"
HOMEPAGE="https://openbangla.org/ https://github.com/OpenBangla/OpenBangla-Keyboard"
SRC_URI="
	https://github.com/OpenBangla/OpenBangla-Keyboard/archive/${OB_COMMIT}.tar.gz
		-> ${P}.tar.gz
	https://github.com/OpenBangla/riti/archive/${RITI_COMMIT}.tar.gz
		-> riti-${RITI_COMMIT}.tar.gz
	https://github.com/corrosion-rs/corrosion/archive/${CORROSION_COMMIT}.tar.gz
		-> corrosion-${CORROSION_COMMIT}.tar.gz
	${CARGO_CRATE_URIS}
"
S="${WORKDIR}/OpenBangla-Keyboard-${OB_COMMIT}"

# GPL-3+: OpenBangla and riti; remainder: bundled crates.
LICENSE="GPL-3+ Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD-2 LGPL-2.1+ MIT Unicode-3.0 Unlicense"
SLOT="0"
KEYWORDS="~amd64"

DEPEND="
	>=app-i18n/fcitx-5.0.5:5
	app-arch/zstd
"
RDEPEND="${DEPEND}"
BDEPEND="virtual/pkgconfig"

PATCHES=(
	"${FILESDIR}"/${PN}-fcitx-only.patch
)

src_prepare() {
	# The release archive carries empty submodule mount points; drop them and
	# graft in the separately fetched riti engine and corrosion CMake helper.
	rm -rf src/engine/riti cmake/corrosion-rs || die
	mv "${WORKDIR}/riti-${RITI_COMMIT}" src/engine/riti || die
	mv "${WORKDIR}/corrosion-${CORROSION_COMMIT}" cmake/corrosion-rs || die
	# riti ships no Cargo.lock; supply the one pinning the vendored CRATES.
	cp "${FILESDIR}"/riti-afee54a7-Cargo.lock src/engine/riti/Cargo.lock || die

	cmake_src_prepare
}

src_configure() {
	local mycmakeargs=(
		-DENABLE_FCITX=ON
		-DENABLE_IBUS=OFF
	)
	cmake_src_configure
}

src_install() {
	cmake_src_install

	# The Qt5 settings GUI is not built, so its desktop launcher and AppStream
	# metadata would only dangle; the engine keeps its layouts, data and icon.
	rm "${ED}"/usr/share/applications/openbangla-keyboard.desktop || die
	rm "${ED}"/usr/share/metainfo/io.github.openbangla.keyboard.metainfo.xml || die
}