# $Id$

PortSystem      1.0

name            libtool
version         2.4.2
categories      devel sysutils
# Scripts are GPL-2+, libltdl is LGPL-2+, but all parts that tend to be
# distributed with dependents have a licensing exception that allows
# distrbution under the same terms as the rest of the program.
license         libtool
maintainers     ram openmaintainer
description     GNU Libtool - The GNU Portable Library Tool

long_description \
    GNU libtool is a generic library support script. Libtool hides the  \
    complexity of using shared libraries behind a consistent, portable  \
    interface.

homepage        http://www.gnu.org/software/libtool/
platforms       darwin freebsd
master_sites    gnu

checksums           md5     d2f3b7d4627e69e13514a40e72a24d50 \
                    sha1    22b71a8b5ce3ad86e1094e7285981cae10e6ff88 \
                    rmd160  b7153f3f1e1c50d8c04787cafccd4e19af62ec7d

depends_build   port:automake

if {${os.platform} != "darwin"} {
    depends_lib port:grep \
                port:gsed
}

#worksrcdir      [strsed $distname {s/[a-z]*$//}]

configure.args  F77=no \
                FC=no \
                GCJ=no \
                --program-prefix=g

use_parallel_build  yes

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} AUTHORS COPYING ChangeLog NEWS README THANKS \
        TODO ${destroot}${docdir}
}

test.run        yes
test.target     check

platform darwin {
    configure.env-append GREP=/usr/bin/grep \
                         SED=/usr/bin/sed
    post-destroot {
        foreach {neededfile} "${prefix}/lib/libltdl.dylib" {
            if {![file exists ${destroot}${neededfile}]} {
                ui_error "${neededfile} is not in the destroot. Please clean ${name} and try again."
                return -code error "missing ${neededfile} in destroot"
            }
        }
    }
}

livecheck.type  regex
livecheck.url   http://ftp.gnu.org/gnu/${name}/?C=M&O=D
livecheck.regex ${name}-(\\d+(?:\\.\\d+)*\[a-z\]?)