dev-tex/tex4ht/tex4ht-20090611_p1038-r2.ebuild
changeset 219 c0c5810e06b8
parent 217 cc0327602480
child 220 fca4a6de7c45
equal deleted inserted replaced
217:cc0327602480 219:c0c5810e06b8
     1 # Copyright 1999-2010 Gentoo Foundation
       
     2 # Distributed under the terms of the GNU General Public License v2
       
     3 # $Header: /var/cvsroot/gentoo-x86/dev-tex/tex4ht/tex4ht-20090611_p1038-r1.ebuild,v 1.8 2010/07/18 12:25:15 nixnut Exp $
       
     4 
       
     5 EAPI=2
       
     6 
       
     7 inherit latex-package toolchain-funcs java-pkg-opt-2
       
     8 
       
     9 IUSE=""
       
    10 
       
    11 # tex4ht-20050331_p2350 -> tex4ht-1.0.2005_03_31_2350
       
    12 MY_P="${PN}-1.0.${PV:0:4}_${PV:4:2}_${PV:6:2}_${PV/*_p/}"
       
    13 
       
    14 DESCRIPTION="Converts (La)TeX to (X)HTML, XML and OO.org"
       
    15 HOMEPAGE="http://www.cse.ohio-state.edu/~gurari/TeX4ht/
       
    16 	http://www.cse.ohio-state.edu/~gurari/TeX4ht/bugfixes.html"
       
    17 SRC_URI="http://www.cse.ohio-state.edu/~gurari/TeX4ht/fix/${MY_P}.tar.gz"
       
    18 
       
    19 LICENSE="LPPL-1.2"
       
    20 KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
       
    21 SLOT="0"
       
    22 
       
    23 DEPEND=">=sys-apps/sed-4
       
    24 	java? ( >=virtual/jdk-1.5 )"
       
    25 
       
    26 RDEPEND="app-text/ghostscript-gpl
       
    27 	|| ( media-gfx/imagemagick media-gfx/graphicsmagick[imagemagick] )
       
    28 	java? ( >=virtual/jre-1.5 )"
       
    29 
       
    30 IUSE="java"
       
    31 
       
    32 S="${WORKDIR}/${MY_P}"
       
    33 
       
    34 src_unpack() {
       
    35 	unpack ${A}
       
    36 	cd "${S}/texmf/tex4ht/base/unix"
       
    37 	sed -i -e \
       
    38 	's#~/tex4ht.dir#/usr/share#' tex4ht.env || die
       
    39 	sed -i -e \
       
    40 	's#tpath/tex/texmf/fonts/tfm/!#t/usr/share/texmf/fonts/tfm/!\nt/usr/local/share/texmf/fonts/tfm/!\nt/var/cache/fonts/tfm/!#' tex4ht.env || die
       
    41 	sed -i -e \
       
    42 	's#%%~/texmf-dist#/usr/share/texmf#g' tex4ht.env || die
       
    43 
       
    44 	einfo "Removing precompiled java stuff"
       
    45 	find "${S}" '(' -name '*.class' -o -name '*.jar' ')' -print -delete
       
    46 }
       
    47 
       
    48 src_compile() {
       
    49 	cd "${S}/src/"
       
    50 	einfo "Compiling postprocessor sources..."
       
    51 	for f in tex4ht t4ht htcmd ; do
       
    52 		$(tc-getCC) ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} -o $f $f.c \
       
    53 			-DENVFILE='"/usr/share/texmf/tex4ht/base/tex4ht.env"' \
       
    54 			-DHAVE_DIRENT_H -DKPATHSEA -lkpathsea \
       
    55 			|| die "Compiling $f failed"
       
    56 	done
       
    57 	if use java; then
       
    58 		einfo "Compiling java files..."
       
    59 		cd java
       
    60 		ejavac *.java */*.java */*/*.java -d ../../texmf/tex4ht/bin
       
    61 		cd "${S}/texmf/tex4ht/bin"
       
    62 		# Create the jar needed by oolatex
       
    63 		jar -cf "${S}/${PN}.jar" * || die "failed to create jar"
       
    64 	fi
       
    65 }
       
    66 
       
    67 src_install () {
       
    68 	# install the binaries
       
    69 	dobin "${S}/src/tex4ht" "${S}/src/t4ht" "${S}/src/htcmd"
       
    70 	# install the scripts
       
    71 	if ! use java; then
       
    72 		rm -f "${S}"/bin/unix/oo*
       
    73 		rm -f "${S}"/bin/unix/jh*
       
    74 	fi
       
    75 	dobin "${S}"/bin/unix/mk4ht || die
       
    76 
       
    77 	# install the .4ht scripts
       
    78 	insinto /usr/share/texmf/tex/generic/tex4ht
       
    79 	doins "${S}"/texmf/tex/generic/tex4ht/* || die
       
    80 
       
    81 	# install the special htf fonts
       
    82 	insinto /usr/share/texmf/tex4ht
       
    83 	doins -r "${S}/texmf/tex4ht/ht-fonts" || die
       
    84 
       
    85 	if use java; then
       
    86 		# install the java files
       
    87 		doins -r "${S}/texmf/tex4ht/bin"
       
    88 		java-pkg_jarinto /usr/share/texmf/tex4ht/bin
       
    89 		java-pkg_dojar "${S}/${PN}.jar"
       
    90 	fi
       
    91 
       
    92 	# install the .4xt files
       
    93 	doins -r "${S}/texmf/tex4ht/xtpipes" || die
       
    94 
       
    95 	# install the env file
       
    96 	insinto /usr/share/texmf/tex4ht/base
       
    97 	newins "${S}/texmf/tex4ht/base/unix/tex4ht.env" tex4ht.env || die
       
    98 
       
    99 	if latex-package_has_tetex_3 ; then
       
   100 		insinto /etc/texmf/texmf.d
       
   101 		doins "${FILESDIR}/50tex4ht.cnf" || die
       
   102 	fi
       
   103 
       
   104 	insinto /usr/share/texmf/tex/generic/${PN}
       
   105 	insopts -m755
       
   106 	doins "${S}"/bin/ht/unix/* || die
       
   107 }
       
   108 
       
   109 pkg_postinst() {
       
   110 	use java ||	elog 'ODF converters (oolatex & friends) require the java use flag'
       
   111 	latex-package_pkg_postinst
       
   112 	elog "In order to avoid collisions with multiple packages"
       
   113 	elog "We are not installing the scripts in /usr/bin anymore"
       
   114 	elog "If you want to use, say, htlatex, you can use 'mk4ht htlatex file'"
       
   115 }