From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2697F1581FB for ; Tue, 27 Aug 2024 15:16:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 92DC8E29E8; Tue, 27 Aug 2024 15:16:18 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 67425E29E8 for ; Tue, 27 Aug 2024 15:16:17 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 735BD342FAC for ; Tue, 27 Aug 2024 15:16:16 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 0F99A1F08 for ; Tue, 27 Aug 2024 15:16:15 +0000 (UTC) From: "Yixun Lan" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Yixun Lan" Message-ID: <1724771757.bd95d15e5a523b74cdc900b1ef66d1559b601fea.dlan@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: app-i18n/opencc/ X-VCS-Repository: repo/gentoo X-VCS-Files: app-i18n/opencc/opencc-1.1.7-r1.ebuild X-VCS-Directories: app-i18n/opencc/ X-VCS-Committer: dlan X-VCS-Committer-Name: Yixun Lan X-VCS-Revision: bd95d15e5a523b74cdc900b1ef66d1559b601fea X-VCS-Branch: master Date: Tue, 27 Aug 2024 15:16:15 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: dbf44995-f7ea-49bf-bb18-90cea053d51c X-Archives-Hash: ae1855a32ce26f70b2a921bf978b2324 commit: bd95d15e5a523b74cdc900b1ef66d1559b601fea Author: blackteahamburger outlook com> AuthorDate: Tue Aug 20 03:33:42 2024 +0000 Commit: Yixun Lan gentoo org> CommitDate: Tue Aug 27 15:15:57 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bd95d15e app-i18n/opencc: add python use flag Closes: https://bugs.gentoo.org/938212 Closes: https://github.com/gentoo/gentoo/pull/38212 Signed-off-by: blackteahamburger outlook.com> Signed-off-by: Yixun Lan gentoo.org> app-i18n/opencc/opencc-1.1.7-r1.ebuild | 121 +++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/app-i18n/opencc/opencc-1.1.7-r1.ebuild b/app-i18n/opencc/opencc-1.1.7-r1.ebuild new file mode 100644 index 000000000000..89372cdb262c --- /dev/null +++ b/app-i18n/opencc/opencc-1.1.7-r1.ebuild @@ -0,0 +1,121 @@ +# Copyright 2010-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..13} ) +DISTUTILS_EXT=1 +DISTUTILS_OPTIONAL=1 +DISTUTILS_SINGLE_IMPL=1 +DISTUTILS_USE_PEP517=setuptools + +inherit cmake distutils-r1 + +DESCRIPTION="Library for conversion between Traditional and Simplified Chinese characters" +HOMEPAGE="https://github.com/BYVoid/OpenCC" +SRC_URI="https://github.com/BYVoid/OpenCC/archive/ver.${PV}.tar.gz -> ${P}.tar.gz" +S="${WORKDIR}/OpenCC-ver.${PV}" + +LICENSE="Apache-2.0" +SLOT="0/1.1" +KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~riscv ~x86" +IUSE="doc python test" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" +RESTRICT="!test? ( test )" + +RDEPEND="dev-libs/marisa + python? ( ${PYTHON_DEPS} ) +" +DEPEND="${RDEPEND} + dev-cpp/tclap + dev-libs/darts + dev-libs/rapidjson +" +BDEPEND="${PYTHON_DEPS} + doc? ( app-text/doxygen ) + python? ( + ${DISTUTILS_DEPS} + app-admin/chrpath + $(python_gen_cond_dep 'dev-python/pybind11[${PYTHON_USEDEP}]') + test? ( $(python_gen_cond_dep 'dev-python/pytest[${PYTHON_USEDEP}]') ) + ) + test? ( + dev-cpp/gtest + !hppa? ( !sparc? ( dev-cpp/benchmark ) ) + ) +" + +DOCS=( AUTHORS NEWS.md README.md ) + +pkg_setup() { + use python && python-single-r1_pkg_setup +} + +src_prepare() { + rm -r deps || die + + sed -e "s:\${DIR_SHARE_OPENCC}/doc:share/doc/${PF}:" -i doc/CMakeLists.txt || die + + cmake_src_prepare + use python && distutils-r1_src_prepare +} + +src_configure() { + local mycmakeargs=( + -DBUILD_DOCUMENTATION=$(usex doc) + -DBUILD_PYTHON=$(usex python) + -DENABLE_BENCHMARK=$(if use test && has_version -d dev-cpp/benchmark; then echo ON; else echo OFF; fi) + -DENABLE_GTEST=$(usex test) + -DUSE_SYSTEM_DARTS=ON + -DUSE_SYSTEM_GOOGLE_BENCHMARK=ON + -DUSE_SYSTEM_GTEST=ON + -DUSE_SYSTEM_MARISA=ON + -DUSE_SYSTEM_PYBIND11=ON + -DUSE_SYSTEM_RAPIDJSON=ON + -DUSE_SYSTEM_TCLAP=ON + ) + + cmake_src_configure + use python && distutils-r1_src_configure +} + +src_compile() { + cmake_src_compile + if use python; then + cp "${BUILD_DIR}"/opencc_clib.*.so python/opencc/clib/ + distutils-r1_src_compile + fi +} + +python_test() { + epytest +} + +src_test() { + cmake_src_test + if use python; then + cd "${BUILD_DIR}_${EPYTHON}/install/usr/lib/${EPYTHON}/site-packages/opencc/clib" || die + mkdir -p share/opencc || die + cp "${S}/data/config"/*.json share/opencc/ || die + pushd "${S}" || die + + distutils-r1_src_test + + popd || die + rm -r share/ || die + fi +} + +src_install() { + cmake_src_install + if use python; then + distutils-r1_src_install + + # Hack to make opencc's python binding to use system opencc's configs + dodir "/usr/lib/${EPYTHON}/site-packages/opencc/clib/share" + dosym -r /usr/share/opencc "/usr/lib/${EPYTHON}/site-packages/opencc/clib/share/opencc" + + # Remove insecure RPATH + chrpath --delete "${ED}/usr/lib/${EPYTHON}/site-packages/opencc/clib"/*.so || die + fi +}