upgpkg: ufw 0.36.2-1
[ArchLinux/community.git] / fcitx-mozc / trunk / PKGBUILD
blob621bb4eb1d71e357217fc00bc0f51f5f7af608d0
1 # Maintainer: Jiachen Yang <farseerfc@archlinux.org>
2 # Contributor: Felix Yan <felixonmars@archlinux.org>
3 # Contributor: ponsfoot <cabezon dot hashimoto at gmail dot com>
4 # Contributor: UTUMI Hirosi <utuhiro78 at yahoo dot co dot jp>
6 ## Mozc compile option
7 _bldtype=Release
8 _mozc_commit=ca82d39
10 ## follow the submodule commits in https://github.com/fcitx/mozc/tree/fcitx/src/third_party
11 _abseil_cpp_commit=0f3bb46
12 _breakpad_commit=216cea7
13 _gtest_commit=703bd9c
14 _gyp_commit=caa6002
15 _japanese_usage_dictionary_commit=e5b3425
16 _jsoncpp_commit=11086dd
17 _protobuf_commit=fde7cf7
19 ## the latest release from https://osdn.net/projects/ponsfoot-aur/storage/mozc/
20 _zipcode_rel=202104
22 _pkgbase=mozc
23 pkgname=fcitx-mozc
24 pkgdesc="Fcitx Module of A Japanese Input Method for Chromium OS, Windows, Mac and Linux (the Open Source Edition of Google Japanese Input)"
25 pkgver=2.26.4360.102.gca82d39
26 pkgrel=2
27 arch=('x86_64')
28 url="https://github.com/google/mozc"
29 license=('custom')
30 depends=('qt5-base' 'fcitx')
31 makedepends=('pkg-config' 'python' 'curl' 'gtk2' 'mesa' 'subversion' 'ninja' 'git' 'clang' 'python-six')
32 replaces=('mozc-fcitx')
33 conflicts=('mozc' 'mozc-server' 'mozc-utils-gui' 'mozc-fcitx' 'fcitx5-mozc')
34 source=(git+https://github.com/fcitx/mozc.git#commit=${_mozc_commit}
35         https://osdn.net/projects/ponsfoot-aur/storage/mozc/jigyosyo-${_zipcode_rel}.zip
36         https://osdn.net/projects/ponsfoot-aur/storage/mozc/x-ken-all-${_zipcode_rel}.zip
37         git+https://chromium.googlesource.com/breakpad/breakpad#commit=${_breakpad_commit}
38         git+https://github.com/google/googletest.git#commit=${_gtest_commit}
39         git+https://chromium.googlesource.com/external/gyp#commit=${_gyp_commit}
40         git+https://github.com/hiroyuki-komatsu/japanese-usage-dictionary.git#commit=${_japanese_usage_dictionary_commit}
41         git+https://github.com/open-source-parsers/jsoncpp.git#commit=${_jsoncpp_commit}
42         git+https://github.com/google/protobuf.git#commit=${_protobuf_commit}
43         git+https://github.com/abseil/abseil-cpp.git#commit=${_abseil_cpp_commit}
44         )
45 sha512sums=('SKIP'
46             'cadb43138597371d13d21a2766ba38f0940a73bd961a1142f3713f700d1b8e75bdb6ccc0600ea57518ad5bf1931eed329cd11faeb87b191aa460e379ed1fed93'
47             'b473bda282e12c448ec10522306035b10b566d7ebfb051602e287a7890405db9189ce60189ed47cc130d15a196cd8c7440c6cbb2aaacc7e8cd62b90e50bcb1d9'
48             'SKIP'
49             'SKIP'
50             'SKIP'
51             'SKIP'
52             'SKIP'
53             'SKIP'
54             'SKIP')
55 validpgpkeys=('2CC8A0609AD2A479C65B6D5C8E8B898CBF2412F9')  # Weng Xuetian
57 pkgver(){
58   cd mozc
59   # change pkgver is OK because we fixed commit
60   # parse major.minor.buildid from version template, revision is fixed to 102 for Linux
61   _bzr_ver=$(sed 's/ //g;$ a echo $MAJOR.$MINOR.$BUILD.102' src/data/version/mozc_version_template.bzl | source /dev/stdin)
62   printf "%s.g%s" "${_bzr_ver}" "${_mozc_commit}"
65 prepare() {
66   cd "$srcdir/mozc"
67   git submodule init
68   git config submodule.src/third_party/breakpad.url "$srcdir/breakpad"
69   git config submodule.src/third_party/gtest.url "$srcdir/googletest"
70   git config submodule.src/third_party/gyp.url "$srcdir/gyp"
71   git config submodule.src/third_party/japanese_usage_dictionary.url "$srcdir/japanese-usage-dictionary"
72   git config submodule.src/third_party/jsoncpp.url "$srcdir/jsoncpp"
73   git config submodule.src/third_party/protobuf.url "$srcdir/protobuf"
74   git config submodule.src/third_party/abseil-cpp.url "$srcdir/abseil-cpp"
75   git submodule update
77   cd src
78   # Generate zip code seed
79   echo "Generating zip code seed..."
80   PYTHONPATH="$PWD:$PYTHONPATH" python dictionary/gen_zip_code_seed.py --zip_code="${srcdir}/x-ken-all.csv" --jigyosyo="${srcdir}/JIGYOSYO.CSV" >> data/dictionary_oss/dictionary09.txt
81   echo "Done."
83   # disable fcitx5 target
84   rm unix/fcitx5/fcitx5.gyp
85   
86   ## use libstdc++ instead of libc++
87   sed "/stdlib=libc++/d;/-lc++/d" -i gyp/common.gypi
89   # Fix build with python 3.10
90   cd third_party/gyp
91   git cherry-pick -n bc83cdacf5428ab6ddcc92fd0b0fc494cc9a4d4f
93   # Fix build with GCC 11
94   cd ../abseil-cpp
95   git checkout 5bf048b8425cc0a342e4647932de19e25ffd6ad7
98 build() {
99   # Fix compatibility with google-glog 0.3.3 (symbol conflict)
100   CFLAGS="${CFLAGS} -fvisibility=hidden"
101   CXXFLAGS="${CXXFLAGS} -fvisibility=hidden"
102   export _bldtype
104   cd mozc/src
106   _targets="server/server.gyp:mozc_server gui/gui.gyp:mozc_tool unix/fcitx/fcitx.gyp:fcitx-mozc"
108   QTDIR=/usr GYP_DEFINES="document_dir=/usr/share/licenses/$pkgname use_libzinnia=1" python build_mozc.py gyp
109   python build_mozc.py build -c $_bldtype $_targets
110   #../scripts/build
112   # Extract license part of mozc
113   head -n 29 server/mozc_server.cc > LICENSE
116 package() {
117   cd mozc/src
118   export PREFIX="${pkgdir}/usr"
119   export _bldtype
120   ../scripts/install_server
122   install -d "${pkgdir}/usr/share/licenses/$pkgname/"
123   install -m 644 LICENSE data/installer/*.html "${pkgdir}/usr/share/licenses/${pkgname}/"
125   install -d "${PREFIX}/share/fcitx/addon"
126   install -d "${PREFIX}/share/fcitx/inputmethod"
127   install -d "${PREFIX}/lib/fcitx"
128   ../scripts/install_fcitx