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

github.setup        openresty luajit2 2.1-20220411 v
name                luajit-openresty
revision            0
checksums           rmd160  9e77865de5b7731d4acc620695e1fb427f2d349f \
                    sha256  d3f2c870f8f88477b01726b32accab30f6e5d57ae59c5ec87374ff73d0794316 \
                    size    1141007

categories          lang
license             MIT
maintainers         {l2dy @l2dy} openmaintainer
description         OpenResty's maintained branch of LuaJIT
long_description    ${description}. LuaJIT is a Just-In-Time Compiler for the Lua programming language.

github.tarball_from archive

conflicts           luajit

use_configure       no

compiler.blacklist  {clang < 700} macports-clang-3.3 macports-clang-3.4

# changes to compiler flags must be made before `CFLAGS=...`
xcode_workaround.type append_to_compiler_flags

build.target        amalg
build.args-append   CC="${configure.cc}" \
                    CFLAGS="${configure.cppflags} ${configure.cflags} [get_canonical_archflags] -DLUAJIT_ENABLE_LUA52COMPAT" \
                    LDFLAGS="${configure.ldflags} [get_canonical_archflags]" \
                    PREFIX="${prefix}" \
                    Q=""

destroot.args-append \
                    PREFIX="${prefix}"

post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/share/doc
    copy ${worksrcpath}/doc/ ${destroot}${prefix}/share/doc/${name}
}
