Ticket #47972: Portfile.diff

File Portfile.diff, 4.6 KB (added by brucemiller (bruce miller), 8 years ago)

diff -u Portfile-0.8.1 Portfile

  • (a) Portfile-0.8.1 vs. (b) Portfile

    a b  
    6060# - it can install its own style files for use within tex/latex
    6161# We could simply depend on texlive, but some folks prefer MacTeX
    6262# and object to 2nd multi-GB download!  So we define variants.
     63options latexml.found_tex
     64default latexml.found_tex no
    6365
    64 notes "${name} works best with some version of TeX installed. \
    65    Please consider +texlive variant, or PRE-install MacTeX and use +mactex variant."
    66 
    67 # The texlive variant depends on texlive
    68 # and install latexml's stylefiles to texlive's texmf
    69 variant texlive conflicts mactex description {Build with (macports) texlive support} {
    70     notes "Using texlive for TeX: will install styles to its texmf"
    71     depends_lib-append      port:texlive
    72     pre-configure {
    73         configure.args-append   TEXMF=${texlive_texmfports}
     66# No texmf install via Makefile.
     67pre-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.
     72post-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/
    7476    }
    75     post-activate {
    76         texlive.mktexlsr
     77}
     78# invoke mktexlsr IFF texlive already installed;
     79# otherwise texlive will do it if it's ever installed.
     80post-activate {
     81    if [file executable ${prefix}/bin/mktexlsr] {
     82        latexml.found_tex yes
     83        ${texlive.mktexlsr}
     84    }
     85}
     86# Remove style files
     87post-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}
    7793    }
    7894}
    7995
    8096# The mactex variant expects MacTeX to be installed
    81 # and installs latexml's stylefiles to MacTeX's texmf
    82 variant mactex conflicts texlive description {Build with MacTeX support} {
    83     # check if MacTeX actually seems to be there...
    84     pre-configure {
    85         if {![file executable /usr/texbin/kpsewhich]} {
    86             ui_error "I cannot find MacTeX's kpswhich in /usr/texbin; aborting installation"
    87             return -code error "MacTeX not installed"
    88         } else {
    89             configure.args-append   TEXMF=[exec /usr/texbin/kpsewhich --expand-var='\$TEXMFLOCAL']
     97# and installs latexml's stylefiles to MacTeX's texmf (local)
     98options latexml.mactex_bin
     99options latexml.mactex_texmf
     100default latexml.mactex_bin ""
     101default latexml.mactex_texmf ""
     102set latexml.mactex_candidates { \
     103   "/Library/TeX/texbin" \
     104   "/usr/texbin" \
     105}
     106variant 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
    90112        }
    91113    }
    92     notes "Using MacTeX for TeX: will install styles to MacTeX's texmf \
    93         (outside macport's common directory structure)"
    94     post-activate {
    95         system /usr/texbin/mktexlsr
     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"
    96121    }
    97122
     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)"
    98142    # AND, since we're installing files outside macports' normal directories
    99143    destroot.violate_mtree  yes
    100144}
    101145
     146post-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
    102153#============================================================