Bump japanese/xgate to version 3.7pl6_2
[dports.git] / japanese / skk-jisyo / Makefile
1 # Created by: Shigeyuki FUKUSHIMA <shige@kuis.kyoto-u.ac.jp>
2 # $FreeBSD$
3
4 PORTNAME=       skk-jisyo
5 PORTVERSION=    201409
6 #PORTREVISION=  0
7 CATEGORIES=     japanese
8 MASTER_SITES=   LOCAL/matusita/${PORTNAME}
9 .if defined(WITH_SKKJISYO_CDB)
10 PKGNAMESUFFIX=  -cdb
11 .endif
12 DIST_SUBDIR=    skk-jisyo
13
14 MAINTAINER?=    ports@FreeBSD.org
15 COMMENT?=       Jisyo (dictionary) files for the SKK Japanese-input software
16
17 .if defined(WITH_SKKJISYO_CDB)
18 BUILD_DEPENDS=  ${LOCALBASE}/bin/cdb:databases/tinycdb
19 .endif
20
21 SKKDIR?=        share/skk
22 SKK_JISYO_TYPE?=L M S
23
24 USES=           tar:bzip2
25 NO_WRKSUBDIR=           yes
26 EXTRACT_CMD=            ${CP}
27 EXTRACT_BEFORE_ARGS=    -p
28 EXTRACT_AFTER_ARGS=     ${WRKSRC}
29 PLIST_SUB+=             SKKDIR=${SKKDIR}
30 .for type in ${SKK_JISYO_TYPE}
31 DISTFILES+=             SKK-JISYO.${type}.${PORTVERSION}.bz2
32 PLIST_FILES+=           ${SKKDIR}/SKK-JISYO.${type}${CDBSUFFIX}
33 .endfor
34
35 .if defined(WITH_SKKJISYO_CDB)
36 CDBSUFFIX=              .cdb
37 .else
38 CDBSUFFIX=              #empty
39 NO_BUILD=               yes
40 .endif
41
42 post-extract:
43         @(cd ${WRKSRC}; ${BZIP2_CMD} -d *.bz2)
44
45 .if defined(WITH_SKKJISYO_DELCOMMENTS)
46 # Strip comments in transtation candidates list.
47 # Candidate list starts with '/', and each candidate is concatinated by
48 # '/' (e.g., "/c1/c2/".)  Each candidate may have a comment just after
49 # the candidate, leading a marker character ';' (e.g. /c3;comment/).
50 do-patch:
51 .for type in ${SKK_JISYO_TYPE}
52         ${REINPLACE_CMD} -e '/^[^;]/s,;[^/]*/,/,g' -e '/^>/d' \
53                 ${WRKSRC}/SKK-JISYO.${type}.${PORTVERSION}
54 .endfor
55 .endif
56
57 .if defined(WITH_SKKJISYO_CDB)
58 # Convert plaintext jisyo data to CDB database by cdbmake.
59 # Each line consists of "+${klen},${dlen}:${key}->${data}", where klen/dlen
60 # are length of key/data.  A blank line at the end of data is required.
61 # See also: <URL:http://cr.yp.to/cdb/cdbmake.html>.
62 do-build:
63 .for type in ${SKK_JISYO_TYPE}
64         LC_ALL=C ${AWK} '/^[^;]/ { \
65                         s = substr($$0, index($$0, " ") + 1); \
66                         print "+" length($$1) "," length(s) ":" $$1 "->" s; \
67                 } \
68                 END { \
69                         print ""; \
70                 }' \
71                 < ${WRKSRC}/SKK-JISYO.${type}.${PORTVERSION} | \
72         ${LOCALBASE}/bin/cdb -c -t - \
73                 ${WRKSRC}/SKK-JISYO.${type}.${PORTVERSION}${CDBSUFFIX}
74 .endfor
75 .endif
76
77 do-install:
78         ${MKDIR} ${STAGEDIR}${PREFIX}/${SKKDIR}
79 .for type in ${SKK_JISYO_TYPE}
80         ${INSTALL_DATA} ${WRKSRC}/SKK-JISYO.${type}.${PORTVERSION}${CDBSUFFIX} \
81                 ${STAGEDIR}${PREFIX}/${SKKDIR}/SKK-JISYO.${type}${CDBSUFFIX}
82 .endfor
83
84 .include <bsd.port.mk>