summaryrefslogtreecommitdiff
path: root/print/ja-ptex-bin/Makefile
blob: ec4fe1134b7d5d2bace9d5e78fd221825e1317fb (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# $NetBSD: Makefile,v 1.13 2004/10/07 02:01:38 jlam Exp $

DISTNAME=	ptex-src-${PTEX_VERS}
PKGNAME=	ja-ptex-bin-${PTEX_VERS}
PKGREVISION=	2
CATEGORIES=	print japanese
MASTER_SITES=	ftp://ftp.ascii.co.jp/pub/TeX/ascii-ptex/tetex/ \
		ftp://ring.gr.jp/pub/text/TeX/ascii-ptex/tetex/
DISTFILES+=	${DISTNAME}${EXTRACT_SUFX} # XXX
DISTFILES+=	${DF_DVIPSK_PATCH}
DISTFILES+=	mendexk${MENDEXK_VERS}${EXTRACT_SUFX}

MAINTAINER=	kei@NetBSD.org
HOMEPAGE=	http://www.ascii.co.jp/pb/ptex/
COMMENT=	Publishing TeX (pTeX)

# XXX ${MAKE_VARIABLES} won't be extracted here.  strange...
SITES_dvipsk-jpatch-p1.6.tar.gz= \
		ftp://ftp.ascii.co.jp/pub/TeX/ascii-ptex/dvips/ \
		ftp://ring.gr.jp/pub/text/TeX/ascii-ptex/dvips/
SITES_mendexk2.5.tar.gz= \
		ftp://ftp.ascii.co.jp/pub/TeX/ascii-ptex/mendex/ \
		ftp://ring.gr.jp/pub/text/TeX/ascii-ptex/mendex/

DEPENDS+=	ja-ptex-share>=2.1:../../print/ja-ptex-share

INSTALL_EXTRA_TMPL+=	${.CURDIR}/INSTALL
DEINSTALL_EXTRA_TMPL+=	${.CURDIR}/DEINSTALL

.include "../../print/teTeX-bin/Makefile.common"

PTEX_VERS=		3.1.2
DVIPSK_PATCH_VERS=	p1.6
MENDEXK_VERS=		2.5

DF_TETEX_BIN= tetex-src-${TETEX_BIN_VERS}${EXTRACT_SUFX}
DF_DVIPSK_PATCH= dvipsk-jpatch-${DVIPSK_PATCH_VERS}${EXTRACT_SUFX}
DF_MENDEXK= mendexk${MENDEXK_VERS}${EXTRACT_SUFX}

WRKDIR_=		${PKGSRCDIR}/print/teTeX-bin/${WRKDIR:T}
TETEX_DIR=		${WRKDIR_}/tetex-src-${TETEX_BIN_VERS}
WRKSRC=			${TETEX_DIR}
WRKSRC_PTEX=		${WRKSRC}/texk/web2c/${DISTNAME:S/-src//}
EXTRACT_ONLY=		# none

TEXMF=			${PREFIX}/share/texmf
TEXMFLOCAL=		${PREFIX}/share/texmf.local
FILES_SUBST+=		TEXMFLOCAL=${TEXMFLOCAL}
FILES_SUBST+=		TEXMFSITE=${TEXMFSITE}
FILES_SUBST+=		WRKDIR_=${WRKDIR_}
#FILES_SUBST+=		FILESDIR=${FILESDIR}
FILES_SUBST+=		PATCH=${PATCH}

pre-extract:
	if [ ! -r ${WRKSRC} ]; then \
		cd ../../print/teTeX-bin && ${MAKE} patch; \
	elif [ ! -r ${WRKSRC_PTEX} ]; then \
		cd ../../print/teTeX-bin && ${MAKE} clean; ${MAKE} patch; \
	fi;

post-extract:
.if defined(EXTRACT_USING_PAX)
	cd ${WRKDIR_} && \
		${PAX} -O -zrf ${DISTDIR}/${DIST_SUBDIR}/${DF_TETEX_BIN}
	cd ${WRKSRC}/texk/web2c && \
		${PAX} -O -zrf ${DISTDIR}/${DIST_SUBDIR}/${DISTNAME}${EXTRACT_SUFX}
	cd ${WRKSRC}/texk && \
		${PAX} -O -zrf ${DISTDIR}/${DIST_SUBDIR}/${DF_DVIPSK_PATCH}; \
		${PAX} -O -zrf ${DISTDIR}/${DIST_SUBDIR}/${DF_MENDEXK}
.else
	cd ${WRKDIR_} && \
		${GTAR} -zxpf ${DISTDIR}/${DIST_SUBDIR}/${DF_TETEX_BIN}
	cd ${WRKSRC}/texk/web2c && \
		${GTAR} -zxpf ${DISTDIR}/${DIST_SUBDIR}/${DISTNAME}${EXTRACT_SUFX}
	cd ${WRKSRC}/texk && \
		${GTAR} -zxpf ${DISTDIR}/${DIST_SUBDIR}/${DF_DVIPSK_PATCH}; \
		${GTAR} -zxpf ${DISTDIR}/${DIST_SUBDIR}/${DF_MENDEXK}
.endif
	${SED} -e "s|\$$TEXMF/ptex/plain/||" \
	${LOCALBASE}/share/texmf.local/ptex/plain/base/ptex.tex > \
		${WRKSRC_PTEX}/ptex.tex
	${RM} -f ${WRKSRC}/texmf ${WRKSRC}/texmf.local
	${LN} -s ${LOCALBASE}/share/texmf ${WRKSRC}
	${LN} -s ${LOCALBASE}/share/texmf.local ${WRKSRC}

pre-patch:
	${PATCH} -d ${WRKSRC}/texk -p0 -s \
		< ${WRKSRC}/texk/dvipsk-5.92b-${DVIPSK_PATCH_VERS}.patch

post-patch:
	${MV} ${WRKSRC}/texk/kpathsea/texmf.in \
		${WRKSRC}/texk/kpathsea/texmf.in.orig
	${SED} -e 's,@texmfsite@,${TEXMFSITE},' \
		-e 's,@texmflocal@,${TEXMFLOCAL},' \
		${WRKSRC}/texk/kpathsea/texmf.in.orig > \
		${WRKSRC}/texk/kpathsea/texmf.in

post-configure:
	cd ${WRKSRC_PTEX}; ./configure EUC ${TEXMFLOCAL}

do-build:
	cd ${WRKSRC}/texk/web2c; ${MAKE_PROGRAM}
	cd ${WRKSRC_PTEX}; ${MAKE_PROGRAM}
	cd ${WRKSRC}/texk/dvipsk; ${MAKE_PROGRAM}
	cd ${WRKSRC}/texk/mendexk${MENDEXK_VERS}; ${MAKE_PROGRAM}

do-install:
	cd ${WRKSRC_PTEX}; \
		${SETENV} texmflcl=${TEXMFLOCAL} ${MAKE_PROGRAM} install
	cd ${WRKSRC}/texk/dvipsk; \
		${SETENV} texmflcl=${TEXMFLOCAL} ${MAKE_PROGRAM} install; \
	${INSTALL_DATA} psfonts.map ${TEXMFLOCAL}/dvips/base
	${INSTALL_PROGRAM} ${WRKSRC}/texk/mendexk${MENDEXK_VERS}/mendex \
		${PREFIX}/bin
	${INSTALL_DATA} ${WRKSRC}/texk/PSTricks.patch ${TEXMF}/dvips/pstricks

pre-clean:
	cd ../../print/teTeX-bin && ${MAKE} clean

.include "../../print/teTeX-bin/kpathsea.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"