diff options
Diffstat (limited to 'app-i18n/nkf')
-rw-r--r-- | app-i18n/nkf/Manifest | 5 | ||||
-rw-r--r-- | app-i18n/nkf/files/nkf-2.1.5-python-ssize_t-deux.patch | 45 | ||||
-rw-r--r-- | app-i18n/nkf/files/nkf-2.1.5-python-ssize_t.patch | 71 | ||||
-rw-r--r-- | app-i18n/nkf/metadata.xml | 2 | ||||
-rw-r--r-- | app-i18n/nkf/nkf-2.1.5-r1.ebuild | 117 |
5 files changed, 239 insertions, 1 deletions
diff --git a/app-i18n/nkf/Manifest b/app-i18n/nkf/Manifest index 7a0c03d7d682..c3d218afc0f6 100644 --- a/app-i18n/nkf/Manifest +++ b/app-i18n/nkf/Manifest @@ -1,5 +1,8 @@ +AUX nkf-2.1.5-python-ssize_t-deux.patch 1282 BLAKE2B 6b8ce62ea54ca85e20a42f5af4f0ee304e03f11f256759ccfc8dc4f399047609c5c3978e90faf90d57c66db44aa4da42391756a095816928285c4ab361406f8f SHA512 9a5967ae1faff877110d3fc9468eccc6ab23f8a3bb02757d05e0d911d4eb5b9fe6a50711862fc68a16a0f8ab74e7c548dc9acb445c9fa78f3370bbec91de1a70 +AUX nkf-2.1.5-python-ssize_t.patch 2102 BLAKE2B 4032c12fc124efe3c44c4fbf81c6b72b01109c4ae7f92248eac2d27b1116e76e73b1606c77eb3e92c2c167163ceb3144d785b7a635f65e1350b42ab236a0307c SHA512 25ad67cb287eee4315845c3d70be6cd93d5db431d6942a78ca09c12931160e8b53144cb22a55f9ed61d11be7a0f13a0a7b58d8c4ad7608760ff192995b8a92eb AUX nkf-python.patch 285 BLAKE2B 439d4009b56cd6469fc7d717b91bf0b89fcbf275d87081359eeb7ade447c76261465703ba33836b9d9a87b4da482dd9cea8bdd46818a43a0b27eb4e7182ae371 SHA512 4c9bc8468656ffb09033f6564775686e1bc2bc99c8e4856c7f38de87b4c3c842bdf6798924ea97a5da2b1b697d7aaca62556c836d122dd496e278b223c3d48f3 DIST nkf-2.1.5.tar.gz 215879 BLAKE2B b5ae8f51b0ed97261f9e82ad469adbc9e469e709dc5acb64bfba48881555931eade5fcb772e7956a7401399008ec33bd57c8d6d8b5790eefe4d69d4e1dabed7c SHA512 fa5b683184481b25249872e7902033a72b6a6219b4c63d508a738710029430733e78cfa13b3d69dc281676762765e0452c92244a3855d3acbb5e23aa63214847 DIST python-nkf-0.2.0_p20191121.tar.gz 188496 BLAKE2B f7c9baaff8129956b7981011634f7ee5ece97e1b6650551a5cc2b50ff51a0c96a454f39e888c80120242a12b202c0422c0ecfc21858b1822a4959ff4c108b10d SHA512 ae1494ebdd488dc40802178a1b7b05c9a9b0bcf9cf9fa5017c6bc9f153c01b475c00f993489a21f643acc4ad61595c38c5afe28f3512a4d24f36eda7abd33958 +EBUILD nkf-2.1.5-r1.ebuild 2428 BLAKE2B 76a3ae5c85cad694f21f174b6c182dd6bd2b160f0243f14dc6d8cb0231d325f974fe4f9f68e76847188b472239ba5d2b3f95dc7928bcd7781ffa7caea160a2f0 SHA512 fc40cb311a1f0042a72aa2991bb1efe2c32e06487ef92d9f3877a5dee2c84df44b3a0f284ad42ecb0beef1b443e48a401e623f5a8ced80a8c4262267b48d1d77 EBUILD nkf-2.1.5.ebuild 2316 BLAKE2B b8e984fd5e3e58825a3cb3e7bb85b108c6b1b9c6065f1a708de96d9cd4298ee1384be2ea9a3b90910f4b15221b7805f7ca40cf460c3e2b49d818de4825ead53b SHA512 1e01b532207ad235645d573d052dc9d3f3a556c9d5f68822aa8ee37d6da314a55868c0d52907933a15652156562fa69fd66f947eb1d79b0f0a92e65a4d1c853e -MISC metadata.xml 301 BLAKE2B 708b7eeb753f365dcb021d159c3a7c56117081ae8a4130978702c7e0c9208ed9ba51c88343b7d94371b0ae6c13685e1844583d42cf4727a24308d3c8b02cc7a4 SHA512 0bd4bdcbda3457e0a8722f39fe32f20f5a9450f3d5181c83fa872fbdf9b478f895523e7a7f4992434d01c0e3a3386585181c90a525a7b080b2d7fac35fce04cb +MISC metadata.xml 408 BLAKE2B b84991c18d84658969ef2b7ed339f908b4bc9e2c1e03167950bac4950a18a1aefdbd7f603f82e1858ac62b6c07fc6711fc1cf7b8a1a859c2e6c510833cc589a6 SHA512 3783846f3ebf23b12c22d23e213c3ee38cb92e39921165fc108ec8d0973d1c2d093d4119733dcc1f459409b7323a8b6b368e1642e98146524bee572078add284 diff --git a/app-i18n/nkf/files/nkf-2.1.5-python-ssize_t-deux.patch b/app-i18n/nkf/files/nkf-2.1.5-python-ssize_t-deux.patch new file mode 100644 index 000000000000..355951cab319 --- /dev/null +++ b/app-i18n/nkf/files/nkf-2.1.5-python-ssize_t-deux.patch @@ -0,0 +1,45 @@ +https://github.com/fumiyas/python-nkf/pull/7 + +From abdebb9d49619d9b9cafa172d2ad7c171f3977d4 Mon Sep 17 00:00:00 2001 +From: Sam James <sam@gentoo.org> +Date: Tue, 4 Oct 2022 05:56:12 +0100 +Subject: [PATCH] Use designated initialiser syntax for PyModuleDef + +Fixes build with Clang. Switch to the more readable designated +initialiser syntax to avoid having to lookup member order. + +Before, Clang would complain: +``` +nkf.c:205:3: error: incompatible pointer to integer conversion initializing 'Py_ssize_t' (aka 'long') with an expression of type 'void *' [-Wint-conversion] + NULL, + ^~~~ +/usr/lib/llvm/16/bin/../../../../lib/clang/16.0.0/include/stddef.h:89:16: note: expanded from macro 'NULL' + ^~~~~~~~~~ +2 warnings and 1 error generated. +``` + +This is because some of PyModuleDef's members are actually +Py_ssize_t so chucking a NULL in looks like a codesmell to Clang. + +Bug: https://bugs.gentoo.org/874303 +Signed-off-by: Sam James <sam@gentoo.org> +--- a/NKF.python/nkf.c ++++ b/NKF.python/nkf.c +@@ -200,14 +200,8 @@ nkfmethods[] = { + static struct PyModuleDef + moduledef = { + PyModuleDef_HEAD_INIT, +- "nkf", +- NULL, +- NULL, +- nkfmethods, +- NULL, +- NULL, +- NULL, +- NULL ++ .m_name = "nkf", ++ .m_methods = nkfmethods + }; + + /* Module initialization function */ + diff --git a/app-i18n/nkf/files/nkf-2.1.5-python-ssize_t.patch b/app-i18n/nkf/files/nkf-2.1.5-python-ssize_t.patch new file mode 100644 index 000000000000..6aa986866e0d --- /dev/null +++ b/app-i18n/nkf/files/nkf-2.1.5-python-ssize_t.patch @@ -0,0 +1,71 @@ +https://github.com/nurse/nkf/commit/8246108073f739d45a21ef42ad2d9342fa3c6c28 + +From 8246108073f739d45a21ef42ad2d9342fa3c6c28 Mon Sep 17 00:00:00 2001 +From: slic <slic-io@users.noreply.github.com> +Date: Sun, 6 Mar 2022 18:05:54 +0900 +Subject: [PATCH] fix: python3 extention ABI # variant when parsing warning + +--- a/NKF.python3/NKF_python.c ++++ b/NKF.python3/NKF_python.c +@@ -20,6 +20,8 @@ Changes. + ** THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. + ***************************************************************************/ + ++#define PY_SSIZE_T_CLEAN ++ + #include "Python.h" + #include <setjmp.h> + +@@ -33,7 +35,7 @@ Changes. + #undef FALSE + #define putchar(c) pynkf_putchar(c) + +-static int pynkf_ibufsize, pynkf_obufsize; ++static Py_ssize_t pynkf_ibufsize, pynkf_obufsize; + static unsigned char *pynkf_inbuf, *pynkf_outbuf; + static int pynkf_icount,pynkf_ocount; + static unsigned char *pynkf_iptr, *pynkf_optr; +@@ -62,7 +64,7 @@ pynkf_ungetc(int c, FILE *f) + static void + pynkf_putchar(int c) + { +- size_t size; ++ Py_ssize_t size; + unsigned char *p; + + if (pynkf_guess_flag) { +@@ -89,7 +91,7 @@ pynkf_putchar(int c) + #include "../nkf.c" + + static PyObject * +-pynkf_convert(unsigned char* str, int strlen, char* opts, int optslen) ++pynkf_convert(unsigned char* str, Py_ssize_t strlen, char* opts, Py_ssize_t optslen) + { + PyObject * res; + +@@ -157,12 +159,12 @@ static + PyObject *pynkf_nkf(PyObject *self, PyObject *args) + { + unsigned char *str; +- int strlen; ++ Py_ssize_t strlen; + char *opts; +- int optslen; ++ Py_ssize_t optslen; + PyObject* res; + +- if (!PyArg_ParseTuple(args, "s#y#", &opts, &optslen, &str, &strlen)) { ++ if (!PyArg_ParseTuple(args, "s#s#", &opts, &optslen, &str, &strlen)) { + return NULL; + } + res = pynkf_convert(str, strlen, opts, optslen); +@@ -178,7 +180,7 @@ PyObject *pynkf_guess(PyObject *self, PyObject *args) + int strlen; + PyObject* res; + +- if (!PyArg_ParseTuple(args, "y#", &str, &strlen)) { ++ if (!PyArg_ParseTuple(args, "s#", &str, &strlen)) { + return NULL; + } + res = pynkf_convert_guess(str, strlen); + diff --git a/app-i18n/nkf/metadata.xml b/app-i18n/nkf/metadata.xml index 7eb84b5ec91c..414beff9a719 100644 --- a/app-i18n/nkf/metadata.xml +++ b/app-i18n/nkf/metadata.xml @@ -7,5 +7,7 @@ </maintainer> <upstream> <remote-id type="osdn">nkf</remote-id> + <remote-id type="github">nurse/nkf</remote-id> + <remote-id type="github">fumiyas/python-nkf</remote-id> </upstream> </pkgmetadata> diff --git a/app-i18n/nkf/nkf-2.1.5-r1.ebuild b/app-i18n/nkf/nkf-2.1.5-r1.ebuild new file mode 100644 index 000000000000..095d49cf0515 --- /dev/null +++ b/app-i18n/nkf/nkf-2.1.5-r1.ebuild @@ -0,0 +1,117 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{8..10} ) +DISTUTILS_OPTIONAL="1" + +inherit distutils-r1 perl-module toolchain-funcs vcs-snapshot + +PY_P="python-${PN}-0.2.0_p20191121" +PY_COMMIT="c2c6724714b66f295137c8818dae4c09fc09e0a3" + +DESCRIPTION="Network Kanji code conversion Filter with UTF-8/16 support" +HOMEPAGE="https://osdn.net/projects/nkf/" +SRC_URI="mirror://sourceforge.jp/${PN}/70406/${P}.tar.gz + python? ( https://github.com/fumiyas/python-${PN}/archive/${PY_COMMIT}.tar.gz -> ${PY_P}.tar.gz )" + +LICENSE="ZLIB python? ( BSD )" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86" +IUSE="perl python l10n_ja" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" + +RDEPEND="python? ( ${PYTHON_DEPS} )" +DEPEND="${RDEPEND}" +BDEPEND="python? ( + ${PYTHON_DEPS} + dev-python/setuptools[${PYTHON_USEDEP}] + )" + +PATCHES=( + "${FILESDIR}"/${P}-python-ssize_t.patch + "${FILESDIR}"/${PN}-2.1.5-python-ssize_t-deux.patch +) + +src_unpack() { + use python && vcs-snapshot_src_unpack || default +} + +src_prepare() { + sed -i \ + -e "/^CFLAGS/{ s/-g -O2//; s/=/+=/; }" \ + -e "/ -o ${PN}/s/\(-o \)/\$(LDFLAGS) \1/" \ + Makefile + if use python; then + mv "${WORKDIR}"/${PY_P} NKF.python || die + eapply "${FILESDIR}"/${PN}-python.patch + cd NKF.python || die + distutils-r1_src_prepare + cd - >/dev/null || die + fi + + default +} + +src_configure() { + default + if use perl; then + cd NKF.mod || die + perl-module_src_configure + cd - >/dev/null || die + fi + if use python; then + cd NKF.python || die + distutils-r1_src_configure + cd - >/dev/null || die + fi +} + +src_compile() { + emake CC="$(tc-getCC)" + if use perl; then + cd NKF.mod || die + perl-module_src_compile + cd - >/dev/null || die + fi + if use python; then + cd NKF.python || die + distutils-r1_src_compile + cd - >/dev/null || die + fi +} + +src_test() { + default + if use perl; then + cd NKF.mod || die + perl-module_src_test + cd - >/dev/null || die + fi +} + +src_install() { + dobin ${PN} + doman ${PN}.1 + + if use l10n_ja; then + iconv -f ISO-2022-JP-3 -t UTF-8 ${PN}.1j > ${PN}.ja.1 || die + doman ${PN}.ja.1 + fi + dodoc ${PN}.doc + + if use perl; then + cd NKF.mod || die + docinto perl + perl-module_src_install + cd - >/dev/null || die + fi + if use python; then + cd NKF.python || die + docinto python + DOCS= distutils-r1_src_install + dodoc CHANGES README.md + cd - >/dev/null || die + fi +} |