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 ## Generate dictionary seeds from UT dictionary oneself.
22 ## (Requires more build time)
25 ## ニコニコ大百科IME辞書 (NICONICOPEDIA IME dictionary)
26 ## if you want to make redistributable mozc-ut,
27 ## keep **DISABLE** _NICODIC="yes" please.
28 ## This is ignored if $_gendic != "yes".
31 ## Mozc compile option
35 #*************************************************************
39 # http://code.google.com/p/mozc/
41 # Japanese zip code data by Japan Post
42 # http://www.post.japanpost.jp/zipcode/download.html
44 # Additional dictionary by UTSUMI
45 # http://www.geocities.jp/ep3797/mozc_01.html
48 # http://code.google.com/p/macuim/
50 #*************************************************************
54 true && pkgname=('mozc-ut')
61 arch=('i686' 'x86_64')
62 url="http://www.geocities.jp/ep3797/mozc_01.html"
63 license=('BSD' 'GPL' 'CC-BY-SA' 'custom')
64 makedepends=('pkg-config' 'python2' 'gtest' 'zinnia')
66 if [[ "$_gendic" != "yes" ]]; then
67 # Patched source from UT
68 pkgver=1.2.855.102.20111125
69 source=(http://downloads.sourceforge.net/mdk-ut/mozc-ut-${pkgver}.7z)
70 sha1sums=('8bf4fc499048995283d1c33d1642fc0cd8a92ddd')
71 makedepends+=('p7zip')
73 pkgver=${_mozcver}.${_utdicver}
74 source=(http://mozc.googlecode.com/files/mozc-${_mozcver}.tar.bz2
75 http://downloads.sourceforge.net/mdk-ut/mozcdic-ut-${_utdicver}.tar.bz2)
76 sha1sums=('41f349b9b4ea87dda19d42653d5f4b584da16c37'
77 'd0aba35246b3f51797a98edf05ee675b5d14d0ca')
80 source+=(EDICT_license.html
81 http://downloads.sourceforge.net/pnsft-aur/ken_all-${_zipcoderel}.zip
82 http://downloads.sourceforge.net/pnsft-aur/jigyosyo-${_zipcoderel}.zip)
83 sha1sums+=('e0ba18e67c1be8e3cfb8ecb30760597b215da255'
84 '099fd4323f0dbd345431a003e718bd978b1f2679'
85 '003d424b788a6d6b1b9f86c30733c5b3083c1a6d'
88 if [[ "$_ibus_mozc" = "yes" ]]; then
89 true && pkgname+=('ibus-mozc-ut')
92 if [[ "$_scim_mozc" = "yes" ]]; then
93 true && pkgname+=('scim-mozc-ut')
96 if [[ "$_emacs_mozc" = "yes" ]]; then
97 true && pkgname+=('emacs-mozc-ut')
100 if [[ "$_uim_mozc" = "yes" ]]; then
101 true && pkgname+=('uim-mozc-ut')
103 source+=(http://downloads.sourceforge.net/project/pnsft-aur/mozc/uim-mozc-${_uimmozcrev}.tar.xz
104 http://protobuf.googlecode.com/files/protobuf-${_protobuf_ver}.tar.bz2)
105 sha1sums+=('9761fb2eddf2dc7545305cc114d81feb7cb2ff88'
106 'df5867e37a4b51fb69f53a8baf5b994938691d6d')
108 depends+=('protobuf')
112 if [[ "$_ibus_mozc" != "yes" && "$_scim_mozc" != "yes" && "$_uim_mozc" != "yes" ]]; then
113 msg "*****************************************************"
114 msg " Please choose either one of ibus, scim or uim"
115 msg " at least. See PKGBUILD."
116 msg "*****************************************************"
120 if [[ "$QTDIR" && -z "$_qtdir" ]]; then
121 msg '====================================================='
122 msg ' *** CAUTION ***'
123 msg ' $QTDIR will be replaced temporarily and forcibly'
124 msg ' for Qt3 users.'
125 msg ' If it is inconvenient for you, please edit'
126 msg ' PKGBUILD. (Please see it for datail)'
127 msg '====================================================='
130 msg '====================================================='
131 msg ' *** Build Info ***'
132 msg ' The following package files will be generated:'
133 for _p in ${pkgname[@]}
135 msg " * ${_p}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
137 msg '====================================================='
141 if [[ "$_gendic" = "yes" ]]; then
142 # Generate mozc-ut dictionary seeds
143 cd "${srcdir}/mozcdic-ut-${_utdicver}"
144 # Adjust for Ruby>=1.9, makepkg, etc.
145 find . -name \*.rb -type f \
146 -exec sed -i -e "2i #-*- encoding: utf-8 -*-" -e "s/\]\.length /\]\.bytesize /g" {} +
147 sed -i -e "s|^MOZCVER=.*|MOZCVER=\"${_mozcver}\"|" \
148 -e "s|^DATE=.*|DATE=\"${_utdicver}\"|" \
149 -e 's|^rm -rf \.\./mozc-$MOZCVER|#&|' \
150 -e 's|^tar jxf mozc-$MOZCVER\.tar\.bz2|#&|' \
151 -e "s/^ruby.*/& || exit 1/g" \
154 [[ "$_NICODIC" = "yes" ]] && sed -i 's/NICODIC="false"/NICODIC="true"/' generate-mozc-ut.sh
155 msg "Generating UT dictionary seed..."
156 sh ./generate-mozc-ut.sh
159 7z x -y mozc-ut-${pkgver}.7z
162 cd "${srcdir}/${pkgbase}-${pkgver}"
165 if [[ "$_uim_mozc" = "yes" ]]; then
166 # patch to link protobuf statically
167 cp -rf "${srcdir}/protobuf-${_protobuf_ver}" protobuf/files
168 patch -p0 -i "${srcdir}/uim-mozc-${_uimmozcrev}/mozc-linux-protobuf.diff"
169 cp -rf "${srcdir}/uim-mozc-${_uimmozcrev}/uim" unix/
170 patch -p0 -i "${srcdir}/uim-mozc-${_uimmozcrev}/mozc-kill-line.diff"
171 # Extract license part of uim-mozc
172 head -n 32 unix/uim/mozc.cc > unix/uim/LICENSE
176 find . -name \*.py -type f -exec sed -i -e "1s|python.*$|python2|" {} +
177 find . -regex ".*\.gypi?$" -type f -exec sed -i -e "s|'python'|'python2'|g" {} +
180 msg "Generating zip code seed..."
181 python2 dictionary/gen_zip_code_seed.py --zip_code="${srcdir}/KEN_ALL.CSV" --jigyosyo="${srcdir}/JIGYOSYO.CSV" >> data/dictionary/dictionary09.txt
184 msg "Starting make..."
186 # Get make -j option from $MAKEFLAGS
187 _jobs=`sed -n -e "s/.*--jobs=\([0-9]\+\).*/\1/p" -e "s/.*-j *\([0-9]\+\).*/\1/p" <<< "$MAKEFLAGS"`
190 _targets="server/server.gyp:mozc_server gui/gui.gyp:mozc_tool "
191 [[ "$_emacs_mozc" = "yes" ]] && _targets+="unix/emacs/emacs.gyp:mozc_emacs_helper "
192 [[ "$_ibus_mozc" = "yes" ]] && _targets+="unix/ibus/ibus.gyp:ibus_mozc "
193 [[ "$_scim_mozc" = "yes" ]] && _targets+="unix/scim/scim.gyp:scim_mozc unix/scim/scim.gyp:scim_mozc_setup "
194 [[ "$_uim_mozc" = "yes" ]] && _targets+="unix/uim/uim.gyp:uim-mozc "
196 QTDIR="$_qtdir" python2 build_mozc.py gyp --channel_dev=0
197 python2 build_mozc.py build_tools -c $_bldtype -j $_jobs
198 python2 build_mozc.py build -c $_bldtype -j $_jobs $_targets
200 [[ "$_ibus_mozc" = "yes" ]] && sed -i 's|/usr/libexec/|/usr/lib/ibus-mozc/|g' out_linux/${_bldtype}/obj/gen/unix/ibus/mozc.xml
202 if [[ "$_emacs_mozc" = "yes" ]]; then
204 emacs -batch -f batch-byte-compile mozc.el
208 # Extract liccense part of mozc
209 head -n 28 server/mozc_server.cc > LICENSE
213 pkgdesc="Mozc the Japanese Input Method containing Mozc UT Dictionary (additional dictionary) and uim-mozc (optional)"
214 arch=('i686' 'x86_64')
217 [[ "$_uim_mozc" != "yes" ]] && depends+=('protobuf')
219 replaces=('mozc-server-ut' 'mozc-utils-gui-ut')
220 conflicts=('mozc' 'mozc-server' 'mozc-utils-gui')
221 optdepends=('zinnia: hand-writing recognition support'
222 'tegaki-models-zinnia-japanese: hand-writing recognition support')
224 cd "${srcdir}/${pkgbase}-${pkgver}"
225 install -D -m 755 out_linux/${_bldtype}/mozc_server "${pkgdir}/usr/lib/mozc/mozc_server"
226 install -D -m 755 out_linux/${_bldtype}/mozc_tool "${pkgdir}/usr/lib/mozc/mozc_tool"
227 install -d "${pkgdir}/usr/lib/mozc/documents/"
228 install -m 644 data/installer/*.html "${pkgdir}/usr/lib/mozc/documents/"
230 _licpath="${pkgdir}/usr/share/licenses/${pkgbase}"
231 install -D -m 644 LICENSE "${_licpath}/LICENSE_MOZC"
233 install -D -m 644 README "${_licpath}/README_MOZC-UT"
234 _dics="skk jinmei hatena edict altcanna"
235 [[ "$_gendic" = "yes" && "$_NICODIC" = "yes" ]] && _dics+=" niconico"
238 install -d "${_licpath}/dictionary/${d}"
239 install -m 644 dictionary/${d}/* "${_licpath}/dictionary/${d}"
241 install -m 644 ${srcdir}/EDICT_license.html "${_licpath}/dictionary/edict/license.html"
244 package_emacs-mozc-ut() {
245 pkgdesc="Mozc for Emacs"
246 arch=('i686' 'x86_64')
248 depends=("mozc-ut=${pkgver}" 'emacs')
249 install=emacs-mozc.install
250 replaces=('emacs-mozc-bin')
251 provides=('emacs-mozc')
252 conflicts=('emacs-mozc' 'emacs-mozc-bin')
254 cd "${srcdir}/${pkgbase}-${pkgver}"
255 install -D -m 755 out_linux/${_bldtype}/mozc_emacs_helper "${pkgdir}/usr/bin/mozc_emacs_helper"
256 install -d "${pkgdir}/usr/share/emacs/site-lisp/emacs-mozc/"
257 install -m 644 unix/emacs/mozc.el{,c} "${pkgdir}/usr/share/emacs/site-lisp/emacs-mozc"
260 package_ibus-mozc-ut() {
261 pkgdesc="IBus engine module for Mozc"
262 arch=('i686' 'x86_64')
264 depends=("mozc-ut=${pkgver}" 'ibus')
265 provides=('ibus-mozc')
266 conflicts=('ibus-mozc')
268 cd "${srcdir}/${pkgbase}-${pkgver}"
269 install -D -m 755 out_linux/${_bldtype}/ibus_mozc "${pkgdir}/usr/lib/ibus-mozc/ibus-engine-mozc"
270 install -D -m 644 out_linux/${_bldtype}/obj/gen/unix/ibus/mozc.xml "${pkgdir}/usr/share/ibus/component/mozc.xml"
271 install -D -m 644 data/images/unix/ime_product_icon_opensource-32.png "${pkgdir}/usr/share/ibus-mozc/product_icon.png"
272 install -m 644 data/images/unix/ui-tool.png "${pkgdir}/usr/share/ibus-mozc/tool.png"
273 install -m 644 data/images/unix/ui-properties.png "${pkgdir}/usr/share/ibus-mozc/properties.png"
274 install -m 644 data/images/unix/ui-dictionary.png "${pkgdir}/usr/share/ibus-mozc/dictionary.png"
275 install -m 644 data/images/unix/ui-direct.png "${pkgdir}/usr/share/ibus-mozc/direct.png"
276 install -m 644 data/images/unix/ui-hiragana.png "${pkgdir}/usr/share/ibus-mozc/hiragana.png"
277 install -m 644 data/images/unix/ui-katakana_half.png "${pkgdir}/usr/share/ibus-mozc/katakana_half.png"
278 install -m 644 data/images/unix/ui-katakana_full.png "${pkgdir}/usr/share/ibus-mozc/katakana_full.png"
279 install -m 644 data/images/unix/ui-alpha_half.png "${pkgdir}/usr/share/ibus-mozc/alpha_half.png"
280 install -m 644 data/images/unix/ui-alpha_full.png "${pkgdir}/usr/share/ibus-mozc/alpha_full.png"
283 package_scim-mozc-ut() {
284 pkgdesc="SCIM IMEngine module for Mozc"
285 arch=('i686' 'x86_64')
287 depends=("mozc-ut=${pkgver}" 'scim')
288 provides=('scim-mozc')
289 conflicts=('scim-mozc')
291 cd "${srcdir}/${pkgbase}-${pkgver}"
292 _moduledir=`pkg-config scim --variable=moduledir`
293 install -D -m 755 out_linux/${_bldtype}/lib.target/libscim_mozc.so "${pkgdir}${_moduledir}/IMEngine/mozc.so"
294 install -D -m 755 out_linux/${_bldtype}/lib.target/libscim_mozc_setup.so "${pkgdir}${_moduledir}/SetupUI/mozc-setup.so"
295 _icondir=`pkg-config scim --variable=icondir`
296 install -D -m 644 data/images/unix/ime_product_icon_opensource-32.png "${pkgdir}${_icondir}/scim-mozc.png"
297 install -m 644 data/images/unix/ui-tool.png "${pkgdir}${_icondir}/scim-mozc-tool.png"
298 install -m 644 data/images/unix/ui-properties.png "${pkgdir}${_icondir}/scim-mozc-properties.png"
299 install -m 644 data/images/unix/ui-dictionary.png "${pkgdir}${_icondir}/scim-mozc-dictionary.png"
300 install -m 644 data/images/unix/ui-direct.png "${pkgdir}${_icondir}/scim-mozc-direct.png"
301 install -m 644 data/images/unix/ui-hiragana.png "${pkgdir}${_icondir}/scim-mozc-hiragana.png"
302 install -m 644 data/images/unix/ui-katakana_half.png "${pkgdir}${_icondir}/scim-mozc-katakana_half.png"
303 install -m 644 data/images/unix/ui-katakana_full.png "${pkgdir}${_icondir}/scim-mozc-katakana_full.png"
304 install -m 644 data/images/unix/ui-alpha_half.png "${pkgdir}${_icondir}/scim-mozc-alpha_half.png"
305 install -m 644 data/images/unix/ui-alpha_full.png "${pkgdir}${_icondir}/scim-mozc-alpha_full.png"
308 package_uim-mozc-ut() {
309 pkgdesc="uim IMEngine module for Mozc"
310 arch=('i686' 'x86_64')
312 depends=("mozc-ut=${pkgver}" 'uim')
313 install=uim-mozc.install
314 provides=('uim-mozc')
315 conflicts=('uim-mozc')
317 cd "${srcdir}/${pkgbase}-${pkgver}"
318 install -D -m 755 out_linux/${_bldtype}/libuim-mozc.so "${pkgdir}/usr/lib/uim/plugin/libuim-mozc.so"
319 install -d "${pkgdir}/usr/share/uim"
320 install -m 644 ${srcdir}/uim-mozc-${_uimmozcrev}/scm/*.scm "${pkgdir}/usr/share/uim/"
321 install -D -m 644 data/images/unix/ime_product_icon_opensource-32.png "${pkgdir}/usr/share/uim/pixmaps/mozc.png"
322 install -m 644 data/images/unix/ui-tool.png "${pkgdir}/usr/share/uim/pixmaps/mozc_tool_selector.png"
323 install -m 644 data/images/unix/ui-properties.png "${pkgdir}/usr/share/uim/pixmaps/mozc_tool_config_dialog.png"
324 install -m 644 data/images/unix/ui-dictionary.png "${pkgdir}/usr/share/uim/pixmaps/mozc_tool_dictionary_tool.png"
326 install -D -m 644 unix/uim/LICENSE "${pkgdir}/usr/share/licenses/${pkgbase}/uim-mozc/LICENSE"
329 # Global pkgdesc and depends are here so that they will be picked up by AUR
330 pkgdesc="Mozc the Japanese Input Method containing Mozc UT Dictionary (additional dictionary) and uim-mozc (optional)"
331 depends=('curl' 'qt')