# -*- 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
# $Id$

PortSystem          1.0

name                luajit
version             2.0.4
revision            0
categories          lang
platforms           darwin
license             BSD

maintainers         stromnov openmaintainer

description         a Just-In-Time Compiler for Lua
long_description    LuaJIT is a Just-In-Time Compiler for the Lua programming language.

homepage            http://luajit.org
master_sites        ${homepage}/download

distname            LuaJIT-${version}

checksums           rmd160  ef9ec596ebf81e3871f060c40303bcd2002474c4 \
                    sha256  620fa4eb12375021bef6e4f237cbd2dd5d49e56beb414bee052c746beef1807d

post-patch {
    reinplace "s|/usr/local|${prefix}|" ${worksrcpath}/etc/luajit.pc
}

use_configure       no

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

livecheck.type      regex
livecheck.url       ${master_sites}.html
livecheck.regex     {LuaJIT-(\d+(?:\.\d+)*(?:-beta\d+)?).tar.gz}