# $Id: Portfile 48158 2009-03-15 16:39:44Z mww@macports.org $

PortSystem 1.0

name                gnutar
version             1.22
categories          archivers
maintainers         mww
description         tar version of the GNU project
long_description \
    the gnutar program creates, adds files to, or extracts files from   \
    an archive file in gnutar format, called a tarfile. A tarfile is    \
    often a magnetic tape, but can be a floppy diskette or any regular  \
    disk file.

homepage            http://www.gnu.org/software/tar/
master_sites        gnu:tar
checksums           md5     07fa517027f426bb80f5f5ff91b63585 \
                    sha1    ca99a6ade7308f9293bdb04048cb335e52c63215 \
                    rmd160  62436792e47586f00a9aa8f5eaac87b9ce61d503
distname            tar-${version}
use_bzip2           yes
platforms           darwin

depends_lib         port:gettext port:libiconv

configure.args      --program-prefix=gnu \
                    --infodir=${prefix}/share/info

test.run            yes
test.target         check

post-destroot {
    xinstall -v -m 755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -v -W ${worksrcpath} ABOUT-NLS AUTHORS COPYING ChangeLog \
        ChangeLog.1 INSTALL NEWS PORTS README THANKS TODO \
        ${destroot}${prefix}/share/doc/${name}
    file rename ${destroot}${prefix}/share/info/tar.info ${destroot}${prefix}/share/info/gnutar.info
    file rename ${destroot}${prefix}/share/info/tar.info-1 ${destroot}${prefix}/share/info/gnutar.info-1
    file rename ${destroot}${prefix}/share/info/tar.info-2 ${destroot}${prefix}/share/info/gnutar.info-2
}

variant with_default_names description {Install files without 'gnu' prefix} {
    post-destroot {
        foreach {d} {bin libexec share/info} {
            foreach {f} [glob -tails -directory ${destroot}${prefix}/${d} gnu*] {
                ln -sf ${prefix}/${d}/${f} ${destroot}${prefix}/${d}/[string range ${f} 3 end]
            }
        }
    }
}


livecheck.check	regex
livecheck.url	http://ftp.gnu.org/gnu/tar/?C=M&O=D
livecheck.regex	tar-(\[0-9\.\]+\[0-9\])\\.

