summaryrefslogtreecommitdiff
path: root/libraries/libchewing
diff options
context:
space:
mode:
authorGuan-Zhong Huang <imprazaguy@gmail.com>2010-07-05 14:35:20 -0400
committerErik Hanson <erik@slackbuilds.org>2010-07-06 02:33:54 -0500
commit5a9673ed285889fe6dd7599aa05d739dea1661bc (patch)
tree4ea59fda1bc8ec20d24eec70c103a5700bb3c600 /libraries/libchewing
parent1094379a98ffb4cd0a35ea4fc54b2def1149b35d (diff)
downloadslackbuilds-5a9673ed285889fe6dd7599aa05d739dea1661bc.tar.gz
libraries/libchewing: Added patch for ibus-chewing.
Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
Diffstat (limited to 'libraries/libchewing')
-rw-r--r--libraries/libchewing/README3
-rw-r--r--libraries/libchewing/libchewing-rev1048.patch235
-rw-r--r--libraries/libchewing/libchewing.SlackBuild6
3 files changed, 241 insertions, 3 deletions
diff --git a/libraries/libchewing/README b/libraries/libchewing/README
index 9765869752..fa4340f6cd 100644
--- a/libraries/libchewing/README
+++ b/libraries/libchewing/README
@@ -1,2 +1,5 @@
libchewing is a library required by New Chewing Input Method, which is a good
Traditional Chinese intelligent phonetic input method.
+
+This SlackBuild script provides a patch to patch source to rev1048. It is
+required by ibus-chewing.
diff --git a/libraries/libchewing/libchewing-rev1048.patch b/libraries/libchewing/libchewing-rev1048.patch
new file mode 100644
index 0000000000..1a2b10bdf1
--- /dev/null
+++ b/libraries/libchewing/libchewing-rev1048.patch
@@ -0,0 +1,235 @@
+Index: test/randkeystroke.c
+===================================================================
+--- test/randkeystroke.c (revision 1038)
++++ test/randkeystroke.c (revision 1048)
+@@ -46,6 +46,7 @@
+ printf( "usage: randkeystroke [-r] [-n num] [-h]\n" \
+ "\t -r - total random\n" \
+ "\t -n num - generate num keystrokes\n"
++ "\t -s seed - random seed\n"
+ "\t -h - help\n" );
+ }
+
+@@ -63,6 +64,9 @@
+ nk = atoi( argv[i] );
+ } else if ( ! strcmp( argv[i], "-r" ) ) {
+ total_random = 1;
++ } else if ( ! strcmp( argv[i], "-s" ) ) {
++ if ( ++i < argc )
++ srand( atoi( argv[i] ) );
+ } else if ( ! strcmp( argv[i], "-h" ) ) {
+ usage();
+ return 0;
+@@ -71,7 +75,7 @@
+ if (total_random) {
+ for ( i = 0; i < nk; i++ ) {
+ n = rand() % (n_nkeys + n_okeys);
+- if ( n > n_nkeys )
++ if ( n >= n_nkeys )
+ printf( "%s", other_keys[n - n_nkeys] );
+ else
+ printf( "%c", normal_keys[n] );
+@@ -97,4 +101,5 @@
+ return 0;
+ }
+
+-/* vim: noet */
++/* vim: noet
++ */
+Index: python/chewing.py
+===================================================================
+--- python/chewing.py (revision 1038)
++++ python/chewing.py (revision 1048)
+@@ -2,9 +2,11 @@
+ from functools import partial
+
+ _libchewing = CDLL('libchewing.so.3')
+-_libchewing.chewing_handle_Default.argtypes = [c_void_p, c_char]
+ _libchewing.chewing_commit_String.restype = c_char_p
+ _libchewing.chewing_buffer_String.restype = c_char_p
++_libchewing.chewing_cand_String.restype = c_char_p
++_libchewing.chewing_zuin_String.restype = c_char_p
++_libchewing.chewing_aux_String.restype = c_char_p
+
+ def Init(datadir, userdir):
+ return _libchewing.chewing_Init(datadir, userdir)
+Index: src/tree.c
+===================================================================
+--- src/tree.c (revision 1038)
++++ src/tree.c (revision 1048)
+@@ -285,25 +285,16 @@
+ for ( i = begin; i <= end; i++ ) {
+ for (
+ child = tree[ tree_p ].child_begin;
+- child <= tree[ tree_p ].child_end;
++ child != -1 && child <= tree[ tree_p ].child_end;
+ child++ ) {
+-#ifdef USE_BINARY_DATA
+- /**
+- * This is a workaround to prevent access violation.
+- *
+- * Sometimes, child < 0 and tree[ child ] refer to an invalid
+- * address for unknown reason.This could be a bug of libchewing.
+- * This serious bug was discovered by seamxr.
+- */
+- if ( child < 0 || child * sizeof(TreeType) > tree_size )
+- return -1;
+-#endif
+
++ assert(0 <= child && child * sizeof(TreeType) < tree_size);
++
+ if ( tree[ child ].phone_id == phoneSeq[ i ] )
+ break;
+ }
+ /* if not found any word then fail. */
+- if ( child > tree[ tree_p ].child_end )
++ if ( child == -1 || child > tree[ tree_p ].child_end )
+ return -1;
+ else {
+ tree_p = child;
+Index: src/mod_aux.c
+===================================================================
+--- src/mod_aux.c (revision 1038)
++++ src/mod_aux.c (revision 1048)
+@@ -90,7 +90,7 @@
+ if ( ctx->output->zuinBuf[ i ].s[ 0 ] != '\0' ) {
+ strcat( s, (char *) (ctx->output->zuinBuf[ i ].s) );
+ if ( zuin_count )
+- *zuin_count++;
++ (*zuin_count)++;
+ }
+ }
+ return s;
+Index: scripts/gen-tabe-diff.sh
+===================================================================
+--- scripts/gen-tabe-diff.sh (revision 1038)
++++ scripts/gen-tabe-diff.sh (revision 1048)
+@@ -1,19 +0,0 @@
+-#!/bin/sh
+-
+-if [ ! -f scripts/gen-tabe-diff.sh ]; then
+- echo -e "\033[44;37m You *MUST* run this script in top dir. \033[m"
+- exit
+-fi
+-
+-if [ ! -f data/tabe-tsi.src ]; then
+- echo -e "\033[44;37m tabe-tsi.src not found. Try to generate. \033[m"
+- sh ./scripts/cvsup-tsi-src.sh
+-fi
+-
+-# compare
+-sort data/tsi.src | cut --delimiter=' ' -f1 > /tmp/orig-tsi
+-sort data/tabe-tsi.src | cut --delimiter=' ' -f1 > /tmp/tabe-tsi
+-diff -u /tmp/orig-tsi /tmp/tabe-tsi > tabe-tsi.diff
+-rm -f /tmp/orig-tsi /tmp/tabe-tsi
+-
+-echo -e "\033[44;37m Please check out tabe-tsi.diff \033[m"
+Index: scripts/tsi-chewing.diff
+===================================================================
+--- scripts/tsi-chewing.diff (revision 1038)
++++ scripts/tsi-chewing.diff (revision 1048)
+@@ -1,51 +0,0 @@
+---- tsidump.c 2004-05-12 23:30:19.000000000 +0800
+-+++ tsidump-chewing.c 2004-05-12 23:29:12.000000000 +0800
+-@@ -65,32 +65,23 @@
+- }
+- i++;
+- len = strlen((char *)tsi->tsi)/2;
+-- fprintf(fp, "%s", tsi->tsi);
+-- if (ref) {
+-- fprintf(fp, " %ld", tsi->refcount);
+-- }
+- if (tsiyin) {
+- ZuYinSymbolSequence zs = NULL;
+-- int begin = 0;
+-
+-- fprintf(fp, " ");
+- for (j = 0; j < tsi->yinnum; j++) {
+-+ if (len > 7)
+-+ continue;
+-+ fprintf(fp, "%s %ld\t", tsi->tsi, tsi->refcount);
+- for (k = 0; k < len; k++) {
+- zs = tabeYinToZuYinSymbolSequence(tsi->yindata[j*len+k]);
+- if (zs) {
+-- if (begin) {
+-- fprintf(fp, "¡@");
+-- }
+-- else {
+-- begin = 1;
+-- }
+-- fprintf(fp, "%s", zs);
+-+ fprintf(fp, "%s ", zs);
+- free(zs);
+- }
+- }
+-+ fprintf(fp, "\n");
+- }
+- }
+-- fprintf(fp, "\n");
+- }
+-
+- db->Close(db);
+-@@ -109,8 +100,8 @@
+- char *db_name, *op_name;
+-
+- db_name = op_name = (char *)NULL;
+-- ref = 0;
+-- tsiyin = 0;
+-+ ref = 1;
+-+ tsiyin = 1;
+-
+- while ((ch = getopt(argc, argv, "d:f:ry")) != -1) {
+- switch(ch) {
+Index: scripts/cvsup-tsi-src.sh
+===================================================================
+--- scripts/cvsup-tsi-src.sh (revision 1038)
++++ scripts/cvsup-tsi-src.sh (revision 1048)
+@@ -1,48 +0,0 @@
+-#!/bin/sh
+-
+-TOP=`pwd`
+-TABE_TSI=$TOP/data/tabe-tsi.src
+-
+-if [ ! -f scripts/cvsup-tsi-src.sh ]; then
+- echo -e "\033[44;37m You *MUST* run this script in top dir. \033[m"
+- exit
+-fi
+-if [ -f $TABE_TSI ]; then
+- echo -e "\033[44;37m tabe-tsi.src done. \033[m"
+- exit
+-fi
+-
+-if [ ! -d libtabe ]; then
+- echo -e "\033[44;37m No libtabe found. cvs check from libtabe \033[m"
+- cvs -z9 -d :pserver:xcin@xcin.linux.org.tw:/home/service/cvsroot/xcin \
+- checkout libtabe
+-fi
+-
+-if [ ! -d libtabe ]; then
+- echo -e "\033[44;37m There were some problems while checking out. \033[m"
+- exit
+-fi
+-
+-pushd libtabe
+-./configure
+-if [ -f Makefile ]; then
+- make clean all
+-
+- # patch tsidump to adapt Chewing
+- pushd util
+- if [ ! -f PATCHED ]; then
+- patch -p0 < $TOP/scripts/tsi-chewing.diff
+- touch PATCHED
+- fi
+- make
+-
+- # generation
+- if [ -f tsidump ]; then
+- ./tsidump -d ../tsi-src/tsi.db > $TABE_TSI
+- fi
+- popd
+-fi
+-popd
+-
+-rm -rf libtabe
+-
diff --git a/libraries/libchewing/libchewing.SlackBuild b/libraries/libchewing/libchewing.SlackBuild
index 096fc0d219..9dc3a2a63b 100644
--- a/libraries/libchewing/libchewing.SlackBuild
+++ b/libraries/libchewing/libchewing.SlackBuild
@@ -2,7 +2,7 @@
# Slackware build script for libchewing
-# Copyright 2009 Guan-Zhong Huang, Taiwan <imprazaguy@gmail.com>
+# Copyright 2010 Guan-Zhong Huang, Taiwan <imprazaguy@gmail.com>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -24,10 +24,9 @@
PRGNAM=libchewing
VERSION=${VERSION:-0.3.2}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
-# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
@@ -64,6 +63,7 @@ cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
cd $PRGNAM-$VERSION
+patch -p0 < $CWD/libchewing-rev1048.patch
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \