aboutsummaryrefslogtreecommitdiff
path: root/japanese/mozc-server/Makefile
blob: 0621e14755fe9213e3f4f26da496f48227d0e576 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# New ports collection makefile for:	mozc-server
# Date created:				26 June 2010
# Whom:					Daichi GOTO <daichi@freebsd.org>
#
# $FreeBSD$
#

PORTNAME=	mozc
PORTVERSION=	1.3.931.102
PORTREVISION?=	1
CATEGORIES=	japanese
MASTER_SITES=	${MASTER_SITE_GOOGLE_CODE}
PKGNAMEPREFIX?=	ja-
PKGNAMESUFFIX?=	-server

MAINTAINER=	daichi@FreeBSD.org
COMMENT?=	Mozc server for IBus, SCIM and others

LIB_DEPENDS=	curl.6:${PORTSDIR}/ftp/curl \
		gtest.0:${PORTSDIR}/devel/googletest \
		protobuf.7:${PORTSDIR}/devel/protobuf \
		zinnia.0:${PORTSDIR}/japanese/zinnia
RUN_DEPENDS=	xdg-open:${PORTSDIR}/devel/xdg-utils

USE_BZIP2=	yes
USE_GMAKE=	yes
USE_ICONV=	yes
USE_PYTHON=	yes

BUILD_MOZC_LIST?=	mozc_server

.if ${BUILD_MOZC_LIST:Mmozc_tool} == "mozc_tool"
USE_QT_VER=	4
QT_COMPONENTS=	gui dbus qmake_build moc_build uic_build rcc_build
.endif
.if ${BUILD_MOZC_LIST:Mibus_mozc} == "ibus_mozc" || ${BUILD_MOZC_LIST:Mscim_mozc} == "scim_mozc"
USE_GNOME=	pygtk2
.endif
.if ${BUILD_MOZC_LIST:Mmozc-el} == "mozc-el"
USE_EMACS=	yes
.endif

.include <bsd.port.pre.mk>

.if ${OSVERSION} < 800107
BROKEN=		Does not compile on FreeBSD 7.X
.endif

.if ${ARCH} == "ia64" || ${ARCH} == "powerpc" || ${ARCH} == "sparc64"
BROKEN=		Does not compile: segfault
.endif

.if defined(WITH_DEBUG_CODE)
BUILD_MODE=	Debug
.else
BUILD_MODE=	Release
.endif

LOCALBASE_REPLACE_FILES= \
		build_mozc.py \
		gyp/common.gypi \
		unix/ibus/gen_mozc_xml.py \
		unix/ibus/mozc.xml \
		unix/ibus/path_util.cc \
		unix/scim/scim.gyp \
		unix/scim/scim_mozc.cc \
		base/util.cc \
		base/process.cc \
		gui/about_dialog/about_dialog.cc \
		handwriting/zinnia_handwriting.cc

BUILD_CMD=	${SETENV} ${MAKE_ENV} ${GMAKE}
BUILD_MOZC_CMD=	cd ${BUILD_WRKSRC} && \
		${SETENV} BUILD_COMMAND="${WRKSRC}/mozcmake" \
		PYTHONPATH=${WRKSRC}/third_party/gyp/local/lib/python${PYTHON_VER}/site-packages \
		FLOCK= \
		${PYTHON_CMD} build_mozc.py
BUILD_GYP_CMD=	cd ${WRKSRC}/third_party/gyp && ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYSETUP}

post-patch:
	cd ${WRKSRC} && \
		${REINPLACE_CMD} "s/@@LOCALBASE@@/${LOCALBASE:S/\//\\\//g}/g" \
		${LOCALBASE_REPLACE_FILES}

pre-build:
	${PRINTF} "%s\n%s\n" "#!/bin/sh" 'exec ${BUILD_CMD} $$@' > ${WRKSRC}/mozcmake
	${CHMOD} +x ${WRKSRC}/mozcmake
	${BUILD_GYP_CMD} ${PYDISTUTILS_CONFIGURE_TARGET} ${PYDISTUTILS_CONFIGUREARGS}
	${BUILD_GYP_CMD} ${PYDISTUTILS_BUILD_TARGET} ${PYDISTUTILS_BUILDARGS}
	${BUILD_GYP_CMD} ${PYDISTUTILS_INSTALL_TARGET} --prefix=${WRKSRC}/third_party/gyp/local
	${BUILD_MOZC_CMD} gyp --gypdir=${WRKSRC}/third_party/gyp/local/bin
	${BUILD_MOZC_CMD} build_tools -c ${BUILD_MODE}

