From edd100ebfad0fc5e7bcdf07ca8d06e5e535cefc3 Mon Sep 17 00:00:00 2001 From: Bruce Miller Date: Thu, 30 Jun 2016 18:25:54 -0400 Subject: [PATCH] Update Portfile to have no texlive dependency, but install stylefiles where texlive would expect; Revise mactex veriant to be non-conflicting, and to check several potential mactex installation directories --- release/Portfile | 111 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 84 insertions(+), 27 deletions(-) diff --git a/release/Portfile b/release/Portfile index ba1549c68..2c3fca4b9 100644 --- a/release/Portfile +++ b/release/Portfile @@ -4,11 +4,12 @@ # Portfile for LaTeXML #====================================================================== PortSystem 1.0 +PortGroup texlive 1.0 name LaTeXML version 0.8.1 revision 1 -categories tex +license public-domain maintainers nist.gov:bruce.miller description LaTeXML converts TeX to XML/HTML/MathML long_description \ @@ -16,13 +17,16 @@ long_description \ # Written in Perl, but it is an application, not just modules PortGroup perl5 1.0 -perl5.branches 5.8 5.10 5.12 5.14 5.16 5.18 5.20 +perl5.branches 5.22 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 312f0a3d74db75a9210220ab8ea4a1c3f95c6f71 \ sha256 ea264e1c11210e219a46b7699a578d8632c7bbb6eaea5b06d2eb094122cbab2f @@ -32,8 +36,7 @@ checksums rmd160 312f0a3d74db75a9210220ab8ea4a1c3f95c6f71 \ #============================================================ # Dependencies -if {${perl5.major} ne ""} { - depends_lib-append \ +depends_lib-append \ port:p${perl5.major}-archive-zip \ port:p${perl5.major}-file-which \ port:p${perl5.major}-getopt-long \ @@ -47,7 +50,7 @@ if {${perl5.major} ne ""} { 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. @@ -57,40 +60,94 @@ if {${perl5.major} ne ""} { # - 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. +options latexml.found_tex +default latexml.found_tex no -notes "${name} works best with some version of TeX installed. \ - Please consider +texlive variant, or PRE-install MacTeX and use +mactex variant." - -# The texlive variant depends on texlive -# and install latexml's stylefiles to texlive's texmf -variant texlive description {Build with (macports) texlive support} { - notes "Using texlive for TeX: will install styles to its texmf" - depends_lib-append port:texlive - configure.args-append TEXMF=[exec kpsewhich --expand-var='\$TEXMFLOCAL'] - post-activate { - system "mktexlsr" +# No texmf install via Makefile. +pre-configure { + configure.args-append TEXMF= + } +# We don't want dependencies on texlive, but want to cooperate. +# We'll install style files where texlive expects or will expect. +post-destroot { + xinstall -d ${texlive_texmfdist}/tex/latex/latexml + foreach sty [glob ${worksrcpath}/lib/LaTeXML/texmf/*.sty] { + file copy -force ${sty} ${texlive_texmfdist}/tex/latex/latexml/ + } +} +# invoke mktexlsr IFF texlive already installed; +# otherwise texlive will do it if it's ever installed. +post-activate { + if [file executable ${prefix}/bin/mktexlsr] { + latexml.found_tex yes + ${texlive.mktexlsr} + } +} +# Remove style files +post-uninstall { + foreach sty [glob -nocomplain ${texlive_texmfdist}/tex/latex/latexml/*.sty] { + delete ${sty} + } + if [file executable ${prefix}/bin/mktexlsr] { + ${texlive.mktexlsr} } } # The mactex variant expects MacTeX to be installed -# and installs latexml's stylefiles to MacTeX's texmf +# and installs latexml's stylefiles to MacTeX's texmf (local) +options latexml.mactex_bin +options latexml.mactex_texmf +default latexml.mactex_bin "" +default latexml.mactex_texmf "" +set latexml.mactex_candidates { \ + "/Library/TeX/texbin" \ + "/usr/texbin" \ +} variant mactex description {Build with MacTeX support} { - # check if MacTeX actually seems to be there... - pre-configure { - if {![file executable /usr/texbin/kpsewhich]} { - ui_error "I cannot find MacTeX's kpswhich in /usr/texbin; aborting installation" - return -code error + # First, check if MacTeX actually seems to be there... + foreach dir ${latexml.mactex_candidates} { + if [file executable "${dir}/kpsewhich"] { + latexml.mactex_bin ${dir} + break } } - notes "Using MacTeX for TeX: will install styles to MacTeX's texmf \ - (outside macport's common directory structure)" - configure.args-append TEXMF=[exec /usr/texbin/kpsewhich --expand-var='\$TEXMFLOCAL'] - post-activate { - system /usr/texbin/mktexlsr + if { ${latexml.mactex_bin} != "" } { + latexml.mactex_texmf \ + [exec ${latexml.mactex_bin}/kpsewhich --expand-var='\$TEXMFLOCAL'] + regsub -all {'} ${latexml.mactex_texmf} "" latexml.mactex_texmf + latexml.found_tex yes + } else { + return -code error "Cannot find MacTeX installation; aborting" } + post-destroot { + xinstall -d ${latexml.mactex_texmf}/tex/latex/latexml + foreach sty [glob ${worksrcpath}/lib/LaTeXML/texmf/*.sty] { + file copy -force ${sty} ${latexml.mactex_texmf}/tex/latex/latexml/ + } + } + post-activate { + system "${latexml.mactex_bin}/mktexlsr" + } + # Remove style files + post-uninstall { + foreach sty [glob -nocomplain ${latexml.mactex_texmf}/tex/latex/latexml/*.sty] { + delete ${sty} + } + 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 } +post-activate { + if {! ${latexml.found_tex}} { + ui_msg "${name} works best with some version of TeX installed. \ + Please consider installing texlive, or PRE-install MacTeX and use +mactex variant." + } +} + #============================================================