# -*- 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       cmake  1.0
PortGroup       github 1.0

github.setup    contextgarden luametatex 2.11.08 v
github.tarball_from archive

#name            luametatex
#version         2.11.07
#master_sites    https://www.ambulatoryclam.net/texlive/
#homepage        https://github.com/contextgarden/luametatex

categories      tex
maintainers     {dports @drkp} openmaintainer
license         GPL-2+
description     LuaMetaTeX engine for ConTeXt
long_description \
   LuaMetaTeX is a follow-up to the LuaTeX engine for use with ConTeXt

checksums           rmd160  aa5220eb803e6a8cd67279d52c905ae832925b86 \
                    sha256  cf825633ee10a7bbf2a9bf98aa6842de5ef23258e8c370560c19ff5581b3d534 \
                    size    3464142

compiler.c_standard 2011

# Fix GCC build (primarily for 10.5/10.6).
# 1. Apple's ld doesn't support -z; use -stack_size instead
#    https://trac.macports.org/ticket/74037
# 2. Upstream's post-build strip uses GNU flags (-g -S -d -x) that Apple's
#    strip doesn't support; use -x -S instead
#    https://trac.macports.org/ticket/72204
post-patch {
    reinplace "s|-Wl,-z,stack-size=2621440|-Wl,-stack_size,0x280000|g" \
        ${worksrcpath}/CMakeLists.txt
    reinplace {s|${CMAKE_STRIP} -g -S -d -x|${CMAKE_STRIP} -x -S|g} \
        ${worksrcpath}/cmake/luametatex.cmake
}
