You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
3.9 KiB
133 lines
3.9 KiB
3 years ago
|
# Copyright 1999-2021 Gentoo Authors
|
||
9 years ago
|
# Distributed under the terms of the GNU General Public License v2
|
||
|
|
||
6 years ago
|
EAPI=7
|
||
9 years ago
|
|
||
3 years ago
|
inherit latex-package toolchain-funcs java-pkg-opt-2 flag-o-matic readme.gentoo-r1
|
||
9 years ago
|
|
||
|
# tex4ht-20050331_p2350 -> tex4ht-1.0.2005_03_31_2350
|
||
3 years ago
|
MY_P="${PN}-1.0.${PV:0:4}_${PV:4:2}_${PV:6:2}_$(ver_cut 3)"
|
||
|
|
||
|
# from https://mirrors.ctan.org/systems/texlive/tlnet/archive/tex4ht.tar.xz
|
||
|
MY_P_TEXLIVE="${PN}-texlive-$(ver_cut 5)"
|
||
9 years ago
|
|
||
|
DESCRIPTION="Converts (La)TeX to (X)HTML, XML and OO.org"
|
||
|
HOMEPAGE="http://www.cse.ohio-state.edu/~gurari/TeX4ht/
|
||
|
http://www.cse.ohio-state.edu/~gurari/TeX4ht/bugfixes.html"
|
||
|
SRC_URI="http://www.cse.ohio-state.edu/~gurari/TeX4ht/fix/${MY_P}.tar.gz
|
||
3 years ago
|
https://dev.gentoo.org/~ulm/distfiles/${MY_P_TEXLIVE}.tar.xz
|
||
|
doc? ( https://dev.gentoo.org/~ulm/distfiles/${MY_P_TEXLIVE}.doc.tar.xz )"
|
||
9 years ago
|
|
||
|
LICENSE="LPPL-1.2"
|
||
|
SLOT="0"
|
||
3 years ago
|
KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 ~mips ppc ppc64 ~s390 sparc x86 ~amd64-linux ~x86-linux ~x64-macos"
|
||
3 years ago
|
IUSE="doc java"
|
||
9 years ago
|
|
||
|
RDEPEND="app-text/ghostscript-gpl
|
||
|
media-gfx/imagemagick
|
||
|
dev-libs/kpathsea
|
||
3 years ago
|
java? ( >=virtual/jre-1.8:* )"
|
||
9 years ago
|
|
||
3 years ago
|
DEPEND="dev-libs/kpathsea
|
||
|
java? ( >=virtual/jdk-1.8:* )"
|
||
6 years ago
|
|
||
3 years ago
|
BDEPEND="virtual/pkgconfig"
|
||
9 years ago
|
|
||
|
S="${WORKDIR}/${MY_P}"
|
||
|
|
||
|
src_prepare() {
|
||
|
cp -a "${WORKDIR}/texmf-dist/"* texmf/ || die
|
||
3 years ago
|
default
|
||
6 years ago
|
cd "${S}/texmf/tex4ht/base/unix" || die
|
||
9 years ago
|
sed -i \
|
||
|
-e "s#~/tex4ht.dir#${EPREFIX}/usr/share#" \
|
||
|
-e "s#tpath/tex/texmf/fonts/tfm/!#t${EPREFIX}/usr/share/texmf-dist/fonts/tfm/!\nt${EPREFIX}/usr/local/share/texmf/fonts/tfm/!\nt${EPREFIX}/var/cache/fonts/tfm/!\nt${EPREFIX}${TEXMF}/fonts/tfm/!#" \
|
||
6 years ago
|
-e "s#%%~#${EPREFIX}${TEXMF}#g" \
|
||
9 years ago
|
-e "s#/usr/share/texmf/#${EPREFIX}${TEXMF}/#" \
|
||
|
tex4ht.env \
|
||
|
|| die "sed of tex4ht.env failed"
|
||
|
|
||
|
einfo "Removing precompiled java stuff"
|
||
6 years ago
|
find "${S}" '(' -name '*.class' -o -name '*.jar' ')' -print -delete || die
|
||
9 years ago
|
}
|
||
|
|
||
|
src_compile() {
|
||
6 years ago
|
has_version '>=dev-libs/kpathsea-6.2.1' \
|
||
|
&& append-cppflags "$($(tc-getPKG_CONFIG) --cflags kpathsea)"
|
||
9 years ago
|
|
||
6 years ago
|
cd "${S}/src" || die
|
||
9 years ago
|
einfo "Compiling postprocessor sources..."
|
||
3 years ago
|
for f in tex4ht t4ht; do
|
||
9 years ago
|
$(tc-getCC) ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} -o $f $f.c \
|
||
|
-DENVFILE="\"${EPREFIX}${TEXMF}/tex4ht/base/tex4ht.env\"" \
|
||
|
-DHAVE_DIRENT_H -DKPATHSEA -lkpathsea \
|
||
|
|| die "Compiling $f failed"
|
||
|
done
|
||
|
if use java; then
|
||
|
einfo "Compiling java files..."
|
||
6 years ago
|
cd java || die
|
||
9 years ago
|
ejavac *.java */*.java */*/*.java -d ../../texmf/tex4ht/bin
|
||
6 years ago
|
cd "${S}/texmf/tex4ht/bin" || die
|
||
9 years ago
|
# Create the jar needed by oolatex
|
||
|
jar -cf "${S}/${PN}.jar" * || die "failed to create jar"
|
||
|
fi
|
||
|
}
|
||
|
|
||
5 years ago
|
src_install() {
|
||
9 years ago
|
# install the binaries
|
||
3 years ago
|
dobin "${S}/src/tex4ht" "${S}/src/t4ht"
|
||
9 years ago
|
# install the scripts
|
||
|
if ! use java; then
|
||
3 years ago
|
rm -f "${S}"/bin/unix/oo* || die
|
||
|
rm -f "${S}"/bin/unix/jh* || die
|
||
9 years ago
|
fi
|
||
6 years ago
|
dobin "${S}"/bin/unix/mk4ht
|
||
9 years ago
|
|
||
|
# install the .4ht scripts
|
||
|
insinto ${TEXMF}/tex/generic/tex4ht
|
||
6 years ago
|
doins "${S}"/texmf/tex/generic/tex4ht/*
|
||
9 years ago
|
|
||
3 years ago
|
if use doc; then
|
||
|
# install the documentation
|
||
|
insinto ${TEXMF}/doc/generic/tex4ht
|
||
|
doins "${S}"/texmf/doc/generic/tex4ht/*
|
||
|
fi
|
||
|
|
||
9 years ago
|
# install the special htf fonts
|
||
|
insinto ${TEXMF}/tex4ht
|
||
6 years ago
|
doins -r "${S}/texmf/tex4ht/ht-fonts"
|
||
9 years ago
|
|
||
|
if use java; then
|
||
|
# install the java files
|
||
|
doins -r "${S}/texmf/tex4ht/bin"
|
||
|
java-pkg_jarinto ${TEXMF}/tex4ht/bin
|
||
|
java-pkg_dojar "${S}/${PN}.jar"
|
||
|
fi
|
||
|
|
||
|
# install the .4xt files
|
||
6 years ago
|
doins -r "${S}/texmf/tex4ht/xtpipes"
|
||
9 years ago
|
|
||
|
# install the env file
|
||
|
insinto ${TEXMF}/tex4ht/base
|
||
6 years ago
|
newins "${S}/texmf/tex4ht/base/unix/tex4ht.env" tex4ht.env
|
||
9 years ago
|
|
||
6 years ago
|
insinto /etc/texmf/texmf.d
|
||
|
doins "${FILESDIR}/50tex4ht.cnf"
|
||
9 years ago
|
|
||
|
insinto ${TEXMF}/tex/generic/${PN}
|
||
|
insopts -m755
|
||
6 years ago
|
doins "${S}"/bin/ht/unix/*
|
||
3 years ago
|
|
||
|
local DOC_CONTENTS="In order to avoid collisions with multiple packages,
|
||
|
we are not installing the scripts in /usr/bin any more.
|
||
|
If you want to use, say, htlatex, you can use 'mk4ht htlatex file'."
|
||
|
use java || DOC_CONTENTS+="\n\nODF converters (oolatex & friends)
|
||
|
require the java use flag."
|
||
|
readme.gentoo_create_doc
|
||
9 years ago
|
}
|
||
|
|
||
|
pkg_postinst() {
|
||
|
latex-package_pkg_postinst
|
||
3 years ago
|
readme.gentoo_print_elog
|
||
9 years ago
|
}
|