aboutsummaryrefslogtreecommitdiff
path: root/chinese/ttfm/Makefile.ttf
blob: efaaf2829efca664b64993ca3203d7e8e6326812 (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
# makefile for use of:	chinese/*ttf
# Date created:		17 Feb 2005
# Whom:			leeym
#
# $FreeBSD$
#
# The variable(s) for installing TrueType fonts.
# TTF		- Name(s) of font file(s) installed in FONTSDIR. Mandatory.
#
# The variable(s) to change the behavior of installing TrueType fonts.
# WITH_GS	- Add Ghostscript support
# WITHOUT_X11	- Remove X Window support
#

FONTSDIR?=	${PREFIX}/share/fonts/TrueType
FONTSDIR_REL=	${FONTSDIR:S,^${PREFIX}/,,}
PLIST_SUB+=	FONTSDIR=${FONTSDIR_REL}

XFONTSDIR?=	${LOCALBASE}/lib/X11/fonts/TrueType
XFONTSDIR_REL=	${XFONTSDIR:S,${LOCALBASE}/,,}
PLIST_SUB+=	XFONTSDIR=${XFONTSDIR_REL}

.if !defined(WITHOUT_X11)
RUN_DEPENDS+=	${LOCALBASE}/bin/fc-cache:${PORTSDIR}/x11-fonts/fontconfig
_TTF_MODULES=	xttfm
.endif

.if defined(WITH_GS)
RUN_DEPENDS+=	${LOCALBASE}/share/fonts/adobe-cmaps/ai0/CMap/Identity-H:${PORTSDIR}/print/adobe-cmaps
_TTF_MODULES+=	gscjk
.endif

.if defined(_TTF_MODULES)
RUN_DEPENDS+=	${PREFIX}/bin/ttfm.sh:${PORTSDIR}/chinese/ttfm
.endif

check-makefile: check-makefile-ttf
check-makefile-ttf:
.if !defined(_TTF_MODULES)
	@${ECHO_CMD} "Makefile warning: You choose neither X11 nor GS. Only font files themselves are installed"
.else
	@${ECHO_CMD} ""
	@${ECHO_CMD} "You may use the following options:"
	@${ECHO_CMD} "	WITH_GS		- if you want Ghostscript support"
	@${ECHO_CMD} "	WITHOUT_X11	- if you DON'T want X Window support"
	@${ECHO_CMD} ""
.endif
.if !defined(TTF)
	@${ECHO_CMD} "Makefile error: You need to define TTF for installing TrueType fonts"
	@${FALSE}
.endif

post-install: do-install-ttf
do-install-ttf:
.if defined(_TTF_MODULES)
	@${ECHO_MSG} "===>  Running ttfm.sh"
.endif
.for module in ${_TTF_MODULES}
.	for ttf in ${TTF}
		${PREFIX}/bin/ttfm.sh --add ${module} ${FONTSDIR}/${ttf}
.	endfor
.endfor
.if !defined(WITHOUT_X11)
	@${ECHO_MSG} "===>  Running fc-cache"
	-@${LOCALBASE}/bin/fc-cache -f -v ${XFONTSDIR}
.endif

add-plist-post: add-plist-ttf
add-plist-ttf:
.for module in ${_TTF_MODULES}
.	for ttf in ${TTF}
		@${ECHO_CMD} "@unexec %D/bin/ttfm.sh --remove ${module} ${FONTSDIR}/${ttf} || true" >> ${TMPPLIST}
.	endfor
.endfor
.for ttf in ${TTF}
	@${ECHO_CMD} "${FONTSDIR_REL}/${ttf}" >> ${TMPPLIST}
.endfor
.for module in ${_TTF_MODULES}
.	for ttf in ${TTF}
		@${ECHO_CMD} "@exec %D/bin/ttfm.sh --add ${module} ${FONTSDIR}/${ttf} || true" >> ${TMPPLIST}
.	endfor
.endfor
.if !defined(WITHOUT_X11)
	@${ECHO_CMD} "@unexec ${LOCALBASE}/bin/fc-cache -f -v ${XFONTSDIR} || true" >> ${TMPPLIST}
	@${ECHO_CMD} "@exec ${LOCALBASE}/bin/fc-cache -f -v ${XFONTSDIR} || true" >> ${TMPPLIST}
	@${ECHO_CMD} "@unexec find ${XFONTSDIR} -size -3c -delete || true" >> ${TMPPLIST}
	@${ECHO_CMD} "@unexec rmdir ${XFONTSDIR} 2>/dev/null || true" >> ${TMPPLIST}
.endif
	@${ECHO_CMD} "@unexec rmdir ${FONTSDIR} 2>/dev/null || true" >> ${TMPPLIST}
	@${ECHO_CMD} "@unexec rmdir %D/share/fonts 2>/dev/null || true" >> ${TMPPLIST}