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

name                libparserutils
version             0.2.5
revision            0
categories          devel
license             MIT
maintainers         nomaintainer
description         Library for building efficient parsers
long_description    {*}${description}
homepage            https://www.netsurf-browser.org/projects/${name}
master_sites        https://download.netsurf-browser.org/libs/releases/
distname            ${name}-${version}-src
checksums           rmd160  72d9e380c778ee3a1221677ca1fd0ff305e77c97 \
                    sha256  317ed5c718f17927b5721974bae5de32c3fd6d055db131ad31b4312a032ed139 \
                    size    74518
worksrcdir          ${name}-${version}

depends_build       port:netsurf-buildsystem
depends_lib         port:libiconv

configure.ldflags-append \
                    -liconv

build.args          NSSHARED=${prefix}/share/netsurf-buildsystem \
                    PREFIX=${prefix}

destroot.args       NSSHARED=${prefix}/share/netsurf-buildsystem \
                    PREFIX=${destroot}${prefix}

platform darwin 8 {
    depends_build-append port:gmake
    build.cmd ${prefix}/bin/gmake
}

build {
    system -W ${worksrcpath} "LDFLAGS=\"${configure.ldflags}\" ${build.cmd} ${build.args} COMPONENT_TYPE=lib-shared"
    system -W ${worksrcpath} "LDFLAGS=\"${configure.ldflags}\" ${build.cmd} ${build.args} COMPONENT_TYPE=lib-static"
}

destroot {
    system -W ${worksrcpath} "${destroot.cmd} install ${destroot.args} COMPONENT_TYPE=lib-shared"
    system -W ${worksrcpath} "${destroot.cmd} install ${destroot.args} COMPONENT_TYPE=lib-static"
}

post-destroot {
    system -W ${destroot}${prefix}/lib "install_name_tool -id ${prefix}/lib/${name}.dylib ${name}.dylib"
}
