summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatsuu Takuto <matsuu@gentoo.org>2009-09-30 14:25:02 +0000
committerMatsuu Takuto <matsuu@gentoo.org>2009-09-30 14:25:02 +0000
commitb2ec9bee76e0ecfe86ee6419c3c222a7180e9cd7 (patch)
treedbb2425324d94dc35ba658a2f6be859f95ed0743 /app-text
parentFixed compilation on newer kernels. (diff)
downloadgentoo-2-b2ec9bee76e0ecfe86ee6419c3c222a7180e9cd7.tar.gz
gentoo-2-b2ec9bee76e0ecfe86ee6419c3c222a7180e9cd7.tar.bz2
gentoo-2-b2ec9bee76e0ecfe86ee6419c3c222a7180e9cd7.zip
Fixed #126092, #223793, #226877, #284825 and #282874.
(Portage version: 2.1.6.13/cvs/Linux x86_64)
Diffstat (limited to 'app-text')
-rw-r--r--app-text/ptex/ChangeLog11
-rw-r--r--app-text/ptex/files/CVE-2009-1284.patch18
-rw-r--r--app-text/ptex/files/ptex-3.1.10_p20090610-gentoo.patch133
-rw-r--r--app-text/ptex/files/ptex-3.1.10_p20090610-getline.patch84
-rw-r--r--app-text/ptex/ptex-3.1.10_p20090610.ebuild287
5 files changed, 531 insertions, 2 deletions
diff --git a/app-text/ptex/ChangeLog b/app-text/ptex/ChangeLog
index 654f932b8370..053ac8184cf7 100644
--- a/app-text/ptex/ChangeLog
+++ b/app-text/ptex/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for app-text/ptex
-# Copyright 2000-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-text/ptex/ChangeLog,v 1.81 2008/10/31 21:08:57 ulm Exp $
+# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-text/ptex/ChangeLog,v 1.82 2009/09/30 14:25:02 matsuu Exp $
+
+*ptex-3.1.10_p20090610 (30 Sep 2009)
+
+ 30 Sep 2009; MATSUU Takuto <matsuu@gentoo.org>
+ +ptex-3.1.10_p20090610.ebuild, +files/ptex-3.1.10_p20090610-gentoo.patch,
+ +files/ptex-3.1.10_p20090610-getline.patch, +files/CVE-2009-1284.patch:
+ Fixed #126092, #223793, #226877, #284825 and #282874.
31 Oct 2008; Ulrich Mueller <ulm@gentoo.org> ptex-3.1.10_p20071203.ebuild,
ptex-3.1.10_p20080128.ebuild, ptex-3.1.10_p20080414.ebuild:
diff --git a/app-text/ptex/files/CVE-2009-1284.patch b/app-text/ptex/files/CVE-2009-1284.patch
new file mode 100644
index 000000000000..3e5b7f791500
--- /dev/null
+++ b/app-text/ptex/files/CVE-2009-1284.patch
@@ -0,0 +1,18 @@
+--- tetex-src-3.0.orig/texk/web2c/bibtex.ch 2004-07-15 02:32:51.000000000 +0900
++++ tetex-src-3.0/texk/web2c/bibtex.ch 2009-09-30 08:11:22.000000000 +0900
+@@ -1077,6 +1077,15 @@
+ @y
+ @z
+
++% Forgot to check for pool overflow here. Triggered by test case linked
++% from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=520920.
++@x
++while (sp_ptr < sp_end) do {shift the substring}
++@y
++str_room(sp_end - sp_ptr);
++while (sp_ptr < sp_end) do {shift the substring}
++@z
++
+ % [459] Eliminate unreferenced statement label, because `undefined' is
+ % now a constant expression that is not evaluated at the Web level. If
+ % this label were ever required, it could be replaced by the constant
diff --git a/app-text/ptex/files/ptex-3.1.10_p20090610-gentoo.patch b/app-text/ptex/files/ptex-3.1.10_p20090610-gentoo.patch
new file mode 100644
index 000000000000..75c199523943
--- /dev/null
+++ b/app-text/ptex/files/ptex-3.1.10_p20090610-gentoo.patch
@@ -0,0 +1,133 @@
+--- ptetex3-20090610.orig/2extract-src.sh 2009-06-07 10:00:07.000000000 +0200
++++ ptetex3-20090610/2extract-src.sh 2009-09-16 08:05:52.000000000 +0200
+@@ -147,25 +147,25 @@
+ $MKDIR $SRC/texk/pdvipsk
+ $CP $SRC/texk/dvipsk/* $SRC/texk/pdvipsk/ 2> /dev/null
+ tarcp $SRC/texk/xdvik $SRC/texk/pxdvik
+- P=p
++ DVIPSK_P=p
+ fi # "$JAPANESE" = "international"
+ ## for dvipsk
+-#tarx archive/dvipsk-jpatch-p*.tar.gz $SRC/texk/${P}dvipsk
+-#cpatch $SRC/texk/${P}dvipsk/dvipsk-*.patch 1 $SRC/texk/${P}dvipsk
+-tarx archive/dvipsk-*-p*.tar.gz $SRC/texk/${P}dvipsk
+-cpatch $SRC/texk/${P}dvipsk/dvipsk-*.diff 1 $SRC/texk/${P}dvipsk
+-perlprint 's/^kpse_include/ac_include/g' $SRC/texk/${P}dvipsk/Makefile.in
++#tarx archive/dvipsk-jpatch-p*.tar.gz $SRC/texk/${DVIPSK_P}dvipsk
++#cpatch $SRC/texk/${DVIPSK_P}dvipsk/dvipsk-*.patch 1 $SRC/texk/${DVIPSK_P}dvipsk
++tarx archive/dvipsk-*-p*.tar.gz $SRC/texk/${DVIPSK_P}dvipsk
++cpatch $SRC/texk/${DVIPSK_P}dvipsk/dvipsk-*.diff 1 $SRC/texk/${DVIPSK_P}dvipsk
++perlprint 's/^kpse_include/ac_include/g' $SRC/texk/${DVIPSK_P}dvipsk/Makefile.in
+
+ ## for xdvik
+-zpatch archive/xdvik-200?????-tetex-3.0.diff.gz 3 $SRC/texk/${P}xdvik
++zpatch archive/xdvik-200?????-tetex-3.0.diff.gz 3 $SRC/texk/${DVIPSK_P}xdvik
+ # fix for FC5
+ perlprint 'print "#define NeedWidePrototypes 1\n" if /limits/' \
+- $SRC/texk/${P}xdvik/xdvi.h
++ $SRC/texk/${DVIPSK_P}xdvik/xdvi.h
+ # pTeX fontmap
+ perlnoprint "s/^ptexmap .*/ptexmap kanjix.map/; print unless /IPA/" \
+- $SRC/texk/${P}xdvik/texmf/xdvi.cfg
++ $SRC/texk/${DVIPSK_P}xdvik/texmf/xdvi.cfg
+ # adjust X resource
+-cat <<EOF >> $SRC/texk/${P}xdvik/texmf/XDvi || exit 1
++cat <<EOF >> $SRC/texk/${DVIPSK_P}xdvik/texmf/XDvi || exit 1
+
+
+ !!! ------- added by ptetex3 -------
+--- ptetex3-20090610.orig/4make-install.sh 2009-05-04 18:35:49.000000000 +0200
++++ ptetex3-20090610/4make-install.sh 2009-09-16 08:40:47.000000000 +0200
+@@ -44,11 +44,9 @@
+
+ echo "[--tetex--] configure"
+ cd $SRC || exit
+-$MKDIR $PREFIX/share/texmf 2> /dev/null # avoid warning of texmf tree
+ ./configure --prefix=$PREFIX --datadir=$DATADIR \
+ --disable-multiplatform --with-ptexenc=$KANJI_CODE \
+ $CONF_OPTION || exit
+-$RMDIR $PREFIX/share/texmf 2> /dev/null # avoid warning of texmf tree
+ xdvi_check
+ echo "[--tetex--] make"
+ $MAKE $MAKE_OPTION || exit
+diff -Naur ptetex3-20090610.orig/7font-search.sh ptetex3-20090610/7font-search.sh
+--- ptetex3-20090610.orig/7font-search.sh 2008-04-14 18:07:04.000000000 +0900
++++ ptetex3-20090610/7font-search.sh 2008-05-10 09:36:33.000000000 +0900
+@@ -58,6 +58,17 @@
+ done
+ }
+
++mksymlink_gentoo(){
++ $MKDIR $TRUETYPE
++ fonts_dir=/usr/share/fonts/
++ find $fonts_dir -maxdepth 1 -mindepth 1 -type d | while read font_path; do
++ if [ `find $font_path -maxdepth 1 -type f -iname '*.ttf' | wc -l` -gt 0 ]; then
++ font_name=${font_path/$fonts_dir/}
++ test -h ${TRUETYPE}/${font_name} && continue
++ $LN "${font_path}" "${TRUETYPE}/${font_name}"
++ fi
++ done
++}
+
+ setrmlgbm() {
+ if test -n "$2"; then
+@@ -111,10 +122,10 @@
+
+ mksymlink $CMAP <<EOF
+ ### リンク名 検索ディレクトリ/ファイル
+-Acrobat4 /usr{,/local,/sfw}{,/lib}/Acrobat4/Resource/CMap
+-Acrobat5 /usr{,/local,/sfw}{,/lib}/Acrobat5/Resource/Font
+-Acrobat7 /usr{,/local,/sfw}{,/lib}{,/Adobe}/Acrobat7.0/Resource/CMap
+-Acrobat8 /usr{,/local,/sfw}{,/lib}{,/Adobe}/Acrobat8.0/Resource/CMap
++Acrobat4 {/opt,/usr{,/local,/sfw}{,/lib}}/Acrobat4/Resource/CMap
++Acrobat5 {/opt,/usr{,/local,/sfw}{,/lib}}/Acrobat5/Resource/Font
++Acrobat7 {/opt,/usr{,/local,/sfw}{,/lib}}{,/Adobe}/Acrobat7{,.0}/Resource/CMap
++Acrobat8 {/opt,/usr{,/local,/sfw}{,/lib}}{,/Adobe}/{Acrobat,Reader}8{,.0}/Resource/CMap
+ ghostscript /usr{,/local,/sfw}/{share,lib}/ghostscript{,/*}/Resource/CMap
+ openwinja /usr/openwin/lib/locale/ja/X11/Resource/CMap
+ openwinko /usr/openwin/lib/locale/ko/X11/Resource/CMap
+@@ -122,21 +133,7 @@
+ openwintw /usr/openwin/lib/locale/zh_TW.BIG5/X11/Resource/CMap
+ EOF
+
+-mksymlink $TRUETYPE <<EOF
+-### リンク名 検索ディレクトリ/ファイル
+-x11 /usr{,/local,/X11R6,/pkg}/lib/X11/fonts/truetype
+-X11 /usr{,/local,/X11R6,/pkg}/lib/X11/fonts/TrueType
+-X11TTF /usr{,/local,/X11R6,/pkg}/lib/X11/fonts/TTF
+-truetype /usr{,/local}/share/fonts/truetype
+-TrueType /usr{,/local}/share/fonts/TrueType
+-TTF /usr{,/local}/share/fonts/TTF
+-ja /usr{,/local}/share/fonts/ja/TrueType
+-japanese /usr{,/local}/share/fonts/japanese/TrueType
+-openwin /usr/openwin/lib/locale/ja/X11/fonts/TT
+-QtPalmtop /opt/QtPalmtop/lib/X11/fonts/TrueType
+-f8sazanami-min /usr/share/fonts/sazanami-fonts-mincho
+-f8sazanami-goth /usr/share/fonts/sazanami-fonts-gothic
+-EOF
++mksymlink_gentoo
+
+ mksymlink $OPENTYPE <<EOF
+ ### リンク名 検索ディレクトリ/ファイル
+diff -Naur ptetex3-20090610.orig/common.sh ptetex3-20090610/common.sh
+--- ptetex3-20090610.orig/common.sh 2008-04-05 17:51:07.000000000 +0900
++++ ptetex3-20090610/common.sh 2008-05-10 09:47:00.000000000 +0900
+@@ -220,12 +220,12 @@
+ echo "You are root."
+ echo "It is RECOMMENDED to execute by a user."
+ echo "Executing by root may cause SERIOUS DAMAGE for your system."
+- echo -n "Are you sure to execute by root AT YOUR OWN RISK? (yes/NO) "
+- read REPLY
+- case $REPLY in
+- yes) ;;
+- *) exit 1;;
+- esac
++# echo -n "Are you sure to execute by root AT YOUR OWN RISK? (yes/NO) "
++# read REPLY
++# case $REPLY in
++# yes) ;;
++# *) exit 1;;
++# esac
+ fi
+ }
+
diff --git a/app-text/ptex/files/ptex-3.1.10_p20090610-getline.patch b/app-text/ptex/files/ptex-3.1.10_p20090610-getline.patch
new file mode 100644
index 000000000000..1a570cbce6fc
--- /dev/null
+++ b/app-text/ptex/files/ptex-3.1.10_p20090610-getline.patch
@@ -0,0 +1,84 @@
+diff -Naur tetex-src-3.0.orig/texk/dvipsk/afm2tfm.c tetex-src-3.0/texk/dvipsk/afm2tfm.c
+--- tetex-src-3.0.orig/texk/dvipsk/afm2tfm.c 2005-01-30 22:17:09.000000000 +0900
++++ tetex-src-3.0/texk/dvipsk/afm2tfm.c 2009-09-29 08:47:30.000000000 +0900
+@@ -257,7 +257,7 @@
+ }
+
+ int
+-getline P1H(void) {
++_getline P1H(void) {
+ register char *p ;
+ register int c ;
+
+@@ -606,7 +606,7 @@
+ ai = newchar() ;
+ ai->adobenum = -1 ;
+ ai->adobename = "||" ; /* boundary character name */
+- while (getline()) {
++ while (_getline()) {
+ switch(interest(paramstring())) {
+ case FontName:
+ fontname = paramnewstring() ;
+@@ -1882,7 +1882,7 @@
+
+ while (1) {
+ while (param == 0 || *param == 0) {
+- if (getline() == 0)
++ if (_getline() == 0)
+ error("! premature end in encoding file") ;
+ for (p=buffer; *p; p++)
+ if (*p == '%') {
+@@ -1973,7 +1973,7 @@
+ p = gettoken() ;
+ if (strcmp(p, "]"))
+ error("! token 258 in encoding must be make-array (])") ;
+- while (getline()) {
++ while (_getline()) {
+ for (p=buffer; *p; p++)
+ if (*p == '%') {
+ if (ignoreligkern == 0)
+diff -Naur tetex-src-3.0.orig/texk/web2c/cpascal.h tetex-src-3.0/texk/web2c/cpascal.h
+--- tetex-src-3.0.orig/texk/web2c/cpascal.h 2004-08-29 05:49:59.000000000 +0900
++++ tetex-src-3.0/texk/web2c/cpascal.h 2009-09-29 23:09:57.000000000 +0900
+@@ -14,6 +14,7 @@
+
+ /* We must include this first, to resolve many C issues. */
+ #include "config.h"
++#define getline _getline
+
+ /* We only use getopt in the applications, not in web2c itself. */
+ #include <kpathsea/getopt.h>
+diff -Naur tetex-src-3.0.orig/texk/web2c/mpware/mpto.c tetex-src-3.0/texk/web2c/mpware/mpto.c
+--- tetex-src-3.0.orig/texk/web2c/mpware/mpto.c 2004-07-15 02:40:35.000000000 +0900
++++ tetex-src-3.0/texk/web2c/mpware/mpto.c 2009-09-29 23:09:35.000000000 +0900
+@@ -95,7 +95,7 @@
+ exit(1);
+ }
+
+-char *getline() /* returns NULL on EOF or error, otherwise buf */
++char *_getline() /* returns NULL on EOF or error, otherwise buf */
+ {
+ int c;
+ unsigned loc = 0;
+@@ -203,10 +203,10 @@
+
+ while (*aa==' ' || *aa=='\t') aa++;
+ if (*aa==0)
+- if ((aa=getline())==NULL)
++ if ((aa=_getline())==NULL)
+ err("btex section does not end");
+ do { if (*aa==0)
+- if ((aa=getline())==NULL)
++ if ((aa=_getline())==NULL)
+ err("btex section does not end");
+ else printf("\n");
+ if (getbta(aa) && *tt=='e') {
+@@ -372,7 +372,7 @@
+ postverb = troff_postverb;
+ }
+ printf("%s",predoc);
+- while (getline()!=NULL)
++ while (_getline()!=NULL)
+ do_line();
+ printf("%s",postdoc);
+ free(buf);
diff --git a/app-text/ptex/ptex-3.1.10_p20090610.ebuild b/app-text/ptex/ptex-3.1.10_p20090610.ebuild
new file mode 100644
index 000000000000..df2747d22d7a
--- /dev/null
+++ b/app-text/ptex/ptex-3.1.10_p20090610.ebuild
@@ -0,0 +1,287 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-text/ptex/ptex-3.1.10_p20090610.ebuild,v 1.1 2009/09/30 14:25:02 matsuu Exp $
+
+# jmbreuer FOR DEV ONLY
+RESTRICT="mirror test"
+
+TETEX_PV=3.0_p1
+
+inherit eutils tetex-3 flag-o-matic autotools multilib
+
+SMALL_PV="${TETEX_PV/_p*}"
+TETEX_TEXMF_PV="${SMALL_PV}"
+TETEX_S="${WORKDIR}/tetex-src-${SMALL_PV}"
+
+DESCRIPTION="TeX distribution teTeX with Japanese patch collection 'ptetex3'"
+HOMEPAGE="http://www.nn.iij4u.or.jp/~tutimura/tex/ptetex.html"
+
+TETEX_SRC="tetex-src-${SMALL_PV}.tar.gz"
+TETEX_TEXMF="tetex-texmf-${TETEX_TEXMF_PV:-${TETEX_PV}}"
+TETEX_TEXMF_SRC="tetex-texmf-${TETEX_TEXMF_PV:-${TETEX_PV}}po.tar.gz"
+PTETEX="ptetex3-${PV/*_p}"
+PTETEX_CMAP="ptetex-cmap-20090506"
+
+SRC_PATH_TETEX="http://www.ctan.org/tex-archive/obsolete/systems/unix/teTeX/3.0/distrib"
+SRC_URI="${SRC_PATH_TETEX}/${TETEX_SRC}
+ ${SRC_PATH_TETEX}/${TETEX_TEXMF_SRC}
+ http://tutimura.ath.cx/~nob/tex/ptetex/ptetex3/${PTETEX}.tar.gz
+ http://tutimura.ath.cx/~nob/tex/ptetex/ptetex-cmap/${PTETEX_CMAP}.tar.gz
+ mirror://gentoo/${PN}-3.1.10_p20071122-dviljk-security-fixes.patch.bz2"
+
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86"
+
+BUILD_DIR="${WORKDIR}/build/usr"
+
+LICENSE="GPL-2 BSD"
+IUSE="X motif Xaw3d neXt iconv unicode"
+
+RDEPEND="!app-text/tetex
+ !<app-text/ptetex-3.1.9
+ !app-text/dvipdfmx
+ !app-text/xdvik
+ !dev-texlive/texlive-basic
+ !dev-texlive/texlive-latex
+ !dev-texlive/texlive-latexrecommended
+ media-libs/t1lib
+ media-libs/gd
+ X? (
+ >=media-libs/freetype-2.3.4
+ || (
+ media-fonts/ja-ipafonts
+ media-fonts/ipamonafont
+ media-fonts/vlgothic
+ media-fonts/sazanami
+ media-fonts/kochi-substitute
+ )
+ )"
+DEPEND="${RDEPEND}
+ app-arch/unzip"
+
+S="${WORKDIR}/${PTETEX}"
+
+src_unpack() {
+ mkdir -p "${WORKDIR}/${TETEX_TEXMF}"
+ cd "${WORKDIR}/${TETEX_TEXMF}"
+ unpack ${TETEX_TEXMF_SRC}
+ cd "${WORKDIR}"
+ unpack ${TETEX_SRC}
+ cd "${WORKDIR}"
+ unpack ${PN}-3.1.10_p20071122-dviljk-security-fixes.patch.bz2
+ unpack ${PTETEX}.tar.gz
+ unpack ${PTETEX_CMAP}.tar.gz
+ echo ">>> Unpacking jis and morisawa fonts ..."
+ tar xzf "${WORKDIR}"/${PTETEX}/archive/jis.tar.gz -C "${WORKDIR}" || die
+ tar xzf "${WORKDIR}"/${PTETEX}/archive/morisawa.tar.gz -C "${WORKDIR}" || die
+
+ # Gentoo box reserves variable ${P}!!
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-gentoo.patch
+
+ cat <<EOF > "${S}"/my_option
+SRC_DIR="${WORKDIR}"
+TMP_PREFIX="${BUILD_DIR}"
+PREFIX=/usr
+DATADIR=/usr/share
+TEXMFDIST="${WORKDIR}/${TETEX_TEXMF}"
+TEXSRC_EXTRACTED="${WORKDIR}"
+#make_option vartexfonts=/var/lib/texmf
+make_option vartexfonts="${T}/texfonts"
+make_option CC="$(tc-getCC)"
+make_option CXX="$(tc-getCXX)"
+JAPANESE=international
+XDVI=echo
+PXDVI=echo
+PLATEX209=no
+STRIP=no
+conf_option --without-dviljk
+conf_option --without-dvipng
+conf_option --without-info
+conf_option --without-texi2html
+conf_option --without-texinfo
+
+conf_option --with-system-zlib
+conf_option --with-system-pnglib
+conf_option --with-system-gd
+conf_option --with-system-ncurses
+conf_option --with-system-t1lib
+conf_option --enable-shared
+EOF
+
+ if use iconv ; then
+ echo "conf_option --enable-kanji-iconv" >> "${S}"/my_option
+ fi
+
+ if use unicode ; then
+ echo "KANJI_CODE=UTF8" >> "${S}"/my_option
+ else
+ echo "KANJI_CODE=EUC" >> "${S}"/my_option
+ fi
+
+ # copied from tetex-3.eclass and modified
+ if use X ; then
+ if use motif ; then
+ toolkit="motif"
+ elif use neXt ; then
+ toolkit="neXtaw"
+ elif use Xaw3d ; then
+ toolkit="xaw3d"
+ else
+ toolkit="xaw"
+ fi
+ echo "export CPPFLAGS=\"${CPPFLAGS} $(freetype-config --cflags)\"" >> "${S}"/my_option
+ echo "export LDFLAGS=\"${LDFLAGS} $(freetype-config --libs)\"" >> "${S}"/my_option
+ echo "conf_option --with-xdvi-x-toolkit=${toolkit}" >> "${S}"/my_option
+ else
+ echo "conf_option --without-x" >> "${S}"/my_option
+ echo "conf_option --without-xdvik" >> "${S}"/my_option
+ echo "conf_option --without-pxdvik" >> "${S}"/my_option
+ fi
+
+ cd "${S}"
+ unset TEXMFMAIN TEXMF HOME
+ emake -j1 x || die "emake x failed"
+
+ cd "${TETEX_S}"
+
+ epatch "${FILESDIR}/tetex-${SMALL_PV}-kpathsea-pic.patch"
+
+ # bug 85404
+ epatch "${FILESDIR}/${PN}-3.1.10_p20071122-epstopdf-wrong-rotation.patch"
+
+ # ptetex included
+ #epatch "${FILESDIR}/tetex-${TETEX_PV}-amd64-xdvik-wp.patch"
+ epatch "${FILESDIR}/tetex-${TETEX_PV}-mptest.patch"
+
+ #bug 98029
+ # no need
+ #epatch "${FILESDIR}/${PN}-3.1.10_p20071122-fmtutil-etex.patch"
+
+ #bug 115775
+ # ptex included
+ #epatch "${FILESDIR}/tetex-${TETEX_PV}-xpdf-vulnerabilities.patch"
+
+ # bug 94860
+ epatch "${FILESDIR}/${PN}-3.1.10_p20071122-pdftosrc-install.patch"
+
+ # bug 126918
+ epatch "${FILESDIR}/tetex-${TETEX_PV}-create-empty-files.patch"
+
+ # bug 94901
+ epatch "${FILESDIR}/tetex-${TETEX_PV}-dvipdfm-timezone.patch"
+
+ # security bug #170861
+ # ptetex included
+ # epatch "${FILESDIR}/tetex-${TETEX_PV}-CVE-2007-0650.patch"
+
+ # security bug #188172
+ # ptetex included
+ #epatch "${FILESDIR}/tetex-${TETEX_PV}-xpdf-CVE-2007-3387.patch"
+
+ # security bug #198238
+ epatch "${FILESDIR}/tetex-${TETEX_PV}-dvips_bufferoverflow.patch"
+
+ # securty bug #196735
+ epatch "${FILESDIR}/xpdf-3.02pl2.patch"
+
+ # Construct a Gentoo site texmf directory
+ # that overlays the upstream supplied
+ # target not found
+ #epatch "${FILESDIR}/tetex-${TETEX_PV}-texmf-site.patch"
+
+ # security bug #198238
+ epatch "${WORKDIR}/${PN}-3.1.10_p20071122-dviljk-security-fixes.patch"
+
+ # security bug #198238 and bug #193437
+ epatch "${FILESDIR}/tetex-${TETEX_PV}-t1lib-SA26241_buffer_overflow.patch"
+
+ # security bug #282874
+ epatch "${FILESDIR}/CVE-2009-1284.patch"
+
+ epatch "${FILESDIR}/${P}-getline.patch"
+
+ cd "${TETEX_S}/texk/dviljk"
+ eautoreconf
+}
+
+src_compile() {
+ unset TEXMFMAIN TEXMF HOME
+
+ emake -j1 c || die "emake c failed"
+ emake -j1 macro || die "emake macro failed"
+ emake -j1 otf || die "emake otf failed"
+ emake -j1 fonty || die "emake fonty failed"
+ emake -j1 babel || die "emake babel failed"
+
+ einfo "Setting ptetex-cmap ..."
+ cd "${WORKDIR}/${PTETEX_CMAP}"
+ PATH="${BUILD_DIR}/bin:${PATH}" \
+ LD_LIBRARY_PATH="${BUILD_DIR}/lib:${LD_LIBRARY_PATH}" \
+ TEXMFMAIN="${BUILD_DIR}/share/texmf" \
+ ./setup.sh "${BUILD_DIR}"/share/texmf/fonts/cmap
+}
+
+src_test() {
+ PATH="${BUILD_DIR}/bin:${PATH}" \
+ LD_LIBRARY_PATH="${BUILD_DIR}/lib:${LD_LIBRARY_PATH}" \
+ TEXMFMAIN="${BUILD_DIR}/share/texmf" \
+ emake -j1 test || die "emake test failed"
+}
+
+src_install() {
+ einfo "Installing ptetex3 binaries ..."
+ dobin "${BUILD_DIR}"/bin/*
+ dolib "${BUILD_DIR}"/lib/*
+
+ einfo "Installing /usr/include/* files ..."
+ insinto /usr/include
+ doins -r "${BUILD_DIR}"/include/*
+
+ einfo "Installing /usr/share/* files ..."
+ insinto /usr/share
+ cp -dr "${BUILD_DIR}"/share/* "${D}"/usr/share
+
+ einfo "Installing document files ..."
+ doman "${BUILD_DIR}"/man/*/*
+ doinfo "${BUILD_DIR}"/info/*
+
+ einfo "Installing jis and morisawa fonts ..."
+ insinto /usr/share/texmf/fonts/tfm
+ doins -r "${WORKDIR}"/jis/tfm/* || die "installing jis/tfm failed"
+ doins -r "${WORKDIR}"/morisawa/tfm/* || die "installing morisawa/tfm failed"
+
+ einfo "Installing texmf files ..."
+ find "${WORKDIR}"/${TETEX_TEXMF} -maxdepth 1 -mindepth 1 -type f | xargs rm -f
+ insinto /usr/share/texmf
+ doins -r "${WORKDIR}"/${TETEX_TEXMF}/*
+
+ einfo "Installing other files ..."
+ insinto /usr/share/texmf/fonts/map/dvips/tetex
+ insinto /usr/share/texmf/web2c
+ doins -r "${BUILD_DIR}"/share/texmf-var/web2c/*.fmt
+
+ einfo "Removing unnecessary files ..."
+ rm -r "${D}"/usr/share/texmf/doc
+ rm -r "${D}"/usr/share/texmf/web2c/texmf.cnf.*
+ rm -r "${D}"/usr/share/texmf/web2c/fmtutil.cnf.*
+ find "${D}"/usr/share/texmf | grep "ls-R" | xargs rm -f
+
+ einfo "Installing texmf-update scripte ..."
+ dosbin "${FILESDIR}"/texmf-update
+
+ dodoc ChangeLog* README*
+}
+
+pkg_postinst() {
+ tetex-3_pkg_postinst
+
+ elog
+ elog "Japanese dvips and xdvi have been renamed to pdvipsk and pxdvik."
+ elog
+ elog "To use proper Japanese font in dvips/dvipdfmx/xdvi/pdftex, you"
+ elog "needs to run updmap or updmap-sys w/ map. More deteil info about"
+ elog "this fonts central configuration can be available at following"
+ elog "ptetex Wiki:"
+ elog " http://tutimura.ath.cx/ptetex/?%A5%D5%A5%A9%A5%F3%A5%C8%A4%CE%BD%B8%C3%E6%B4%C9%CD%FD"
+ elog
+}