# $Id: Portfile 86786 2011-11-04 05:20:35Z boeyms@macports.org $

PortSystem			1.0

name				getopt
version				1.1.4
revision            1
categories			sysutils
license				GPL-2+
installs_libs		no
maintainers			nomaintainer
description			Replacement getopt for shell script use
long_description \
	Getopt(1) is a program to help shell scripts parse command-line \
	parameters.  It can do anything that the GNU getopt(3) routines can do. \
	It can cope with spaces and shell metacharacters within arguments. \
	It can parse long parameters. \
	It can shuffle parameters, so you can mix options and other parameters on \
	the command-line. \
	It can be easily identified as an enhanced getopt(1) from within shell \
	scripts. \
	It can report parse errors as coming from the shell script. \
	It is fully compatible with other getopt(1) implementations.

platforms			darwin

homepage			http://software.frodo.looijaard.name/getopt/
master_sites		http://software.frodo.looijaard.name/getopt/files/

checksums       md5 02188ca68da27c4175d6e9f3da732101 \
                sha1 8b9b329b3a8f5d52c91c0381616ecbd1ba291486 \
                rmd160 79fffccf1b48956bfc1fbb19c22c2d94adf10dff

patchfiles			patch-Makefile.diff

depends_lib			port:gettext

use_configure		no

build.args			LIBCGETOPT=0 prefix=${prefix} mandir=${prefix}/share/man CC=${configure.cc}

destroot.args		${build.args}
destroot.target		install install_doc

post-destroot {
    set docdir ${prefix}/share/doc/${name}-${version}
	xinstall -d ${destroot}${docdir}
	xinstall -m 644 -W ${worksrcpath} COPYING Changelog README TODO \
		${destroot}${docdir}
}

platform darwin 8 powerpc {
    configure.universal_ldflags-append -liconv
}

variant universal {
    post-patch {
        reinplace -E "/^CFLAGS/s|\$| ${configure.universal_cflags}|" ${worksrcpath}/Makefile
        reinplace -E "/^LDFLAGS/s|\$| ${configure.universal_ldflags}|" ${worksrcpath}/Makefile
    }
}
if {![variant_isset universal]} {
    post-patch {
        reinplace -E "/^CFLAGS/s|\$| ${configure.cc_archflags}|" ${worksrcpath}/Makefile
        reinplace -E "/^LDFLAGS/s|\$| ${configure.cc_archflags}|" ${worksrcpath}/Makefile
    }
}

livecheck.type  regex
livecheck.url   ${homepage}download.php
livecheck.regex ${name}-(\\d+(?:\\.\\d+)*)

