Permalink
Fetching contributors…
Cannot retrieve contributors at this time
127 lines (111 sloc) 4.54 KB
# -*- coding: utf-8; mode: tcl; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4; truncate-lines: t -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup texlive 1.0
name LaTeXML
version 0.8.3
checksums rmd160 27cd0fa18dbb99daf524a57128183c4df7cf3f01 \
sha256 28a57369b65b85d09c1a2516e69d26bbbe102ab790cae5e2fc9709b26185f62f \
size 10704659
license public-domain
maintainers {nist.gov:bruce.miller @brucemiller}
description LaTeXML converts TeX to XML/HTML/MathML
long_description \
LaTeXML converts TeX to XML, including HTML, XHTML, ePub with MathML.
# Written in Perl, but it is an application, not just modules
PortGroup perl5 1.0
perl5.branches 5.26
perl5.setup ${name} ${version}
perl5.link_binaries_suffix
categories tex
homepage http://dlmf.nist.gov/LaTeXML/
master_sites ${homepage}releases/
platforms darwin
supported_archs noarch
depends_lib-append \
port:p${perl5.major}-archive-zip \
port:p${perl5.major}-file-which \
port:p${perl5.major}-getopt-long \
port:p${perl5.major}-image-size \
port:p${perl5.major}-io-string \
port:p${perl5.major}-json-xs \
port:p${perl5.major}-libwww-perl \
port:p${perl5.major}-parse-recdescent \
port:p${perl5.major}-text-unidecode \
port:p${perl5.major}-time-hires \
port:p${perl5.major}-uri \
port:p${perl5.major}-xml-libxml \
port:p${perl5.major}-xml-libxslt \
port:p${perl5.major}-perlmagick
# Also requires: DB_File, Pod::Parser, Test::More & version
# but those should be in any non-obsolete Perl's core modules.
#============================================================
# LaTeXML works MUCH better if there is a TeX installed.
# - it uses some latex style files from texlive within bindings
# - it can install its own style files for use within tex/latex
# We could simply depend on texlive, but some folks prefer MacTeX
# and object to 2nd multi-GB download! So we define variants.
set latexml.found_tex no
# We don't want dependencies on texlive, but want to cooperate.
# We'll install style files where texlive expects or will expect.
configure.args-append TEXMF=${texlive_texmfdist}
# But the .packlist will need cleanup
post-destroot {
fs-traverse file ${destroot}${prefix}/share {
if {[file isfile ${file}] && [file tail ${file}] eq ".packlist"} {
ui_info "Fixing paths in [string map "${destroot}${prefix}/ {}" ${file}]"
reinplace -n "s|${destroot}||p" ${file}
}
}
}
# Note whether we've found a TeX
post-activate {
if [file executable ${prefix}/bin/mktexlsr] {
set latexml.found_tex yes
}
}
# The mactex variant expects MacTeX to be installed
# and installs latexml's stylefiles to MacTeX's texmf (local)
set latexml.mactex_bin ""
set latexml.mactex_texmf ""
set latexml.mactex_candidates { \
"/Library/TeX/texbin" \
"/usr/texbin" \
}
variant mactex description {Build with MacTeX support} {
# First, check if MacTeX actually seems to be there...
foreach dir ${latexml.mactex_candidates} {
if [file executable "${dir}/kpsewhich"] {
set latexml.mactex_bin ${dir}
break
}
}
if { ${latexml.mactex_bin} != "" } {
set latexml.mactex_texmf \
[exec ${latexml.mactex_bin}/kpsewhich --expand-var='\$TEXMFLOCAL']
regsub -all {'} ${latexml.mactex_texmf} "" latexml.mactex_texmf
set latexml.found_tex yes
} else {
return -code error "Cannot find MacTeX installation; aborting"
}
post-destroot {
xinstall -d ${destroot}${latexml.mactex_texmf}/tex/latex/latexml
foreach sty [glob ${worksrcpath}/lib/LaTeXML/texmf/*.sty] {
xinstall -m 644 ${sty} ${destroot}${latexml.mactex_texmf}/tex/latex/latexml
}
}
post-activate {
system "${latexml.mactex_bin}/mktexlsr"
}
post-deactivate {
system "${latexml.mactex_bin}/mktexlsr"
}
notes "Using MacTeX for TeX: will install styles to MacTeX's texmf-local
${latexml.mactex_texmf} \
(which is outside macport's common directory structure)"
# AND, since we're installing files outside macports' normal directories
destroot.violate_mtree yes
}
if {! ${latexml.found_tex}} {
notes "${name} works best with some version of TeX installed.
Please consider installing texlive, or PRE-install MacTeX and use the +mactex variant."
}