summaryrefslogtreecommitdiff
blob: fe912c140b05186e20ded3ed8a3548e2aa708cd5 (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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-text/tetex/tetex-20020901-r1.ebuild,v 1.6 2002/10/04 05:08:12 vapier Exp $

TETEXSRC="teTeX-src-beta-${PV}.tar.gz"
TEXMFSRC="teTeX-texmfsrc-beta-20020829.tar.gz"
TEXMF="teTeX-texmf-beta-${PV}.tar.gz"

S=${WORKDIR}/teTeX-src-beta-${PV}
DESCRIPTION="teTeX is a complete TeX distribution"
SRC_URI=" ftp://ftp.dante.de/tex-archive/systems/unix/teTeX-beta/${TETEXSRC}
	ftp://ftp.dante.de/tex-archive/systems/unix/teTeX-beta/${TEXMFSRC}
	ftp://ftp.dante.de/tex-archive/systems/unix/teTeX-beta/${TEXMF}
	mirror://gentoo/ec-ready-mf-tfm.tar.gz
	mirror://gentoo/teTeX-french.tar.gz"
HOMEPAGE="http://tug.cs.umb.edu/tetex/"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="x86 ppc sparc sparc64"

DEPEND="sys-apps/ed
	sys-libs/zlib 
	X? ( virtual/x11 )
	png? ( >=media-libs/libpng-1.2.1 )
	ncurses? ( sys-libs/ncurses )
	libwww? ( >=net-libs/libwww-5.4.0-r1 )"

RDEPEND=">=sys-devel/perl-5.2
	dev-util/dialog"

src_unpack() {

	unpack ${TETEXSRC}
	
	mkdir -p ${S}/texmf
	cd ${S}/texmf
	umask 022
	echo ">>> Unpacking ${TEXMFSRC}"
	tar --no-same-owner -xzf ${DISTDIR}/${TEXMFSRC} || die "Failed to unpack ${TEXMFSRC}!"
	echo ">>> Unpacking ${TEXMF}"
	tar --no-same-owner -xzf ${DISTDIR}/${TEXMF} || die "Failed to unpack ${TEXMF}!"
	echo ">>> Unpacking ec-ready-mf-tfm.tar.gz"
	tar --no-same-owner -xzf ${DISTDIR}/ec-ready-mf-tfm.tar.gz -C .. || \
		die "Failed to unpack ec-ready-mf-tfm.tar.gz!"
	echo ">>> Unpacking teTeX-french.tar.gz"
	tar --no-same-owner -xzf ${DISTDIR}/teTeX-french.tar.gz || \
		die "Failed to unpack teTeX-french.tar.gz!"

	cd ${S}
	# Fix invalid font mappings.
	patch -p0 < ${FILESDIR}/${P}-fontmap.diff || die
	# Change TEXMFLOCAL to /usr/local/share/texmf by default.
	patch -p1 < ${FILESDIR}/${P}-local.diff || die

	# Do not run config stuff during 'make install'
	# Rather do it here, as we really should not do it during
	# src_install().
	patch -p1 < ${FILESDIR}/${P}-dont-run-config.diff || die
	
	if [ "`use ncurses`" ]
	then
		cd ${S}/texk/tetex
		sed 's/tcdialog/dialog/g' texconfig > tc-gentoo
		mv tc-gentoo texconfig
	fi
}

src_compile() {

	local myconf=""
	use X \
		&& myconf="--with-x" \
		|| myconf="--without-x"

	use libwww \
		&& myconf="${myconf} --with-system-wwwlib"

	use png \
		&& myconf="${myconf} --with-system-pnglib"
	
	use ncurses \
		&& myconf="${myconf} --with-system-ncurses \
		                     --with-ncurses-libdir=/usr/lib \
		                     --with-ncurses-include=/usr/include"
	
	./configure --host=${CHOST} \
		--prefix=/usr \
		--bindir=/usr/bin \
		--datadir=/usr/share \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--datadir=${S} \
		--without-texinfo \
		--without-dialog \
		--with-system-zlib \
		--disable-multiplatform \
		--with-epsfwin \
		--with-mftalkwin \
		--with-regiswin \
		--with-tektronixwin \
		--with-unitermwin \
		--with-ps=gs \
		--enable-ipc \
		--with-etex \
		${myconf} || die

	make texmf=/usr/share/texmf || die
}

src_install() {

	dodir /usr/share/
	einfo "Installing texmf data..."
	mv -f texmf ${D}/usr/share
	
	make prefix=${D}/usr \
		bindir=${D}/usr/bin \
		datadir=${D}/usr/share \
		mandir=${D}/usr/share/man/man1 \
		infodir=${D}/usr/share/info \
		texmf=${D}/usr/share/texmf \
		-f Makefile \
		install || die

	dodoc PROBLEMS README
	docinto texk
	dodoc texk/ChangeLog texk/README
	docinto kpathesa
	cd ${S}/texk/kpathsea
	dodoc README* NEWS PROJECTS HIER
	docinto dviljk
	cd ${S}/texk/dviljk
	dodoc AUTHORS README NEWS
	docinto dvipsk
	cd ${S}/texk/dvipsk
	dodoc AUTHORS ChangeLog INSTALLATION README
	docinto makeindexk
	cd ${S}/texk/makeindexk
	dodoc CONTRIB COPYING NEWS NOTES PORTING README
	docinto ps2pkm
	cd ${S}/texk/ps2pkm
	dodoc ChangeLog CHANGES.type1 INSTALLATION README* 
	docinto web2c
	cd ${S}/texk/web2c
	dodoc AUTHORS ChangeLog NEWS PROJECTS README
	docinto xdvik
	cd ${S}/texk/xdvik
	dodoc BUGS FAQ README* 

	# Fix for conflicting readlink binary.
	rm -f ${D}/bin/readlink
	# Add /var/cache/fonts directory.
	dodir /var/cache/fonts

	# Fix for lousy upstream permissions on /usr/share/texmf files
	# NOTE: fowners is not recursive...
	einfo "Fixing permissions and ownership..."
	chown -R root.root ${D}/usr/share/texmf
}

pkg_postinst() {

	if [ "${ROOT}" = "/" ]
	then
		einfo "Configuring teTeX..."
		mktexlsr &> /dev/null
		fmtutil --all &> /dev/null
		texlinks &> /dev/null
		texconfig init &> /dev/null
		texconfig confall &> /dev/null
		texconfig font vardir /var/cache/fonts &> /dev/null
		texconfig font rw &> /dev/null
		echo
		
		einfo "****************************************************"
		einfo " To allow only root to generate fonts, use:"
		einfo
		einfo "   # texconfig font ro"
		einfo 
		einfo "****************************************************"
	fi
}