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

name                    luash
version                 0.9
revision                2
license                 AGPL-3+
categories              shells
maintainers             nomaintainer
description             shell written in Lua/C++
long_description        luash is a shell written in Lua/C++ that allow you to run command using Lua syntax
homepage                http://luaforge.net/projects/luash

# https://trac.macports.org/ticket/72434
# Disable upstream website, 2025 May 8.
# Upstream site luaforge.net is abandoned and hijacked.
# No alternate was found today.
# Now fetch exclusively from MacPorts archive copy.
# master_sites          http://files.luaforge.net/releases/luash/luash/luash${version}

master_sites            macports_distfiles
distname                ${name}
dist_subdir             ${name}/${version}

checksums               rmd160  165d88850e8d068d7586f1785b36dd20c9c8ce37 \
                        sha256  40ed9a86924fead319be3be966426f844a4ef7b5cb73425e5fe930daa6970634 \
                        size    15927

use_bzip2               yes

# patch for luash.lua addresses a change in API for os.execute() in 5.2
# remove it if a lua51 port is introduced and used to compile luash
patchfiles              patch-makefile.diff \
                        patch-luash_cpp.diff \
                        patch-luash_lua.diff

use_configure           no
universal_variant       yes

depends_lib             port:lua \
                        port:lua-luafilesystem

pre-build {
    build.args          CXX=${configure.cxx} \
                        CXX_FLAGS="${configure.cppflags} ${configure.cxxflags} \
                            [get_canonical_archflags cxx] ${configure.ldflags}"
}

destroot.destdir        PREFIX=${destroot}${prefix}

post-destroot {
    xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}
    xinstall    -m 644 -W ${worksrcpath} COPYING README ${destroot}${prefix}/share/doc/${name}
}