# mozc_server
.if ${BUILD_MOZC_LIST:Mmozc_server} == "mozc_server"
PLIST_FILES+=	bin/mozc_server

do-build-mozc_server:
	${BUILD_MOZC_CMD} build -c ${BUILD_MODE} server/server.gyp:mozc_server

do-install-mozc_server:
	@${INSTALL_PROGRAM} \
		${WRKSRC}/out_linux/${BUILD_MODE}/mozc_server \
		${PREFIX}/bin
.endif

# mozc_tool
.if ${BUILD_MOZC_LIST:Mmozc_tool} == "mozc_tool"
RUN_DEPENDS+=	${LOCALBASE}/share/tegaki/models/zinnia/handwriting-ja.model:${PORTSDIR}/japanese/tegaki-zinnia-japanese

PLIST_FILES+=	bin/mozc_tool \
		${DATADIR_REL}/icons/product_logo.png \
		${DATADIR_REL}/icons/update_uptodate.png
PLIST_DIRS+=	${DATADIR_REL}/icons ${DATADIR_REL}

do-build-mozc_tool:
	${BUILD_MOZC_CMD} build -c ${BUILD_MODE} gui/gui.gyp:mozc_tool

do-install-mozc_tool:
	@${INSTALL_PROGRAM} \
	       ${WRKSRC}/out_linux/${BUILD_MODE}/mozc_tool \
	       ${PREFIX}/bin
	@${MKDIR} ${DATADIR}/icons
	@${INSTALL_DATA} \
		${WRKSRC}/data/images/unix/ime_product_icon_opensource-32.png \
		${DATADIR}/icons/product_logo.png
	@${INSTALL_DATA} \
		${WRKSRC}/data/images/unix/ime_product_icon_opensource-32.png \
		${DATADIR}/icons/update_uptodate.png
.endif

# ibus_mozc
.if ${BUILD_MOZC_LIST:Mibus_mozc} == "ibus_mozc"
LIB_DEPENDS+=	ibus-1.0.400:${PORTSDIR}/textproc/ibus
RUN_DEPENDS+=	mozc_server:${PORTSDIR}/japanese/mozc-server \
		mozc_tool:${PORTSDIR}/japanese/mozc-tool \
		mozc_server_start:${PORTSDIR}/japanese/mozc-additions \
		${PYTHON_SITELIBDIR}/gtk-2.0/pynotify/_pynotify.so:${PORTSDIR}/devel/py-notify

PLIST_FILES+=	libexec/ibus-engine-mozc \
		share/ibus/component/mozc.xml \
		${DATADIR_REL}/icons/alpha_full.png \
		${DATADIR_REL}/icons/alpha_half.png \
		${DATADIR_REL}/icons/dictionary.png \
		${DATADIR_REL}/icons/direct.png \
		${DATADIR_REL}/icons/hiragana.png \
		${DATADIR_REL}/icons/katakana_full.png \
		${DATADIR_REL}/icons/katakana_half.png \
		${DATADIR_REL}/icons/product_logo.png \
		${DATADIR_REL}/icons/properties.png \
		${DATADIR_REL}/icons/tool.png
PLIST_DIRS+=	${DATADIR_REL}/icons ${DATADIR_REL}

do-build-ibus_mozc:
	${BUILD_MOZC_CMD} build -c ${BUILD_MODE} unix/ibus/ibus.gyp:ibus_mozc

do-install-ibus_mozc:
	${INSTALL_PROGRAM} \
		${WRKSRC}/out_linux/${BUILD_MODE}/ibus_mozc \
		${PREFIX}/libexec/ibus-engine-mozc
	${INSTALL_DATA} \
		${WRKSRC}/unix/ibus/mozc.xml \
		${PREFIX}/share/ibus/component/mozc.xml
	${MKDIR} ${DATADIR}/icons
