public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Yixun Lan" <dlan@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: app-i18n/opencc/
Date: Tue, 27 Aug 2024 15:16:15 +0000 (UTC)	[thread overview]
Message-ID: <1724771757.bd95d15e5a523b74cdc900b1ef66d1559b601fea.dlan@gentoo> (raw)

commit:     bd95d15e5a523b74cdc900b1ef66d1559b601fea
Author:     blackteahamburger <blackteahamburger <AT> outlook <DOT> com>
AuthorDate: Tue Aug 20 03:33:42 2024 +0000
Commit:     Yixun Lan <dlan <AT> gentoo <DOT> 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 <blackteahamburger <AT> outlook.com>
Signed-off-by: Yixun Lan <dlan <AT> 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
+}


             reply	other threads:[~2024-08-27 15:16 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27 15:16 Yixun Lan [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-07-05 10:37 [gentoo-commits] repo/gentoo:master commit in: app-i18n/opencc/ Arthur Zamarin
2024-07-05 10:37 Arthur Zamarin
2023-03-17 13:18 Yixun Lan
2022-08-12 14:27 Sam James
2022-08-03  7:49 Agostino Sarubbo
2022-08-02 19:54 Arthur Zamarin
2022-08-02 16:01 Arthur Zamarin
2022-08-02 16:01 Arthur Zamarin
2022-08-02 16:01 Arthur Zamarin
2022-07-07 13:59 Yixun Lan
2022-06-13 21:30 Jakov Smolić
2022-06-10  6:48 Agostino Sarubbo
2022-06-09  7:37 Agostino Sarubbo
2022-06-09  7:37 Agostino Sarubbo
2022-06-09  7:36 Agostino Sarubbo
2022-06-08 20:04 Arthur Zamarin
2022-05-19  5:08 WANG Xuerui
2022-05-17 12:38 Agostino Sarubbo
2022-03-09  8:59 Jakov Smolić
2022-01-31 20:26 Arthur Zamarin
2022-01-31 18:51 Sam James
2022-01-31  6:24 Sam James
2022-01-30 22:25 Sam James
2022-01-30 22:25 Sam James
2022-01-29 15:20 Yixun Lan
2022-01-29 15:20 Yixun Lan
2022-01-14 11:36 Arthur Zamarin
2021-09-06 21:34 Sam James
2021-09-06 21:34 Sam James
2021-07-27 21:54 Marek Szuba
2021-06-08  7:41 Sam James
2021-03-26 14:38 Mike Gilbert
2021-03-26 14:38 Mike Gilbert
2021-03-26 14:38 Mike Gilbert
2021-03-26 14:38 Mike Gilbert
2020-12-31  1:47 Sam James
2020-12-27 18:39 Mike Gilbert
2020-12-27 18:39 Mike Gilbert
2020-12-27 18:39 Mike Gilbert
2020-11-22 19:32 Mike Gilbert
2020-11-22 19:32 Mike Gilbert
2020-11-22 19:32 Mike Gilbert
2020-11-22 19:32 Mike Gilbert
2020-11-22 19:32 Mike Gilbert
2020-11-22 19:32 Mike Gilbert
2020-11-22 19:32 Mike Gilbert
2020-02-08 12:50 Sergei Trofimovich
2019-12-31 18:08 Aaron Bauman
2019-08-30 18:39 Sergei Trofimovich
2019-08-18  3:06 Aaron Bauman
2017-10-05  9:04 Sergei Trofimovich
2017-09-24 12:29 Sergei Trofimovich
2017-09-24 11:00 Sergei Trofimovich
2017-08-31 19:53 Mike Gilbert
2017-08-23 14:25 Akinori Hattori
2017-08-22 14:21 Mike Gilbert
2017-08-22 14:21 Mike Gilbert
2017-08-22 14:21 Mike Gilbert
2017-08-22 14:21 Mike Gilbert
2017-08-22 14:21 Mike Gilbert
2017-02-15 22:04 Yixun Lan
2017-02-03 21:49 Johannes Huber
2017-02-03 20:08 Jeroen Roovers
2017-02-03 20:05 Jeroen Roovers
2017-01-29 13:55 Agostino Sarubbo
2016-05-27 10:22 Yixun Lan
2015-09-01 18:52 Tobias Klausmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1724771757.bd95d15e5a523b74cdc900b1ef66d1559b601fea.dlan@gentoo \
    --to=dlan@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox