Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
[submodule "keyman"]
path = keyman
url = https://github.com/keymanapp/keyman
[submodule "kyotocabinet"]
path = kyotocabinet
url = https://github.com/deepin-community/kyotocabinet
[submodule "leveldb"]
path = leveldb
url = https://github.com/google/leveldb
Expand All @@ -58,6 +61,9 @@
[submodule "libmozc"]
path = libmozc
url = https://github.com/fcitx-contrib/fcitx5-mozc
[submodule "libpinyin"]
path = libpinyin
url = https://github.com/libpinyin/libpinyin
[submodule "librime"]
path = librime
url = https://github.com/rime/librime
Expand Down
1 change: 1 addition & 0 deletions kyotocabinet
Submodule kyotocabinet added at 1812d3
1 change: 1 addition & 0 deletions libpinyin
Submodule libpinyin added at a9b614
26 changes: 26 additions & 0 deletions patches/kyotocabinet.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/configure b/configure
index 6447b39..64fec24 100755
--- a/configure
+++ b/configure
@@ -2141,7 +2141,7 @@ MYPCFILES="kyotocabinet.pc"
# Building flags
MYCFLAGS="-Wall -ansi -pedantic -fPIC -fsigned-char -g0 -O2"
MYCXXFLAGS="-Wall -fPIC -fsigned-char -g0 -O2"
-MYCPPFLAGS="-I. -I\$(INCLUDEDIR) -I/usr/local/include"
+MYCPPFLAGS="-I."
MYCPPFLAGS="$MYCPPFLAGS -DNDEBUG -D_GNU_SOURCE=1"
MYCPPFLAGS="$MYCPPFLAGS -D_FILE_OFFSET_BITS=64 -D_REENTRANT -D__EXTENSIONS__"
MYLDFLAGS="-L. -L\$(LIBDIR) -L/usr/local/lib"
diff --git a/kccommon.h b/kccommon.h
index 999f37a..946b8b4 100644
--- a/kccommon.h
+++ b/kccommon.h
@@ -190,7 +190,7 @@ using tr1::unordered_set;
#else
#define __KCFUNC__ "-" ///< for debugging
#endif
-#define _KCCODELINE_ __FILE__, __LINE__, __KCFUNC__ ///< for debugging
+#define _KCCODELINE_ __FILE_NAME__, __LINE__, __KCFUNC__ ///< for debugging

