Ticket #51818: Portfile.2

File Portfile.2, 5.0 KB (added by brucemiller (bruce miller), 8 years ago)
Line 
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#======================================================================
6PortSystem          1.0
7PortGroup           texlive 1.0
8
9name                LaTeXML
10version             0.8.2
11license             public-domain
12maintainers         nist.gov:bruce.miller
13description         LaTeXML converts TeX to XML/HTML/MathML
14long_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
18PortGroup           perl5 1.0
19perl5.branches      5.24
20perl5.setup         ${name} ${version}
21perl5.link_binaries_suffix
22
23categories          tex
24homepage            http://dlmf.nist.gov/LaTeXML/
25
26platforms           darwin
27supported_archs     noarch
28
29master_sites        ${homepage}/releases/
30checksums           rmd160 6dbf960277cdcf30605ce93335e3383673c1ff66 \
31                    sha256 3d41a3012760d31d721b569d8c1b430cde1df2b68fcc3c66f41ec640965caabf
32# Use:
33# openssl rmd160 LaTeXML-0.8.2.tar.gz
34# openssl sha256 LaTeXML-0.8.2.tar.gz
35
36#============================================================
37# Dependencies
38depends_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.
63set latexml.found_tex no
64# No texmf install via Makefile.
65configure.args-append   TEXMF=
66
67# We don't want dependencies on texlive, but want to cooperate.
68# We'll install style files where texlive expects or will expect.
69post-destroot {
70    xinstall -d ${destroot}${texlive_texmfdist}/tex/latex/latexml
71    foreach sty [glob ${worksrcpath}/lib/LaTeXML/texmf/*.sty] {
72        file copy -force ${sty} ${destroot}${texlive_texmfdist}/tex/latex/latexml/
73    }
74}
75# invoke mktexlsr IFF texlive already installed;
76# otherwise texlive will do it if it's ever installed.
77post-activate {
78    if [file executable ${prefix}/bin/mktexlsr] {
79        latexml.found_tex yes
80        ${texlive.mktexlsr}
81    }
82}
83
84# The mactex variant expects MacTeX to be installed
85# and installs latexml's stylefiles to MacTeX's texmf (local)
86set latexml.mactex_bin ""
87set latexml.mactex_texmf ""
88set latexml.mactex_candidates { \
89   "/Library/TeX/texbin" \
90   "/usr/texbin" \
91}
92variant mactex description {Build with MacTeX support} {
93    # First, check if MacTeX actually seems to be there...
94    foreach dir ${latexml.mactex_candidates} {
95        if [file executable "${dir}/kpsewhich"] {
96            set latexml.mactex_bin ${dir}
97            break
98        }
99    }
100    if { ${latexml.mactex_bin} != "" } {
101        set latexml.mactex_texmf \
102            [exec ${latexml.mactex_bin}/kpsewhich --expand-var='\$TEXMFLOCAL']
103        regsub -all {'} ${latexml.mactex_texmf} "" latexml.mactex_texmf
104        set latexml.found_tex yes
105    } else {
106        return -code error "Cannot find MacTeX installation; aborting"
107    }
108
109    post-destroot {
110        xinstall -d ${latexml.mactex_texmf}/tex/latex/latexml
111        foreach sty [glob ${worksrcpath}/lib/LaTeXML/texmf/*.sty] {
112            file copy -force ${sty} ${latexml.mactex_texmf}/tex/latex/latexml/
113        }
114    }
115    post-activate {
116        system "${latexml.mactex_bin}/mktexlsr"
117    }
118    # Remove style files
119    post-uninstall {
120        foreach sty [glob -nocomplain ${latexml.mactex_texmf}/tex/latex/latexml/*.sty] {
121            delete ${sty}
122        }
123        system "${latexml.mactex_bin}/mktexlsr"
124    }
125    notes "Using MacTeX for TeX: will install styles to MacTeX's texmf-local \
126        ${latexml.mactex_texmf} \
127        (which is outside macport's common directory structure)"
128    # AND, since we're installing files outside macports' normal directories
129    destroot.violate_mtree  yes
130}
131
132if {! ${latexml.found_tex}} {
133  notes "${name} works best with some version of TeX installed. \
134    Please consider installing texlive, or PRE-install MacTeX and use +mactex variant."
135}
136
137#============================================================