# Template file for 'libime'
pkgname=libime
version=1.0.16
revision=1
build_style=cmake
build_helper=qemu
hostmakedepends="pkg-config gettext extra-cmake-modules python3"
makedepends="libfcitx5-devel boost-devel"
short_desc="Library to support generic input method implementation"
maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
license="LGPL-2.1-or-later"
homepage="https://fcitx-im.org/wiki/Fcitx"
_lm_sc=lm_sc.arpa-20220810.tar.xz
_dict=dict-20220810.tar.xz
distfiles="https://download.fcitx-im.org/fcitx5/libime/libime-${version}.tar.xz
 https://download.fcitx-im.org/data/${_lm_sc}
 https://download.fcitx-im.org/data/${_dict}
 https://download.fcitx-im.org/data/table.tar.gz"
checksum="07b1518f41747f0bff988135892da4b6d29b4b5a336bdf86361acbbce30a6608
 a11bc97d275adaf195f9bac854368ae06cdb4a0fe1eecf59db5ae580615db4fa
 971752f413188007e8d19158c11b85c955e25d7b321ec2275c4b3af6d8a85d26
 6196053c724125e3ae3d8bd6b2f9172d0c83b65b0d410d3cde63b7a8d6ab87b7"
skip_extraction="
 ${_lm_sc}
 ${_dict}
 table.tar.gz"

post_extract() {
	local _srcdistdir=${XBPS_SRCDISTDIR}/${pkgname}-${version}
	local _file
	for _file in ${skip_extraction}; do
		cp ${_srcdistdir}/${_file} data
	done
}

post_install() {
	sed -i '/INTERFACE_INCLUDE_DIRECTORIES/s,"/usr,"${_IMPORT_PREFIX},' \
		"${DESTDIR}/usr/lib/cmake"/*/*Targets.cmake
}

libime-migration_package() {
	short_desc+=" - migration tools"
	pkg_install() {
		vmove "usr/bin/libime_migrate_*"
	}
}

libime-utils_package() {
	short_desc+=" - utilities"
	pkg_install() {
		vmove usr/bin
	}
}

libime-devel_package() {
	short_desc+=" - development files"
	depends="boost-devel libime-utils>=${version}_${revision}
	 libime>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/cmake
		vmove "usr/lib/*.so"
	}
}
