summaryrefslogtreecommitdiff
path: root/inputmethod/ja-freewnn-lib/Makefile.common
blob: 63988ea4d146a6f496e80a27dfa71f3b5414ed48 (plain)
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
# $NetBSD: Makefile.common,v 1.11 2006/03/10 22:29:08 jlam Exp $
#

DISTNAME=	FreeWnn-1.10
MASTER_SITES=	ftp://ftp.freewnn.org/pub/FreeWnn/	\
		ftp://etlport.etl.go.jp/pub/FreeWnn/	\
		ftp://ftp.st.ryukoku.ac.jp/pub/japanese-im/FreeWnn/	\
		ftp://ftp.kddlabs.co.jp/Japan/Wnn/FreeWnn/	\
		ftp://ftp.tomo.gr.jp/pub/FreeWnn/

PATCH_SITES=	${MASTER_SITES}
PATCHFILES=	patch-1.1.0-a01.gz
PATCH_DIST_STRIP=	-p2
DIST_SUBDIR=	freewnn

WRKSRC=		${WRKDIR}/Xsi
INSTALL_TARGET=	install install.man

.include "../../mk/bsd.prefs.mk"
WNNOWNER?=	wnn
SEDSCRIPT+=	-e 's|\(WNNOWNER = \).*|\1${WNNOWNER}|'
SEDSCRIPT+=	-e 's|\([JCKT]\)\(WNNDICDIR = \).*|\1\2${IMDICTDIR}/wnn/$$(\1WNNLANG)|'

.if defined(WNN_TARGET) && (${WNN_TARGET} == "SERVER")
MAKE_ENV+=	"WNN_TARGET=SERVER"
SEDSCRIPT+=	-e 's|$$([CK]*WNNJLIBSRC)/lib\([ck]*wnn\).a|-l\1|'
SEDSCRIPT+=	-e 's|\(:.*\)$$(WNNJLIB)|\1|'
.elif defined(WNN_TARGET) && (${WNN_TARGET} == "DICT")
MAKE_ENV+=	"WNN_TARGET=DICT"
DEINSTALL_SRC=	# empty
INSTALL_SRC=	${FILESDIR}/INSTALL
FILES_SUBST+=	WNNOWNER=${WNNOWNER}
.else
MAKE_ENV+=	"WNN_TARGET=LIBRARY"
.endif

.if defined(WNNDIR)
MAKE_ENV+=	"WNNDIR=${WNNDIR}"
.endif
.if defined(CWNNDIR)
MAKE_ENV+=	"CWNNDIR=${CWNNDIR}"
.endif
.if defined(KWNNDIR)
MAKE_ENV+=	"KWNNDIR=${KWNNDIR}"
.endif

GNU_CONFIGURE=	YES

post-patch:
	@for file in `${FIND} ${WRKSRC} -name Makefile.in -print`; do	\
		${MV} $$file $$file.orig;			\
		${SED} -e '/PREFIX = /d'			\
			-e 's|\(WNNBINDIR = $${PREFIX}/\)\(bin\)|\1s\2|' \
			-e 's|\([CK]*WNNBINDIR = $$(WNNBINDIR)\)/[ck]*Wnn4|\1|'\
			-e 's|\(WNNWNNDIR = $${PREFIX}/\)lib\(/wnn\)|\1share\2|'\
			-e '/(COMPRESSMANCMD) /d'		\
			-e 's|\/usr\/X11R6|$${PREFIX}|'		\
			${SEDSCRIPT}				\
			$$file.orig > $$file;			\
	done
	@for file in `${FIND} ${WRKSRC}/Wnn/man -name Makefile.in -print`; do\
		${MV} $$file $$file.orig2;				\
		${SED} -e 's|\(MANPATH = .*\)|\1/ja_JP.EUC|'		\
			$$file.orig2 > $$file;				\
	done
	@(cd ${WRKSRC}/Wnn/include;				\
		${MV} config.h config.h.orig;			\
		${SED} -e 's|^\(\#define	LIBDIR		"\)/usr/local/lib\(/wnn"\)|\1${PREFIX}/share\2|' \
			config.h.orig > config.h)

.if defined(WNN_TARGET) && (${WNN_TARGET} == "SERVER")
post-build:
	@${MV} ${WRKSRC}/Wnn/jd/jserverrc ${WRKSRC}/Wnn/jd/jserverrc.orig
	@${SED} -e 's|^\(jserver_dir\).*|\1 ${IMDICTDIR}/wnn/${WNN_LANG}|' \
		${WRKSRC}/Wnn/jd/jserverrc.orig > ${WRKSRC}/Wnn/jd/jserverrc
.endif

.if defined(WNN_TARGET) && (${WNN_TARGET} == "DICT")
EVAL_PREFIX+=	WNNSERVERBINDIR=ja-FreeWnn-server-bin

pre-build:
	@for file in `${FIND} ${WRKSRC}/Wnn/pubdic ${WRKSRC}/Wnn/wnncons -name Makefile -print`; do	\
		${MV} $$file $$file.orig2;				\
		${SED} -e 's|\(ATOD = \).*|\1${WNNSERVERBINDIR}/sbin/atod|' \
			-e 's|\(ATOF = \).*|\1${WNNSERVERBINDIR}/sbin/atof|' \
			-e 's|\(WNNTOUCH = \).*|\1${WNNSERVERBINDIR}/sbin/wnntouch|' \
			$$file.orig2 > $$file;				\
	done;
	@${MV} ${WRKSRC}/Wnn/Makefile ${WRKSRC}/Wnn/Makefile.orig2
	@${SED} -e 's|\(MKDIRHIER.*=\).*|\1 ${TRUE}|' \
		${WRKSRC}/Wnn/Makefile.orig2 > ${WRKSRC}/Wnn/Makefile
.endif

.include "../../mk/bsd.pkg.mk"