[PATCH] Add package: ibus-chewing

OpenSubmitted by Guu, Jin-Cheng.
2 participants
  • Guu, Jin-Cheng
  • Raghav Gururajan
Guu, Jin-Cheng wrote on 19 Apr 02:02 +0200
(address . guix-patches@gnu.org)
Hello all,
Attached is my first patch to guix. It's for the package`ibus-chewing`, an IBus front-end of Chewing, which is an intelligentChinese input method for Zhuyin (BoPoMoFo) users. A dependency `gob`is also added. Hopefully, this will attract more Chinese users toguix.
Special thanks for their patience and guides to nckx andraghavgururajan on #guix. Most of the code work came fromraghavgururajan.
From bb226b2680d5b66a863ff234d2d0a6207f7f8cb0 Mon Sep 17 00:00:00 2001From: jcguu95 <jcguu95@gmail.com>Date: Sun, 18 Apr 2021 18:32:00 -0500Subject: [PATCH] gnu: Add gob and ibus-chewing.
* gnu/packages/ibus.scm: Add two packages: gob and ibus-chewing.--- gnu/packages/ibus.scm | 138 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+)
Toggle diff (171 lines)diff --git a/gnu/packages/ibus.scm b/gnu/packages/ibus.scmindex e6001efa7f..4d838db44f 100644--- a/gnu/packages/ibus.scm+++ b/gnu/packages/ibus.scm@@ -36,19 +36,24 @@ #:use-module (gnu packages anthy) #:use-module (gnu packages autotools) #:use-module (gnu packages base)+ #:use-module (gnu packages bison) #:use-module (gnu packages boost) #:use-module (gnu packages check) #:use-module (gnu packages cmake) #:use-module (gnu packages databases) #:use-module (gnu packages datastructures) #:use-module (gnu packages dbm)+ #:use-module (gnu packages flex) #:use-module (gnu packages freedesktop) #:use-module (gnu packages gettext) #: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 language) #:use-module (gnu packages logging)+ #:use-module (gnu packages package-management)+ #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) #:use-module (gnu packages serialization)@@ -57,6 +62,139 @@ #:use-module (gnu packages unicode) #:use-module (gnu packages xorg)) +(define-public gob+ (package+ (name "gob")+ (version "2.0.20")+ (source+ (origin+ (method url-fetch)+ (uri+ (string-append "http://ftp.5z.com/pub/gob/gob2-" version ".tar.xz"))+ (sha256+ (base32 "09l0pr83vpl53hyl610qsrlsml2dribijik0b9pfk2m8gk089vpp"))))+ (build-system glib-or-gtk-build-system)+ (inputs+ `(("glib" ,glib)+ ("gtk+" ,gtk+)))+ (native-inputs+ `(("bison" ,bison)+ ("flex" ,flex)+ ("perl" ,perl)+ ("pkg-config" ,pkg-config)))+ (home-page "https://www.jirka.org/gob.html")+ (synopsis "GObject Builder")+ (description "GOB is a preprocessor for making GObjects with inline C code so+that generated files are not edited. Syntax is inspired by Java and Yacc or+Lex. The implementation is intentionally kept simple, and no C actual code+parsing is done.")+ (license gpl2+)))++(define-public ibus-chewing+ (package+ (name "ibus-chewing")+ (version "1.6.1")+ (source+ (origin+ (method git-fetch)+ (uri (git-reference+ (url "https://github.com/definite/ibus-chewing")+ (commit version)+ ;; To pull CMake-Fedora.+ (recursive? #t)))+ (file-name (git-file-name name version))+ (sha256+ (base32 "06vmvkz7jvw2lf0q3qif9ava0kmsjc8jvhvf2ngp0l60b8bi5p03"))))+ (build-system cmake-build-system)+ (arguments+ `(#:configure-flags+ (list+ (string-append "-DLIBEXEC_DIR="+ (assoc-ref %outputs "out")+ "/libexec"))+ #:imported-modules+ (,@%cmake-build-system-modules+ (guix build glib-or-gtk-build-system))+ #:modules+ ((guix build cmake-build-system)+ ((guix build glib-or-gtk-build-system)+ #:prefix glib-or-gtk:)+ (guix build utils))+ #:phases+ (modify-phases %standard-phases+ (delete 'check)+ (add-after 'install 'wrap-env+ (lambda* (#:key inputs outputs #:allow-other-keys)+ (let ((out (assoc-ref outputs "out")))+ (for-each+ (lambda (name)+ (let ((file (string-append out "/libexec/" name))+ (out (assoc-ref outputs "out")))+ (wrap-program file+ `("GI_TYPELIB_PATH" ":" prefix+ (,(string-append (assoc-ref inputs "ibus")+ "/lib/girepository-1.0")))+ `("XDG_DATA_DIRS" ":" prefix+ (,(string-append out "/share"))))))+ '("ibus-engine-chewing" "ibus-setup-chewing")))))+ (add-after 'wrap-env 'glib-or-gtk-compile-schemas+ (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))+ (add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap+ (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap))+ (add-after 'glib-or-gtk-wrap 'custom-check+ (lambda* (#:key outputs #:allow-other-keys)+ ;; Tests write to $HOME.+ (setenv "HOME" (getcwd))+ ;; Tests look for $XDG_RUNTIME_DIR.+ (setenv "XDG_RUNTIME_DIR" (getcwd))+ ;; Tests look for $XDG_DATA_DIRS.+ (setenv "XDG_DATA_DIRS"+ (string-append (getenv "XDG_DATA_DIRS")+ ":" (assoc-ref outputs "out") "/share"))+ ;; For missing '/etc/machine-id'.+ (setenv "DBUS_FATAL_WARNINGS" "0")+ ;; Tests require a running X server.+ (system "Xvfb :1 +extension GLX &")+ (setenv "DISPLAY" ":1")+ ;; Tests require running iBus daemon.+ (system "ibus-daemon --daemonize")+ (with-directory-excursion "test-bin"+ (for-each (lambda (test)+ (invoke test))+ (list+ "./IBusChewingPreEdit-test"+ "./ibus-chewing-engine-test"+ "./MakerDialogUtil-test"+ "./IBusChewingUtil-test"+ "./MakerDialogBackend-test"))))))))+ (inputs+ `(("glib" ,glib)+ ("gob" ,gob)+ ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)+ ("gtk" ,gtk+-2)+ ("ibus" ,ibus)+ ("libnotify" ,libnotify)+ ("libchewing" ,libchewing)+ ("libx11" ,libx11)+ ("libxtst" ,libxtst)+ ("rpm" ,rpm)))+ (native-inputs+ `(("gettext" ,gettext-minimal)+ ("glib-bin" ,glib "bin")+ ("perl" ,perl)+ ("pkg-config" ,pkg-config)+ ("xorg-server" ,xorg-server-for-tests)))+ (home-page "https://github.com/definite/ibus-chewing")+ (synopsis "Chewing engine for IBus")+ (description "IBus-Chewing is an IBus front-end of Chewing,+an intelligent Chinese input method for Zhuyin (BoPoMoFo) users.")+ (license+ (list+ ;; CMake-Fedora.+ expat+ ;; Others.+ gpl2+))))+ (define-public ibus (package (name "ibus")-- 2.31.1
Raghav Gururajan wrote on 19 Apr 14:21 +0200
(address . 47884@debbugs.gnu.org)
Hi Jin-Cheng!
Congratulations on your first patch. \o/
You don't have to under-sell your work. I just cleaned up the pack-def and fixed the glib schema error. All others are your work. :-)
Also, if anyone helps you with code/snippet in #guix, you don't have to use the same code/snippet. You are free to adopt them in any way you see fit. Folks usually share a code/snippet, purely for informational purposes.
[1] As Julien mentioned in #guix, it is better to make two patches, one for dependency package and one for the main package.
[2] Package gob appears to be a candidate for glib.scm. So its better to move this package to glib.scm.
[3] In Guix, we try to avoid bundled stuff, for better security and reproducibilty. It'd be great if you package cmake-fedora separately (like gob) and remove the use of `recursive? #t`, in ibus-chewing.
As usual, if you have any questions, feel to free to ask around in #guix. ;-)
Attachment: OpenPGP_signature