aboutsummaryrefslogtreecommitdiffstats
path: root/chinese/fcitx/Makefile
blob: 3f3e9b2c526a073d8f2f8882319ded223ecbc755 (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
# Created by: Shen Chuan-Hsing <statue@freebsd.sinica.edu.tw>
# $FreeBSD$

PORTNAME=   fcitx
PORTVERSION=    4.2.6.1
CATEGORIES= chinese x11
PORTREVISION=   1
MASTER_SITES=   ${MASTER_SITE_GOOGLE_CODE}
DISTFILES=  ${DISTNAME}${EXTRACT_SUFX} \
        pinyin.tar.gz table.tar.gz en_dict-${_DICT_VER}.tar.gz
DIST_SUBDIR=    ${PORTNAME}
EXTRACT_ONLY=   ${DISTNAME}${EXTRACT_SUFX}

MAINTAINER= lichray@gmail.com
COMMENT=    A Flexible Input Method Framework

LICENSE=    GPLv2

BUILD_DEPENDS=  ${LOCALBASE}/libdata/pkgconfig/iso-codes.pc:${PORTSDIR}/misc/iso-codes
LIB_DEPENDS=    execinfo:${PORTSDIR}/devel/libexecinfo \
        dbus-1:${PORTSDIR}/devel/dbus \
        icuuc:${PORTSDIR}/devel/icu
RUN_DEPENDS=    xdg-open:${PORTSDIR}/devel/xdg-utils

MAN1=       createPYMB.1 fcitx-remote.1 fcitx.1 mb2org.1 mb2txt.1 \
        readPYBase.1 readPYMB.1 scel2org.1 txt2mb.1
SUB_FILES=  pkg-message
SUB_LIST+=  PORTSDIR=${PORTSDIR}

CONFLICTS=  zh-scim-fcitx-3.*

USE_XZ=     yes
USE_GNOME=  pango intltool libxml2 gnomehack
USE_XORG=   x11 xext xkbfile
USE_LDCONFIG=   yes
USES=       cmake gettext
INSTALLS_ICONS= yes

OPTIONS_DEFINE= GTK2 GTK3 QT4 OPENCC TPUNC
OPTIONS_DEFAULT=GTK2

GTK2_DESC=  Enable Gtk2 IM module
GTK3_DESC=  Enable Gtk3 IM module
QT4_DESC=   Enable Qt4 IM module
OPENCC_DESC=    Enable OpenCC for Chinese Transform
TPUNC_DESC= Use traditional quotation marks

.include <bsd.port.options.mk>

CMAKE_ARGS+=    -DENABLE_XDGAUTOSTART=OFF -DFORCE_ENCHANT=ON

.if ${PORT_OPTIONS:MGTK2}
USE_GNOME+= gtk20
PLIST_SUB+= GTK2=""
SUB_LIST+=  GTK2_IM=fcitx
.else
CMAKE_ARGS+=    -DENABLE_GTK2_IM_MODULE=OFF
PLIST_SUB+= GTK2="@comment "
SUB_LIST+=  GTK2_IM=xim
.endif

.if ${PORT_OPTIONS:MGTK3}
USE_GNOME+= gtk30
CMAKE_ARGS+=    -DENABLE_GTK3_IM_MODULE=ON
PLIST_SUB+= GTK3=""
SUB_LIST+=  GTK3_IM=fcitx
.else
PLIST_SUB+= GTK3="@comment "
SUB_LIST+=  GTK3_IM=xim
.endif

.if ${PORT_OPTIONS:MQT4}
USE_QT4=    qmake_build moc_build rcc_build uic_build dbus gui inputmethods
CMAKE_ARGS+=    -DENABLE_QT_IM_MODULE=ON
PLIST_SUB+= QT4=""
.else
PLIST_SUB+= QT4="@comment "
.endif

.if ${PORT_OPTIONS:MOPENCC}
LIB_DEPENDS+=   opencc:${PORTSDIR}/chinese/opencc
.else
CMAKE_ARGS+=    -DENABLE_OPENCC=OFF
.endif

.if ${PORT_OPTIONS:MTPUNC}
EXTRA_PATCHES+= ${FILESDIR}/tpunc-data_punc.mb.zh_CN
.endif

.if defined(WITH_DEBUG)
CMAKE_ARGS+=    -DENABLE_DEBUG=ON
.endif

.if defined(NOPORTDOCS)
EXTRA_PATCHES+= ${FILESDIR}/nodocs-doc_CMakeLists.txt
.endif

.if defined(NOPORTDATA)
IGNORE=     code tables are required, undefine NOPORTDATA
.endif

_DICT_VER=  20120815

post-patch:
    @${CP} ${_DISTDIR}/pinyin.tar.gz ${WRKSRC}/data
    @${CP} ${_DISTDIR}/table.tar.gz ${WRKSRC}/data/table
    @${CP} ${_DISTDIR}/en_dict-${_DICT_VER}.tar.gz ${WRKSRC}/data
.if ${OSVERSION} < 800067
# getline() is GNU extension which FreeBSD only recently adopted
EXTRA_PATCHES+= ${FILESDIR}/getline-src_lib_fcitx-utils_utils.c \
        ${FILESDIR}/getline-src_lib_fcitx-utils_utils.h
.endif

post-install:
.if ${PORT_OPTIONS:MGTK2}
    -gtk-query-immodules-2.0 > ${LOCALBASE}/etc/gtk-2.0/gtk.immodules
.endif
.if ${PORT_OPTIONS:MGTK3}
    -gtk-query-immodules-3.0 > ${LOCALBASE}/lib/gtk-3.0/${GTK3_VERSION}/immodules.cache
.endif
    @${ECHO_CMD}
    @${CAT} ${PKGMESSAGE}
    @${ECHO_CMD}

.include <bsd.port.mk>