File: Portfile

package info (click to toggle)
latexml 0.8.8-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 31,920 kB
  • sloc: xml: 109,048; perl: 30,224; sh: 179; javascript: 28; makefile: 13
file content (134 lines) | stat: -rw-r--r-- 4,978 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# -*- 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
#======================================================================
# Portfile for LaTeXML
#======================================================================
PortSystem          1.0
PortGroup           texlive 1.0

name                LaTeXML
version             0.8.2
license             public-domain
maintainers         nist.gov:bruce.miller
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.24
perl5.setup         ${name} ${version}
perl5.link_binaries_suffix

categories          tex
homepage            http://dlmf.nist.gov/LaTeXML/

platforms           darwin
supported_archs     noarch

master_sites        ${homepage}/releases/
checksums           rmd160 6dbf960277cdcf30605ce93335e3383673c1ff66 \
                    sha256 3d41a3012760d31d721b569d8c1b430cde1df2b68fcc3c66f41ec640965caabf
# Use:
# openssl rmd160 LaTeXML-0.8.2.tar.gz
# openssl sha256 LaTeXML-0.8.2.tar.gz

#============================================================
# Dependencies
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."
}

#============================================================