updated on Thu Jan 5 13:17:10 UTC 2012
[aur-mirror.git] / mozc-svn / PKGBUILD
blob44324fe0a799175a55f6f18b43d0febed66a82ef
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=87
49 pkgrel=1
50 _zipcoderel=201111
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=('2bef5a5940232a155e220fa09fcc449af90c4c23'
61           '3ef000c82642b84f1c7f9708edb4bcb02ced1d44'
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       cp -rf "${srcdir}/protobuf-${_protobuf_ver}" protobuf/files
158       patch -p0 -i "${srcdir}/uim-mozc/mozc-linux-protobuf.diff"
159       cp -rf "${srcdir}/uim-mozc/uim" unix/
160       patch -p0 -i "${srcdir}/uim-mozc/mozc-kill-line.diff"
161       # Extract license part of uim-mozc
162       head -n 32 unix/uim/mozc.cc > unix/uim/LICENSE
163   fi
165   # Add zip code
166   msg "Generating zip code seed..."
167   python2 dictionary/gen_zip_code_seed.py --zip_code="${srcdir}/KEN_ALL.CSV" --jigyosyo="${srcdir}/JIGYOSYO.CSV" >> data/dictionary/dictionary09.txt
169   msg "Starting make..."
171   # Get make -j option from $MAKEFLAGS
172   _jobs=`sed -n -e "s/.*--jobs=\([0-9]\+\).*/\1/p" -e "s/.*-j *\([0-9]\+\).*/\1/p" <<< "$MAKEFLAGS"`
173   _jobs=${_jobs:-1}
175   _targets="server/server.gyp:mozc_server gui/gui.gyp:mozc_tool "
176   [[ "$_emacs_mozc" = "yes" ]] && _targets+="unix/emacs/emacs.gyp:mozc_emacs_helper "
177   [[ "$_ibus_mozc"  = "yes" ]] && _targets+="unix/ibus/ibus.gyp:ibus_mozc "
178   [[ "$_scim_mozc"  = "yes" ]] && _targets+="unix/scim/scim.gyp:scim_mozc unix/scim/scim.gyp:scim_mozc_setup "
179   [[ "$_uim_mozc"   = "yes" ]] && _targets+="unix/uim/uim.gyp:uim-mozc "
181   QTDIR="$_qtdir" python2 build_mozc.py gyp --channel_dev=0
182   python2 build_mozc.py build_tools -c $_bldtype -j $_jobs
183   python2 build_mozc.py build -c $_bldtype -j $_jobs $_targets
185   [[ "$_ibus_mozc" = "yes" ]] && sed -i 's|/usr/libexec/|/usr/lib/ibus-mozc/|g' out_linux/${_bldtype}/obj/gen/unix/ibus/mozc.xml
187   if [[ "$_emacs_mozc" = "yes" ]]; then
188     cd unix/emacs
189     emacs -batch -f batch-byte-compile mozc.el
190     cd ~-
191   fi
194 package_mozc-svn() {
195   pkgdesc="A Japanese Input Method for Chromium OS, Windows, Mac and Linux (the Open Source Edition of Google Japanese Input)"
196   arch=('i686' 'x86_64')
197   groups=('mozc-im')
198   depends=('curl' 'qt')
199   [[ "$_uim_mozc" != "yes" ]] && depends+=('protobuf')
200   provides=('mozc')
201   replaces=('mozc-server-svn' 'mozc-utils-gui-svn')
202   conflicts=('mozc' 'mozc-server' 'mozc-utils-gui')
203   optdepends=('zinnia: hand-writing recognition support)'
204               'tegaki-models-zinnia-japanese: hand-writing recognition support')
206   cd "${srcdir}/${_svnmod}-build"
207   install -D -m 755 out_linux/${_bldtype}/mozc_server "${pkgdir}/usr/lib/mozc/mozc_server"
208   install    -m 755 out_linux/${_bldtype}/mozc_tool "${pkgdir}/usr/lib/mozc/mozc_tool"
209   install -d "${pkgdir}/usr/lib/mozc/documents/"
210   install -m 644 data/installer/*.html "${pkgdir}/usr/lib/mozc/documents/"
212   install -D -m 644 debian/copyright "${pkgdir}/usr/share/licenses/${pkgbase}/copyright"
215 package_emacs-mozc-svn() {
216   pkgdesc="Mozc for Emacs"
217   arch=('i686' 'x86_64')
218   groups=('mozc-im')
219   depends=("mozc-svn=${pkgver}" 'emacs')
220   install=emacs-mozc.install
221   replaces=('emacs-mozc-bin')
222   provides=('emacs-mozc')
223   conflicts=('emacs-mozc' 'emacs-mozc-bin')
225   cd "${srcdir}/${_svnmod}-build"
226   install -D -m 755 out_linux/${_bldtype}/mozc_emacs_helper "${pkgdir}/usr/bin/mozc_emacs_helper"
227   install -d "${pkgdir}/usr/share/emacs/site-lisp/emacs-mozc/"
228   install -m 644 unix/emacs/mozc.el{,c} "${pkgdir}/usr/share/emacs/site-lisp/emacs-mozc"
231 package_ibus-mozc-svn() {
232   pkgdesc="IBus engine module for Mozc"
233   arch=('i686' 'x86_64')
234   groups=('mozc-im')
235   depends=("mozc-svn=${pkgver}" 'ibus')
236   provides=('ibus-mozc')
237   conflicts=('ibus-mozc')
239   cd "${srcdir}/${_svnmod}-build"
240   install -D -m 755 out_linux/${_bldtype}/ibus_mozc       "${pkgdir}/usr/lib/ibus-mozc/ibus-engine-mozc"
241   install -D -m 644 out_linux/${_bldtype}/obj/gen/unix/ibus/mozc.xml "${pkgdir}/usr/share/ibus/component/mozc.xml"
242   install -D -m 644 data/images/unix/ime_product_icon_opensource-32.png "${pkgdir}/usr/share/ibus-mozc/product_icon.png"
243   install    -m 644 data/images/unix/ui-tool.png          "${pkgdir}/usr/share/ibus-mozc/tool.png"
244   install    -m 644 data/images/unix/ui-properties.png    "${pkgdir}/usr/share/ibus-mozc/properties.png"
245   install    -m 644 data/images/unix/ui-dictionary.png    "${pkgdir}/usr/share/ibus-mozc/dictionary.png"
246   install    -m 644 data/images/unix/ui-direct.png        "${pkgdir}/usr/share/ibus-mozc/direct.png"
247   install    -m 644 data/images/unix/ui-hiragana.png      "${pkgdir}/usr/share/ibus-mozc/hiragana.png"
248   install    -m 644 data/images/unix/ui-katakana_half.png "${pkgdir}/usr/share/ibus-mozc/katakana_half.png"
249   install    -m 644 data/images/unix/ui-katakana_full.png "${pkgdir}/usr/share/ibus-mozc/katakana_full.png"
250   install    -m 644 data/images/unix/ui-alpha_half.png    "${pkgdir}/usr/share/ibus-mozc/alpha_half.png"
251   install    -m 644 data/images/unix/ui-alpha_full.png    "${pkgdir}/usr/share/ibus-mozc/alpha_full.png"
254 package_scim-mozc-svn() {
255   pkgdesc="SCIM IMEngine module for Mozc"
256   arch=('i686' 'x86_64')
257   groups=('mozc-im')
258   depends=("mozc-svn=${pkgver}" 'scim')
259   provides=('scim-mozc')
260   conflicts=('scim-mozc')
262   cd "${srcdir}/${_svnmod}-build"
263   _moduledir=`pkg-config scim --variable=moduledir`
264   install -D -m 755 out_linux/${_bldtype}/lib.target/libscim_mozc.so       "${pkgdir}${_moduledir}/IMEngine/mozc.so"
265   install -D -m 755 out_linux/${_bldtype}/lib.target/libscim_mozc_setup.so "${pkgdir}${_moduledir}/SetupUI/mozc-setup.so"
266   _icondir=`pkg-config scim --variable=icondir`
267   install -D -m 644 data/images/unix/ime_product_icon_opensource-32.png "${pkgdir}${_icondir}/scim-mozc.png"
268   install    -m 644 data/images/unix/ui-tool.png          "${pkgdir}${_icondir}/scim-mozc-tool.png"
269   install    -m 644 data/images/unix/ui-properties.png    "${pkgdir}${_icondir}/scim-mozc-properties.png"
270   install    -m 644 data/images/unix/ui-dictionary.png    "${pkgdir}${_icondir}/scim-mozc-dictionary.png"
271   install    -m 644 data/images/unix/ui-direct.png        "${pkgdir}${_icondir}/scim-mozc-direct.png"
272   install    -m 644 data/images/unix/ui-hiragana.png      "${pkgdir}${_icondir}/scim-mozc-hiragana.png"
273   install    -m 644 data/images/unix/ui-katakana_half.png "${pkgdir}${_icondir}/scim-mozc-katakana_half.png"
274   install    -m 644 data/images/unix/ui-katakana_full.png "${pkgdir}${_icondir}/scim-mozc-katakana_full.png"
275   install    -m 644 data/images/unix/ui-alpha_half.png    "${pkgdir}${_icondir}/scim-mozc-alpha_half.png"
276   install    -m 644 data/images/unix/ui-alpha_full.png    "${pkgdir}${_icondir}/scim-mozc-alpha_full.png"
279 package_uim-mozc-svn() {
280   pkgdesc="uim IMEngine module for Mozc"
281   arch=('i686' 'x86_64')
282   groups=('mozc-im')
283   depends=("mozc-svn=${pkgver}" 'uim')
284   install=uim-mozc.install
285   provides=('uim-mozc')
286   conflicts=('uim-mozc')
288   cd "${srcdir}/${_svnmod}-build"
289   install -D -m 755 out_linux/${_bldtype}/libuim-mozc.so  "${pkgdir}/usr/lib/uim/plugin/libuim-mozc.so"
290   install -d "${pkgdir}/usr/share/uim"
291   install    -m 644 ${srcdir}/uim-mozc/scm/*.scm       "${pkgdir}/usr/share/uim/"
292   install -D -m 644 data/images/unix/ime_product_icon_opensource-32.png "${pkgdir}/usr/share/uim/pixmaps/mozc.png"
293   install    -m 644 data/images/unix/ui-tool.png       "${pkgdir}/usr/share/uim/pixmaps/mozc_tool_selector.png"
294   install    -m 644 data/images/unix/ui-properties.png "${pkgdir}/usr/share/uim/pixmaps/mozc_tool_config_dialog.png"
295   install    -m 644 data/images/unix/ui-dictionary.png "${pkgdir}/usr/share/uim/pixmaps/mozc_tool_dictionary_tool.png"
297   install -D -m 644 unix/uim/LICENSE "${pkgdir}/usr/share/licenses/${pkgbase}/uim-mozc/LICENSE"
300 # Global pkgdesc and depends are here so that they will be picked up by AUR
301 pkgdesc="A Japanese Input Method for Chromium OS, Windows, Mac and Linux (the Open Source Edition of Google Japanese Input), with uim-mozc (optional)"
302 depends=('curl' 'qt')