Permalink
Browse files

template; nothing works; compiles

  • Loading branch information...
0 parents commit a9dbf80bc27d3d54ded6afc6b958f6a01b085bc8 taylorchu committed Dec 30, 2011
Showing with 832 additions and 0 deletions.
  1. +7 −0 .gitignore
  2. +2 −0 AUTHORS
  3. +32 −0 CMakeLists.txt
  4. +340 −0 COPYING
  5. +15 −0 INSTALL
  6. +2 −0 README
  7. +21 −0 cmake/cmake_uninstall.cmake.in
  8. +2 −0 data/CMakeLists.txt
  9. +10 −0 data/fcitx-chewing.conf.in
  10. +7 −0 data/fcitx-chewing.desc
  11. +26 −0 po/CMakeLists.txt
  12. +7 −0 po/POTFILES.in.in
  13. +46 −0 po/getdescpo
  14. +33 −0 po/zh_CN.po
  15. +18 −0 src/CMakeLists.txt
  16. +26 −0 src/config.c
  17. +179 −0 src/eim.c
  18. +59 −0 src/eim.h
@@ -0,0 +1,7 @@
+build/*
+*.kdev4
+.kdev_include_paths
+.directory
+*.kate-swp
+*.orig
+*~
@@ -0,0 +1,2 @@
+Weng Xuetian <wengxt@gmail.com>
+Tai-Lin Chu <tailinchu@gmail.com>
@@ -0,0 +1,32 @@
+cmake_minimum_required (VERSION 2.6)
+
+project(fcitx-chewing)
+
+FIND_PACKAGE(Gettext REQUIRED)
+FIND_PACKAGE(Fcitx REQUIRED)
+
+# uninstall target
+configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+ IMMEDIATE @ONLY)
+
+add_custom_target(uninstall
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
+
+set(CMAKE_C_FLAGS "-Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -fvisibility=hidden ${CMAKE_C_FLAGS}")
+set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -fvisibility=hidden ${CMAKE_CXX_FLAGS}")
+set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed ${CMAKE_SHARED_LINKER_FLAGS}")
+set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--as-needed ${CMAKE_MODULE_LINKER_FLAGS}")
+
+if(NOT DEFINED LIB_INSTALL_DIR)
+ set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib)
+endif()
+
+set(HAVE_CONFIG_H)
+
+set(libdir ${LIB_INSTALL_DIR})
+
+add_subdirectory(src)
+add_subdirectory(data)
+add_subdirectory(po)
340 COPYING

Large diffs are not rendered by default.

Oops, something went wrong.
15 INSTALL
@@ -0,0 +1,15 @@
+fcitx-chewing install instructions
+=================================================
+
+To compile and install, go in the source directory and type:
+mkdir build; cd build
+cmake ..
+(If you want to install in a different path, use instead:
+cmake .. -DCMAKE_INSTALL_PREFIX=/install/path)
+make
+
+To install, become root if required:
+
+make install
+
+Once installed, you can restart fcitx and it will be enabled by default.
2 README
@@ -0,0 +1,2 @@
+fcitx-chewing
+Chewing Wrapper for Fcitx.
@@ -0,0 +1,21 @@
+if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+ message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
+endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+string(REGEX REPLACE "\n" ";" files "${files}")
+foreach (file ${files})
+ message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
+ if (EXISTS "$ENV{DESTDIR}${file}" OR IS_SYMLINK "$ENV{DESTDIR}${file}")
+ execute_process(
+ COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
+ OUTPUT_VARIABLE rm_out
+ RESULT_VARIABLE rm_retval
+ )
+ if(NOT ${rm_retval} EQUAL 0)
+ message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
+ endif (NOT ${rm_retval} EQUAL 0)
+ else (EXISTS "$ENV{DESTDIR}${file}" OR IS_SYMLINK "$ENV{DESTDIR}${file}")
+ message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
+ endif (EXISTS "$ENV{DESTDIR}${file}" OR IS_SYMLINK "$ENV{DESTDIR}${file}")
+endforeach(file)
@@ -0,0 +1,2 @@
+fcitx_add_addon_conf_file(fcitx-chewing.conf)
+fcitx_add_configdesc_file(fcitx-chewing.desc)
@@ -0,0 +1,10 @@
+[Addon]
+Name=fcitx-chewing
+_GeneralName=Chewing
+_Comment=Chewing Wrapper For Fcitx
+Category=InputMethod
+Enabled=True
+Library=fcitx-chewing.so
+Type=SharedLibrary
+IMRegisterMethod=ConfigFile
+Dependency=fcitx-punc
@@ -0,0 +1,7 @@
+[Chewing/Priority]
+Type=Integer
+DefaultValue=1
+Description=Priority of Chewing
+
+[DescriptionFile]
+LocaleDomain=fcitx-chewing
@@ -0,0 +1,26 @@
+set(PO_FILES zh_CN.po)
+file(RELATIVE_PATH REL_SOURCE_ROOT ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR})
+if ("${REL_SOURCE_ROOT}" STREQUAL "")
+ set(REL_SOURCE_ROOT ".")
+endif("${REL_SOURCE_ROOT}" STREQUAL "")
+
+set(POT_FILE ${CMAKE_CURRENT_BINARY_DIR}/fcitx-chewing.pot)
+
+configure_file(POTFILES.in.in ${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in)
+
+extract_fcitx_addon_conf_postring()
+
+add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/desc.po
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/getdescpo ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS getdescpo)
+
+add_custom_command(
+ OUTPUT ${POT_FILE}
+ COMMAND INTLTOOL_EXTRACT=${INTLTOOL_EXTRACT} srcdir=${CMAKE_CURRENT_BINARY_DIR} ${INTLTOOL_UPDATE} --gettext-package fcitx-chewing --pot
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/conf.po ${CMAKE_CURRENT_BINARY_DIR}/desc.po
+ )
+
+# Update .po files and compile them to binary .gmo files
+gettext_create_translations(${POT_FILE} ALL ${PO_FILES})
+
@@ -0,0 +1,7 @@
+# List of source files which contain translatable strings.
+./po/desc.po
+./po/conf.po
+@REL_SOURCE_ROOT@/src/eim.c
+@REL_SOURCE_ROOT@/src/eim.h
+@REL_SOURCE_ROOT@/src/config.c
+@REL_SOURCE_ROOT@/data/fcitx-chewing.conf.in
@@ -0,0 +1,46 @@
+#!/bin/sh
+filename=desc.po
+indir=$1
+outdir=$2
+
+cd "$outdir"
+
+rm -f "$outdir/$filename"; touch "$outdir/$filename"
+
+cat > "$outdir/$filename" <<EOF
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
+"POT-Creation-Date: 2010-11-17 11:48+0800\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+EOF
+
+cd $indir
+
+descfiles=`find "$indir" -name ".hg" -prune -or -name "test" -prune -or -iname "*.desc" | grep desc`
+
+# Extract Description
+for f in $descfiles
+do
+ awk '/^[\t ]*Description=/ { print "\n#: '$f':" NR"\n" "msgid \"" substr($0, 13)"\"\n" "msgstr \"\""}' "$f" >> "$outdir/$filename"
+done
+
+# Extract Group Name
+grep -nH '^\[' $descfiles | grep -v 'DescriptionFile' | awk ' "^[" { split($0, a, ":"); split(a[3], b, "/"); print substr(b[1], 2); }' | sort | uniq | awk '{ print "# unknown\nmsgid \""$0"\"\nmsgstr \"\"\n"; }' >> "$outdir/$filename"
+
+# Extract Enum Name
+grep -h 'Enum[0-9]' $descfiles | sed -e 's/Enum[0-9]=//g' | sort | uniq | awk '{ print "#: unknown\nmsgid \""$0"\"\nmsgstr \"\"\n"; }' >> "$outdir/$filename"
+
@@ -0,0 +1,33 @@
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+#
+# Weng Xuetian <wengxt@gmail.com>, 2010, 2011.
+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-12-30 14:45-0800\n"
+"PO-Revision-Date: 2011-08-12 01:54+0800\n"
+"Last-Translator: \n"
+"Language-Team: Chinese Simplified <kde-i18n-doc@kde.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Lokalize 1.2\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+
+# unknown
+#: /home/march/fcitx-hangul/build/po/tmp/fcitx-chewing.conf.in.h:1
+#: /home/march/fcitx-hangul/build/po/../..//src/eim.c:78
+msgid "Chewing"
+msgstr "Chewing"
+
+#: /home/march/fcitx-hangul/build/po/tmp/fcitx-chewing.conf.in.h:2
+msgid "Chewing Wrapper For Fcitx"
+msgstr "Fcitx 的 Chewing 封装"
+
+# unknown
+#: /home/march/fcitx-hangul/data/fcitx-chewing.desc:4
+msgid "Priority of Chewing"
+msgstr "Chewing 的优先级"
@@ -0,0 +1,18 @@
+include(FindPkgConfig)
+
+PKG_CHECK_MODULES(CHEWING REQUIRED "chewing" )
+
+include_directories (${CHEWING_INCLUDE_DIRS})
+include_directories (${FCITX4_FCITX_INCLUDE_DIRS})
+include_directories (${FCITX4_FCITX_CONFIG_INCLUDE_DIRS})
+include_directories (${FCITX4_FCITX_UTILS_INCLUDE_DIRS})
+
+set( fcitx_chewing_sources
+ eim.c
+ config.c
+ )
+
+add_definitions( -DLOCALEDIR=\"${CMAKE_INSTALL_PREFIX}/share/locale\" )
+
+fcitx_add_addon(fcitx-chewing ${fcitx_chewing_sources} )
+target_link_libraries (fcitx-chewing ${CHEWING_LIBRARIES})
@@ -0,0 +1,26 @@
+/***************************************************************************
+ * Copyright (C) 2010~2010 by CSSlayer *
+ * wengxt@gmail.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#include "eim.h"
+
+/* USE fcitx provided macro to bind config and variable */
+CONFIG_BINDING_BEGIN(FcitxChewingConfig)
+CONFIG_BINDING_REGISTER("Chewing", "Priority", iChewingPriority)
+CONFIG_BINDING_END()
Oops, something went wrong.

0 comments on commit a9dbf80

Please sign in to comment.