1 |
commit: 8effb27cc81b23cd05c9c2dfc63983a64d65437d |
2 |
Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org> |
3 |
AuthorDate: Thu Sep 28 16:31:10 2017 +0000 |
4 |
Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Sep 28 17:11:00 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8effb27c |
7 |
|
8 |
app-i18n/mozc: Add live ebuild. |
9 |
|
10 |
app-i18n/mozc/mozc-9999.ebuild | 309 +++++++++++++++++++++++++++++++++++++++++ |
11 |
1 file changed, 309 insertions(+) |
12 |
|
13 |
diff --git a/app-i18n/mozc/mozc-9999.ebuild b/app-i18n/mozc/mozc-9999.ebuild |
14 |
new file mode 100644 |
15 |
index 00000000000..686839da1c0 |
16 |
--- /dev/null |
17 |
+++ b/app-i18n/mozc/mozc-9999.ebuild |
18 |
@@ -0,0 +1,309 @@ |
19 |
+# Copyright 1999-2017 Gentoo Foundation |
20 |
+# Distributed under the terms of the GNU General Public License v2 |
21 |
+ |
22 |
+EAPI="6" |
23 |
+PYTHON_COMPAT=(python2_7) |
24 |
+ |
25 |
+inherit elisp-common multiprocessing python-any-r1 toolchain-funcs |
26 |
+ |
27 |
+if [[ "${PV}" == "9999" ]]; then |
28 |
+ inherit git-r3 |
29 |
+ |
30 |
+ EGIT_REPO_URI="https://github.com/google/mozc" |
31 |
+ EGIT_SUBMODULES=(src/third_party/japanese_usage_dictionary) |
32 |
+else |
33 |
+ MOZC_GIT_REVISION="" |
34 |
+ JAPANESE_USAGE_DICTIONARY_GIT_REVISION="" |
35 |
+ JAPANESE_USAGE_DICTIONARY_DATE="" |
36 |
+fi |
37 |
+ |
38 |
+FCITX_PATCH_VERSION="2.18.2612.102.1" |
39 |
+ |
40 |
+DESCRIPTION="Mozc - Japanese input method editor" |
41 |
+HOMEPAGE="https://github.com/google/mozc" |
42 |
+if [[ "${PV}" == "9999" ]]; then |
43 |
+ SRC_URI="" |
44 |
+else |
45 |
+ SRC_URI="https://github.com/google/${PN}/archive/${MOZC_GIT_REVISION}.tar.gz -> ${P}.tar.gz |
46 |
+ https://github.com/hiroyuki-komatsu/japanese-usage-dictionary/archive/${JAPANESE_USAGE_DICTIONARY_GIT_REVISION}.tar.gz -> japanese-usage-dictionary-${JAPANESE_USAGE_DICTIONARY_DATE}.tar.gz" |
47 |
+fi |
48 |
+SRC_URI+=" fcitx4? ( https://download.fcitx-im.org/fcitx-mozc/fcitx-mozc-${FCITX_PATCH_VERSION}.patch )" |
49 |
+ |
50 |
+# Mozc: BSD |
51 |
+# src/data/dictionary_oss: ipadic, public-domain |
52 |
+# src/data/unicode: unicode |
53 |
+# japanese-usage-dictionary: BSD-2 |
54 |
+LICENSE="BSD BSD-2 ipadic public-domain unicode" |
55 |
+SLOT="0" |
56 |
+KEYWORDS="" |
57 |
+IUSE="debug emacs fcitx4 +gui +handwriting-tegaki handwriting-tomoe ibus renderer test" |
58 |
+REQUIRED_USE="|| ( emacs fcitx4 ibus ) gui? ( ^^ ( handwriting-tegaki handwriting-tomoe ) ) !gui? ( !handwriting-tegaki !handwriting-tomoe )" |
59 |
+ |
60 |
+RDEPEND="dev-libs/protobuf:= |
61 |
+ emacs? ( virtual/emacs ) |
62 |
+ fcitx4? ( app-i18n/fcitx:4 ) |
63 |
+ gui? ( |
64 |
+ app-i18n/zinnia |
65 |
+ dev-qt/qtcore:5 |
66 |
+ dev-qt/qtgui:5 |
67 |
+ dev-qt/qtwidgets:5 |
68 |
+ handwriting-tegaki? ( app-i18n/tegaki-zinnia-japanese ) |
69 |
+ handwriting-tomoe? ( app-i18n/zinnia-tomoe ) |
70 |
+ ) |
71 |
+ ibus? ( |
72 |
+ >=app-i18n/ibus-1.4.1 |
73 |
+ dev-libs/glib:2 |
74 |
+ x11-libs/libxcb |
75 |
+ ) |
76 |
+ renderer? ( |
77 |
+ dev-libs/glib:2 |
78 |
+ x11-libs/cairo |
79 |
+ x11-libs/gtk+:2 |
80 |
+ x11-libs/pango |
81 |
+ )" |
82 |
+DEPEND="${RDEPEND} |
83 |
+ ${PYTHON_DEPS} |
84 |
+ dev-util/gyp |
85 |
+ dev-util/ninja |
86 |
+ virtual/pkgconfig |
87 |
+ test? ( |
88 |
+ >=dev-cpp/gtest-1.8.0 |
89 |
+ dev-libs/jsoncpp |
90 |
+ )" |
91 |
+ |
92 |
+S="${WORKDIR}/${P}/src" |
93 |
+ |
94 |
+SITEFILE="50${PN}-gentoo.el" |
95 |
+ |
96 |
+execute() { |
97 |
+ einfo "$@" |
98 |
+ "$@" |
99 |
+} |
100 |
+ |
101 |
+src_unpack() { |
102 |
+ if [[ "${PV}" == "9999" ]]; then |
103 |
+ git-r3_src_unpack |
104 |
+ else |
105 |
+ unpack ${P}.tar.gz |
106 |
+ mv mozc-${MOZC_GIT_REVISION} ${P} || die |
107 |
+ |
108 |
+ unpack japanese-usage-dictionary-${JAPANESE_USAGE_DICTIONARY_DATE}.tar.gz |
109 |
+ cp -p japanese-usage-dictionary-${JAPANESE_USAGE_DICTIONARY_GIT_REVISION}/usage_dict.txt ${P}/src/third_party/japanese_usage_dictionary || die |
110 |
+ fi |
111 |
+} |
112 |
+ |
113 |
+src_prepare() { |
114 |
+ eapply -p2 "${FILESDIR}/${PN}-2.20.2673.102-system_libraries.patch" |
115 |
+ eapply -p2 "${FILESDIR}/${PN}-2.20.2673.102-tests_build.patch" |
116 |
+ eapply -p2 "${FILESDIR}/${PN}-2.20.2673.102-tests_skipping.patch" |
117 |
+ |
118 |
+ if use fcitx4; then |
119 |
+ eapply -p2 "${DISTDIR}/fcitx-mozc-${FCITX_PATCH_VERSION}.patch" |
120 |
+ fi |
121 |
+ |
122 |
+ eapply_user |
123 |
+ |
124 |
+ sed \ |
125 |
+ -e "s/def GypMain(options, unused_args):/def GypMain(options, gyp_args):/" \ |
126 |
+ -e "s/RunOrDie(gyp_command + gyp_options)/RunOrDie(gyp_command + gyp_options + gyp_args)/" \ |
127 |
+ -e "s/RunOrDie(\[ninja/&, '-j$(makeopts_jobs)', '-l$(makeopts_loadavg "${MAKEOPTS}" 0)', '-v'/" \ |
128 |
+ -i build_mozc.py || die |
129 |
+ |
130 |
+ sed \ |
131 |
+ -e "s/'release_extra_cflags%': \['-O2'\]/'release_extra_cflags%': []/" \ |
132 |
+ -e "s/'debug_extra_cflags%': \['-O0', '-g'\]/'debug_extra_cflags%': []/" \ |
133 |
+ -i gyp/common.gypi || die |
134 |
+ |
135 |
+ local ar=($(tc-getAR)) |
136 |
+ local cc=($(tc-getCC)) |
137 |
+ local cxx=($(tc-getCXX)) |
138 |
+ local ld=($(tc-getLD)) |
139 |
+ local nm=($(tc-getNM)) |
140 |
+ local readelf=($(tc-getPROG READELF readelf)) |
141 |
+ |
142 |
+ # Use absolute paths. Non-absolute paths are mishandled by GYP. |
143 |
+ ar[0]=$(type -P ${ar[0]}) |
144 |
+ cc[0]=$(type -P ${cc[0]}) |
145 |
+ cxx[0]=$(type -P ${cxx[0]}) |
146 |
+ ld[0]=$(type -P ${ld[0]}) |
147 |
+ nm[0]=$(type -P ${nm[0]}) |
148 |
+ readelf[0]=$(type -P ${readelf[0]}) |
149 |
+ |
150 |
+ sed \ |
151 |
+ -e "s:<!(which ar):${ar[@]}:" \ |
152 |
+ -e "s:<!(which clang):${cc[@]}:" \ |
153 |
+ -e "s:<!(which clang++):${cxx[@]}:" \ |
154 |
+ -e "s:<!(which ld):${ld[@]}:" \ |
155 |
+ -e "s:<!(which nm):${nm[@]}:" \ |
156 |
+ -e "s:<!(which readelf):${readelf[@]}:" \ |
157 |
+ -i gyp/common.gypi || die |
158 |
+} |
159 |
+ |
160 |
+src_configure() { |
161 |
+ if use debug; then |
162 |
+ BUILD_TYPE="Debug" |
163 |
+ else |
164 |
+ BUILD_TYPE="Release" |
165 |
+ fi |
166 |
+ |
167 |
+ local gyp_arguments=() |
168 |
+ |
169 |
+ if tc-is-gcc; then |
170 |
+ gyp_arguments+=(-D compiler_host=gcc -D compiler_target=gcc) |
171 |
+ elif tc-is-clang; then |
172 |
+ gyp_arguments+=(-D compiler_host=clang -D compiler_target=clang) |
173 |
+ else |
174 |
+ gyp_arguments+=(-D compiler_host=unknown -D compiler_target=unknown) |
175 |
+ fi |
176 |
+ |
177 |
+ gyp_arguments+=(-D use_libibus=$(usex ibus 1 0)) |
178 |
+ gyp_arguments+=(-D use_libprotobuf=1) |
179 |
+ gyp_arguments+=(-D use_libzinnia=1) |
180 |
+ gyp_arguments+=(-D enable_gtk_renderer=$(usex renderer 1 0)) |
181 |
+ |
182 |
+ gyp_arguments+=(-D server_dir="${EPREFIX}/usr/libexec/mozc") |
183 |
+ gyp_arguments+=(-D document_dir="${EPREFIX}/usr/libexec/mozc/documents") |
184 |
+ |
185 |
+ if use handwriting-tegaki; then |
186 |
+ gyp_arguments+=(-D zinnia_model_file="${EPREFIX}/usr/share/tegaki/models/zinnia/handwriting-ja.model") |
187 |
+ elif use handwriting-tomoe; then |
188 |
+ gyp_arguments+=(-D zinnia_model_file="${EPREFIX}/usr/$(get_libdir)/zinnia/model/tomoe/handwriting-ja.model") |
189 |
+ fi |
190 |
+ |
191 |
+ if use ibus; then |
192 |
+ gyp_arguments+=(-D ibus_mozc_path="${EPREFIX}/usr/libexec/ibus-engine-mozc") |
193 |
+ gyp_arguments+=(-D ibus_mozc_icon_path="${EPREFIX}/usr/share/ibus-mozc/product_icon.png") |
194 |
+ fi |
195 |
+ |
196 |
+ unset AR CC CXX LD NM READELF |
197 |
+ |
198 |
+ execute "${PYTHON}" build_mozc.py gyp \ |
199 |
+ --gypdir="${EPREFIX}/usr/bin" \ |
200 |
+ --server_dir="${EPREFIX}/usr/libexec/mozc" \ |
201 |
+ --verbose \ |
202 |
+ $(usex gui "" --noqt) \ |
203 |
+ -- "${gyp_arguments[@]}" || die "Configuration failed" |
204 |
+} |
205 |
+ |
206 |
+src_compile() { |
207 |
+ local targets=(server/server.gyp:mozc_server) |
208 |
+ if use emacs; then |
209 |
+ targets+=(unix/emacs/emacs.gyp:mozc_emacs_helper) |
210 |
+ fi |
211 |
+ if use fcitx4; then |
212 |
+ targets+=(unix/fcitx/fcitx.gyp:fcitx-mozc) |
213 |
+ fi |
214 |
+ if use gui; then |
215 |
+ targets+=(gui/gui.gyp:mozc_tool) |
216 |
+ fi |
217 |
+ if use ibus; then |
218 |
+ targets+=(unix/ibus/ibus.gyp:ibus_mozc) |
219 |
+ fi |
220 |
+ if use renderer; then |
221 |
+ targets+=(renderer/renderer.gyp:mozc_renderer) |
222 |
+ fi |
223 |
+ if use test; then |
224 |
+ targets+=(gyp/tests.gyp:unittests) |
225 |
+ fi |
226 |
+ |
227 |
+ execute "${PYTHON}" build_mozc.py build -c ${BUILD_TYPE} -v "${targets[@]}" || die "Building failed" |
228 |
+ |
229 |
+ if use emacs; then |
230 |
+ elisp-compile unix/emacs/*.el |
231 |
+ fi |
232 |
+} |
233 |
+ |
234 |
+src_test() { |
235 |
+ execute "${PYTHON}" build_mozc.py runtests -c ${BUILD_TYPE} --test_jobs 1 || die "Testing failed" |
236 |
+} |
237 |
+ |
238 |
+src_install() { |
239 |
+ exeinto /usr/libexec/mozc |
240 |
+ doexe out_linux/${BUILD_TYPE}/mozc_server |
241 |
+ |
242 |
+ if use gui; then |
243 |
+ doexe out_linux/${BUILD_TYPE}/mozc_tool |
244 |
+ fi |
245 |
+ |
246 |
+ if use renderer; then |
247 |
+ doexe out_linux/${BUILD_TYPE}/mozc_renderer |
248 |
+ fi |
249 |
+ |
250 |
+ insinto /usr/libexec/mozc/documents |
251 |
+ doins data/installer/credits_en.html |
252 |
+ |
253 |
+ if use emacs; then |
254 |
+ dobin out_linux/${BUILD_TYPE}/mozc_emacs_helper |
255 |
+ elisp-install ${PN} unix/emacs/*.{el,elc} |
256 |
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}" ${PN} |
257 |
+ fi |
258 |
+ |
259 |
+ if use fcitx4; then |
260 |
+ exeinto /usr/$(get_libdir)/fcitx |
261 |
+ doexe out_linux/${BUILD_TYPE}/fcitx-mozc.so |
262 |
+ |
263 |
+ insinto /usr/share/fcitx/addon |
264 |
+ doins unix/fcitx/fcitx-mozc.conf |
265 |
+ |
266 |
+ insinto /usr/share/fcitx/inputmethod |
267 |
+ doins unix/fcitx/mozc.conf |
268 |
+ |
269 |
+ insinto /usr/share/fcitx/mozc/icon |
270 |
+ newins data/images/product_icon_32bpp-128.png mozc.png |
271 |
+ local image |
272 |
+ for image in data/images/unix/ui-*.png; do |
273 |
+ newins "${image}" "mozc-${image#data/images/unix/ui-}" |
274 |
+ done |
275 |
+ |
276 |
+ local locale mo_file |
277 |
+ for mo_file in out_linux/${BUILD_TYPE}/gen/unix/fcitx/po/*.mo; do |
278 |
+ locale="${mo_file##*/}" |
279 |
+ locale="${locale%.mo}" |
280 |
+ insinto /usr/share/locale/${locale}/LC_MESSAGES |
281 |
+ newins "${mo_file}" fcitx-mozc.mo |
282 |
+ done |
283 |
+ fi |
284 |
+ |
285 |
+ if use ibus; then |
286 |
+ exeinto /usr/libexec |
287 |
+ newexe out_linux/${BUILD_TYPE}/ibus_mozc ibus-engine-mozc |
288 |
+ |
289 |
+ insinto /usr/share/ibus/component |
290 |
+ doins out_linux/${BUILD_TYPE}/gen/unix/ibus/mozc.xml |
291 |
+ |
292 |
+ insinto /usr/share/ibus-mozc |
293 |
+ newins data/images/unix/ime_product_icon_opensource-32.png product_icon.png |
294 |
+ local image |
295 |
+ for image in data/images/unix/ui-*.png; do |
296 |
+ newins "${image}" "${image#data/images/unix/ui-}" |
297 |
+ done |
298 |
+ fi |
299 |
+} |
300 |
+ |
301 |
+pkg_postinst() { |
302 |
+ if use emacs; then |
303 |
+ elisp-site-regen |
304 |
+ |
305 |
+ elog "USAGE IN EMACS" |
306 |
+ elog |
307 |
+ elog "mozc-mode is minor mode to input Japanese text using Mozc server." |
308 |
+ elog "mozc-mode can be used via LEIM (Library of Emacs Input Method)." |
309 |
+ elog |
310 |
+ elog "In order to use mozc-mode by default, the following settings should be added to" |
311 |
+ elog "Emacs init file (~/.emacs.d/init.el or ~/.emacs):" |
312 |
+ elog |
313 |
+ elog " (require 'mozc)" |
314 |
+ elog " (set-language-environment \"Japanese\")" |
315 |
+ elog " (setq default-input-method \"japanese-mozc\")" |
316 |
+ elog |
317 |
+ elog "With the above settings, typing C-\\ (which is bound to \"toggle-input-method\"" |
318 |
+ elog "by default) will enable mozc-mode." |
319 |
+ elog |
320 |
+ elog "Alternatively, at run time, after loading mozc.el, mozc-mode can be activated by" |
321 |
+ elog "calling \"set-input-method\" and entering \"japanese-mozc\"." |
322 |
+ fi |
323 |
+} |
324 |
+ |
325 |
+pkg_postrm() { |
326 |
+ use emacs && elisp-site-regen |
327 |
+} |