[arch-commits] Commit in fcitx/trunk (PKGBUILD opencc-1.0.patch)
Felix Yan
fyan at archlinux.org
Fri Nov 7 05:33:26 UTC 2014
Date: Friday, November 7, 2014 @ 06:33:25
Author: fyan
Revision: 122136
upgpkg: fcitx 4.2.8.5-6
opencc 1.0.1 rebuild
Added:
fcitx/trunk/opencc-1.0.patch
Modified:
fcitx/trunk/PKGBUILD
------------------+
PKGBUILD | 9 ++++++---
opencc-1.0.patch | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 3 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2014-11-07 04:38:26 UTC (rev 122135)
+++ PKGBUILD 2014-11-07 05:33:25 UTC (rev 122136)
@@ -6,7 +6,7 @@
pkgbase=fcitx
pkgname=('fcitx' 'fcitx-gtk2' 'fcitx-gtk3' 'fcitx-qt4')
pkgver=4.2.8.5
-pkgrel=5
+pkgrel=6
groups=('fcitx-im')
arch=('i686' 'x86_64')
url="http://fcitx-im.org"
@@ -14,14 +14,17 @@
makedepends=('cmake' 'doxygen' 'gtk2' 'gtk3' 'qt4' 'icu' 'mesa' 'opencc' \
'iso-codes' 'gobject-introspection' 'libxkbfile' 'enchant' 'python2')
source=(http://download.fcitx-im.org/$pkgbase/$pkgbase-${pkgver}_dict.tar.xz
- custom-translation-install-dir.patch)
+ custom-translation-install-dir.patch
+ opencc-1.0.patch)
sha512sums=('ee6612a34087135065537fa14f09078bad9f029f69b636fb2221193f23d86c5431a9d8a848b264bdcb259680f6bda41d08d58dcf67d19e5a200cb11fa4a26ffe'
- 'c57ef118b72accdfc42a0035a5318bf4b0ebe082af46efff7bfea4b063d382cc92bef0205555e42d140a6ffcbbdb87d43db833e1a221c5d3a97f12c8720e759a')
+ 'c57ef118b72accdfc42a0035a5318bf4b0ebe082af46efff7bfea4b063d382cc92bef0205555e42d140a6ffcbbdb87d43db833e1a221c5d3a97f12c8720e759a'
+ 'f652e81e5a28107903b3a65601a507eace59aa147ffc19fa6471c902241110209dceb902d659de312c9b16e0efd1b2873316aca652534ba6fb27af81d9f4c08d')
prepare() {
cd ${pkgbase}-${pkgver}
patch -p1 -i ../custom-translation-install-dir.patch
+ patch -p1 -i ../opencc-1.0.patch
}
build() {
Added: opencc-1.0.patch
===================================================================
--- opencc-1.0.patch (rev 0)
+++ opencc-1.0.patch 2014-11-07 05:33:25 UTC (rev 122136)
@@ -0,0 +1,53 @@
+From 3b931e059ffa28066363cd53feae0221cf71714c Mon Sep 17 00:00:00 2001
+From: Weng Xuetian <wengxt at gmail.com>
+Date: Wed, 5 Nov 2014 13:11:23 -0500
+Subject: [PATCH] [chttrans] add support for new opencc
+
+---
+ src/module/chttrans/chttrans-opencc.c | 26 ++++++++++++++++++++++++--
+ 1 file changed, 24 insertions(+), 2 deletions(-)
+
+diff --git a/src/module/chttrans/chttrans-opencc.c b/src/module/chttrans/chttrans-opencc.c
+index a6eb0cd..57ce03b 100644
+--- a/src/module/chttrans/chttrans-opencc.c
++++ b/src/module/chttrans/chttrans-opencc.c
+@@ -6,8 +6,13 @@
+ #include <stdlib.h>
+ #include <dlfcn.h>
+
+-#define _OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD "zhs2zht.ini"
+-#define _OPENCC_DEFAULT_CONFIG_TRAD_TO_SIMP "zht2zhs.ini"
++#define _OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD_OLD "zhs2zht.ini"
++#define _OPENCC_DEFAULT_CONFIG_TRAD_TO_SIMP_OLD "zht2zhs.ini"
++
++#define _OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD "s2t.json"
++#define _OPENCC_DEFAULT_CONFIG_TRAD_TO_SIMP "t2s.json"
++
++
+ static void* _opencc_handle = NULL;
+ static void* (*_opencc_open)(const char* config_file) = NULL;
+ static char* (*_opencc_convert_utf8)(void* opencc, const char* inbuf, size_t length) = NULL;
+@@ -49,6 +54,23 @@ OpenCCInit(FcitxChttrans* transState)
+ return false;
+ transState->ods2t = _opencc_open(_OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD);
+ transState->odt2s = _opencc_open(_OPENCC_DEFAULT_CONFIG_TRAD_TO_SIMP);
++
++ if (transState->ods2t == (void*) -1) {
++ transState->ods2t = _opencc_open(_OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD_OLD);
++ }
++ if (transState->odt2s == (void*) -1) {
++ transState->odt2s = _opencc_open(_OPENCC_DEFAULT_CONFIG_TRAD_TO_SIMP_OLD);
++ }
++
++ // stupid opencc use -1 as failure
++ if (transState->ods2t == (void*) -1) {
++ transState->ods2t = NULL;
++ }
++
++ if (transState->odt2s == (void*) -1) {
++ transState->odt2s = NULL;
++ }
++
+ if (!transState->ods2t && !transState->odt2s)
+ return false;
+ return true;
More information about the arch-commits
mailing list