Compare commits
No commits in common. "4aa8fad7267a03399139cd35fd4bf296d57f9688" and "dbf1166ff293f571f19e2b6656a9770869827737" have entirely different histories.
4aa8fad726
...
dbf1166ff2
@ -1,56 +0,0 @@
|
|||||||
From e95b947a72b899b4dc737f49d8a8a1e52d6395c0 Mon Sep 17 00:00:00 2001
|
|
||||||
From: ut004615 <haomimi@uniontech.com>
|
|
||||||
Date: Thu, 17 Aug 2023 11:21:05 +0800
|
|
||||||
Subject: [PATCH] add loongarch64 support
|
|
||||||
|
|
||||||
---
|
|
||||||
SConstruct | 3 ++-
|
|
||||||
SConstruct.python3 | 3 ++-
|
|
||||||
SConstruct.scons | 3 ++-
|
|
||||||
3 files changed, 6 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/SConstruct b/SConstruct
|
|
||||||
index 866a729..a2d2bf4 100644
|
|
||||||
--- a/SConstruct
|
|
||||||
+++ b/SConstruct
|
|
||||||
@@ -336,7 +336,8 @@ def AppendEndianCheck(conf):
|
|
||||||
|| defined(__alpha__) || defined(__ARMEL__) \
|
|
||||||
|| defined(_MIPSEL) || (defined(__sh__) && defined(__LITTLE_ENDIAN__)) \
|
|
||||||
|| defined(__riscv) \
|
|
||||||
- || defined(__AARCH64EL__)
|
|
||||||
+ || defined(__AARCH64EL__) \
|
|
||||||
+ || defined(__loongarch64) || defined(__loongarch64__)
|
|
||||||
# undef WORDS_BIGENDIAN
|
|
||||||
|
|
||||||
#else
|
|
||||||
diff --git a/SConstruct.python3 b/SConstruct.python3
|
|
||||||
index 7d9dd6f..4b3369f 100644
|
|
||||||
--- a/SConstruct.python3
|
|
||||||
+++ b/SConstruct.python3
|
|
||||||
@@ -335,7 +335,8 @@ def AppendEndianCheck(conf):
|
|
||||||
|| defined(__alpha__) || defined(__ARMEL__) \
|
|
||||||
|| defined(_MIPSEL) || (defined(__sh__) && defined(__LITTLE_ENDIAN__)) \
|
|
||||||
|| defined(__riscv) \
|
|
||||||
- || defined(__AARCH64EL__)
|
|
||||||
+ || defined(__AARCH64EL__) \
|
|
||||||
+ || defined(__loongarch64) || defined(__loongarch64__)
|
|
||||||
# undef WORDS_BIGENDIAN
|
|
||||||
|
|
||||||
#else
|
|
||||||
diff --git a/SConstruct.scons b/SConstruct.scons
|
|
||||||
index 530e1f4..241878a 100644
|
|
||||||
--- a/SConstruct.scons
|
|
||||||
+++ b/SConstruct.scons
|
|
||||||
@@ -335,7 +335,8 @@ def AppendEndianCheck(conf):
|
|
||||||
|| defined(__alpha__) || defined(__ARMEL__) \
|
|
||||||
|| defined(_MIPSEL) || (defined(__sh__) && defined(__LITTLE_ENDIAN__)) \
|
|
||||||
|| defined(__riscv) \
|
|
||||||
- || defined(__AARCH64EL__)
|
|
||||||
+ || defined(__AARCH64EL__) \
|
|
||||||
+ || defined(__loongarch64) || defined(__loongarch64__)
|
|
||||||
# undef WORDS_BIGENDIAN
|
|
||||||
|
|
||||||
#else
|
|
||||||
--
|
|
||||||
2.27.0
|
|
||||||
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
From 374709081d2b3cf9d97a2b71e294bab152bf3f3c Mon Sep 17 00:00:00 2001
|
|
||||||
From: maqi <maqi@uniontech.com>
|
|
||||||
Date: Fri, 8 Nov 2024 21:37:01 +0800
|
|
||||||
Subject: [PATCH] add sw support
|
|
||||||
|
|
||||||
---
|
|
||||||
SConstruct | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/SConstruct b/SConstruct
|
|
||||||
index a2d2bf4..d6bacff 100644
|
|
||||||
--- a/SConstruct
|
|
||||||
+++ b/SConstruct
|
|
||||||
@@ -337,6 +337,7 @@ def AppendEndianCheck(conf):
|
|
||||||
|| defined(_MIPSEL) || (defined(__sh__) && defined(__LITTLE_ENDIAN__)) \
|
|
||||||
|| defined(__riscv) \
|
|
||||||
|| defined(__AARCH64EL__) \
|
|
||||||
+ || defined(__sw_64__) \
|
|
||||||
|| defined(__loongarch64) || defined(__loongarch64__)
|
|
||||||
# undef WORDS_BIGENDIAN
|
|
||||||
|
|
||||||
--
|
|
||||||
2.33.0
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,34 +0,0 @@
|
|||||||
Index: sunpinyin-20190805/SConstruct
|
|
||||||
===================================================================
|
|
||||||
--- sunpinyin-20190805.orig/SConstruct
|
|
||||||
+++ sunpinyin-20190805/SConstruct
|
|
||||||
@@ -2,6 +2,7 @@ import platform
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
+from functools import reduce
|
|
||||||
|
|
||||||
version = "2.0.4"
|
|
||||||
abi_major = 3
|
|
||||||
@@ -227,7 +228,7 @@ def CreateEnvironment():
|
|
||||||
def PassVariables(envvar, env):
|
|
||||||
for (x, y) in envvar:
|
|
||||||
if x in os.environ:
|
|
||||||
- print 'Warning: you\'ve set %s in the environmental variable!' % x
|
|
||||||
+ print ('Warning: you\'ve set %s in the environmental variable!' % x)
|
|
||||||
env[y] = os.environ[x]
|
|
||||||
|
|
||||||
env = CreateEnvironment()
|
|
||||||
Index: sunpinyin-20190805/src/SConscript
|
|
||||||
===================================================================
|
|
||||||
--- sunpinyin-20190805.orig/src/SConscript
|
|
||||||
+++ sunpinyin-20190805/src/SConscript
|
|
||||||
@@ -53,7 +53,7 @@ env.Substfile('sunpinyin-dictgen.mk.in',
|
|
||||||
})
|
|
||||||
env.Command('sunpinyin-dictgen', 'sunpinyin-dictgen.mk', [
|
|
||||||
Copy("$TARGET", "$SOURCE"),
|
|
||||||
- Chmod("$TARGET", 0755),
|
|
||||||
+ Chmod("$TARGET", "0755"),
|
|
||||||
])
|
|
||||||
|
|
||||||
# -*- indent-tabs-mode: nil -*- vim:et:ts=4
|
|
||||||
@ -1,171 +0,0 @@
|
|||||||
commit d0693ba9f2686ffa46328da129ffef345258fa12
|
|
||||||
Author: Peng Wu <alexepico@gmail.com>
|
|
||||||
Date: Thu Jul 26 15:08:41 2018 +0800
|
|
||||||
|
|
||||||
Use python3
|
|
||||||
|
|
||||||
Index: sunpinyin-20190805/SConstruct
|
|
||||||
===================================================================
|
|
||||||
--- sunpinyin-20190805.orig/SConstruct
|
|
||||||
+++ sunpinyin-20190805/SConstruct
|
|
||||||
@@ -299,11 +299,11 @@ def CheckPKG(context, name):
|
|
||||||
|
|
||||||
def CheckPython(context):
|
|
||||||
context.Message('Checking for Python library...')
|
|
||||||
- ret = context.TryAction('python-config --prefix')[0]
|
|
||||||
+ ret = context.TryAction('python3-config --prefix')[0]
|
|
||||||
context.Result(ret)
|
|
||||||
if ret:
|
|
||||||
- context.env.MergeFlags(['!python-config --includes',
|
|
||||||
- '!python-config --libs'])
|
|
||||||
+ context.env.MergeFlags(['!python3-config --includes',
|
|
||||||
+ '!python3-config --libs'])
|
|
||||||
return ret
|
|
||||||
|
|
||||||
|
|
||||||
Index: sunpinyin-20190805/python/pinyin_info_gen.py
|
|
||||||
===================================================================
|
|
||||||
--- sunpinyin-20190805.orig/python/pinyin_info_gen.py
|
|
||||||
+++ sunpinyin-20190805/python/pinyin_info_gen.py
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/python
|
|
||||||
+#!/usr/bin/python3
|
|
||||||
|
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
|
||||||
#
|
|
||||||
@@ -38,60 +38,60 @@
|
|
||||||
from pinyin_data import *
|
|
||||||
|
|
||||||
def fmt_str_array (name, var) :
|
|
||||||
- print 'static const char *%s[] = { %s };' % (name, ', '.join ('"%s"' % s for s in var))
|
|
||||||
+ print('static const char *%s[] = { %s };' % (name, ', '.join ('"%s"' % s for s in var)))
|
|
||||||
|
|
||||||
def fmt_array_size (name):
|
|
||||||
- print 'static const unsigned num_%s = sizeof(%s) / sizeof(*%s);' % (name, name, name)
|
|
||||||
+ print('static const unsigned num_%s = sizeof(%s) / sizeof(*%s);' % (name, name, name))
|
|
||||||
|
|
||||||
def fmt_str_pair_array (name, var) :
|
|
||||||
- print 'static const char *%s[] = {' % name
|
|
||||||
+ print('static const char *%s[] = {' % name)
|
|
||||||
for s1, s2 in var:
|
|
||||||
- print ' %-7s %s' % ('"%s",' % s1, '"%s",' % s2)
|
|
||||||
- print '};'
|
|
||||||
+ print(' %-7s %s' % ('"%s",' % s1, '"%s",' % s2))
|
|
||||||
+ print('};')
|
|
||||||
|
|
||||||
def fmt_pair_array_size (name):
|
|
||||||
- print 'static const unsigned num_%s = sizeof(%s) / sizeof(*%s) / 2;' % (name, name, name)
|
|
||||||
+ print('static const unsigned num_%s = sizeof(%s) / sizeof(*%s) / 2;' % (name, name, name))
|
|
||||||
|
|
||||||
fmt_str_array ('initials', initials)
|
|
||||||
fmt_array_size ('initials')
|
|
||||||
-print ''
|
|
||||||
+print('')
|
|
||||||
|
|
||||||
fmt_str_array('finals', finals)
|
|
||||||
fmt_array_size ('finals')
|
|
||||||
-print ''
|
|
||||||
+print('')
|
|
||||||
|
|
||||||
fmt_str_array('fuzzy_finals', inner_fuzzy_finals)
|
|
||||||
fmt_array_size ('fuzzy_finals')
|
|
||||||
-print ''
|
|
||||||
+print('')
|
|
||||||
|
|
||||||
fmt_str_pair_array ('fuzzy_pairs', fuzzy_pairs)
|
|
||||||
fmt_pair_array_size ('fuzzy_pairs')
|
|
||||||
-print ''
|
|
||||||
+print('')
|
|
||||||
|
|
||||||
fmt_str_pair_array ('auto_correction_pairs', sorted(auto_correction_pairs.items()))
|
|
||||||
fmt_pair_array_size ('auto_correction_pairs')
|
|
||||||
-print ''
|
|
||||||
+print('')
|
|
||||||
|
|
||||||
-print 'static const unsigned fuzzy_finals_map [] = {'
|
|
||||||
+print('static const unsigned fuzzy_finals_map [] = {')
|
|
||||||
for s in inner_fuzzy_finals:
|
|
||||||
- print ' %-7s %-7s %-7s /* %-4s -> %-4s len %d */' % ('0x%02x,' % finals.index(s), '0x%02x,' % valid_syllables[s[1:]], '%d,' % (len(s)-1,), s, s[1:], len(s)-1)
|
|
||||||
-print '};\n'
|
|
||||||
+ print(' %-7s %-7s %-7s /* %-4s -> %-4s len %d */' % ('0x%02x,' % finals.index(s), '0x%02x,' % valid_syllables[s[1:]], '%d,' % (len(s)-1,), s, s[1:], len(s)-1))
|
|
||||||
+print('};\n')
|
|
||||||
|
|
||||||
-print 'static const TPyTabEntry pinyin_table[] = {'
|
|
||||||
+print('static const TPyTabEntry pinyin_table[] = {')
|
|
||||||
for syllable, hex_syllable in sorted(valid_syllables.items()):
|
|
||||||
- print ' { %-9s %s },' % ('"%s",' % syllable, '0x%05x' % hex_syllable)
|
|
||||||
-print '};\n'
|
|
||||||
+ print(' { %-9s %s },' % ('"%s",' % syllable, '0x%05x' % hex_syllable))
|
|
||||||
+print('};\n')
|
|
||||||
|
|
||||||
-print 'static const unsigned fuzzy_pre_syllables [] = {'
|
|
||||||
+print('static const unsigned fuzzy_pre_syllables [] = {')
|
|
||||||
for s in fuzzy_pre_syllables:
|
|
||||||
- print ' %-11s %-7s %-11s /* %s */' % ('0x%05x,' % valid_syllables[s[:-1]], "'%s'," % s[-1], '0x%05x,' % valid_syllables[s], s)
|
|
||||||
-print ' 0x0,'
|
|
||||||
-print '};\n'
|
|
||||||
+ print(' %-11s %-7s %-11s /* %s */' % ('0x%05x,' % valid_syllables[s[:-1]], "'%s'," % s[-1], '0x%05x,' % valid_syllables[s], s))
|
|
||||||
+print(' 0x0,')
|
|
||||||
+print('};\n')
|
|
||||||
|
|
||||||
-print 'static const unsigned fuzzy_pro_syllables [] = {'
|
|
||||||
+print('static const unsigned fuzzy_pro_syllables [] = {')
|
|
||||||
for s in fuzzy_pro_syllables:
|
|
||||||
- print ' %-11s %-7s %-11s /* %s */' % ('0x%05x,' % valid_syllables[s], "'%s'," % s[0], '0x%05x,' % valid_syllables[s[1:]], s)
|
|
||||||
-print ' 0x0,'
|
|
||||||
-print '};\n'
|
|
||||||
+ print(' %-11s %-7s %-11s /* %s */' % ('0x%05x,' % valid_syllables[s], "'%s'," % s[0], '0x%05x,' % valid_syllables[s[1:]], s))
|
|
||||||
+print(' 0x0,')
|
|
||||||
+print('};\n')
|
|
||||||
|
|
||||||
# -*- indent-tabs-mode: nil -*- vim:et:ts=4
|
|
||||||
Index: sunpinyin-20190805/python/quanpin_trie_gen.py
|
|
||||||
===================================================================
|
|
||||||
--- sunpinyin-20190805.orig/python/quanpin_trie_gen.py
|
|
||||||
+++ sunpinyin-20190805/python/quanpin_trie_gen.py
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/python
|
|
||||||
+#!/usr/bin/python3
|
|
||||||
|
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
|
||||||
#
|
|
||||||
@@ -42,7 +42,7 @@ import sys
|
|
||||||
orig_trie = trie.Trie ()
|
|
||||||
pytrie = trie.DATrie ()
|
|
||||||
|
|
||||||
-for syllable, hex_syllable in pinyin_data.valid_syllables.items():
|
|
||||||
+for syllable, hex_syllable in list(pinyin_data.valid_syllables.items()):
|
|
||||||
orig_trie.add(syllable[::-1], hex_syllable)
|
|
||||||
|
|
||||||
pytrie.construct_from_trie (orig_trie)
|
|
||||||
Index: sunpinyin-20190805/python/trie.py
|
|
||||||
===================================================================
|
|
||||||
--- sunpinyin-20190805.orig/python/trie.py
|
|
||||||
+++ sunpinyin-20190805/python/trie.py
|
|
||||||
@@ -133,7 +133,7 @@ class DATrie (object):
|
|
||||||
|
|
||||||
trie = Trie()
|
|
||||||
for w in words:
|
|
||||||
- trie.add (w, itval.next() if itval else -1)
|
|
||||||
+ trie.add (w, next(itval) if itval else -1)
|
|
||||||
|
|
||||||
self.construct_from_trie (trie, values!=None)
|
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ class DATrie (object):
|
|
||||||
if progress_cb:
|
|
||||||
progress_cb ()
|
|
||||||
|
|
||||||
- for i in xrange (self.chr_encoder (max(trie.root.trans))+1):
|
|
||||||
+ for i in range (self.chr_encoder (max(trie.root.trans))+1):
|
|
||||||
if self.check[i] == -1:
|
|
||||||
self.check[i] = 0
|
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ def test ():
|
|
||||||
v, l = match_longest (datrie, s+'b')
|
|
||||||
assert (len(s) == l and valid_syllables[s] == v)
|
|
||||||
|
|
||||||
- print 'test executed successfully'
|
|
||||||
+ print('test executed successfully')
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
test ()
|
|
||||||
108
sunpinyin.spec
108
sunpinyin.spec
@ -1,108 +0,0 @@
|
|||||||
# TODO: fixes scons to generate debug information
|
|
||||||
#%%global debug_package %{nil}
|
|
||||||
|
|
||||||
%define _xinputconf %{_sysconfdir}/X11/xinit/xinput.d/xsunpinyin.conf
|
|
||||||
%define gitdate 20190805
|
|
||||||
|
|
||||||
Name: sunpinyin
|
|
||||||
Version: 3.0.0
|
|
||||||
Release: 5
|
|
||||||
Summary: A statistical language model based Chinese input method engine
|
|
||||||
License: LGPL-2.0-only or CDDL-1.0 or CC-BY-SA-3.0
|
|
||||||
Obsoletes: %{name}-data-le
|
|
||||||
Obsoletes: %{name}-data-be
|
|
||||||
URL: http://code.google.com/p/sunpinyin/
|
|
||||||
Source0: %{name}-%{gitdate}.tar.xz
|
|
||||||
Source2: http://downloads.sourceforge.net/project/open-gram/lm_sc.3gm.arpa-20140820.tar.bz2
|
|
||||||
Source3: http://downloads.sourceforge.net/project/open-gram/dict.utf8-20131214.tar.bz2
|
|
||||||
Patch0: sunpinyin-use-python3.patch
|
|
||||||
Patch1: sunpinyin-fixes-scons.patch
|
|
||||||
Patch2: 0001-add-loongarch64-support.patch
|
|
||||||
Patch3: add-sw-support.patch
|
|
||||||
BuildRequires: gcc-c++, sqlite-devel, gettext, python3-scons, perl(Pod::Man), python3-devel
|
|
||||||
|
|
||||||
%description
|
|
||||||
Sunpinyin is an input method engine for Simplified Chinese. It is an SLM based
|
|
||||||
IM engine, and features full sentence input.
|
|
||||||
|
|
||||||
SunPinyin has been ported to various input method platforms and operating
|
|
||||||
systems. The 2.0 release currently supports iBus, XIM, and Mac OS X.
|
|
||||||
|
|
||||||
%package devel
|
|
||||||
Summary: Development files for %{name}
|
|
||||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
|
||||||
|
|
||||||
%description devel
|
|
||||||
The %{name}-devel package contains libraries and header files that allows user
|
|
||||||
to write their own front-end for sunpinyin.
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%setup -q -n %{name}-%{gitdate}
|
|
||||||
%patch0 -p1 -b .python3
|
|
||||||
%patch1 -p1 -b .scons
|
|
||||||
%patch2 -p1
|
|
||||||
%patch3 -p1
|
|
||||||
|
|
||||||
mkdir -p raw
|
|
||||||
cp %SOURCE2 raw
|
|
||||||
cp %SOURCE3 raw
|
|
||||||
pushd raw
|
|
||||||
tar xvf lm_sc.3gm.arpa-20140820.tar.bz2
|
|
||||||
tar xvf dict.utf8-20131214.tar.bz2
|
|
||||||
popd
|
|
||||||
# fix strip
|
|
||||||
sed -i 's|-Wall|-Wall -s -g|' SConstruct SConstruct.python3 SConstruct.scons
|
|
||||||
sed -i 's|-std=c++11|-std=c++11 -s -g|' SConstruct SConstruct.python3 SConstruct.scons
|
|
||||||
|
|
||||||
%build
|
|
||||||
# export CFLAGS, CXXFLAGS, LDFLAGS, ...
|
|
||||||
%configure || :
|
|
||||||
|
|
||||||
scons %{?_smp_mflags} --prefix=%{_prefix} --libdir=%{_libdir} --datadir=%{_datadir}
|
|
||||||
export PATH=`pwd`/src:$PATH
|
|
||||||
pushd raw
|
|
||||||
ln -sf ../doc/SLM-inst.mk Makefile
|
|
||||||
make %{?_smp_mflags} VERBOSE=1
|
|
||||||
popd
|
|
||||||
|
|
||||||
%install
|
|
||||||
scons %{?_smp_mflags} --prefix=%{_prefix} --libdir=%{_libdir} --datadir=%{_datadir} install --install-sandbox=%{buildroot}
|
|
||||||
pushd raw
|
|
||||||
make install DESTDIR=%{buildroot} INSTALL="install -p"
|
|
||||||
popd
|
|
||||||
install -m0644 AUTHORS TODO %{buildroot}%{_docdir}/%{name}
|
|
||||||
|
|
||||||
|
|
||||||
%ldconfig_scriptlets
|
|
||||||
|
|
||||||
%files
|
|
||||||
%license COPYING *.LICENSE
|
|
||||||
%{_libdir}/libsunpinyin*.so.*
|
|
||||||
%{_datadir}/%{name}
|
|
||||||
%{_bindir}/*
|
|
||||||
%{_mandir}/man1/*.1.gz
|
|
||||||
%{_docdir}/%{name}/SLM-*.mk
|
|
||||||
%{_docdir}/%{name}/README
|
|
||||||
%{_docdir}/%{name}/AUTHORS
|
|
||||||
%{_docdir}/%{name}/TODO
|
|
||||||
|
|
||||||
%files devel
|
|
||||||
%{_libdir}/libsunpinyin*.so
|
|
||||||
%{_libdir}/pkgconfig/sunpinyin*.pc
|
|
||||||
%{_includedir}/sunpinyin*
|
|
||||||
|
|
||||||
%changelog
|
|
||||||
* Mon Mar 03 2025 maqi <maqi@uniontech.com> - 3.0.0-5
|
|
||||||
- Add sw_64 support
|
|
||||||
|
|
||||||
* Thu Aug 17 2023 haomimi <haomimi@uniontech.com> - 3.0.0-4
|
|
||||||
- add loongarch64 support
|
|
||||||
|
|
||||||
* Mon Mar 20 2023 liweiganga <liweiganga@uniontech.com> - 3.0.0-3
|
|
||||||
- feat: fix strip and enable debug
|
|
||||||
|
|
||||||
* Wed Jul 27 2022 yaoxin <yaoxin30@h-partners.com> - 3.0.0-2
|
|
||||||
- License compliance rectification
|
|
||||||
|
|
||||||
* Tue Dec 22 2020 weidong <weidong@uniontech.com> - 3.0.0-1
|
|
||||||
- Initial Package
|
|
||||||
Loading…
x
Reference in New Issue
Block a user