summaryrefslogtreecommitdiff
path: root/japanese/skk-jisyo/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'japanese/skk-jisyo/Makefile')
-rw-r--r--japanese/skk-jisyo/Makefile89
1 files changed, 71 insertions, 18 deletions
diff --git a/japanese/skk-jisyo/Makefile b/japanese/skk-jisyo/Makefile
index f77fd180e47e..e26697624bb8 100644
--- a/japanese/skk-jisyo/Makefile
+++ b/japanese/skk-jisyo/Makefile
@@ -5,36 +5,89 @@
# $FreeBSD$
#
-PORTNAME?= skk-jisyo
-PORTVERSION?= 200408
+PORTNAME= skk-jisyo
+PORTVERSION= 200410
CATEGORIES= japanese
-MASTER_SITES?= http://www.tkd.ne.jp/~toru/skk/
-DISTFILES?= SKK-JISYO.L.${PORTVERSION}${SKK_JISYO_SUFFIX}.gz \
- SKK-JISYO.M.${PORTVERSION}${SKK_JISYO_SUFFIX}.gz \
- SKK-JISYO.S.${PORTVERSION}${SKK_JISYO_SUFFIX}.gz
+MASTER_SITES= ${MASTER_SITE_LOCAL}
+MASTER_SITE_SUBDIR= matusita/${PORTNAME}
+.if defined(WITH_SKKJISYO_CDB)
+PKGNAMESUFFIX= -cdb
+.endif
DIST_SUBDIR= skk-jisyo
-MAINTAINER?= ports@FreeBSD.org
+MAINTAINER?= matusita@FreeBSD.org
COMMENT?= Jisyo (dictionary) files for the SKK Japanese-input software
-NO_WRKSUBDIR= yes
-NO_BUILD= yes
-EXTRACT_CMD= ${CP}
+.if defined(WITH_SKKJISYO_CDB)
+BUILD_DEPENDS= ${LOCALBASE}/bin/cdbmake:${PORTSDIR}/databases/cdb
+.endif
+
+SKKDIR?= share/skk
+SKK_JISYO_TYPE?=L M S
+
+USE_BZIP2= yes
+NO_WRKSUBDIR= yes
+EXTRACT_CMD= ${CP}
EXTRACT_BEFORE_ARGS= -p
EXTRACT_AFTER_ARGS= ${WRKDIR}
+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_DELCOMMENTS)
+USE_REINPLACE= yes
+.endif
-SKKDIR?= share/skk
-SKK_JISYO_TYPE?= L M S
-SKK_JISYO_SUFFIX?= # empty
-
-PLIST_SUB= SKKDIR=${SKKDIR} JISYO_SUFFIX=${SKK_JISYO_SUFFIX}
+.if defined(WITH_SKKJISYO_CDB)
+CDBSUFFIX= .cdb
+.else
+CDBSUFFIX= #empty
+NO_BUILD= yes
+.endif
post-extract:
- @(cd ${WRKDIR}; ${GUNZIP_CMD} *.gz)
+ @(cd ${WRKDIR}; ${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' \
+ ${WRKDIR}/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} '/^[^;]/ { \
+ k = $$1; didx = index($$0, $$2); \
+ d = substr($$0, didx); \
+ print "+" length(k) "," length(d) ":" k "->" d; \
+ } \
+ END { \
+ print ""; \
+ }' \
+ < ${WRKDIR}/SKK-JISYO.${type}.${PORTVERSION} | \
+ ${LOCALBASE}/bin/cdbmake \
+ ${WRKDIR}/SKK-JISYO.${type}.${PORTVERSION}${CDBSUFFIX} \
+ ${WRKDIR}/SKK-JISYO.${type}.${PORTVERSION}.tmp
+.endfor
+.endif
+
do-install:
${MKDIR} ${PREFIX}/${SKKDIR}
-.for i in ${SKK_JISYO_TYPE}
- ${INSTALL_DATA} ${WRKSRC}/SKK-JISYO.${i}.${PORTVERSION}${SKK_JISYO_SUFFIX} ${PREFIX}/${SKKDIR}/SKK-JISYO.${i}${SKK_JISYO_SUFFIX}
+.for type in ${SKK_JISYO_TYPE}
+ ${INSTALL_DATA} ${WRKSRC}/SKK-JISYO.${type}.${PORTVERSION}${CDBSUFFIX} \
+ ${PREFIX}/${SKKDIR}/SKK-JISYO.${type}${CDBSUFFIX}
.endfor
.include <bsd.port.mk>