From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: WIP: ibus-pinyin Date: Sat, 05 Sep 2015 23:15:58 +0200 Message-ID: <87a8t0a7ox.fsf@elephly.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYKok-0000QK-Vf for guix-devel@gnu.org; Sat, 05 Sep 2015 17:16:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYKoh-0005h8-M2 for guix-devel@gnu.org; Sat, 05 Sep 2015 17:16:10 -0400 Received: from sender163-mail.zoho.com ([74.201.84.163]:25475) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYKoh-0005fr-Cf for guix-devel@gnu.org; Sat, 05 Sep 2015 17:16:07 -0400 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi Guix, attached are three patches that show the current status of my work to bring ibus-pinyin to Guix. Unfortunately, it’s not working for me, i.e. I can start ‘ibus-setup’ and add Chinese Pinyin or Chinese Bopomofo to the enabled input methods, but no matter what I do: my selection of input methods (cycling between methods is done with Super+Space by default) has no effect on what I type. To test this yourself I recommend deleting the following dirs: ~/.config/ibus ~/.cache/ibus (Just in case.) You probably also need to set IBUS_COMPONENT_PATH as suggested by the ‘ibus’ package. I also needed to run the dconf service, which can be started by running ‘$dconf/libexec/dconf-service’. Without this service the ‘ibus-setup’ changes have no effect. I played around with generating a GTK_IM_MODULES_FILE using ‘gtk-query-immodules-3.0’, but since I don’t know how to debug ibus-pinyin, I didn’t continue to investigate there. ‘$out/libexec/ibus-setup-pinyin’ cannot be executed at all. If someone could give me a hint how to debug this, I’d be very grateful. It all seems like magic to me, as I cannot see at what point the translation from pinyin input to output characters fails. ~~ Ricardo --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-gnu-Add-PyZy.patch >From c710cd3d64e81b1e2cb80d0bc0cf69f21243ecb7 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sat, 5 Sep 2015 22:39:09 +0200 Subject: [PATCH 1/3] gnu: Add PyZy. * gnu/packages/ibus.scm (pyzy): New variable. --- gnu/packages/ibus.scm | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/gnu/packages/ibus.scm b/gnu/packages/ibus.scm index 1abe70a..9c64530 100644 --- a/gnu/packages/ibus.scm +++ b/gnu/packages/ibus.scm @@ -21,13 +21,18 @@ #:use-module (guix licenses) #:use-module (guix packages) #:use-module (guix download) + #:use-module (guix git-download) #:use-module (guix build-system gnu) #:use-module (guix build-system glib-or-gtk) #:use-module (gnu packages) + #:use-module (gnu packages autotools) + #:use-module (gnu packages base) + #:use-module (gnu packages databases) #:use-module (gnu packages glib) #:use-module (gnu packages gnome) #:use-module (gnu packages gtk) #:use-module (gnu packages iso-codes) + #:use-module (gnu packages linux) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python)) @@ -90,3 +95,57 @@ input method user interface. It comes with multilingual input support. It may also simplify input method development.") (home-page "http://ibus.googlecode.com/") (license lgpl2.1+))) + +(define-public pyzy + ;; There is no release tarball, so we take the last commit. + (let ((commit "6d9c3cdff")) + (package + (name "pyzy") + (version "0.1.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/pyzy/pyzy.git") + (commit commit))) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "0i7lnh5gp25wi9rk5f2pjdlhn7vzs2s7pnfbfgk9q8cmzqkgrh6g")) + (patches (list (search-patch "pyzy-no-download.patch"))))) + (build-system gnu-build-system) + (arguments + '(#:configure-flags '("--enable-db-open-phrase" + "--enable-db-android") + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'unpack-database + (lambda* (#:key inputs #:allow-other-keys) + (zero? (system* "tar" "-C" "data" "-xvf" + (assoc-ref inputs "pyzy-database"))))) + (add-before 'configure 'autoreconf + (lambda _ (zero? (system* "autoreconf" "-vif"))))))) + (inputs + `(("glib" ,glib) + ("libuuid" ,util-linux) + ("sqlite" ,sqlite) + ("pyzy-database" + ,(origin + (method url-fetch) + (uri (string-append "https://pyzy.googlecode.com/files/" + "pyzy-database-1.0.0.tar.bz2")) + (sha256 + (base32 + "08f3jhk48m4pqjaaq69bgxz3djz6m3n593q0z70dzqa1kxxx1irj")))))) + (native-inputs + `(("python" ,python-2) + ("tar" ,tar) + ("pkg-config" ,pkg-config) + ("autoconf" ,autoconf) + ("automake" ,automake) + ("libtool" ,libtool))) + (synopsis "Conversion library for Chinese Pinyin and Bopomofo") + (description + "PyZy is a conversion library for the Chinese input methods Pinyin and +Bopomofo.") + (home-page "https://github.com/pyzy/pyzy") + (license lgpl2.1+)))) -- 2.5.0 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-WIP-gnu-Add-ibus-pinyin.patch >From 41ba1793f1768b4aa3c559e83ec31482cae00f3a Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sat, 5 Sep 2015 23:05:06 +0200 Subject: [PATCH 2/3] WIP: gnu: Add ibus-pinyin. * gnu/packages/ibus.scm (ibus-pinyin): New variable. --- gnu/packages/ibus.scm | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/gnu/packages/ibus.scm b/gnu/packages/ibus.scm index 9c64530..4474665 100644 --- a/gnu/packages/ibus.scm +++ b/gnu/packages/ibus.scm @@ -28,6 +28,7 @@ #:use-module (gnu packages autotools) #:use-module (gnu packages base) #:use-module (gnu packages databases) + #:use-module (gnu packages freedesktop) #:use-module (gnu packages glib) #:use-module (gnu packages gnome) #:use-module (gnu packages gtk) @@ -96,6 +97,60 @@ may also simplify input method development.") (home-page "http://ibus.googlecode.com/") (license lgpl2.1+))) +(define-public ibus-pinyin + (package + (name "ibus-pinyin") + (version "1.5.0") + (source + (origin + (method url-fetch) + (uri (string-append "https://ibus.googlecode.com/files/ibus-pinyin-" + version ".tar.gz")) + (sha256 + (base32 + "15mwpm64mjxm2j9fmjxd74xwngwb88131rj9b3b9zsjirj6lapd8")))) + (build-system glib-or-gtk-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'use-full-python-path + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "setup/ibus-setup-pinyin.in" + (("exec python") + (string-append "exec " (assoc-ref inputs "python") + "/bin/python"))) + #t)) + (add-after 'wrap-program 'wrap-with-additional-paths + (lambda* (#:key inputs outputs #:allow-other-keys) + ;; Make sure 'ibus-setup-pinyin' runs with the correct PYTHONPATH + ;; and GI_TYPELIB_PATH. + ;; TODO: This doesn't work. ibus-setup-pinyin cannot be executed. + (let ((out (assoc-ref outputs "out"))) + (wrap-program (string-append out "/libexec/ibus-setup-pinyin") + `("PYTHONPATH" ":" prefix + (,(getenv "PYTHONPATH"))) + `("GI_TYPELIB_PATH" ":" prefix + (,(getenv "GI_TYPELIB_PATH") + ,(string-append (assoc-ref inputs "ibus") + "/lib/girepository-1.0")))) + #t)))))) + (inputs + `(("ibus" ,ibus) + ("intltool" ,intltool) + ("sqlite" ,sqlite) + ("python" ,python-2) + ("pyxdg" ,python2-pyxdg) + ("pyzy" ,pyzy))) + (native-inputs + `(("gobject-introspection" ,gobject-introspection) + ("pkg-config" ,pkg-config))) + (synopsis "Chinese Pinyin and Bopomofo input methods for IBus") + (description + "This package provides the Chinese Pinyin and Bopomofo input methods for +IBus.") + (home-page "https://github.com/ibus/ibus-pinyin") + (license gpl2+))) + (define-public pyzy ;; There is no release tarball, so we take the last commit. (let ((commit "6d9c3cdff")) -- 2.5.0 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0003-gnu-ibus-Suggest-search-path.patch >From 8191bb145f2c3e97e718cb3f5de6710ccee27310 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sat, 5 Sep 2015 23:05:58 +0200 Subject: [PATCH 3/3] gnu: ibus: Suggest search path. * gnu/packages/ibus.scm (ibus)[native-search-paths]: Add path specification for IBUS_COMPONENT_PATH. --- gnu/packages/ibus.scm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gnu/packages/ibus.scm b/gnu/packages/ibus.scm index 4474665..75b3713 100644 --- a/gnu/packages/ibus.scm +++ b/gnu/packages/ibus.scm @@ -89,6 +89,10 @@ `(("glib" ,glib "bin") ; for glib-genmarshal ("gobject-introspection" ,gobject-introspection) ; for g-ir-compiler ("pkg-config" ,pkg-config))) + (native-search-paths + (list (search-path-specification + (variable "IBUS_COMPONENT_PATH") + (files '("share/ibus/component"))))) (synopsis "Input method framework") (description "IBus is an input framework providing a full-featured and user-friendly -- 2.5.0 --=-=-=--