# -*- 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-context
version             78048
revision            0

categories          tex
maintainers         {dports @drkp}
license             Copyleft Permissive
description         TeX Live: ConTeXt and packages
long_description    Hans Hagen's powerful ConTeXt system, https://pragma-ade.com. Also includes third-party ConTeXt packages. TeX Live uses the ConTeXt repackaging as distributed from https://github.com/gucci-on-fleek/context-packaging. See https://contextgarden.net and https://pragma-ade.com for information about ConTeXt.#

checksums           texlive-context-78048-run.tar.xz \
                    rmd160  b0710c331e5f30d9dc31a8fe1b5b3f291448a79b \
                    sha256  b2234bb60a59fcfad7ca9b675c40747d400d8cdefc410f597aed5babf00eced8 \
                    size    10381460 \
                    texlive-context-78048-doc.tar.xz \
                    rmd160  f13b192b60c9393b4b55efc8dae9ca23a85106d1 \
                    sha256  24241cf1211205aa6d42978c9c4f4ff15198f5793e11b46b963e31a7b71ebfbb \
                    size    130895632 \
                    texlive-context-78048-src.tar.xz \
                    rmd160  0297bb325efc0ded467d4aa959dadaea091242cc \
                    sha256  8c179b380f7e8161aae9562576debadfa6144fc0e39a17024ef1dfe0c438ebf0 \
                    size    3519536

depends_lib         port:texlive-basic

texlive.formats      \
    {1 cont-en pdftex - {-8bit *cont-en.mkii}} \
    {1 cont-en xetex - {-8bit *cont-en.mkii}} \
    {1 luajithbtex luajithbtex language.def,language.dat.lua {luatex.ini}} \
    {1 luajittex luajittex language.def,language.dat.lua {luatex.ini}}

texlive.maps      \
    {Map original-context-symbol.map}

texlive.binaries    context context.lua luajithbtex luajittex mtxrun mtxrun.lua texexec texluajit texluajitc texmfstart

depends_lib-append  port:luametatex \
                    port:texlive-latex \
                    port:texlive-metapost \
                    port:texlive-xetex \
                    port:texlive-fonts-recommended \
                    port:texlive-math-science

patchfiles-append   patch-runfiles_texmf-dist_scripts_context_lua_mtxrun.lua.diff \
    patch-runfiles_texmf-dist_tex_context_base_mkiv_data-res.lua.diff

post-patch {
        reinplace "s|@@TEXMFSYSCONFIG@@|${texlive_texmfsysconfig}|" \
            ${worksrcpath}/runfiles/texmf-dist/scripts/context/lua/mtxrun.lua \
            ${worksrcpath}/runfiles/texmf-dist/tex/context/base/mkiv/data-res.lua
}

texlive.exclude     texmf-dist/web2c/texmfcnf.lua

post-destroot {
    xinstall -d ${destroot}${texlive_bindir}
    ln -s ${prefix}/bin/luametatex ${destroot}${texlive_bindir}/context
    ln -s ${prefix}/bin/luametatex ${destroot}${texlive_bindir}/mtxrun
    ln -s ${texlive_texmfdist}/scripts/context/lua/context.lua \
        ${texlive_texmfdist}/scripts/context/lua/mtxrun.lua \
        ${destroot}${texlive_bindir}/
}

post-deactivate {
    delete ${texlive_texmfsysvar}/luatex-cache
}

texlive.texmfport
