1 # Maintainer: ponsfoot <cabezon dot hashimoto at gmail dot com>
6 ## You can choose the input method framework to use either ibus, scim, uim or both.
7 ## If you will not be using ibus, comment out below.
9 ## If you will be using scim, uncomment below.
11 ## If you will be using uim, uncomment below.
14 ## If you will be using mozc.el on Emacs, uncomment below.
17 ## $QTDIR is changed temporarily and forcibly by default for Qt3 users.
18 ## If you install Qt4 on your custom and set $QTDIR for Qt4, uncomment below.
21 ## ニコニコ大百科IME辞書 (NICONICOPEDIA IME dictionary)
22 ## if you want to make redistributable mozc-ut,
23 ## keep **DISABLE** _NICODIC="yes" please.
26 ## Mozc compile option
30 #*************************************************************
34 # http://code.google.com/p/mozc/
36 # Japanese zip code data by Japan Post
37 # http://www.post.japanpost.jp/zipcode/download.html
39 # Additional dictionary by UT
40 # http://www.geocities.jp/ep3797/mozc_01.html
43 # http://code.google.com/p/macuim/
45 #*************************************************************
49 true && pkgname=('mozc-ut')
56 arch=('i686' 'x86_64')
57 url="http://www.geocities.jp/ep3797/mozc_01.html"
58 license=('BSD' 'GPL' 'CC-BY-SA' 'custom')
59 makedepends=('pkg-config' 'python2' 'gtest' 'zinnia' 'ruby')
61 pkgver=${_mozcver}.${_utdicver}
62 source=(http://mozc.googlecode.com/files/mozc-${_mozcver}.tar.bz2
63 http://downloads.sourceforge.net/mdk-ut/mozcdic-ut-${_utdicver}.tar.bz2
65 http://downloads.sourceforge.net/pnsft-aur/ken_all-${_zipcoderel}.zip
66 http://downloads.sourceforge.net/pnsft-aur/jigyosyo-${_zipcoderel}.zip)
67 sha1sums=('ef3f23083152fa564eba98235e83d72d14a06404'
68 'd0aba35246b3f51797a98edf05ee675b5d14d0ca'
69 'e0ba18e67c1be8e3cfb8ecb30760597b215da255'
70 '099fd4323f0dbd345431a003e718bd978b1f2679'
71 '003d424b788a6d6b1b9f86c30733c5b3083c1a6d'
74 if [[ "$_ibus_mozc" = "yes" ]]; then
75 true && pkgname+=('ibus-mozc-ut')
78 if [[ "$_scim_mozc" = "yes" ]]; then
79 true && pkgname+=('scim-mozc-ut')
82 if [[ "$_emacs_mozc" = "yes" ]]; then
83 true && pkgname+=('emacs-mozc-ut')
86 if [[ "$_uim_mozc" = "yes" ]]; then
87 true && pkgname+=('uim-mozc-ut')
89 source+=(http://downloads.sourceforge.net/project/pnsft-aur/mozc/uim-mozc-${_uimmozcrev}.tar.xz
90 http://protobuf.googlecode.com/files/protobuf-${_protobuf_ver}.tar.bz2)
91 sha1sums+=('7965d1239edb8922f650cf820377c73e98f574b2'
92 'df5867e37a4b51fb69f53a8baf5b994938691d6d')
98 if [[ "$_ibus_mozc" != "yes" && "$_scim_mozc" != "yes" && "$_uim_mozc" != "yes" ]]; then
99 msg "*****************************************************"
100 msg " Please choose either one of ibus, scim or uim"
101 msg " at least. See PKGBUILD."
102 msg "*****************************************************"
106 if [[ "$QTDIR" && -z "$_qtdir" ]]; then
107 msg '====================================================='
108 msg ' *** CAUTION ***'
109 msg ' $QTDIR will be replaced temporarily and forcibly'
110 msg ' for Qt3 users.'
111 msg ' If it is inconvenient for you, please edit'
112 msg ' PKGBUILD. (Please see it for datail)'
113 msg '====================================================='
116 msg '====================================================='
117 msg ' *** Build Info ***'
118 msg ' The following package files will be generated:'
119 for _p in ${pkgname[@]}
121 msg " * ${_p}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
123 msg '====================================================='
127 # Generate mozc-ut dictionary seeds
128 cd "${srcdir}/mozcdic-ut-${_utdicver}"
129 # Adjust for Ruby>=1.9, makepkg, etc.
130 find . -name \*.rb -type f \
131 -exec sed -i -e "2i #-*- encoding: utf-8 -*-" -e "s/\]\.length /\]\.bytesize /g" {} +
132 sed -i -e "s|^MOZCVER=.*|MOZCVER=\"${_mozcver}\"|" \
133 -e "s|^DATE=.*|DATE=\"${_utdicver}\"|" \
134 -e 's|^rm -rf \.\./mozc-$MOZCVER|#&|' \
135 -e 's|^tar jxf mozc-$MOZCVER\.tar\.bz2|#&|' \
136 -e "s/^ruby.*/& || exit 1/g" \
139 [[ "$_NICODIC" = "yes" ]] && sed -i 's/NICODIC="false"/NICODIC="true"/' generate-mozc-ut.sh
140 msg "Generating UT dictionary seed..."
141 sh ./generate-mozc-ut.sh
144 cd "${srcdir}/${pkgbase}-${pkgver}"
147 if [[ "$_uim_mozc" = "yes" ]]; then
148 # patch to link protobuf statically
149 cp -rf "${srcdir}/protobuf-${_protobuf_ver}" protobuf/files
150 patch -p0 -i "${srcdir}/uim-mozc-${_uimmozcrev}/mozc-linux-protobuf.diff"
152 cp -rf "${srcdir}/uim-mozc-${_uimmozcrev}/uim" unix/
154 patch -p0 -i "${srcdir}/uim-mozc-${_uimmozcrev}/mozc-kill-line.diff"
155 # global_language_spec patch
156 patch -p0 -i "${srcdir}/uim-mozc-${_uimmozcrev}/mozc-global_language_spec.diff"
158 # Extract license part of uim-mozc
159 head -n 32 unix/uim/mozc.cc > unix/uim/LICENSE
163 find . -name \*.py -type f -exec sed -i -e "1s|python.*$|python2|" {} +
164 find . -regex ".*\.gypi?$" -type f -exec sed -i -e "s|'python'|'python2'|g" {} +
167 msg "Generating zip code seed..."
168 python2 dictionary/gen_zip_code_seed.py --zip_code="${srcdir}/KEN_ALL.CSV" --jigyosyo="${srcdir}/JIGYOSYO.CSV" >> data/dictionary/dictionary09.txt
171 msg "Starting make..."
173 # Get make -j option from $MAKEFLAGS
174 _jobs=`sed -n -e "s/.*--jobs=\([0-9]\+\).*/\1/p" -e "s/.*-j *\([0-9]\+\).*/\1/p" <<< "$MAKEFLAGS"`
177 _targets="server/server.gyp:mozc_server gui/gui.gyp:mozc_tool "
178 [[ "$_emacs_mozc" = "yes" ]] && _targets+="unix/emacs/emacs.gyp:mozc_emacs_helper "
179 [[ "$_ibus_mozc" = "yes" ]] && _targets+="unix/ibus/ibus.gyp:ibus_mozc "
180 [[ "$_scim_mozc" = "yes" ]] && _targets+="unix/scim/scim.gyp:scim_mozc unix/scim/scim.gyp:scim_mozc_setup "
181 [[ "$_uim_mozc" = "yes" ]] && _targets+="unix/uim/uim.gyp:uim-mozc "
183 QTDIR="$_qtdir" python2 build_mozc.py gyp --channel_dev=0
184 python2 build_mozc.py build_tools -c $_bldtype -j $_jobs
185 python2 build_mozc.py build -c $_bldtype -j $_jobs $_targets
187 [[ "$_ibus_mozc" = "yes" ]] && sed -i 's|/usr/libexec/|/usr/lib/ibus-mozc/|g' out_linux/${_bldtype}/obj/gen/unix/ibus/mozc.xml
189 if [[ "$_emacs_mozc" = "yes" ]]; then
191 emacs -batch -f batch-byte-compile mozc.el
195 # Extract liccense part of mozc
196 head -n 28 server/mozc_server.cc > LICENSE
200 pkgdesc="Mozc the Japanese Input Method containing Mozc UT Dictionary (additional dictionary) and uim-mozc (optional)"
201 arch=('i686' 'x86_64')
204 [[ "$_uim_mozc" != "yes" ]] && depends+=('protobuf')
206 replaces=('mozc-server-ut' 'mozc-utils-gui-ut')
207 conflicts=('mozc' 'mozc-server' 'mozc-utils-gui')
208 optdepends=('zinnia: hand-writing recognition support'
209 'tegaki-models-zinnia-japanese: hand-writing recognition support')
211 cd "${srcdir}/${pkgbase}-${pkgver}"
212 install -D -m 755 out_linux/${_bldtype}/mozc_server "${pkgdir}/usr/lib/mozc/mozc_server"
213 install -D -m 755 out_linux/${_bldtype}/mozc_tool "${pkgdir}/usr/lib/mozc/mozc_tool"
214 install -d "${pkgdir}/usr/lib/mozc/documents/"
215 install -m 644 data/installer/*.html "${pkgdir}/usr/lib/mozc/documents/"
217 _licpath="${pkgdir}/usr/share/licenses/${pkgbase}"
218 install -D -m 644 LICENSE "${_licpath}/LICENSE_MOZC"
220 install -D -m 644 README "${_licpath}/README_MOZC-UT"
221 _dics="skk jinmei hatena edict altcanna"
222 [[ "$_gendic" = "yes" && "$_NICODIC" = "yes" ]] && _dics+=" niconico"
225 install -d "${_licpath}/dictionary/${d}"
226 install -m 644 dictionary/${d}/* "${_licpath}/dictionary/${d}"
228 install -m 644 ${srcdir}/EDICT_license.html "${_licpath}/dictionary/edict/license.html"
231 package_emacs-mozc-ut() {
232 pkgdesc="Mozc for Emacs"
233 arch=('i686' 'x86_64')
235 depends=("mozc-ut=${pkgver}" 'emacs')
236 install=emacs-mozc.install
237 replaces=('emacs-mozc-bin')
238 provides=('emacs-mozc')
239 conflicts=('emacs-mozc' 'emacs-mozc-bin')
241 cd "${srcdir}/${pkgbase}-${pkgver}"
242 install -D -m 755 out_linux/${_bldtype}/mozc_emacs_helper "${pkgdir}/usr/bin/mozc_emacs_helper"
243 install -d "${pkgdir}/usr/share/emacs/site-lisp/emacs-mozc/"
244 install -m 644 unix/emacs/mozc.el{,c} "${pkgdir}/usr/share/emacs/site-lisp/emacs-mozc"
247 package_ibus-mozc-ut() {
248 pkgdesc="IBus engine module for Mozc"
249 arch=('i686' 'x86_64')
251 depends=("mozc-ut=${pkgver}" 'ibus')
252 provides=('ibus-mozc')
253 conflicts=('ibus-mozc')
255 cd "${srcdir}/${pkgbase}-${pkgver}"
256 install -D -m 755 out_linux/${_bldtype}/ibus_mozc "${pkgdir}/usr/lib/ibus-mozc/ibus-engine-mozc"
257 install -D -m 644 out_linux/${_bldtype}/obj/gen/unix/ibus/mozc.xml "${pkgdir}/usr/share/ibus/component/mozc.xml"
258 install -D -m 644 data/images/unix/ime_product_icon_opensource-32.png "${pkgdir}/usr/share/ibus-mozc/product_icon.png"
259 install -m 644 data/images/unix/ui-tool.png "${pkgdir}/usr/share/ibus-mozc/tool.png"
260 install -m 644 data/images/unix/ui-properties.png "${pkgdir}/usr/share/ibus-mozc/properties.png"
261 install -m 644 data/images/unix/ui-dictionary.png "${pkgdir}/usr/share/ibus-mozc/dictionary.png"
262 install -m 644 data/images/unix/ui-direct.png "${pkgdir}/usr/share/ibus-mozc/direct.png"
263 install -m 644 data/images/unix/ui-hiragana.png "${pkgdir}/usr/share/ibus-mozc/hiragana.png"
264 install -m 644 data/images/unix/ui-katakana_half.png "${pkgdir}/usr/share/ibus-mozc/katakana_half.png"
265 install -m 644 data/images/unix/ui-katakana_full.png "${pkgdir}/usr/share/ibus-mozc/katakana_full.png"
266 install -m 644 data/images/unix/ui-alpha_half.png "${pkgdir}/usr/share/ibus-mozc/alpha_half.png"
267 install -m 644 data/images/unix/ui-alpha_full.png "${pkgdir}/usr/share/ibus-mozc/alpha_full.png"
270 package_scim-mozc-ut() {
271 pkgdesc="SCIM IMEngine module for Mozc"
272 arch=('i686' 'x86_64')
274 depends=("mozc-ut=${pkgver}" 'scim')
275 provides=('scim-mozc')
276 conflicts=('scim-mozc')
278 cd "${srcdir}/${pkgbase}-${pkgver}"
279 _moduledir=`pkg-config scim --variable=moduledir`
280 install -D -m 755 out_linux/${_bldtype}/lib.target/libscim_mozc.so "${pkgdir}${_moduledir}/IMEngine/mozc.so"
281 install -D -m 755 out_linux/${_bldtype}/lib.target/libscim_mozc_setup.so "${pkgdir}${_moduledir}/SetupUI/mozc-setup.so"
282 _icondir=`pkg-config scim --variable=icondir`
283 install -D -m 644 data/images/unix/ime_product_icon_opensource-32.png "${pkgdir}${_icondir}/scim-mozc.png"
284 install -m 644 data/images/unix/ui-tool.png "${pkgdir}${_icondir}/scim-mozc-tool.png"
285 install -m 644 data/images/unix/ui-properties.png "${pkgdir}${_icondir}/scim-mozc-properties.png"
286 install -m 644 data/images/unix/ui-dictionary.png "${pkgdir}${_icondir}/scim-mozc-dictionary.png"
287 install -m 644 data/images/unix/ui-direct.png "${pkgdir}${_icondir}/scim-mozc-direct.png"
288 install -m 644 data/images/unix/ui-hiragana.png "${pkgdir}${_icondir}/scim-mozc-hiragana.png"
289 install -m 644 data/images/unix/ui-katakana_half.png "${pkgdir}${_icondir}/scim-mozc-katakana_half.png"
290 install -m 644 data/images/unix/ui-katakana_full.png "${pkgdir}${_icondir}/scim-mozc-katakana_full.png"
291 install -m 644 data/images/unix/ui-alpha_half.png "${pkgdir}${_icondir}/scim-mozc-alpha_half.png"
292 install -m 644 data/images/unix/ui-alpha_full.png "${pkgdir}${_icondir}/scim-mozc-alpha_full.png"
295 package_uim-mozc-ut() {
296 pkgdesc="uim IMEngine module for Mozc"
297 arch=('i686' 'x86_64')
299 depends=("mozc-ut=${pkgver}" 'uim')
300 install=uim-mozc.install
301 provides=('uim-mozc')
302 conflicts=('uim-mozc')
304 cd "${srcdir}/${pkgbase}-${pkgver}"
305 install -D -m 755 out_linux/${_bldtype}/libuim-mozc.so "${pkgdir}/usr/lib/uim/plugin/libuim-mozc.so"
306 install -d "${pkgdir}/usr/share/uim"
307 install -m 644 ${srcdir}/uim-mozc-${_uimmozcrev}/scm/*.scm "${pkgdir}/usr/share/uim/"
308 install -D -m 644 data/images/unix/ime_product_icon_opensource-32.png "${pkgdir}/usr/share/uim/pixmaps/mozc.png"
309 install -m 644 data/images/unix/ui-tool.png "${pkgdir}/usr/share/uim/pixmaps/mozc_tool_selector.png"
310 install -m 644 data/images/unix/ui-properties.png "${pkgdir}/usr/share/uim/pixmaps/mozc_tool_config_dialog.png"
311 install -m 644 data/images/unix/ui-dictionary.png "${pkgdir}/usr/share/uim/pixmaps/mozc_tool_dictionary_tool.png"
313 install -D -m 644 unix/uim/LICENSE "${pkgdir}/usr/share/licenses/${pkgbase}/uim-mozc/LICENSE"
316 # Global pkgdesc and depends are here so that they will be picked up by AUR
317 pkgdesc="Mozc the Japanese Input Method containing Mozc UT Dictionary (additional dictionary) and uim-mozc (optional)"
318 depends=('curl' 'qt')