# -*- 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

PortSystem          1.0
PortGroup           texlive 1.0

name                texlive-bin-extra
version             74436
revision            0

categories          tex
maintainers         {dports @drkp}
license             Copyleft Permissive
description         TeX Live: TeX auxiliary programs
long_description    Myriad additional TeX-related support programs. Includes programs and macros for DVI file manipulation, literate programming, patgen, and plenty more.

checksums           texlive-bin-extra-74436-run.tar.xz \
                    rmd160  81e94a938f7ac85e1a44eb2a900aee6d0d8c7ad2 \
                    sha256  bf308577b1deb5b6e6d4be94e2795504e2af8ae6956d50fdfe482b1a130ec7f2 \
                    size    87215400 \
                    texlive-bin-extra-74436-doc.tar.xz \
                    rmd160  02cb8020ccd9ad04926ffe826a2d06f875dee8a5 \
                    sha256  aac35ee5e721dc11deb58fb0ea70c20e1bf0779a0330b0e3764bf432b8b3f0f8 \
                    size    36132168 \
                    texlive-bin-extra-74436-src.tar.xz \
                    rmd160  14aa8a949b2d5d1a17e4441464e37da01c003a78 \
                    sha256  04bd895db890ca90688165360b5ff12fd687bccddc77ea6b47c529fef60c884d \
                    size    491768

depends_lib         port:texlive-basic

texlive.formats      \
    {0 mflua mflua-nowin - {mf.ini}}

texlive.binaries    a2ping a5toa4 adhocfilelist allcm allec allneeded arara arlatex bibtex8 bibtexu bundledoc checklistings chkdvifont chklref chktex chkweb cllualatex cluttex clxelatex ctan-o-mat ctanbib ctangle ctanify ctanupload ctie ctwill ctwill-proofsort ctwill-refsort ctwill-twinx cweave de-macro depythontex deweb digestif dt2dv dtxgen dv2dt dvi2fax dviasm dvibook dviconcat dvicopy dvidvi dvihp dviinfox dvilj dvilj2p dvilj4 dvilj4l dvilj6 dvipos dvired dviselect dvispc dvitodvi dvitype e2pall edtx2dtx explcheck findhyph fragmaster git-latexdiff gsftopk installfont-tl ketcindy kpsepath kpsetool kpsewhere kpsexpand l3sys-query lacheck latex-git-log latex-papersize latex2man latex2nemeth latexdef latexfileversion latexindent latexpand listings-ext.sh llmk ltxfileinfo ltximg make4ht match_parens mflua mflua-nowin mfluajit mfluajit-nowin mkjobtexmf mkocp mkofm optexcount pamphletangler patgen pdfbook2 pdfclose pdfcrop pdflatexpicscale pdfopen pdftex-quiet pdftosrc pdfxup pfarrei pkfix pkfix-helper pooltype ppmcheckpdf ps2frag pslatex purifyeps pythontex rpdfcrop runtexshebang spix sqltex srcredact sty2dtx synctex tangle tex4ebook texaccents texblend texconfig texconfig-dialog texconfig-sys texcount texdef texdiff texdirflatten texdoc texdoctk texfot texlinks texliveonfly texloganalyser texlogfilter texlogsieve texosquery texosquery-jre5 texosquery-jre8 texplate tie tlcockpit tpic2pdftex twill twill-refsort typeoutfileinfo upmendex weave xindex

# Dependencies for tools that are part of this package in TeX Live,
# but are packaged as separate ports
depends_run-append  port:texlive-tlpdb \
                    port:latexmk \
                    port:opendetex \
                    port:latexdiff \
                    port:pdfjam \
                    port:dvipng \
                    path:bin/dvisvgm:dvisvgm

PortGroup           perl5 1.0
perl5.branches      5.34

# Fix perl paths for any perl scripts that have dependencies. Some of
# the included packages install other perl scripts, but they don't
# require any non-core modules and thus should be able to run with any
# reasonable installed version of perl.
post-patch {
    reinplace -E "1 s,^#! ?(/usr/bin/env perl|/usr/bin/perl),#!${prefix}/bin/perl${perl5.major}," \
        ${worksrcpath}/runfiles/texmf-dist/scripts/ctan-o-mat/ctan-o-mat.pl \
        ${worksrcpath}/runfiles/texmf-dist/scripts/ctanify/ctanify \
        ${worksrcpath}/runfiles/texmf-dist/scripts/ctanupload/ctanupload.pl \
        ${worksrcpath}/runfiles/texmf-dist/scripts/latex-git-log/latex-git-log \
        ${worksrcpath}/runfiles/texmf-dist/scripts/latexindent/latexindent.pl \
        ${worksrcpath}/runfiles/texmf-dist/scripts/ltximg/ltximg.pl \
        ${worksrcpath}/runfiles/texmf-dist/scripts/purifyeps/purifyeps \
        ${worksrcpath}/runfiles/texmf-dist/scripts/texdoctk/texdoctk.pl
}

# dependencies for latexindent
depends_run-append port:p${perl5.major}-data-dumper \
                   port:p${perl5.major}-file-homedir \
                   port:p${perl5.major}-file-which \
                   port:p${perl5.major}-getopt-long \
                   port:p${perl5.major}-log-dispatch \
                   port:p${perl5.major}-log-log4perl \
                   port:p${perl5.major}-mime-charset \
                   port:p${perl5.major}-text-parsewords \
                   port:p${perl5.major}-unicode-linebreak \
                   port:p${perl5.major}-yaml-tiny

# dependencies for ctan-o-mat (also p5-data-dumper)
depends_run-append port:p${perl5.major}-libwww-perl \
                   port:p${perl5.major}-lwp-protocol-https

# dependencies for ctanify
depends_run-append port:p${perl5.major}-file-copy-recursive

# dependencies for ctanupload
depends_run-append port:p${perl5.major}-html-formatter \
                   port:p${perl5.major}-www-mechanize
# dependencies for latex-git-log
depends_run-append port:p${perl5.major}-ipc-system-simple

# dependencies for purifyeps (also p5-file-which)
depends_run-append port:pstoedit

# dependencies for texdoctk
depends_run-append port:p${perl5.major}-tk \

# ltximg also depends on p5-data-dumper

pre-activate {
    # Handle conflicts for TL2023 update
    if { ![catch {set vers [lindex [registry_active texlive-lang-japanese] 0]}]
         && ([vercmp [lindex $vers 1] 66482] < 0) } {
        registry_deactivate_composite texlive-lang-japanese "" [list ports_nodepcheck 1]
    }
}

texlive.texmfport
