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 | # $Id$ |
---|
3 | #====================================================================== |
---|
4 | # Portfile for LaTeXML |
---|
5 | #====================================================================== |
---|
6 | PortSystem 1.0 |
---|
7 | PortGroup texlive 1.0 |
---|
8 | |
---|
9 | name LaTeXML |
---|
10 | version 0.8.1 |
---|
11 | revision 1 |
---|
12 | license public-domain |
---|
13 | maintainers nist.gov:bruce.miller |
---|
14 | description LaTeXML converts TeX to XML/HTML/MathML |
---|
15 | long_description \ |
---|
16 | LaTeXML converts TeX to XML, including HTML, XHTML, ePub with MathML. |
---|
17 | |
---|
18 | # Written in Perl, but it is an application, not just modules |
---|
19 | PortGroup perl5 1.0 |
---|
20 | perl5.branches 5.22 |
---|
21 | perl5.setup ${name} ${version} |
---|
22 | perl5.link_binaries_suffix |
---|
23 | |
---|
24 | categories tex |
---|
25 | homepage http://dlmf.nist.gov/LaTeXML/ |
---|
26 | |
---|
27 | platforms darwin |
---|
28 | supported_archs noarch |
---|
29 | |
---|
30 | master_sites ${homepage}/releases/ |
---|
31 | checksums rmd160 312f0a3d74db75a9210220ab8ea4a1c3f95c6f71 \ |
---|
32 | sha256 ea264e1c11210e219a46b7699a578d8632c7bbb6eaea5b06d2eb094122cbab2f |
---|
33 | # Use: |
---|
34 | # openssl rmd160 LaTeXML-0.8.0.tar.gz |
---|
35 | # openssl sha256 LaTeXML-0.8.0.tar.gz |
---|
36 | |
---|
37 | #============================================================ |
---|
38 | # Dependencies |
---|
39 | depends_lib-append \ |
---|
40 | port:p${perl5.major}-archive-zip \ |
---|
41 | port:p${perl5.major}-file-which \ |
---|
42 | port:p${perl5.major}-getopt-long \ |
---|
43 | port:p${perl5.major}-image-size \ |
---|
44 | port:p${perl5.major}-io-string \ |
---|
45 | port:p${perl5.major}-json-xs \ |
---|
46 | port:p${perl5.major}-libwww-perl \ |
---|
47 | port:p${perl5.major}-parse-recdescent \ |
---|
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 | options latexml.found_tex |
---|
64 | default latexml.found_tex no |
---|
65 | |
---|
66 | # No texmf install via Makefile. |
---|
67 | pre-configure { |
---|
68 | configure.args-append TEXMF= |
---|
69 | } |
---|
70 | # We don't want dependencies on texlive, but want to cooperate. |
---|
71 | # We'll install style files where texlive expects or will expect. |
---|
72 | post-destroot { |
---|
73 | xinstall -d ${texlive_texmfdist}/tex/latex/latexml |
---|
74 | foreach sty [glob ${worksrcpath}/lib/LaTeXML/texmf/*.sty] { |
---|
75 | file copy -force ${sty} ${texlive_texmfdist}/tex/latex/latexml/ |
---|
76 | } |
---|
77 | } |
---|
78 | # invoke mktexlsr IFF texlive already installed; |
---|
79 | # otherwise texlive will do it if it's ever installed. |
---|
80 | post-activate { |
---|
81 | if [file executable ${prefix}/bin/mktexlsr] { |
---|
82 | latexml.found_tex yes |
---|
83 | ${texlive.mktexlsr} |
---|
84 | } |
---|
85 | } |
---|
86 | # Remove style files |
---|
87 | post-uninstall { |
---|
88 | foreach sty [glob -nocomplain ${texlive_texmfdist}/tex/latex/latexml/*.sty] { |
---|
89 | delete ${sty} |
---|
90 | } |
---|
91 | if [file executable ${prefix}/bin/mktexlsr] { |
---|
92 | ${texlive.mktexlsr} |
---|
93 | } |
---|
94 | } |
---|
95 | |
---|
96 | # The mactex variant expects MacTeX to be installed |
---|
97 | # and installs latexml's stylefiles to MacTeX's texmf (local) |
---|
98 | options latexml.mactex_bin |
---|
99 | options latexml.mactex_texmf |
---|
100 | default latexml.mactex_bin "" |
---|
101 | default latexml.mactex_texmf "" |
---|
102 | set latexml.mactex_candidates { \ |
---|
103 | "/Library/TeX/texbin" \ |
---|
104 | "/usr/texbin" \ |
---|
105 | } |
---|
106 | variant mactex description {Build with MacTeX support} { |
---|
107 | # First, check if MacTeX actually seems to be there... |
---|
108 | foreach dir ${latexml.mactex_candidates} { |
---|
109 | if [file executable "${dir}/kpsewhich"] { |
---|
110 | latexml.mactex_bin ${dir} |
---|
111 | break |
---|
112 | } |
---|
113 | } |
---|
114 | if { ${latexml.mactex_bin} != "" } { |
---|
115 | latexml.mactex_texmf \ |
---|
116 | [exec ${latexml.mactex_bin}/kpsewhich --expand-var='\$TEXMFLOCAL'] |
---|
117 | regsub -all {'} ${latexml.mactex_texmf} "" latexml.mactex_texmf |
---|
118 | latexml.found_tex yes |
---|
119 | } else { |
---|
120 | return -code error "Cannot find MacTeX installation; aborting" |
---|
121 | } |
---|
122 | |
---|
123 | post-destroot { |
---|
124 | xinstall -d ${latexml.mactex_texmf}/tex/latex/latexml |
---|
125 | foreach sty [glob ${worksrcpath}/lib/LaTeXML/texmf/*.sty] { |
---|
126 | file copy -force ${sty} ${latexml.mactex_texmf}/tex/latex/latexml/ |
---|
127 | } |
---|
128 | } |
---|
129 | post-activate { |
---|
130 | system "${latexml.mactex_bin}/mktexlsr" |
---|
131 | } |
---|
132 | # Remove style files |
---|
133 | post-uninstall { |
---|
134 | foreach sty [glob -nocomplain ${latexml.mactex_texmf}/tex/latex/latexml/*.sty] { |
---|
135 | delete ${sty} |
---|
136 | } |
---|
137 | system "${latexml.mactex_bin}/mktexlsr" |
---|
138 | } |
---|
139 | notes "Using MacTeX for TeX: will install styles to MacTeX's texmf-local \ |
---|
140 | ${latexml.mactex_texmf} \ |
---|
141 | (which is outside macport's common directory structure)" |
---|
142 | # AND, since we're installing files outside macports' normal directories |
---|
143 | destroot.violate_mtree yes |
---|
144 | } |
---|
145 | |
---|
146 | post-activate { |
---|
147 | if {! ${latexml.found_tex}} { |
---|
148 | ui_msg "${name} works best with some version of TeX installed. \ |
---|
149 | Please consider installing texlive, or PRE-install MacTeX and use +mactex variant." |
---|
150 | } |
---|
151 | } |
---|
152 | |
---|
153 | #============================================================ |
---|