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

checksums           texlive-context-74403-run.tar.xz \
                    rmd160  140ec70fea326207670c14a0830ce6a23b6c720b \
                    sha256  2fa520f56ecc7e50746df524563d2dde856d0813619a408bbd60f42ee2f1921b \
                    size    9913700 \
                    texlive-context-74403-doc.tar.xz \
                    rmd160  1fffe0b6fadece062a094f41c8039be579ced268 \
                    sha256  c8d14de8e9a75ea3b2005ab447a57eb2c33583bc30ef4b57084f16d10c056301 \
                    size    105965904 \
                    texlive-context-74403-src.tar.xz \
                    rmd160  cf717d418b489b7bc22f3573e7a47e8af160cbb2 \
                    sha256  b96db09823162fc5038ee46679f79d7e549da538751543092a430ee3c5ece40a \
                    size    6696

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 contextjit luajithbtex luajittex luatools mtxrun mtxrun.lua mtxrunjit 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
}

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
