# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0

github.setup        svaarala duktape 2.7.0 v
github.tarball_from releases
revision            0

checksums           rmd160  a3aaf08d15b30afbbd3ffe92992de4d35f0fd612 \
                    sha256  90f8d2fa8b5567c6899830ddef2c03f3c27960b11aca222fa17aa7ac613c2890 \
                    size    1026524

description         Duktape is an embeddable Javascript engine, with a focus on portability and compact footprint.
long_description    ${description}
maintainers         nomaintainer
categories          devel
license             MIT

use_xz              yes

depends_build-append \
                    port:pkgconfig

patchfiles          patch-Makefile.sharedlibrary-fix-library-install-name.diff
use_configure       no
build.args          -f Makefile.sharedlibrary CC="${configure.cc} ${configure.cflags} [get_canonical_archflags cc] ${configure.ldflags} [get_canonical_archflags ld]" LD_SONAME_PREFIX=${prefix}/lib/
destroot.args       -f Makefile.sharedlibrary DESTDIR="${destroot}" INSTALL_PREFIX="${prefix}" LIBDIR="/lib"

post-destroot {
    xinstall -m 0644 ${filespath}/duktape.pc.in \
        ${destroot}${prefix}/lib/pkgconfig/duktape.pc
    reinplace \
        "s|@prefix@|${prefix}|g" \
        ${destroot}${prefix}/lib/pkgconfig/duktape.pc
    reinplace \
        "s|@version@|${version}|g" \
        ${destroot}${prefix}/lib/pkgconfig/duktape.pc
}
