222 lines
6.7 KiB
Bash
222 lines
6.7 KiB
Bash
# Template file for 'mozc'
|
|
pkgname=mozc
|
|
# src/data/version/mozc_version_template.bzl
|
|
# revision is always 102, template always says 100 ;)
|
|
version=2.28.4800.102
|
|
revision=1
|
|
_commit=056163a5fddbb261b258beb8444998e4882f0cc5
|
|
_abseil=20211102.0
|
|
_gyp=0.1+20220404git9ecf45e
|
|
_jpn_dict=e5b3425575734c323e1d947009dd74709437b684
|
|
create_wrksrc=yes
|
|
build_wrksrc=mozc/src
|
|
hostmakedepends="gettext ninja pkg-config protobuf protobuf-devel
|
|
python3-six which qt5-qmake qt5-host-tools"
|
|
makedepends="gtk+-devel ibus-devel libzinnia-devel protobuf-devel qt5-devel
|
|
fcitx-devel libfcitx5-devel"
|
|
depends="tegaki-zinnia-japanese>=0.3 mozc-base-${version}_${revision}"
|
|
short_desc="Japanese IME (Open Source version of Google Japanese Input)"
|
|
maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
|
|
license="BSD-3-Clause"
|
|
homepage="https://github.com/google/mozc"
|
|
distfiles="
|
|
https://github.com/fcitx/mozc/archive/$_commit.tar.gz
|
|
https://github.com/abseil/abseil-cpp/archive/refs/tags/$_abseil.tar.gz
|
|
${DEBIAN_SITE}/main/g/gyp/gyp_$_gyp.orig.tar.xz
|
|
https://github.com/hiroyuki-komatsu/japanese-usage-dictionary/archive/$_jpn_dict.tar.gz
|
|
"
|
|
checksum="259d87bfd7535ad03bd554185677d7345a90166353a6db0b6a3606183ad2923d
|
|
dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4
|
|
0325006f012db66dfa27bf7bb048f3fe38f96e512ebe065930cbc70bcdc06bc9
|
|
0b6efee0eebac2c1a8eeea333278aa40fcef7846bba9a379962c6e567e7e3dc1"
|
|
|
|
CXXFLAGS="-D_GNU_SOURCE"
|
|
lib32disabled=yes
|
|
|
|
if [ "$XBPS_TARGET_ENDIAN" = "be" ]; then
|
|
broken="Does not build"
|
|
fi
|
|
|
|
if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
|
|
makedepends+=" libatomic-devel"
|
|
fi
|
|
|
|
post_extract() {
|
|
mv mozc-* mozc
|
|
|
|
# symlink "submodules" into place
|
|
for _src_dest in gyp \
|
|
abseil-cpp \
|
|
japanese-usage-dictionary:japanese_usage_dictionary
|
|
do
|
|
_src=${_src_dest%:*}
|
|
_dst=${_src_dest#*:}
|
|
mv $_src-* $_dst
|
|
rmdir mozc/src/third_party/$_dst
|
|
ln -sr $_dst mozc/src/third_party
|
|
done
|
|
}
|
|
|
|
do_configure() {
|
|
GYP_DEFINES="
|
|
document_dir=/usr/share/licenses/${pkgname}
|
|
ibus_mozc_path=/usr/libexec/ibus-engine-mozc
|
|
use_libprotobuf=1
|
|
use_libzinnia=1
|
|
${XBPS_TARGET_NO_ATOMIC8:+use_libatomic=1}
|
|
" python3 build_mozc.py gyp --target_platform=Linux
|
|
}
|
|
|
|
do_build() {
|
|
local _file _lang
|
|
local _modir=out_linux/Release/gen/unix/fcitx5/po
|
|
|
|
python3 build_mozc.py build \
|
|
--use_gyp_for_ibus_build \
|
|
-c Release \
|
|
server/server.gyp:mozc_server \
|
|
gui/gui.gyp:mozc_tool \
|
|
unix/emacs/emacs.gyp:mozc_emacs_helper \
|
|
unix/ibus/ibus.gyp:ibus_mozc \
|
|
renderer/renderer.gyp:mozc_renderer \
|
|
unix/fcitx/fcitx.gyp:fcitx-mozc \
|
|
unix/fcitx5/fcitx5.gyp:fcitx5-mozc
|
|
|
|
mkdir -p $_modir
|
|
for _file in unix/fcitx5/po/*.po
|
|
do
|
|
_lang=${_file##*/}
|
|
_lang=${_lang%.po}
|
|
msgfmt "$_file" -o $_modir/$_lang.mo
|
|
done
|
|
msgfmt --xml -d unix/fcitx5/po \
|
|
--template unix/fcitx5/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml.in \
|
|
-o $_modir/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml
|
|
|
|
}
|
|
|
|
do_install() {
|
|
local f
|
|
# Base package
|
|
vinstall out_linux/Release/mozc_server 755 usr/lib/mozc
|
|
vlicense data/installer/credits_en.html license.html
|
|
head -n 29 unix/fcitx5/fcitx_key_translator.cc >fcitx.LICENSE
|
|
vlicense fcitx.LICENSE
|
|
# emacs
|
|
vbin out_linux/Release/mozc_emacs_helper
|
|
vinstall unix/emacs/mozc.el 644 usr/share/emacs/site-lisp
|
|
# Qt5 tools
|
|
vinstall out_linux/Release/mozc_tool 755 usr/lib/mozc
|
|
# ibus
|
|
vinstall out_linux/Release/ibus_mozc 755 usr/libexec ibus-engine-mozc
|
|
vinstall out_linux/Release/gen/unix/ibus/mozc.xml 644 \
|
|
usr/share/ibus/component
|
|
vinstall data/images/product_icon_32bpp-128.png 644 \
|
|
usr/share/ibus-mozc product_icon.png
|
|
for f in data/images/unix/48x48/*.png; do
|
|
vinstall "$f" 644 usr/share/ibus-mozc
|
|
done
|
|
vinstall out_linux/Release/mozc_renderer 755 usr/lib/mozc
|
|
# fcitx
|
|
vinstall out_linux/Release/fcitx-mozc.so 644 usr/lib/fcitx
|
|
vinstall unix/fcitx/fcitx-mozc.conf 644 usr/share/fcitx/addon
|
|
vinstall unix/fcitx/mozc.conf 644 usr/share/fcitx/inputmethod
|
|
vinstall data/images/product_icon_32bpp-128.png 644 \
|
|
usr/share/fcitx/mozc/icon mozc.png
|
|
for f in dictionary properties tool; do
|
|
vinstall ../scripts/icons/ui-$f.png 644 \
|
|
usr/share/fcitx/mozc/icon mozc-$f.png
|
|
done
|
|
for f in alpha_full alpha_half direct \
|
|
hiragana katakana_full katakana_half; do
|
|
vinstall data/images/unix/48x48/$f.png 644 \
|
|
usr/share/fcitx/mozc/icon mozc-$f.png
|
|
done
|
|
# fcitx5
|
|
vinstall out_linux/Release/fcitx5-mozc.so 644 usr/lib/fcitx5
|
|
vinstall unix/fcitx5/mozc-addon.conf 644 \
|
|
usr/share/fcitx5/addon mozc.conf
|
|
vinstall unix/fcitx5/mozc.conf 644 usr/share/fcitx5/inputmethod
|
|
vinstall data/images/product_icon_32bpp-128.png 644 \
|
|
usr/share/icons/hicolor/128x128/apps fcitx-mozc.png
|
|
vinstall data/images/unix/ime_product_icon_opensource-32.png 644 \
|
|
usr/share/icons/hicolor/32x32/apps fcitx-mozc.png
|
|
for f in dictionary properties tool; do
|
|
vinstall ../scripts/icons/ui-$f.png 644 \
|
|
usr/share/icons/hicolor/48x48/apps fcitx-mozc-$f.png
|
|
done
|
|
for f in alpha_full alpha_half direct \
|
|
hiragana katakana_full katakana_half; do
|
|
vinstall data/images/unix/48x48/$f.png 644 \
|
|
usr/share/icons/hicolor/48x48/apps fcitx-mozc-${f/_/-}.png
|
|
done
|
|
vinstall out_linux/Release/gen/unix/fcitx5/po/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml \
|
|
644 usr/share/metainfo/
|
|
}
|
|
|
|
mozc-base_package() {
|
|
short_desc+=" - base installation"
|
|
lib32disabled=yes
|
|
replaces="emacs-mozc>=0"
|
|
provides="emacs-mozc-${version}_${revision}"
|
|
pkg_install() {
|
|
vmove usr/bin
|
|
vmove usr/lib/mozc/mozc_server
|
|
vmove usr/share/emacs
|
|
vmove usr/share/licenses
|
|
}
|
|
}
|
|
|
|
ibus-mozc_package() {
|
|
short_desc="Mozc engine for IBus - Client of the Mozc input method"
|
|
depends="mozc-base-${version}_${revision} ibus>=1.5.14"
|
|
lib32disabled=yes
|
|
pkg_install() {
|
|
vmove usr/libexec
|
|
vmove usr/lib/mozc/mozc_renderer
|
|
vmove "usr/share/ibus*"
|
|
}
|
|
}
|
|
|
|
fcitx-mozc_package() {
|
|
short_desc="Mozc engine for fcitx - Client of the Mozc input method"
|
|
depends="mozc-base-${version}_${revision} fcitx>=4.2.9"
|
|
homepage="https://fcitx-im.org/"
|
|
lib32disabled=yes
|
|
pkg_install() {
|
|
local _file _lang
|
|
vmove usr/lib/fcitx
|
|
vmove usr/share/fcitx
|
|
# vmove "usr/share/locale/*/LC_MESSAGES/fcitx-mozc.mo"
|
|
for _file in out_linux/Release/gen/unix/fcitx/po/*.mo
|
|
do
|
|
_lang=${_file##*/}
|
|
_lang=${_lang%.mo}
|
|
vinstall "$_file" 644 \
|
|
usr/share/locale/$_lang/LC_MESSAGES fcitx-mozc.mo
|
|
done
|
|
}
|
|
}
|
|
|
|
fcitx5-mozc_package() {
|
|
short_desc="Mozc engine for fcitx v5"
|
|
depends="mozc-base-${version}_${revision} fcitx5"
|
|
homepage="https://fcitx-im.org/"
|
|
lib32disabled=yes
|
|
pkg_install() {
|
|
local _file _lang
|
|
vmove usr/lib/fcitx5
|
|
vmove usr/share/fcitx5
|
|
vmove usr/share/icons
|
|
# vmove "usr/share/locale/*/LC_MESSAGES/fcitx5-mozc.mo"
|
|
for _file in out_linux/Release/gen/unix/fcitx5/po/*.mo
|
|
do
|
|
_lang=${_file##*/}
|
|
_lang=${_lang%.mo}
|
|
vinstall "$_file" 644 \
|
|
usr/share/locale/$_lang/LC_MESSAGES fcitx5-mozc.mo
|
|
done
|
|
vmove usr/share/metainfo
|
|
}
|
|
}
|