/**
* All symbols of Kyoto Cabinet.
167 changes: 167 additions & 0 deletions patches/libpinyin.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4f62a9f..0942e6b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,7 +15,7 @@
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

######## Project settings
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.5)
set (PACKAGE_NAME libpinyin)
project (${PACKAGE_NAME} CXX C)
enable_testing()
@@ -24,9 +24,9 @@ enable_testing()
set (PACKAGE_URL https://github.com/libpinyin/libpinyin)
set (PACKAGE_BUGREPORT https://github.com/libpinyin/libpinyin/issues)
set (LIBPINYIN_VERSION_MAJOR 2)
-set (LIBPINYIN_VERSION_MINOR 1)
-set (LIBPINYIN_VERSION_REVISION 0)
-set (LIBPINYIN_BINARY_VERSION 13.0)
+set (LIBPINYIN_VERSION_MINOR 11)
+set (LIBPINYIN_VERSION_REVISION 91)
+set (LIBPINYIN_BINARY_VERSION 15.0)

if (CMAKE_BUILD_TYPE MATCHES Debug)
set (version_suffix .Debug)
@@ -79,14 +79,12 @@ endif (DB_FOUND)
if (NOT HAVE_BERKELEY_DB)
# DBM: Kyoto Cabinet
find_package(KyotoCabinet)
- if (KyotoCabinet_FOUND)
include_directories ( ${KyotoCabinet_INCLUDE_PATH} )
SET (LIBS ${LIBS} ${KyotoCabinet_LIBRARY})
SET (HAVE_KYOTO_CABINET 1)
SET (DATABASE_FORMAT "KyotoCabinet")
SET (CMAKE_CXX_LINK_EXECUTABLE
"${CMAKE_CXX_LINK_EXECUTABLE} ${LIBS}")
- endif (KyotoCabinet_FOUND)
endif (NOT HAVE_BERKELEY_DB)


@@ -141,6 +139,12 @@ configure_file(
@ONLY
)

+configure_file(
+ libzhuyin.pc.in
+ libzhuyin.pc
+ @ONLY
+)
+
configure_file(
config.h.cmake
config.h
@@ -150,6 +154,7 @@ configure_file(
install(
FILES
${CMAKE_BINARY_DIR}/libpinyin.pc
+ ${CMAKE_BINARY_DIR}/libzhuyin.pc
DESTINATION
${DIR_LIBRARY}/pkgconfig
)
@@ -178,6 +183,3 @@ include_directories(
######## Subdirectories

add_subdirectory(src)
-add_subdirectory(tests)
-add_subdirectory(utils)
-add_subdirectory(data)
diff --git a/libzhuyin.pc.in b/libzhuyin.pc.in
index f248d1c..0e6b944 100644
--- a/libzhuyin.pc.in
+++ b/libzhuyin.pc.in
@@ -11,5 +11,5 @@ Name: libzhuyin
Description: Library to deal with zhuyin
Version: @VERSION@
Requires: glib-2.0
-Libs: -L${libdir} -lzhuyin
+Libs: -L${libdir} -lpinyin
Cflags: -I${libzhuyinincludedir}
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fe16a66..f8a496f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -10,8 +10,8 @@ set(

add_library(
pinyin
- SHARED
${LIBPINYIN_SOURCES}
+ zhuyin.cpp
)

target_link_libraries(
@@ -41,6 +41,7 @@ install(
install(
FILES
${LIBPINYIN_HEADERS}
+ zhuyin.h
DESTINATION
${DIR_INCLUDE_LIBPINYIN}
)
diff --git a/src/lookup/CMakeLists.txt b/src/lookup/CMakeLists.txt
index 767748c..77da8b1 100644
--- a/src/lookup/CMakeLists.txt
+++ b/src/lookup/CMakeLists.txt
@@ -12,7 +12,7 @@ set(

add_library(
lookup
- STATIC
+ OBJECT
${LIBLOOKUP_SOURCES}
)

diff --git a/src/storage/CMakeLists.txt b/src/storage/CMakeLists.txt
index 26330e0..da215d7 100644
--- a/src/storage/CMakeLists.txt
+++ b/src/storage/CMakeLists.txt
@@ -45,7 +45,7 @@ endif (HAVE_KYOTO_CABINET)

add_library(
storage
- STATIC
+ OBJECT
${LIBSTORAGE_SOURCES}
)

@@ -58,6 +58,7 @@ target_link_libraries(
install(
FILES
${LIBSTORAGE_HEADERS}
+ zhuyin_custom2.h
DESTINATION
${DIR_INCLUDE_LIBPINYIN}
)
diff --git a/src/zhuyin.cpp b/src/zhuyin.cpp
index 1aeecf5..a4d868b 100644
--- a/src/zhuyin.cpp
+++ b/src/zhuyin.cpp
@@ -1127,7 +1127,7 @@ static gint compare_item_with_token(gconstpointer lhs,
#endif

static gint compare_item_with_length_and_frequency(gconstpointer lhs,
- gconstpointer rhs) {
+ gconstpointer rhs, void *) {
lookup_candidate_t * item_lhs = (lookup_candidate_t *)lhs;
lookup_candidate_t * item_rhs = (lookup_candidate_t *)rhs;

@@ -1526,7 +1526,7 @@ bool zhuyin_guess_candidates_after_cursor(zhuyin_instance_t * instance,
_compute_frequency_of_items(context, prev_token, &merged_gram, candidates);

/* sort the candidates by length and frequency. */
- g_array_sort(candidates, compare_item_with_length_and_frequency);
+ g_array_sort(candidates, (GCompareFunc)compare_item_with_length_and_frequency);

