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

# O_CLOEXEC
legacysupport.newest_darwin_requires_legacy 10

github.setup        openresty luajit2 2.1-20260701 v
name                luajit-openresty
revision            0
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.
checksums           rmd160  55926e341508271e0ca8ee0103b6adc2425569ed \
                    sha256  38117ad7b2e2b543baf3796c7424d288b091ca95e48518cf795578053f14c8f2 \
                    size    1175473
github.tarball_from archive

patchfiles          powerpc.patch

conflicts           luajit

use_configure       no

compiler.blacklist  *gcc-4.0 *gcc-4.2 {clang < 700} macports-clang-3.*

# 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}
}
