# -*- 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-music
version             78123
revision            1

categories          tex
maintainers         {dports @drkp}
license             Copyleft Permissive
description         TeX Live: Music packages
long_description    Music-related fonts and packages.

checksums           texlive-music-78123-run.tar.xz \
                    rmd160  6b042c5b6ca145a013d0c1b3b6b953e40967980a \
                    sha256  745ffd4e477b4871ba20eb12e27962bc32c247a0e86e72c27219cbfbb110f02f \
                    size    24356224 \
                    texlive-music-78123-doc.tar.xz \
                    rmd160  b221b1ac7f04fb9e06abddd479702d2f50b23f2f \
                    sha256  c155141e0ada2037e06da52d68437c8dc5d937c6b4c55ea61a45efdc9d7afd46 \
                    size    19532980 \
                    texlive-music-78123-src.tar.xz \
                    rmd160  8c71b0d9b24aa0fc82dd4d292f15277f5c8fcce2 \
                    sha256  8c5ba51a12de3fd12ba9076dcc2338e96ec580fc088725c9af59631fbd583a27 \
                    size    25369368

depends_lib         port:texlive-latex

texlive.maps      \
    {MixedMap musix.map}

texlive.binaries    autosp gregorio lily-glyph-commands lily-image-commands lily-rebuild-pdfs msxlint musixflx musixtex pmxab pmxchords prepmx scor2prt tex2aspc xml2pmx

# Pin Python scripts to correct interpreter
set python_branch   3.13
set python_ver      [string map {. {}} ${python_branch}]
depends_run-append  port:python${python_ver}

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/lilyglyphs/lily-glyph-commands.py \
        ${worksrcpath}/runfiles/texmf-dist/scripts/lilyglyphs/lily-image-commands.py \
        ${worksrcpath}/runfiles/texmf-dist/scripts/lilyglyphs/lily-rebuild-pdfs.py \
        ${worksrcpath}/runfiles/texmf-dist/scripts/lilyglyphs/lilyglyphs_common.py
}

texlive.texmfport
