aboutsummaryrefslogtreecommitdiff
path: root/japanese/skk-jisyo/Makefile
blob: 33ec081b8deb61f9edb70f93012fa4c31cb36bca (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
# Created by: Shigeyuki FUKUSHIMA <shige@kuis.kyoto-u.ac.jp>
# $FreeBSD$

PORTNAME=	skk-jisyo
PORTVERSION=	201409
#PORTREVISION=	0
CATEGORIES=	japanese
MASTER_SITES=	LOCAL/matusita/${PORTNAME}
.if defined(WITH_SKKJISYO_CDB)
PKGNAMESUFFIX=	-cdb
.endif
DIST_SUBDIR=	skk-jisyo

MAINTAINER?=	ports@FreeBSD.org
COMMENT?=	Jisyo (dictionary) files for the SKK Japanese-input software

.if defined(WITH_SKKJISYO_CDB)
BUILD_DEPENDS=	${LOCALBASE}/bin/cdb:databases/tinycdb
.endif

SKKDIR?=	share/skk
SKK_JISYO_TYPE?=L M S

USES=		tar:bzip2
NO_WRKSUBDIR=		yes
EXTRACT_CMD=		${CP}
EXTRACT_BEFORE_ARGS=	-p
EXTRACT_AFTER_ARGS=	${WRKSRC}
PLIST_SUB+=		SKKDIR=${SKKDIR}
.for type in ${SKK_JISYO_TYPE}
DISTFILES+=		SKK-JISYO.${type}.${PORTVERSION}.bz2
PLIST_FILES+=		${SKKDIR}/SKK-JISYO.${type}${CDBSUFFIX}
.endfor

.if defined(WITH_SKKJISYO_CDB)
CDBSUFFIX=		.cdb
.else
CDBSUFFIX=		#empty
NO_BUILD=		yes
.endif

post-extract:
	@(cd ${WRKSRC}; ${BZIP2_CMD} -d *.bz2)

.if defined(WITH_SKKJISYO_DELCOMMENTS)
# Strip comments in transtation candidates list.
# Candidate list starts with '/', and each candidate is concatinated by
# '/' (e.g., "/c1/c2/".)  Each candidate may have a comment just after
# the candidate, leading a marker character ';' (e.g. /c3;comment/).
do-patch:
.for type in ${SKK_JISYO_TYPE}
	${REINPLACE_CMD} -e '/^[^;]/s,;[^/]*/,/,g' -e '/^>/d' \
		${WRKSRC}/SKK-JISYO.${type}.${PORTVERSION}
.endfor
.endif

.if defined(WITH_SKKJISYO_CDB)
# Convert plaintext jisyo data to CDB database by cdbmake.
# Each line consists of "+${klen},${dlen}:${key}->${data}", where klen/dlen
# are length of key/data.  A blank line at the end of data is required.
# See also: <URL:http://cr.yp.to/cdb/cdbmake.html>.
do-build:
.for type in ${SKK_JISYO_TYPE}
	${AWK} '/^[^;]/ { \
			s = substr($$0, index($$0, " ") + 1); \
			print "+" length($$1) "," length(s) ":" $$1 "->" s; \
		} \
		END { \
			print ""; \
		}' \
		< ${WRKSRC}/SKK-JISYO.${type}.${PORTVERSION} | \
	${LOCALBASE}/bin/cdb -c -t - \
		${WRKSRC}/SKK-JISYO.${type}.${PORTVERSION}${CDBSUFFIX}
.endfor
.endif

do-install:
	${MKDIR} ${STAGEDIR}${PREFIX}/${SKKDIR}
.for type in ${SKK_JISYO_TYPE}
	${INSTALL_DATA} ${WRKSRC}/SKK-JISYO.${type}.${PORTVERSION}${CDBSUFFIX} \
		${STAGEDIR}${PREFIX}/${SKKDIR}/SKK-JISYO.${type}${CDBSUFFIX}
.endfor

.include <bsd.port.mk>