# -*- 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            mp3info
version         0.8.5a
revision        1
categories      audio
license         GPL-2+
platforms       darwin
maintainers     nomaintainer
description     MP3 information tool

long_description \
    A small utility to read and write TAG info, as well as retrieve the MP3 \
    Header info. Included is a command-line interface and a gtk-UI.

homepage        http://www.ibiblio.org/mp3info/
master_sites    sunsite:apps/sound/mp3-utils/${name}
extract.suffix  .tgz

checksums       md5 cb7b619a10a40aaac2113b87bb2b2ea2 \
                sha1 54df29eb6c2e581899affc12be698b0a71d91ca6 \
                rmd160 898b566d9ba2f352949d061d991d92f2c8996ec3

depends_lib     port:ncurses

livecheck.type  regex
livecheck.url   ${homepage}
livecheck.regex "The current version of MP3Info is (\\d+(?:\\.\\d+)*\[a-z\]*) --"

patchfiles      patch-mp3tech.c.diff

configure {
   reinplace -E "s|(LIBS =)|\\1 ${configure.ldflags}|" ${worksrcpath}/Makefile
}

build.target    mp3info
build.args-append   CC=${configure.cc} \
                    CXX=${configure.cxx} \
                    CPP=${configure.cpp}

destroot.target     install-mp3info
destroot.args       INSTALL=/usr/bin/install
destroot.destdir    prefix=${destroot}${prefix} \
                    mandir=${destroot}${prefix}/share/man/man1

post-destroot {
    set docdir ${prefix}/share/doc/${name}-${version}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} ChangeLog LICENSE README mp3info.txt mp3info.html \
        ${destroot}${docdir}
}

variant universal {
    post-configure {
        reinplace -E "/^CFLAGS/s|\$| [join ${configure.universal_cflags} " "]|" ${worksrcpath}/Makefile
    }
}
