updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / mozc-svn / PKGBUILD
blob875e3947401778b21f0a5e23f918410049738542
1 # Maintainer: ponsfoot <cabezon dot hashimoto at gmail dot com>
3 ##
4 ## Build configuration 
5 ##
6 ## You can choose the input method framework to use either ibus, scim or both.
7 ## If you will not be using ibus, comment out below.
8 _ibus_mozc="yes"
9 ## If you will be using scim, uncomment below.
10 #_scim_mozc="yes"
11 ## If you will be using uim, uncomment below.
12 #_uim_mozc="yes"
14 ## If you will be using mozc.el on Emacs, uncomment below.
15 #_emacs_mozc="yes"
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.
19 #_qtdir="$QTDIR"
21 ## Mozc compile option
22 _bldtype=Release
23 #_bldtype=Debug
25 #*************************************************************
26 # Upstreams:
28 # mozc
29 # http://code.google.com/p/mozc/
31 # Japanese zip code data by Japan Post
32 # http://www.post.japanpost.jp/zipcode/download.html
34 # macuim (uim-mozc)
35 # http://code.google.com/p/macuim/
37 #*************************************************************
38 # Changes to original mozc:
40 # 1. Add uim-mozc (optional)
41 # 2. Link protobuf statically when uim-mozc is enabled
43 #*************************************************************
45 pkgbase=mozc-svn
46 pkgname=mozc-svn
47 true && pkgname=('mozc-svn')
48 pkgver=94
49 pkgrel=1
50 _zipcoderel=201112
51 _protobuf_ver=2.4.1
52 arch=('i686' 'x86_64')
53 url="http://code.google.com/p/mozc/"
54 license=('BSD' 'custom')
55 makedepends=('pkg-config' 'python2' 'gtest' 'zinnia' 'subversion')
56 changelog=ChangeLog
57 source=(http://downloads.sourceforge.net/pnsft-aur/ken_all-${_zipcoderel}.zip
58         http://downloads.sourceforge.net/pnsft-aur/jigyosyo-${_zipcoderel}.zip
60 sha1sums=('099fd4323f0dbd345431a003e718bd978b1f2679'
61           '003d424b788a6d6b1b9f86c30733c5b3083c1a6d'
64 if [[ "$_ibus_mozc" = "yes" ]]; then
65     true && pkgname+=('ibus-mozc-svn')
66     makedepends+=('ibus')
68 if [[ "$_scim_mozc" = "yes" ]]; then
69     true && pkgname+=('scim-mozc-svn')
70     makedepends+=('scim')
72 if [[ "$_emacs_mozc" = "yes" ]]; then
73     true && pkgname+=('emacs-mozc-svn')
74     makedepends+=('emacs')
76 if [[ "$_uim_mozc"  = "yes" ]]; then
77     true && pkgname+=('uim-mozc-svn')
78     makedepends+=('uim')
79     source+=(http://protobuf.googlecode.com/files/protobuf-${_protobuf_ver}.tar.bz2)
80     sha1sums+=('df5867e37a4b51fb69f53a8baf5b994938691d6d')
81 else
82     depends+=('protobuf')
85 _svntrunk="http://mozc.googlecode.com/svn/trunk/src"
86 _svnmod="src"
88 build() {
89   if [[ "$_ibus_mozc" != "yes" && "$_scim_mozc" != "yes" && "$_uim_mozc" != "yes" ]]; then
90     msg "*****************************************************"
91     msg " Please choose either one of ibus, scim or uim"
92     msg " at least. See PKGBUILD."
93     msg "*****************************************************"
94     return 1
95   fi
97   if [[ "$QTDIR" && -z "$_qtdir" ]]; then
98     msg '====================================================='
99     msg '                *** CAUTION ***'
100     msg ' $QTDIR will be replaced temporarily and forcibly'
101     msg ' for Qt3 users.'
102     msg ' If it is inconvenient for you, please edit'
103     msg ' PKGBUILD. (Please see it for datail)'
104     msg '====================================================='
105   fi
107   msg '====================================================='
108   msg '               *** Build Info ***'
109   msg ' The following package files will be generated:'
110   for _p in ${pkgname[@]}
111   do
112     msg "  * ${_p}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
113   done
114   msg '====================================================='
116   cd "$srcdir"
118   ln -sf /usr/bin/python2 ./python
119   PATH="${srcdir}:${PATH}"
121   # Checkout depot_tools
122   msg "Connecting to depot_tools SVN server..."
123   if [[ -d depot_tools/.svn ]]; then
124       (cd depot_tools ; svn update)
125   else
126       svn co http://src.chromium.org/svn/trunk/tools/depot_tools --config-dir ./
127   fi
128   msg "SVN checkout done or server timeout"
129   PATH="${srcdir}/depot_tools:${PATH}"
131   # Checkout mozc
132   msg "Connecting to mozc SVN server..."
133   if [[ ! -f .gclient ]]; then
134       [[ -d $_svnmod ]] && rm -rf $_svnmod
135       gclient config $_svntrunk
136   fi
137   gclient sync
138   msg "SVN checkout done or server timeout"
140   # Checkout macuim-mozc (for uim-mozc)
141   if [[ "$_uim_mozc" = "yes" ]]; then
142       msg "Connecting to macuim SVN server..."
143       if [[ -d uim-mozc/.svn ]]; then
144           (cd uim-mozc ; svn update)
145       else
146           svn co http://macuim.googlecode.com/svn/trunk/Mozc uim-mozc
147       fi
148       msg "SVN checkout done or server timeout"
149   fi
151   msg "Copying source to src-build..."
152   rm -rf "${_svnmod}-build"
153   cp -r $_svnmod "${_svnmod}-build"
154   cd "${_svnmod}-build"
156   if [[ "$_uim_mozc" = "yes" ]]; then
157       # patch to link protobuf statically
158       cp -rf "${srcdir}/protobuf-${_protobuf_ver}" protobuf/files
159       patch -p0 -i "${srcdir}/uim-mozc/mozc-linux-protobuf.diff"
161       cp -rf "${srcdir}/uim-mozc/uim" unix/
162       # kill-line patch
163       patch -p0 -i "${srcdir}/uim-mozc/mozc-kill-line.diff"
164       # global_language_spec patch
165       patch -p0 -i "${srcdir}/uim-mozc/mozc-global_language_spec.diff"
167       # Extract license part of uim-mozc
168       head -n 32 unix/uim/mozc.cc > unix/uim/LICENSE
169   fi
171   # Add zip code
172   msg "Generating zip code seed..."
173   python2 dictionary/gen_zip_code_seed.py --zip_code="${srcdir}/KEN_ALL.CSV" --jigyosyo="${srcdir}/JIGYOSYO.CSV" >> data/dictionary/dictionary09.txt
175   msg "Starting make..."
177   # Get make -j option from $MAKEFLAGS
178   _jobs=`sed -n -e "s/.*--jobs=\([0-9]\+\).*/\1/p" -e "s/.*-j *\([0-9]\+\).*/\1/p" <<< "$MAKEFLAGS"`
179   _jobs=${_jobs:-1}
181   _targets="server/server.gyp:mozc_server gui/gui.gyp:mozc_tool "
182   [[ "$_emacs_mozc" = "yes" ]] && _targets+="unix/emacs/emacs.gyp:mozc_emacs_helper "
183   [[ "$_ibus_mozc"  = "yes" ]] && _targets+="unix/ibus/ibus.gyp:ibus_mozc "
184   [[ "$_scim_mozc"  = "yes" ]] && _targets+="unix/scim/scim.gyp:scim_mozc unix/scim/scim.gyp:scim_mozc_setup "
185   [[ "$_uim_mozc"   = "yes" ]] && _targets+="unix/uim/uim.gyp:uim-mozc "
187   QTDIR="$_qtdir" python2 build_mozc.py gyp --channel_dev=0
188   python2 build_mozc.py build_tools -c $_bldtype -j $_jobs
189   python2 build_mozc.py build -c $_bldtype -j $_jobs $_targets
191   [[ "$_ibus_mozc" = "yes" ]] && sed -i 's|/usr/libexec/|/usr/lib/ibus-mozc/|g' out_linux/${_bldtype}/obj/gen/unix/ibus/mozc.xml
193   if [[ "$_emacs_mozc" = "yes" ]]; then
194     cd unix/emacs
195     emacs -batch -f batch-byte-compile mozc.el
196     cd ~-
197   fi
200 package_mozc-svn() {
201   pkgdesc="A Japanese Input Method for Chromium OS, Windows, Mac and Linux (the Open Source Edition of Google Japanese Input)"
202   arch=('i686' 'x86_64')
203   groups=('mozc-im')
204   depends=('curl' 'qt')
205   [[ "$_uim_mozc" != "yes" ]] && depends+=('protobuf')
206   provides=('mozc')
207   replaces=('mozc-server-svn' 'mozc-utils-gui-svn')
208   conflicts=('mozc' 'mozc-server' 'mozc-utils-gui')
209   optdepends=('zinnia: hand-writing recognition support'
210               'tegaki-models-zinnia-japanese: hand-writing recognition support')
212   cd "${srcdir}/${_svnmod}-build"
213   install -D -m 755 out_linux/${_bldtype}/mozc_server "${pkgdir}/usr/lib/mozc/mozc_server"
214   install    -m 755 out_linux/${_bldtype}/mozc_tool "${pkgdir}/usr/lib/mozc/mozc_tool"
215   install -d "${pkgdir}/usr/lib/mozc/documents/"
216   install -m 644 data/installer/*.html "${pkgdir}/usr/lib/mozc/documents/"
218   install -D -m 644 debian/copyright "${pkgdir}/usr/share/licenses/${pkgbase}/copyright"
221 package_emacs-mozc-svn() {
222   pkgdesc="Mozc for Emacs"
223   arch=('i686' 'x86_64')
224   groups=('mozc-im')
225   depends=("mozc-svn=${pkgver}" 'emacs')
226   install=emacs-mozc.install
227   replaces=('emacs-mozc-bin')
228   provides=('emacs-mozc')
229   conflicts=('emacs-mozc' 'emacs-mozc-bin')
231   cd "${srcdir}/${_svnmod}-build"
232   install -D -m 755 out_linux/${_bldtype}/mozc_emacs_helper "${pkgdir}/usr/bin/mozc_emacs_helper"
233   install -d "${pkgdir}/usr/share/emacs/site-lisp/emacs-mozc/"
234   install -m 644 unix/emacs/mozc.el{,c} "${pkgdir}/usr/share/emacs/site-lisp/emacs-mozc"
237 package_ibus-mozc-svn() {
238   pkgdesc="IBus engine module for Mozc"
239   arch=('i686' 'x86_64')
240   groups=('mozc-im')
241   depends=("mozc-svn=${pkgver}" 'ibus')
242   provides=('ibus-mozc')
243   conflicts=('ibus-mozc')
245   cd "${srcdir}/${_svnmod}-build"
246   install -D -m 755 out_linux/${_bldtype}/ibus_mozc       "${pkgdir}/usr/lib/ibus-mozc/ibus-engine-mozc"
247   install -D -m 644 out_linux/${_bldtype}/obj/gen/unix/ibus/mozc.xml "${pkgdir}/usr/share/ibus/component/mozc.xml"
248   install -D -m 644 data/images/unix/ime_product_icon_opensource-32.png "${pkgdir}/usr/share/ibus-mozc/product_icon.png"
249   install    -m 644 data/images/unix/ui-tool.png          "${pkgdir}/usr/share/ibus-mozc/tool.png"
250   install    -m 644 data/images/unix/ui-properties.png    "${pkgdir}/usr/share/ibus-mozc/properties.png"
251   install    -m 644 data/images/unix/ui-dictionary.png    "${pkgdir}/usr/share/ibus-mozc/dictionary.png"
252   install    -m 644 data/images/unix/ui-direct.png        "${pkgdir}/usr/share/ibus-mozc/direct.png"
253   install    -m 644 data/images/unix/ui-hiragana.png      "${pkgdir}/usr/share/ibus-mozc/hiragana.png"
254   install    -m 644 data/images/unix/ui-katakana_half.png "${pkgdir}/usr/share/ibus-mozc/katakana_half.png"
255   install    -m 644 data/images/unix/ui-katakana_full.png "${pkgdir}/usr/share/ibus-mozc/katakana_full.png"
256   install    -m 644 data/images/unix/ui-alpha_half.png    "${pkgdir}/usr/share/ibus-mozc/alpha_half.png"
257   install    -m 644 data/images/unix/ui-alpha_full.png    "${pkgdir}/usr/share/ibus-mozc/alpha_full.png"
260 package_scim-mozc-svn() {
261   pkgdesc="SCIM IMEngine module for Mozc"
262   arch=('i686' 'x86_64')
263   groups=('mozc-im')
264   depends=("mozc-svn=${pkgver}" 'scim')
265   provides=('scim-mozc')
266   conflicts=('scim-mozc')
268   cd "${srcdir}/${_svnmod}-build"
269   _moduledir=`pkg-config scim --variable=moduledir`
270   install -D -m 755 out_linux/${_bldtype}/lib.target/libscim_mozc.so       "${pkgdir}${_moduledir}/IMEngine/mozc.so"
271   install -D -m 755 out_linux/${_bldtype}/lib.target/libscim_mozc_setup.so "${pkgdir}${_moduledir}/SetupUI/mozc-setup.so"
272   _icondir=`pkg-config scim --variable=icondir`
273   install -D -m 644 data/images/unix/ime_product_icon_opensource-32.png "${pkgdir}${_icondir}/scim-mozc.png"
274   install    -m 644 data/images/unix/ui-tool.png          "${pkgdir}${_icondir}/scim-mozc-tool.png"
275   install    -m 644 data/images/unix/ui-properties.png    "${pkgdir}${_icondir}/scim-mozc-properties.png"
276   install    -m 644 data/images/unix/ui-dictionary.png    "${pkgdir}${_icondir}/scim-mozc-dictionary.png"
277   install    -m 644 data/images/unix/ui-direct.png        "${pkgdir}${_icondir}/scim-mozc-direct.png"
278   install    -m 644 data/images/unix/ui-hiragana.png      "${pkgdir}${_icondir}/scim-mozc-hiragana.png"
279   install    -m 644 data/images/unix/ui-katakana_half.png "${pkgdir}${_icondir}/scim-mozc-katakana_half.png"
280   install    -m 644 data/images/unix/ui-katakana_full.png "${pkgdir}${_icondir}/scim-mozc-katakana_full.png"
281   install    -m 644 data/images/unix/ui-alpha_half.png    "${pkgdir}${_icondir}/scim-mozc-alpha_half.png"
282   install    -m 644 data/images/unix/ui-alpha_full.png    "${pkgdir}${_icondir}/scim-mozc-alpha_full.png"
285 package_uim-mozc-svn() {
286   pkgdesc="uim IMEngine module for Mozc"
287   arch=('i686' 'x86_64')
288   groups=('mozc-im')
289   depends=("mozc-svn=${pkgver}" 'uim')
290   install=uim-mozc.install
291   provides=('uim-mozc')
292   conflicts=('uim-mozc')
294   cd "${srcdir}/${_svnmod}-build"
295   install -D -m 755 out_linux/${_bldtype}/libuim-mozc.so  "${pkgdir}/usr/lib/uim/plugin/libuim-mozc.so"
296   install -d "${pkgdir}/usr/share/uim"
297   install    -m 644 ${srcdir}/uim-mozc/scm/*.scm       "${pkgdir}/usr/share/uim/"
298   install -D -m 644 data/images/unix/ime_product_icon_opensource-32.png "${pkgdir}/usr/share/uim/pixmaps/mozc.png"
299   install    -m 644 data/images/unix/ui-tool.png       "${pkgdir}/usr/share/uim/pixmaps/mozc_tool_selector.png"
300   install    -m 644 data/images/unix/ui-properties.png "${pkgdir}/usr/share/uim/pixmaps/mozc_tool_config_dialog.png"
301   install    -m 644 data/images/unix/ui-dictionary.png "${pkgdir}/usr/share/uim/pixmaps/mozc_tool_dictionary_tool.png"
303   install -D -m 644 unix/uim/LICENSE "${pkgdir}/usr/share/licenses/${pkgbase}/uim-mozc/LICENSE"
306 # Global pkgdesc and depends are here so that they will be picked up by AUR
307 pkgdesc="A Japanese Input Method for Chromium OS, Windows, Mac and Linux (the Open Source Edition of Google Japanese Input), with uim-mozc (optional)"
308 depends=('curl' 'qt')