1 | # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 |
---|
2 | |
---|
3 | PortSystem 1.0 |
---|
4 | PortGroup python 1.0 |
---|
5 | PortGroup texlive 1.0 |
---|
6 | |
---|
7 | name dblatex |
---|
8 | version 0.3.12pre1 |
---|
9 | distname ${name}3-${version} |
---|
10 | revision 0 |
---|
11 | categories textproc tex |
---|
12 | maintainers {cal @neverpanic} openmaintainer |
---|
13 | license GPL-2+ |
---|
14 | platforms darwin |
---|
15 | supported_archs noarch |
---|
16 | |
---|
17 | description DocBook to LaTeX Converter |
---|
18 | long_description Dblatex transforms a DocBook XML/SGML document to LaTeX. \ |
---|
19 | Once transformed into LaTeX, standard LaTeX tools are \ |
---|
20 | used to produce DVI, Postcript or PDF files. \ |
---|
21 | dblatex tries to hide as much as possible the latex \ |
---|
22 | compiling stuff by providing a single clean script to \ |
---|
23 | produce directly DVI, PostScript and PDF output. \ |
---|
24 | The actual output rendering is done not only by the \ |
---|
25 | XSL stylesheets transformation, but also by a dedicated \ |
---|
26 | LaTeX package. The goal is to allow a deep LaTeX \ |
---|
27 | customisation without changing the XSL stylesheets. \ |
---|
28 | Post-processing is done by Python, to make publication \ |
---|
29 | faster, convert the images if needed, and do the whole \ |
---|
30 | compilation. |
---|
31 | |
---|
32 | homepage http://dblatex.sourceforge.net |
---|
33 | master_sites sourceforge:project/dblatex/dblatex/${name}3-${version} |
---|
34 | |
---|
35 | checksums sha256 497aae48af99a6b7baadc1207d8575c5a8b3633e3f21cbf437ff8443414573f0 \ |
---|
36 | rmd160 5abdec82b79a05aea6f25cf1ac04b1275a442f04 \ |
---|
37 | size 1695197 |
---|
38 | |
---|
39 | use_bzip2 yes |
---|
40 | |
---|
41 | depends_lib port:texlive-latex-extra \ |
---|
42 | port:texlive-latex-recommended \ |
---|
43 | port:texlive-math-science \ |
---|
44 | port:dejavu-fonts \ |
---|
45 | port:ImageMagick \ |
---|
46 | port:docbook-xml \ |
---|
47 | port:docbook-xsl-nons |
---|
48 | |
---|
49 | python.link_binaries no |
---|
50 | python.default_version 38 |
---|
51 | |
---|
52 | default destroot.cmd {${python.bin} setup.py} |
---|
53 | destroot.destdir --root=${destroot} \ |
---|
54 | --catalogs=${destroot}${prefix}/etc/xml/catalog |
---|
55 | |
---|
56 | # The mactex variant expects MacTeX to be installed |
---|
57 | # and installs dblatex's stylefiles to MacTeX's texmf (local) |
---|
58 | set dblatex.texmflocal "" |
---|
59 | set dblatex.mactex_bin "" |
---|
60 | set dblatex.temp "" |
---|
61 | |
---|
62 | variant mactex description {Allow dblatex to use MacTeX or another\ |
---|
63 | external TeXLive installation instead of MacPorts TeXLive tools.\ |
---|
64 | To install the 'mactex' variant the path to the TeX distribution's\ |
---|
65 | binary directory (for example '/Library/TeX/texbin') must be added\ |
---|
66 | to 'binpath' in 'macports.conf' *before* installing this port.} { |
---|
67 | |
---|
68 | # Find the binary directory of the external TeX distribution by |
---|
69 | # searching the kpsewhich program in the path. We assume that all |
---|
70 | # other binaries of the distribution are in this directory, too. |
---|
71 | if {[auto_execok kpsewhich] ne ""} { |
---|
72 | set dblatex.temp {*}[auto_execok kpsewhich] |
---|
73 | } |
---|
74 | set dblatex.mactex_bin \ |
---|
75 | [file dirname [file normalize ${dblatex.temp}]] |
---|
76 | if {${dblatex.mactex_bin} eq "."} { |
---|
77 | pre-fetch { |
---|
78 | return -code error "Cannot find MacTeX or external TeXLive\ |
---|
79 | installation; aborting. Have you added the path to\ |
---|
80 | your TeX distribution's binary directory to 'binpath'\ |
---|
81 | in 'macports.conf'?" |
---|
82 | } |
---|
83 | } elseif {${dblatex.mactex_bin} eq \ |
---|
84 | [file dirname [file normalize "${prefix}/bin/kpsewhich"]]} { |
---|
85 | pre-fetch { |
---|
86 | return -code error "Variant 'mactex' doesn't work with\ |
---|
87 | installed MacPorts TeXLive packages. Either\ |
---|
88 | uninstall them or don't use the 'mactex' variant of\ |
---|
89 | dblatex." |
---|
90 | } |
---|
91 | } else { |
---|
92 | set dblatex.texmflocal \ |
---|
93 | [exec ${dblatex.mactex_bin}/kpsewhich --expand-var='\$TEXMFLOCAL'] |
---|
94 | regsub -all {'} ${dblatex.texmflocal} "" dblatex.texmflocal |
---|
95 | } |
---|
96 | |
---|
97 | # Make 'port notes dblatex +mactex' work even if neither the package |
---|
98 | # nor an external TeXLive is installed. |
---|
99 | if {${dblatex.texmflocal} eq ""} { |
---|
100 | notes "The 'mactex' variant will install styles into your\ |
---|
101 | TeXLive's texmf-local tree (which is outside MacPorts'\ |
---|
102 | common directory structure)." |
---|
103 | } else { |
---|
104 | notes "\ |
---|
105 | The 'mactex' variant will install styles into your TeXLive's texmf-local\ |
---|
106 | tree at |
---|
107 | |
---|
108 | ${dblatex.texmflocal} |
---|
109 | |
---|
110 | (which is outside MacPorts' common directory structure)." |
---|
111 | } |
---|
112 | |
---|
113 | depends_lib-delete \ |
---|
114 | port:texlive-latex-extra \ |
---|
115 | port:texlive-latex-recommended \ |
---|
116 | port:texlive-math-science |
---|
117 | |
---|
118 | # AND, since we're installing files outside MacPorts' normal |
---|
119 | # directories... |
---|
120 | destroot.violate_mtree yes |
---|
121 | } |
---|
122 | |
---|
123 | post-destroot { |
---|
124 | reinplace "s|${destroot}${prefix}|${prefix}|g" ${destroot}${python.prefix}/bin/dblatex |
---|
125 | reinplace "s|#!/usr/bin/env python|#!${python.bin}|" ${destroot}${python.prefix}/bin/dblatex |
---|
126 | |
---|
127 | fs-traverse f ${destroot}${python.prefix}/share { |
---|
128 | if {[file isfile $f]} { |
---|
129 | set f [string range $f [string length ${destroot}${python.prefix}/share/] end] |
---|
130 | file mkdir [file dirname ${destroot}${prefix}/share/$f] |
---|
131 | ln -s ${python.prefix}/share/$f ${destroot}${prefix}/share/$f |
---|
132 | } |
---|
133 | } |
---|
134 | if {![variant_isset mactex]} { |
---|
135 | set dblatex.texmflocal ${texlive_texmflocal} |
---|
136 | set dblatex.bin ${prefix}/bin |
---|
137 | } else { |
---|
138 | set dblatex.bin ${dblatex.mactex_bin} |
---|
139 | } |
---|
140 | file mkdir ${destroot}${dblatex.texmflocal}/tex/latex/dblatex |
---|
141 | fs-traverse f ${destroot}${python.prefix}/share/dblatex/latex { |
---|
142 | if {[file isfile $f]} { |
---|
143 | if {[catch {exec ${dblatex.bin}/kpsewhich -a [file tail $f]} result]} { |
---|
144 | set f [string range $f [string length ${destroot}${python.prefix}/share/dblatex/latex/] end] |
---|
145 | file mkdir [file dirname ${destroot}${dblatex.texmflocal}/tex/latex/dblatex/$f] |
---|
146 | ln -s ${python.prefix}/share/dblatex/latex/$f ${destroot}${dblatex.texmflocal}/tex/latex/dblatex/$f |
---|
147 | } |
---|
148 | } |
---|
149 | } |
---|
150 | ln -s ${python.prefix}/bin/dblatex ${destroot}${prefix}/bin/ |
---|
151 | } |
---|
152 | |
---|
153 | proc dblatex.mktexlsr {} { |
---|
154 | if {![variant_isset mactex]} { |
---|
155 | texlive.mktexlsr |
---|
156 | } else { |
---|
157 | global dblatex.mactex_bin |
---|
158 | system "${dblatex.mactex_bin}/mktexlsr" |
---|
159 | } |
---|
160 | } |
---|
161 | |
---|
162 | post-activate { |
---|
163 | dblatex.mktexlsr |
---|
164 | } |
---|
165 | |
---|
166 | post-deactivate { |
---|
167 | dblatex.mktexlsr |
---|
168 | } |
---|
169 | |
---|
170 | livecheck.regex /${name}-(\[0-9.\]+)/ |
---|