diff --git a/0001-chewing.py-supports-platforms-with-64bit-pointer.patch b/0001-chewing.py-supports-platforms-with-64bit-pointer.patch new file mode 100644 index 0000000..fb5f7ec --- /dev/null +++ b/0001-chewing.py-supports-platforms-with-64bit-pointer.patch @@ -0,0 +1,41 @@ +From 9025eeb2bf2cba851073cb4178fd71f71c74391d Mon Sep 17 00:00:00 2001 +From: Robin Lee +Date: Thu, 8 Aug 2019 17:16:21 +0800 +Subject: [PATCH] chewing.py supports platforms with 64bit pointer + +The old code will segfault on platforms with 64bit pointer like x86_64. +--- + contrib/python/chewing.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/contrib/python/chewing.py b/contrib/python/chewing.py +index a9f17ec..acf000b 100644 +--- a/contrib/python/chewing.py ++++ b/contrib/python/chewing.py +@@ -19,6 +19,8 @@ _libchewing.chewing_cand_String.restype = c_char_p + _libchewing.chewing_zuin_String.restype = c_char_p + _libchewing.chewing_aux_String.restype = c_char_p + _libchewing.chewing_get_KBString.restype = c_char_p ++_libchewing.chewing_new.restype = c_void_p ++_libchewing.chewing_new2.restype = c_void_p + + + def Init(datadir, userdir): +@@ -39,12 +41,12 @@ class ChewingContext: + None) + + def __del__(self): +- _libchewing.chewing_delete(self.ctx) ++ _libchewing.chewing_delete(c_void_p(self.ctx)) + + def __getattr__(self, name): + func = 'chewing_' + name + if hasattr(_libchewing, func): +- wrap = partial(getattr(_libchewing, func), self.ctx) ++ wrap = partial(getattr(_libchewing, func), c_void_p(self.ctx)) + setattr(self, name, wrap) + return wrap + else: +-- +2.21.0 + diff --git a/libchewing.spec b/libchewing.spec new file mode 100644 index 0000000..d51385a --- /dev/null +++ b/libchewing.spec @@ -0,0 +1,80 @@ +%global libchewing_python_dir %{python3_sitelib} + +Name: libchewing +Version: 0.5.1 +Release: 1 +Summary: Intelligent phonetic input method library for Traditional Chinese + +License: LGPLv2+ +URL: http://chewing.csie.net/ +Source0: https://github.com/chewing/%{name}/archive/v%{version}.tar.gz +Patch0: 0001-chewing.py-supports-platforms-with-64bit-pointer.patch + +BuildRequires: autoconf automake libtool pkgconfig texinfo +BuildRequires: sqlite-devel +BuildRequires: python3-devel +BuildRequires: make +Requires: sqlite +Obsoletes: python2-libchewing < 0.5.1-13 + +%description +libchewing is an intelligent phonetic input method library for Chinese. + +It provides the core algorithm and logic that can be used by various +input methods. The Chewing input method is a smart bopomofo phonetics +input method that is useful for inputting Mandarin Chinese. + +%package -n %{name}-devel +Summary: Development files for libchewing +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description -n %{name}-devel +Headers and other files needed to develop applications using the %{name} +library. + +%package -n python3-%{name} +Summary: Python binding for libchewing +BuildArch: noarch +Requires: %{name} = %{version}-%{release} + +%description -n python3-%{name} +Python binding of libchewing. + +%prep +%setup -q +%patch0 -p1 + +%build +CFLAGS="%{optflags} -g -DLIBINSTDIR='%{_libdir}'" +autoreconf -ivf +%configure --disable-static +make V=1 RPM_CFLAGS="%{optflags}" %{_smp_mflags} + +%install +make DESTDIR=%{buildroot} install INSTALL="install -p" +rm %{buildroot}%{_libdir}/libchewing.la + +mkdir -p %{buildroot}%{libchewing_python_dir} +cp -p contrib/python/chewing.py %{buildroot}%{libchewing_python_dir} + +rm -f %{buildroot}/%{_infodir}/dir + +%files +%doc README.md AUTHORS COPYING NEWS TODO +%{_datadir}/%{name}/ +%{_libdir}/*.so.* +%{_infodir}/%{name}.info.* + +%files devel +%dir %{_includedir}/chewing +%{_includedir}/chewing/* +%{_libdir}/pkgconfig/chewing.pc +%{_libdir}/*.so + +%files -n python3-%{name} +%{libchewing_python_dir}/chewing.py +%{libchewing_python_dir}/__pycache__/* + +%changelog +* Wed Jul 20 2022 misaka00251 - 0.5.1-1 +- Init package diff --git a/libchewing.yaml b/libchewing.yaml new file mode 100644 index 0000000..8ca51f7 --- /dev/null +++ b/libchewing.yaml @@ -0,0 +1,4 @@ +version_control: github +src_repo: fujiwarat/anthy-unicode +tag_prefix: "^v" +seperator: "." diff --git a/v0.5.1.tar.gz b/v0.5.1.tar.gz new file mode 100644 index 0000000..d21fcf2 Binary files /dev/null and b/v0.5.1.tar.gz differ