.for F in ui-alpha_full ui-alpha_half ui-dictionary ui-direct \
	ui-hiragana ui-katakana_full ui-katakana_half ui-properties ui-tool
	${INSTALL_DATA} \
		${WRKSRC}/data/images/unix/${F}.png \
		${DATADIR}/icons/${F:S/^ui-//}.png
.endfor
	@${INSTALL_DATA} \
		${WRKSRC}/data/images/unix/ime_product_icon_opensource-32.png \
		${DATADIR}/icons/product_logo.png
.endif

# scim_mozc
.if ${BUILD_MOZC_LIST:Mscim_mozc} == "scim_mozc"
BUILD_DEPENDS+=	scim:${PORTSDIR}/textproc/scim
RUN_DEPENDS+=	scim:${PORTSDIR}/textproc/scim \
		mozc_server:${PORTSDIR}/japanese/mozc-server \
		mozc_tool:${PORTSDIR}/japanese/mozc-tool \
		mozc_server_start:${PORTSDIR}/japanese/mozc-additions \
		${PYTHON_SITELIBDIR}/gtk-2.0/pynotify/_pynotify.so:${PORTSDIR}/devel/py-notify

PLIST_FILES+=	lib/scim-1.0/1.4.0/IMEngine/mozc.so \
		lib/scim-1.0/1.4.0/SetupUI/mozc_setup.so \
		${DATADIR_REL}/icons/scim-mozc-alpha_full.png \
		${DATADIR_REL}/icons/scim-mozc-alpha_half.png \
		${DATADIR_REL}/icons/scim-mozc-dictionary.png \
		${DATADIR_REL}/icons/scim-mozc-direct.png \
		${DATADIR_REL}/icons/scim-mozc-hiragana.png \
		${DATADIR_REL}/icons/scim-mozc-katakana_full.png \
		${DATADIR_REL}/icons/scim-mozc-katakana_half.png \
		${DATADIR_REL}/icons/scim-mozc-properties.png \
		${DATADIR_REL}/icons/scim-mozc-tool.png \
		${DATADIR_REL}/icons/scim-mozc.png
PLIST_DIRS+=	${DATADIR_REL}/icons ${DATADIR_REL}

do-build-scim_mozc:
	${BUILD_MOZC_CMD} build -c ${BUILD_MODE} \
		unix/scim/scim.gyp:scim_mozc \
		unix/scim/scim.gyp:scim_mozc_setup

do-install-scim_mozc:
	${INSTALL_LIB} \
		${WRKSRC}/out_linux/${BUILD_MODE}/lib.target/libscim_mozc.so \
		${PREFIX}/lib/scim-1.0/1.4.0/IMEngine/mozc.so
	${INSTALL_LIB} \
		${WRKSRC}/out_linux/${BUILD_MODE}/lib.target/libscim_mozc_setup.so \
		${PREFIX}/lib/scim-1.0/1.4.0/SetupUI/mozc_setup.so
	@${MKDIR} ${DATADIR}/icons
.for F in ui-alpha_full ui-alpha_half ui-dictionary ui-direct \
	ui-hiragana ui-katakana_full ui-katakana_half ui-properties ui-tool
	@${INSTALL_DATA} \
		${WRKSRC}/data/images/unix/${F}.png \
		${DATADIR}/icons/${F:S/^ui-/scim-mozc-/}.png
.endfor
	@${INSTALL_DATA} \
		${WRKSRC}/data/images/unix/ime_product_icon_opensource-32.png \
		${DATADIR}/icons/scim-mozc.png
.endif

# mozc-el
.if ${BUILD_MOZC_LIST:Mmozc-el} == "mozc-el"
CATEGORIES+=	editors elisp
RUN_DEPENDS+=	mozc_server:${PORTSDIR}/japanese/mozc-server \
		mozc_server_start:${PORTSDIR}/japanese/mozc-additions

PLIST_FILES+=	bin/mozc_emacs_helper \
		${EMACS_VERSION_SITE_LISPDIR}/mozc.el \
		${EMACS_VERSION_SITE_LISPDIR}/mozc.elc

do-build-mozc-el:
	${BUILD_MOZC_CMD} build -c ${BUILD_MODE} \
		unix/emacs/emacs.gyp:mozc_emacs_helper
	@cd ${WRKSRC}/unix/emacs && \
		${EMACS_CMD} -batch -q -no-site-file -no-init-file \
				-f batch-byte-compile mozc.el

do-install-mozc-el:
	@${INSTALL_PROGRAM} \
		${WRKSRC}/out_linux/${BUILD_MODE}/mozc_emacs_helper \
		${PREFIX}/bin/
	@${INSTALL_DATA} \
		${WRKSRC}/unix/emacs/mozc.el \
		${PREFIX}/${EMACS_VERSION_SITE_LISPDIR}/
	@${INSTALL_DATA} \
		${WRKSRC}/unix/emacs/mozc.elc \
		${PREFIX}/${EMACS_VERSION_SITE_LISPDIR}/
.endif

do-build: ${BUILD_MOZC_LIST:S/^/do-build-/}
do-install: ${BUILD_MOZC_LIST:S/^/do-install-/}

.include <bsd.port.post.mk>