# -*- 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                libstree
version             0.4.2
categories          science
license             MIT
maintainers         nomaintainer

description         generic suffix tree implementation, written in C

long_description    {*}${description}

homepage            http://www.cl.cam.ac.uk/~cpk25/libstree/
master_sites        http://www.cl.cam.ac.uk/~cpk25/downloads/

checksums           sha1    b35bc18fbbc43bec1415bc1d884708e1df7bf2c6

patchfiles          implicit.patch \
                    patch-src__lst_string.h

# Update config.guess and config.sub to be able to build on arm64.
depends_build-append    port:automake
post-patch {
    set automake_dirs [glob -directory ${prefix}/share automake-*]
    set automake_dir [lindex [lsort -command vercmp $automake_dirs] end]
    copy -force ${automake_dir}/config.guess ${automake_dir}/config.sub \
        ${worksrcpath}
}

post-build {
    system "cd ${worksrcpath}/src/.libs && \
        /bin/sh ${filespath}/create-dylib.sh libstree.a 1.0.0 ${prefix}/lib"
}

post-destroot {
    xinstall -m 644 -W ${worksrcpath}/src/.libs/ libstree.1.0.0.dylib \
        libstree.dylib ${destroot}${prefix}/lib
}
