1 | # -*- 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 |
---|
2 | #====================================================================== |
---|
3 | # Portfile for LaTeXML |
---|
4 | #====================================================================== |
---|
5 | PortSystem 1.0 |
---|
6 | PortGroup texlive 1.0 |
---|
7 | |
---|
8 | name LaTeXML |
---|
9 | version 0.8.3 |
---|
10 | revision 1 |
---|
11 | license public-domain |
---|
12 | maintainers nist.gov:bruce.miller |
---|
13 | description LaTeXML converts TeX to XML/HTML/MathML |
---|
14 | long_description \ |
---|
15 | LaTeXML converts TeX to XML, including HTML, XHTML, ePub with MathML. |
---|
16 | |
---|
17 | # Written in Perl, but it is an application, not just modules |
---|
18 | PortGroup perl5 1.0 |
---|
19 | perl5.branches 5.26 |
---|
20 | perl5.setup ${name} ${version} |
---|
21 | perl5.link_binaries_suffix |
---|
22 | |
---|
23 | categories tex |
---|
24 | homepage http://dlmf.nist.gov/LaTeXML/ |
---|
25 | |
---|
26 | platforms darwin |
---|
27 | supported_archs noarch |
---|
28 | |
---|
29 | master_sites ${homepage}/releases/ |
---|
30 | checksums rmd160 27cd0fa18dbb99daf524a57128183c4df7cf3f01 \ |
---|
31 | sha256 28a57369b65b85d09c1a2516e69d26bbbe102ab790cae5e2fc9709b26185f62f |
---|
32 | # Use: |
---|
33 | # openssl rmd160 LaTeXML-0.8.2.tar.gz |
---|
34 | # openssl sha256 LaTeXML-0.8.2.tar.gz |
---|
35 | |
---|
36 | #============================================================ |
---|
37 | # Dependencies |
---|
38 | depends_lib-append \ |
---|
39 | port:p${perl5.major}-archive-zip \ |
---|
40 | port:p${perl5.major}-file-which \ |
---|
41 | port:p${perl5.major}-getopt-long \ |
---|
42 | port:p${perl5.major}-image-size \ |
---|
43 | port:p${perl5.major}-io-string \ |
---|
44 | port:p${perl5.major}-json-xs \ |
---|
45 | port:p${perl5.major}-libwww-perl \ |
---|
46 | port:p${perl5.major}-parse-recdescent \ |
---|
47 | port:p${perl5.major}-text-unidecode \ |
---|
48 | port:p${perl5.major}-time-hires \ |
---|
49 | port:p${perl5.major}-uri \ |
---|
50 | port:p${perl5.major}-xml-libxml \ |
---|
51 | port:p${perl5.major}-xml-libxslt \ |
---|
52 | port:p${perl5.major}-perlmagick |
---|
53 | |
---|
54 | # Also requires: DB_File, Pod::Parser, Test::More & version |
---|
55 | # but those should be in any non-obsolete Perl's core modules. |
---|
56 | |
---|
57 | #============================================================ |
---|
58 | # LaTeXML works MUCH better if there is a TeX installed. |
---|
59 | # - it uses some latex style files from texlive within bindings |
---|
60 | # - it can install its own style files for use within tex/latex |
---|
61 | # We could simply depend on texlive, but some folks prefer MacTeX |
---|
62 | # and object to 2nd multi-GB download! So we define variants. |
---|
63 | set latexml.found_tex no |
---|
64 | |
---|
65 | # We don't want dependencies on texlive, but want to cooperate. |
---|
66 | # We'll install style files where texlive expects or will expect. |
---|
67 | configure.args-append TEXMF=${texlive_texmfdist} |
---|
68 | |
---|
69 | # But the .packlist will need cleanup |
---|
70 | post-destroot { |
---|
71 | fs-traverse file ${destroot}${prefix}/share { |
---|
72 | if {[file isfile ${file}] && [file tail ${file}] eq ".packlist"} { |
---|
73 | ui_info "Fixing paths in [string map "${destroot}${prefix}/ {}" ${file}]" |
---|
74 | reinplace -n "s|${destroot}||p" ${file} |
---|
75 | } |
---|
76 | } |
---|
77 | } |
---|
78 | |
---|
79 | # Note whether we've found a TeX |
---|
80 | post-activate { |
---|
81 | if [file executable ${prefix}/bin/mktexlsr] { |
---|
82 | set latexml.found_tex yes |
---|
83 | } |
---|
84 | } |
---|
85 | |
---|
86 | # The mactex variant expects MacTeX to be installed |
---|
87 | # and installs latexml's stylefiles to MacTeX's texmf (local) |
---|
88 | set latexml.mactex_bin "" |
---|
89 | set latexml.mactex_texmf "" |
---|
90 | set latexml.mactex_candidates { \ |
---|
91 | "/Library/TeX/texbin" \ |
---|
92 | "/usr/texbin" \ |
---|
93 | } |
---|
94 | variant mactex description {Build with MacTeX support} { |
---|
95 | # First, check if MacTeX actually seems to be there... |
---|
96 | foreach dir ${latexml.mactex_candidates} { |
---|
97 | if [file executable "${dir}/kpsewhich"] { |
---|
98 | set latexml.mactex_bin ${dir} |
---|
99 | break |
---|
100 | } |
---|
101 | } |
---|
102 | if { ${latexml.mactex_bin} != "" } { |
---|
103 | set latexml.mactex_texmf \ |
---|
104 | [exec ${latexml.mactex_bin}/kpsewhich --expand-var='\$TEXMFLOCAL'] |
---|
105 | regsub -all {'} ${latexml.mactex_texmf} "" latexml.mactex_texmf |
---|
106 | set latexml.found_tex yes |
---|
107 | } else { |
---|
108 | return -code error "Cannot find MacTeX installation; aborting" |
---|
109 | } |
---|
110 | |
---|
111 | post-destroot { |
---|
112 | xinstall -d ${destroot}${latexml.mactex_texmf}/tex/latex/latexml |
---|
113 | foreach sty [glob ${worksrcpath}/lib/LaTeXML/texmf/*.sty] { |
---|
114 | xinstall -m 644 ${sty} ${destroot}${latexml.mactex_texmf}/tex/latex/latexml |
---|
115 | } |
---|
116 | } |
---|
117 | post-activate { |
---|
118 | system "${latexml.mactex_bin}/mktexlsr" |
---|
119 | } |
---|
120 | post-deactivate { |
---|
121 | system "${latexml.mactex_bin}/mktexlsr" |
---|
122 | } |
---|
123 | notes "Using MacTeX for TeX: will install styles to MacTeX's texmf-local |
---|
124 | ${latexml.mactex_texmf} \ |
---|
125 | (which is outside macport's common directory structure)" |
---|
126 | # AND, since we're installing files outside macports' normal directories |
---|
127 | destroot.violate_mtree yes |
---|
128 | } |
---|
129 | |
---|
130 | if {! ${latexml.found_tex}} { |
---|
131 | notes "${name} works best with some version of TeX installed. |
---|
132 | Please consider installing texlive, or PRE-install MacTeX and use the +mactex variant." |
---|
133 | } |
---|
134 | |
---|
135 | #============================================================ |
---|