summaryrefslogtreecommitdiff
blob: 327ddd617fee64b51a87bd949f875cf23def1613 (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
122
123
124
125
126
127
128
129
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-tex/cjk-latex/cjk-latex-4.5.2.ebuild,v 1.8 2004/06/25 02:12:02 agriffis Exp $

inherit latex-package elisp-common gcc

MY_P="${P/-latex/}"

DESCRIPTION="A LaTeX 2e macro package which enables the use of CJK scripts in various encodings"
HOMEPAGE="http://cjk.ffii.org/"
# fonts are taken from ftp://ftp.ctan.org/tex-archive/fonts/CJK.tar.gz
SRC_URI="ftp://ftp.ffii.org/pub/cjk/${MY_P}.tar.gz
	mirror://gentoo/${MY_P}-fonts.tar.gz
	doc? ( ftp://ftp.ffii.org/pub/cjk/${MY_P}-doc.tar.gz )"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~ppc ~sparc amd64"
IUSE="doc emacs"

DEPEND="virtual/tetex
	emacs? ( virtual/emacs )"

S=${WORKDIR}/${MY_P}

src_unpack() {
	unpack ${MY_P}.tar.gz
	use doc && unpack ${MY_P}-doc.tar.gz

	cd ${S}
	unpack ${MY_P}-fonts.tar.gz
	rm CJK/han*.300.tar.gz || die
	for f in ${S}/CJK/*.tar.gz; do
		tar --no-same-owner -xzf $f || die
		find texmf/fonts/hbf -type f -exec cp {} ${T} \; || die
	done
	sed -i -e "/^pk_files/s/no/yes/" \
		-e "/^dpi_x/s/300/500/" \
		texmf/hbf2gf/*.cfg || die
}

src_compile() {
	cd utils
	for d in *conv; do
		cd $d
		local f=`echo $d | tr '[:upper:]' '[:lower:]'`
		$(gcc-getCC) ${CFLAGS} -o $f $f.c || die
		if [ $d = CEFconv ] ; then
			$(gcc-getCC) ${CFLAGS} -o cef5conv cef5conv.c || die
			$(gcc-getCC) ${CFLAGS} -o cefsconv cefsconv.c || die
		fi
		cd -
	done
	cd hbf2gf
	econf --with-kpathsea-lib=/usr/lib \
		--with-kpathsea-include=/usr/include/kpathsea || die
	make || die
	cd -

	if use emacs ; then
		cd lisp
		elisp-compile *.el
		cd emacs-20.3
		elisp-compile *.el
	fi

	cd ${T}

	for f in ${S}/texmf/hbf2gf/*.cfg ; do
		env HBF_TARGET=${S}/texmf/fonts ${S}/utils/hbf2gf/hbf2gf $f || die
	done
	for gf in *.gf ; do
		gftopk $gf || die
	done
}

src_install() {
	cd utils
	for d in *conv; do
		cd $d
		local f=`echo $d | tr '[:upper:]' '[:lower:]'`
		dobin *latex *conv
		doman *.1
		cd -
	done
	cd hbf2gf
	einstall || die

	cd ${S}
	dodir ${TEXMF}/tex/latex/${PN}
	cp -a texinput/* ${D}/${TEXMF}/tex/latex/${PN} || die
	cp -a contrib/wadalab ${D}/${TEXMF}/tex/latex/${PN} || die

	if use emacs ; then
		cd utils/lisp
		elisp-install ${PN} *.el{,c} emacs-20.3/*.el{,c}
		cd -
	fi

	cd ${S}
	for d in texmf/fonts/pk/modeless/*/* ; do
		insinto /usr/share/${d}
		for f in ${T}/${d##*/}*.pk ; do
			newins $f `basename ${f/.pk/.500pk}` \
				|| die "newins failed"
		done
	done
	cp -a texmf/fonts/* ${D}/${TEXMF}/fonts || die "cp failed"

	dodoc ChangeLog README doc/*
	docinto chinese; dodoc doc/chinese/*
	docinto japanese; dodoc doc/japanese/*
	if use doc ; then
		docinto cjk; dodoc doc/cjk/*
		insinto /usr/share/doc/${P}/dvi
		doins doc/dvi/*
		insinto /usr/share/doc/${P}/ps
		doins doc/ps/*
	fi

	docinto examples; dodoc examples/*
	if use doc ; then
		docinto examples/cjk; dodoc examples/cjk/*
		insinto /usr/share/doc/${P}/examples/dvi
		doins examples/dvi/*
		insinto /usr/share/doc/${P}/examples/ps
		doins examples/ps/*
	fi
}