updated on Wed Jan 11 12:00:27 UTC 2012
[aur-mirror.git] / mozc / PKGBUILD
blobf951e333ef5fd491d0bc033d84926152c7f2c737
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"
12 ## If you will be using mozc.el on Emacs, uncomment below.
13 #_emacs_mozc="yes"
15 ## $QTDIR is changed temporarily and forcibly by default for Qt3 users.
16 ## If you install Qt4 on your custom and set $QTDIR for Qt4, uncomment below.
17 #_qtdir="$QTDIR"
19 ## Mozc compile option
20 _bldtype=Release
21 #_bldtype=Debug
23 pkgbase=mozc
24 pkgname=mozc
25 true && pkgname=('mozc')
26 pkgver=1.3.931.102
27 pkgrel=1
28 _zipcoderel=201111
29 arch=('i686' 'x86_64')
30 url="http://code.google.com/p/mozc/"
31 license=('BSD' 'custom')
32 makedepends=('pkg-config' 'python2' 'gtest' 'zinnia')
33 changelog=ChangeLog
34 source=(http://mozc.googlecode.com/files/mozc-${pkgver}.tar.bz2
35         http://downloads.sourceforge.net/pnsft-aur/ken_all-${_zipcoderel}.zip
36         http://downloads.sourceforge.net/pnsft-aur/jigyosyo-${_zipcoderel}.zip
38 sha1sums=('41f349b9b4ea87dda19d42653d5f4b584da16c37'
39           '2bef5a5940232a155e220fa09fcc449af90c4c23'
40           '3ef000c82642b84f1c7f9708edb4bcb02ced1d44')
42 if [[ "$_ibus_mozc" = "yes" ]]; then
43     true && pkgname+=('ibus-mozc')
44     makedepends+=('ibus')
46 if [[ "$_scim_mozc" = "yes" ]]; then
47     true && pkgname+=('scim-mozc')
48     makedepends+=('scim')
50 if [[ "$_emacs_mozc" = "yes" ]]; then
51     true && pkgname+=('emacs-mozc')
52     makedepends+=('emacs')
55 build() {
56   if [[ "$_ibus_mozc" != "yes" && "$_scim_mozc" != "yes" ]]; then
57     msg "*****************************************************"
58     msg " Please choose either one of ibus or scim at least."
59     msg " See PKGBUILD."
60     msg "*****************************************************"
61     return 1
62   fi
64   if [[ "$QTDIR" && -z "$_qtdir" ]]; then
65     msg '====================================================='
66     msg '                *** CAUTION ***'
67     msg ' $QTDIR will be replaced temporarily and forcibly'
68     msg ' for Qt3 users.'
69     msg ' If it is inconvenient for you, please edit'
70     msg ' PKGBUILD. (Please see it for datail)'
71     msg '====================================================='
72   fi
74   msg '====================================================='
75   msg '               *** Build Info ***'
76   msg ' The following package files will be generated:'
77   for _p in ${pkgname[@]}
78   do
79     msg "  * ${_p}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
80   done
81   msg '====================================================='
83   cd "${srcdir}/${pkgbase}-${pkgver}"
85   # Adjust to use python2
86   find . -name  \*.py        -type f -exec sed -i -e "1s|python.*$|python2|"  {} +
87   find . -regex ".*\.gypi?$" -type f -exec sed -i -e "s|'python'|'python2'|g" {} +
89   # Add zip code
90   msg "Generating zip code seed..."
91   python2 dictionary/gen_zip_code_seed.py --zip_code="${srcdir}/KEN_ALL.CSV" --jigyosyo="${srcdir}/JIGYOSYO.CSV" >> data/dictionary/dictionary09.txt
93   msg "Starting make..."
95   # Get make -j option from $MAKEFLAGS
96   _jobs=`sed -n -e "s/.*--jobs=\([0-9]\+\).*/\1/p" -e "s/.*-j *\([0-9]\+\).*/\1/p" <<< "$MAKEFLAGS"`
97   _jobs=${_jobs:-1}
99   _targets="server/server.gyp:mozc_server gui/gui.gyp:mozc_tool "
100   [[ "$_emacs_mozc" = "yes" ]] && _targets+="unix/emacs/emacs.gyp:mozc_emacs_helper "
101   [[ "$_ibus_mozc"  = "yes" ]] && _targets+="unix/ibus/ibus.gyp:ibus_mozc "
102   [[ "$_scim_mozc"  = "yes" ]] && _targets+="unix/scim/scim.gyp:scim_mozc unix/scim/scim.gyp:scim_mozc_setup "
104   QTDIR="$_qtdir" python2 build_mozc.py gyp --channel_dev=0
105   python2 build_mozc.py build_tools -c $_bldtype -j $_jobs
106   python2 build_mozc.py build -c $_bldtype -j $_jobs $_targets
108   [[ "$_ibus_mozc" = "yes" ]] && sed -i 's|/usr/libexec/|/usr/lib/ibus-mozc/|g' out_linux/${_bldtype}/obj/gen/unix/ibus/mozc.xml
110   if [[ "$_emacs_mozc" = "yes" ]]; then
111     cd unix/emacs
112     emacs -batch -f batch-byte-compile mozc.el
113     cd ~-
114   fi
116   # Extract liccense part of mozc
117   head -n 28 server/mozc_server.cc > LICENSE
120 package_mozc() {
121   pkgdesc="A Japanese Input Method for Chromium OS, Windows, Mac and Linux (the Open Source Edition of Google Japanese Input)"
122   arch=('i686' 'x86_64')
123   groups=('mozc-im')
124   depends=('curl' 'protobuf' 'qt')
125   replaces=('mozc-server' 'mozc-utils-gui')
126   conflicts=('mozc-server' 'mozc-utils-gui')
127   optdepends=('zinnia: hand-writing recognition support'
128               'tegaki-models-zinnia-japanese: hand-writing recognition support')
130   cd "${srcdir}/${pkgbase}-${pkgver}"
131   install -D -m 755 out_linux/${_bldtype}/mozc_server "${pkgdir}/usr/lib/mozc/mozc_server"
132   install    -m 755 out_linux/${_bldtype}/mozc_tool   "${pkgdir}/usr/lib/mozc/mozc_tool"
133   install -d "${pkgdir}/usr/lib/mozc/documents/"
134   install    -m 644 data/installer/*.html "${pkgdir}/usr/lib/mozc/documents/"
136   install -D -m 644 LICENSE "${pkgdir}/usr/share/licenses/${pkgbase}/LICENSE"
139 package_emacs-mozc() {
140   pkgdesc="Mozc for Emacs"
141   arch=('i686' 'x86_64')
142   groups=('mozc-im')
143   depends=("mozc=${pkgver}" 'emacs')
144   replaces=('emacs-mozc-bin')
145   conflicts=('emacs-mozc-bin')
146   install=emacs-mozc.install
148   cd "${srcdir}/${pkgbase}-${pkgver}"
149   install -D -m 755 out_linux/${_bldtype}/mozc_emacs_helper "${pkgdir}/usr/bin/mozc_emacs_helper"
150   install -d "${pkgdir}/usr/share/emacs/site-lisp/emacs-mozc/"
151   install -m 644 unix/emacs/mozc.el{,c} "${pkgdir}/usr/share/emacs/site-lisp/emacs-mozc"
154 package_ibus-mozc() {
155   pkgdesc="IBus engine module for Mozc"
156   arch=('i686' 'x86_64')
157   groups=('mozc-im')
158   depends=("mozc=${pkgver}" 'ibus')
160   cd "${srcdir}/${pkgbase}-${pkgver}"
161   install -D -m 755 out_linux/${_bldtype}/ibus_mozc       "${pkgdir}/usr/lib/ibus-mozc/ibus-engine-mozc"
162   install -D -m 644 out_linux/${_bldtype}/obj/gen/unix/ibus/mozc.xml "${pkgdir}/usr/share/ibus/component/mozc.xml"
163   install -D -m 644 data/images/unix/ime_product_icon_opensource-32.png "${pkgdir}/usr/share/ibus-mozc/product_icon.png"
164   install    -m 644 data/images/unix/ui-tool.png          "${pkgdir}/usr/share/ibus-mozc/tool.png"
165   install    -m 644 data/images/unix/ui-properties.png    "${pkgdir}/usr/share/ibus-mozc/properties.png"
166   install    -m 644 data/images/unix/ui-dictionary.png    "${pkgdir}/usr/share/ibus-mozc/dictionary.png"
167   install    -m 644 data/images/unix/ui-direct.png        "${pkgdir}/usr/share/ibus-mozc/direct.png"
168   install    -m 644 data/images/unix/ui-hiragana.png      "${pkgdir}/usr/share/ibus-mozc/hiragana.png"
169   install    -m 644 data/images/unix/ui-katakana_half.png "${pkgdir}/usr/share/ibus-mozc/katakana_half.png"
170   install    -m 644 data/images/unix/ui-katakana_full.png "${pkgdir}/usr/share/ibus-mozc/katakana_full.png"
171   install    -m 644 data/images/unix/ui-alpha_half.png    "${pkgdir}/usr/share/ibus-mozc/alpha_half.png"
172   install    -m 644 data/images/unix/ui-alpha_full.png    "${pkgdir}/usr/share/ibus-mozc/alpha_full.png"
175 package_scim-mozc() {
176   pkgdesc="SCIM IMEngine module for Mozc"
177   arch=('i686' 'x86_64')
178   groups=('mozc-im')
179   depends=("mozc=${pkgver}" 'scim')
181   cd "${srcdir}/${pkgbase}-${pkgver}"
182   _moduledir=`pkg-config scim --variable=moduledir`
183   install -D -m 755 out_linux/${_bldtype}/lib.target/libscim_mozc.so       "${pkgdir}${_moduledir}/IMEngine/mozc.so"
184   install -D -m 755 out_linux/${_bldtype}/lib.target/libscim_mozc_setup.so "${pkgdir}${_moduledir}/SetupUI/mozc-setup.so"
185   _icondir=`pkg-config scim --variable=icondir`
186   install -D -m 644 data/images/unix/ime_product_icon_opensource-32.png "${pkgdir}${_icondir}/scim-mozc.png"
187   install    -m 644 data/images/unix/ui-tool.png          "${pkgdir}${_icondir}/scim-mozc-tool.png"
188   install    -m 644 data/images/unix/ui-properties.png    "${pkgdir}${_icondir}/scim-mozc-properties.png"
189   install    -m 644 data/images/unix/ui-dictionary.png    "${pkgdir}${_icondir}/scim-mozc-dictionary.png"
190   install    -m 644 data/images/unix/ui-direct.png        "${pkgdir}${_icondir}/scim-mozc-direct.png"
191   install    -m 644 data/images/unix/ui-hiragana.png      "${pkgdir}${_icondir}/scim-mozc-hiragana.png"
192   install    -m 644 data/images/unix/ui-katakana_half.png "${pkgdir}${_icondir}/scim-mozc-katakana_half.png"
193   install    -m 644 data/images/unix/ui-katakana_full.png "${pkgdir}${_icondir}/scim-mozc-katakana_full.png"
194   install    -m 644 data/images/unix/ui-alpha_half.png    "${pkgdir}${_icondir}/scim-mozc-alpha_half.png"
195   install    -m 644 data/images/unix/ui-alpha_full.png    "${pkgdir}${_icondir}/scim-mozc-alpha_full.png"
198 # Global pkgdesc and depends are here so that they will be picked up by AUR
199 pkgdesc="A Japanese Input Method for Chromium OS, Windows, Mac and Linux (the Open Source Edition of Google Japanese Input)"
200 depends=('curl' 'protobuf' 'qt')