# -*- 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-pictures
version             78219
revision            1

categories          tex
maintainers         {dports @drkp}
license             Copyleft Permissive
description         TeX Live: Graphics, pictures, diagrams
long_description    Including TikZ, pict, etc., but MetaPost and PStricks are separate.

checksums           texlive-pictures-78219-run.tar.xz \
                    rmd160  68121e66ca1a011364d2ce525cdaec4de9d6bf79 \
                    sha256  419cc4eb4b12145cb051622ef46c02720997d27cd62b991c2ff5ac37cb144dc5 \
                    size    23189232 \
                    texlive-pictures-78219-doc.tar.xz \
                    rmd160  021b13eb5775c6199d5ab3e41754945b9708b688 \
                    sha256  c1b4671f03b03f36b8e4932b61ce7edb528c98ddc66bbc2d93c7fc3201248ca4 \
                    size    265998368 \
                    texlive-pictures-78219-src.tar.xz \
                    rmd160  8c8d2f008386c4ec25cabfbf3a8cb5b5196cbf4b \
                    sha256  b5b5165b6ef1f78f0d63bf0cc297222fa6d061d7084a895496074adc0271148f \
                    size    1627876

depends_lib         port:texlive-basic

texlive.maps      \
    {Map knitfont.map} \
    {MixedMap xypic.map}

texlive.binaries    cachepic epspdf epspdftk fig4latex getmapdl mathspic memoize-clean.pl memoize-clean.py memoize-extract.pl memoize-extract.py mkpic pn2pdf tikztosvg

# Pin Python scripts to correct interpreter.
# memoize-extract uses pdfrw module.
set python_branch   3.13
set python_ver      [string map {. {}} ${python_branch}]
depends_run-append  port:python${python_ver} \
                    port:py${python_ver}-pdfrw

post-patch {
    # Pin Python scripts to correct interpreter
    reinplace -E "1 s,^#! ?(/usr/bin/env python3?|/usr/bin/python)( -O)?\$,#!${prefix}/bin/python${python_branch}," \
        ${worksrcpath}/runfiles/texmf-dist/scripts/latex-make/figdepth.py \
        ${worksrcpath}/runfiles/texmf-dist/scripts/latex-make/gensubfig.py \
        ${worksrcpath}/runfiles/texmf-dist/scripts/latex-make/latexfilter.py \
        ${worksrcpath}/runfiles/texmf-dist/scripts/latex-make/svg2dev.py \
        ${worksrcpath}/runfiles/texmf-dist/scripts/latex-make/svgdepth.py \
        ${worksrcpath}/runfiles/texmf-dist/scripts/memoize/memoize-clean.py \
        ${worksrcpath}/runfiles/texmf-dist/scripts/memoize/memoize-extract.py
}

texlive.texmfport