/* post process to remove duplicated candidates */

@@ -1607,7 +1607,7 @@ bool zhuyin_guess_candidates_before_cursor(zhuyin_instance_t * instance,
_compute_frequency_of_items(context, prev_token, &merged_gram, items);

/* sort the items by length and frequency. */
- g_array_sort(items, compare_item_with_length_and_frequency);
+ g_array_sort(items, (GCompareFunc)compare_item_with_length_and_frequency);

g_array_append_vals(candidates, items->data, items->len);

4 changes: 4 additions & 0 deletions scripts/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ def install(self):


class MakeBuilder(Builder):
target = ''

def configure(self):
command = './configure'
if PLATFORM == 'js':
Expand All @@ -365,6 +367,7 @@ def configure(self):
'--enable-static',
'--disable-shared',
*self.options,
*(self.js if PLATFORM == 'js' else []),
f'PKG_CONFIG_SYSROOT_DIR={PKG_CONFIG_SYSROOT_DIR}',
f'PKG_CONFIG_PATH={PKG_CONFIG_PATH}',
f'XDG_DATA_DIRS={XDG_DATA_DIRS}'
Expand All @@ -373,6 +376,7 @@ def configure(self):
def build(self):
ensure('make', [
'-j8',
self.target,
f'CFLAGS="{get_platform_cflags()}"',
f'CXXFLAGS="{get_platform_cflags()}"'
])
Expand Down
5 changes: 5 additions & 0 deletions scripts/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'json-glib': ['glib'],
'libgee': ['glib'],
'libkkc': ['json-glib', 'libgee', 'marisa'],
'libpinyin': ['glib', 'kyotocabinet'],
'librime': ['boost', 'glog', 'leveldb', 'lua', 'marisa', 'opencc', 'yaml-cpp'],
'libskk': ['json-glib', 'libgee', 'libxkbcommon'],
'opencc': ['marisa'],
Expand All @@ -21,6 +22,7 @@
'json',
'json-glib',
'keyman-core',
'kyotocabinet',
'leveldb',
'libchewing',
'libexpat',
Expand All @@ -29,6 +31,7 @@
'libintl',
'libkkc',
'libmozc',
'libpinyin',
'librime',
'libskk',
'libthai',
Expand Down Expand Up @@ -102,13 +105,15 @@
'json',
'json-glib',
'keyman-core',
'kyotocabinet',
'leveldb',
'libchewing',
'libexpat',
'libgee',
'libhangul',
'libkkc',
'libmozc',
'libpinyin',
'librime',
'libskk',
'libthai',
Expand Down
20 changes: 20 additions & 0 deletions scripts/kyotocabinet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from common import INSTALL_PREFIX, MakeBuilder, ensure, patch


project = 'kyotocabinet'
patch(project) # hard-coded include directory

class KyotoCabinetBuilder(MakeBuilder):
target = 'libkyotocabinet.a'

def install(self):
usr = f'{self.dest_dir}{INSTALL_PREFIX}'
include_dir = f'{usr}/include'
lib_dir = f'{usr}/lib'
pkgconfig_dir = f'{lib_dir}/pkgconfig'
ensure('mkdir', ['-p', include_dir, pkgconfig_dir])
ensure('cp', ['k*.h', include_dir])
ensure('cp', [self.target, lib_dir])
ensure('cp', ['kyotocabinet.pc', pkgconfig_dir])

KyotoCabinetBuilder(project, js=['--disable-zlib']).exec()
6 changes: 6 additions & 0 deletions scripts/libpinyin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from common import CMakeBuilder, patch

project = 'libpinyin'
patch(project)

CMakeBuilder(project).exec()
Loading