阅读:19404回复:10
Yong输入法的编译方法
依赖
小小输入法在linux下开发和编译。没有测试过在其他操作系统下进行编译。 需要是64位系统,32位系统某些模块就没法编译,需要自己手工调整。 gcc 编译器,需要支持c11以上版本。clang应该也行。编译windows相关需要mingw-w64工具链。 nodejs需要0.12版本及以上。 系统中需要安装好相关的开发环境,比如gtk4-devel,gtk3-devel,gtk2-devel,ibus-devel,libxkbcommon-devel,libcurl-devel,wayland-devel, gtk-layer-shell-devel(debian下是libgtk-4-dev libgtk-3-dev libgtk2.0-dev libxkbcommon-dev libibus-1.0-dev libcurl4-openssl-dev libwayland-dev libgtk-layer-shell0-dev)。 准备好build.js,在https://github.com/dgod/build.js 编译 由于git不能存储空目录,所以下载到的源代码缺少一些目录结构,编译前需要先创建好一些目录 mkdir - p {llib,cloud,gbk,mb,vim}/{l32,l64} mkdir -p {im,config}/{l32-gtk3,l32-gtk2,l64-gtk3,l64-gtk2} mkdir -p im/gtk-im/{l32-gtk3,l32-gtk2,l64-gtk3,l64-gtk2} mkdir -p im/IMdkit/{l32,l64} 编译所有相关内容 node build.js 只编译linux相关内容 node build.js l32 l64 编译qt模块 这个编译某些地方是写死了路径的,在某些系统上可能无法编译通过,需要自己调整build.txt。(需要安装包qt5-qtbase-devel,qt5-qtbase-private-devel,debian下是qtbase5-dev,qtbase5-private-dev) node build.js -C im/qt5-im l32-qt5 l64-qt5 代码同样支持qt6 mkdir im/qt5-im/{l32-qt6,l64-qt6,l32-qt5,l64-qt5} node build.js -C im/qt5-im l64-qt5 编译wps使用的模块 安装好wps 编译wps专用qt 参考https://github-wiki-see.page/m/kingsoft-wps/qt5/wiki/Build-Qt-for-WPS,这里需要把build目录放在源代码目录下 cd im/qt5-im mkdir wps export WPS_QT=下载的wps版本qt源代码路径 build wps linux下打包 先node build.js -C install copy 7z(需要系统中安装有p7zip压缩工具) node build.js dist rpm(需要系统中安装有rpmbuild) node build.js rpm deb(需要系统中有dpkg和fakeroot) node build.js deb |
|
沙发#
发布于:2016-08-29 12:02
PKGBUILD for Archlinux
# Maintainer: firef <use_my_id at gmail dot com> pkgname=yong pkgver=2.4.0 pkgrel=1 pkgdesc="Tiny Small Chinese Input Method" arch=('i686') url="https://github.com/dgod/yong" license=('GPL') makedepends=('git' 'nodejs' 'gcc' 'ibus' 'wayland' 'gtk2' 'gtk3' 'libxkbcommon') #provides=("yong=$pkgver") depends=('pango') #install=yong.install source=("git+https://github.com/dgod/yong.git" "git+https://github.com/dgod/build.js.git") md5sums=('SKIP' 'SKIP') pkgver() { cd "$srcdir/$pkgname/install" awk '/%define +version/{print $3}' yong.spec | sed 's|-|.|g' } prepare(){ cd $srcdir/$pkgname mkdir -p {llib,cloud,gbk,mb,vim}/l32 mkdir -p {im,config}/{l32-gtk3,l32-gtk2} mkdir -p im/gtk-im/{l32-gtk3,l32-gtk2} mkdir -p im/IMdkit/l32 sed -i 's/copy_build("l64");//' install/build.txt # modify shuangping rules sed -i -r -e "s/'p'(,[1|2],\"\wh{0,1}un\")/'y'\1/g" \ -e "s/'d'(,[1|2],\"\wh{0,1}uang\")/'l'\1/g" \ -e "s/'d'(,[1|2],\"\wh{0,1}iang\")/'l'\1/g" \ -e "s/'y'(,[1|2],\"\wh{0,1}uai\")/'k'\1/g" \ -e "s/'y'(,[1|2],\"\wh{0,1}ing\")/'k'\1/g" \ -e "s/'w'(,[1|2],\"\wh{0,1}ua\")/'x'\1/g" \ -e "s/'w'(,[1|2],\"\wh{0,1}ia\")/'x'\1/g" \ -e "s/'b'(,[1|2],\"\wh{0,1}ou\")/'z'\1/g" \ -e "s/'z'(,[1|2],\"\wh{0,1}ei\")/'w'\1/g" \ -e "s/'k'(,[1|2],\"\wh{0,1}ao\")/'c'\1/g" \ -e "s/'l'(,[1|2],\"\wh{0,1}ai\")/'d'\1/g" \ -e "s/'n'(,[1|2],\"\wh{0,1}in\")/'b'\1/g" \ -e "s/'x'(,[1|2],\"\wh{0,1}ie\")/'p'\1/g" \ -e "s/'c'(,[1|2],\"\wh{0,1}iao\")/'n'\1/g" common/pinyin.c cp -f common/pinyin.c cloud/pinyin.c sed -i -e 's/default=0/default=6/' \ -e "s|overlay=mb/pinyin.ini|overlay=mb/sp.ini\nsp=zrm|" \ -e "s/select=LSHIFT RSHIFT/select=; '/" \ -e "s/CNen=LCTRL/CNen=LSHIFT/" \ -e "s/page=- =/page=, ./" \ im/yong.ini sed -i 's/"自然码"/"小鹤双拼"/' config/config_ui.c } build() { buildjs="$srcdir/build.js/build.js" cd $srcdir/$pkgname node $buildjs l32 node $buildjs -C install copy } package() { buildjs="$srcdir/build.js/build.js" mkdir -p $pkgdir/usr/bin cp -a $srcdir/$pkgname/install/yong $pkgdir/usr cd $pkgdir/usr/yong ln -sf ../yong/l32/yong-gtk3 $pkgdir/usr/bin/yong ln -sf ../yong/l32/yong-config-gtk3 $pkgdir/usr/bin/yong-config install -D locale/zh_CN.mo $pkgdir/usr/share/locale/zh_CN/LC_MESSAGES/yong.mo install -D l32/gtk-im/im-yong-gtk2.so $pkgdir/usr/lib/gtk-2.0/2.10.0/immodules/im-yong.so install -D l32/gtk-im/im-yong-gtk3.so $pkgdir/usr/lib/gtk-3.0/3.0.0/immodules/im-yong.so } post_install() { gtk-query-immodules-2.0 --update-cache gtk-query-immodules-3.0 --update-cache } post_remove() { gtk-query-immodules-2.0 --update-cache gtk-query-immodules-3.0 --update-cache }把以上脚本存为PKGBUILD..后执行makepkg就会自动编译出Arch专用的安装包了。。 再用root权限执行以下命令就装上了.. pacman -U yong-*.tar.xz需要手动添加以下输入法启动脚本到~/.xprofile文件下。。 export GTK_IM_MODULE=yong export QT_IM_MODULE=yong export XMODIFIERS=@im=yong yong -d注:编译出来自己用。。把内置的自然码双拼改成小鹤双拼(默认输入法). |
|
板凳#
发布于:2016-08-30 10:55
怎么编译成win32版的?
i686-w64-mingw32-gcc -I/run/media/fireflyoo/DD2801CE9FEF970F/msys32/home/Feng/arch-yong/src/yong/llib -I/run/media/fireflyoo/DD2801CE9FEF970F/msys32/home/Feng/arch-yong/src/yong/im -I/run/media/fireflyoo/DD2801CE9FEF970F/msys32/home/Feng/arch-yong/src/yong/im/IMdkit -DCFG_XIM_IBUS `pkg-config --cflags ibus-1.0` -DCFG_XIM_FBTERM -I/run/media/fireflyoo/DD2801CE9FEF970F/msys32/home/Feng/arch-yong/src/yong/im/fbterm -DL_CALL_GLIB_SERVER -D_UNICODE -DUNICODE -march=i686 -Wall -g -O2 -fms-extensions -fno-strict-aliasing -pipe -I/run/media/fireflyoo/DD2801CE9FEF970F/msys32/home/Feng/arch-yong/src/yong/include -I/run/media/fireflyoo/DD2801CE9FEF970F/msys32/home/Feng/arch-yong/src/yong/common `pkg-config --cflags gtk+-3.0` -c /run/media/fireflyoo/DD2801CE9FEF970F/msys32/home/Feng/arch-yong/src/yong/im/ui.c -o ui.o In file included from /usr/include/glib-2.0/gio/gio.h:46:0, from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:28, from /usr/include/gtk-3.0/gdk/gdk.h:32, from /usr/include/gtk-3.0/gtk/gtk.h:30, from /run/media/fireflyoo/DD2801CE9FEF970F/msys32/home/Feng/arch-yong/src/yong/im/ui.c:1: /usr/include/glib-2.0/gio/gcredentials.h:75:1: 错误:未知的类型名‘uid_t’ uid_t g_credentials_get_unix_user (GCredentials *credentials, ^~~~~ /usr/include/glib-2.0/gio/gcredentials.h:79:52: 错误:未知的类型名‘uid_t’ uid_t uid, ^~~~~ In file included from /run/media/fireflyoo/DD2801CE9FEF970F/msys32/home/Feng/arch-yong/src/yong/im/ui.c:2:0: /usr/include/gtk-3.0/gdk/gdkx.h:30:22: 致命错误:X11/Xlib.h:没有那个文件或目录 #include <X11/Xlib.h> ^ 编译中断。我编译失败。。卡在im/ui.c这文件上。。 |
|
地板#
发布于:2016-08-30 12:09
|
|
4楼#
发布于:2017-03-13 00:18
在ubuntuMate1604下试着编译。根据提示,要装上nodejs-legacy才可以运行node.js脚本。
编译时提示出错,估计依赖包没有。不过那些依赖包的确切包名该氏啥呢? 经尝试,有三个包可以装上,不过要增加个加号,devel用dev代替就能装上。 sudo apt install libxkbcommon-dev sudo apt install gtk+2-dev sudo apt install gtk+3-dev 但氏ibus的开发包装不上,不知确切包名氏啥。。。yong输入法怎么还会依赖ibus呢? mate1604@wdnb00:~$ sudo apt install ibus-dev 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 E: 无法定位软件包 ibus-dev |
|
5楼#
发布于:2017-03-13 00:45
原来应该氏libibus-1.0-dev。不过还氏编译出错。
mate1604@wdnb00:/tmp/yong$ node build.js l32 gcc -m32 -march=i686 -I/tmp/yong/llib -I/tmp/yong/im -I/tmp/yong/im/IMdkit -DCFG_XIM_IBUS `pkg-config --cflags ibus-1.0` -DCFG_XIM_FBTERM -I/tmp/yong/im/fbterm -DL_CALL_GLIB_SERVER -Wall -g -O2 -fms-extensions -fno-strict-aliasing -pipe -I/tmp/yong/include -I/tmp/yong/common `pkg-config --cflags gtk+-2.0` -c /tmp/yong/im/ui.c -o ui.o /tmp/yong/im/ui.c:61:22: fatal error: ui-timer.c: 没有那个文件或目录 compilation terminated. 该怎么调整,屮目前所用的电脑氏32位的,所以只需要32版本的。 请楼主和楼上编译成功的坛友指导。 |
|
6楼#
发布于:2017-03-13 10:23
|
|
9楼#
发布于:2018-08-07 11:40
可以把這篇移到“幫助”版塊嗎?
|
|
上一页
下一页