# $Id: Portfile 57780 2009-09-16 15:45:35Z jmr@macports.org $

PortSystem		1.0

name			unzip
version			6.0
maintainers		nomaintainer
categories		archivers sysutils
platforms		darwin freebsd
description		Decompression compatible with pkunzip

long_description \
	UnZip is an extraction utility for archives compressed in .zip \
	format (also called \"zipfiles\"). Although highly compatible both \
	with PKWARE's PKZIP and PKUNZIP utilities for MS-DOS and with Info-ZIP's \
	own Zip program, our primary objectives have been portability and \
	non-MSDOS functionality.

homepage		http://www.info-zip.org/pub/infozip/UnZip.html
master_sites		sourceforge:infozip
distname		${name}[strsed $version g/\\.//]

checksums           md5     62b490407489521db863b523a7f86375 \
                    sha1    abf7de8a4018a983590ed6f5cbd990d4740f8a22 \
                    rmd160  48af66606e9472e45fbb94bc4e285da23d1b89ba

use_configure	no

build.target	macosx
build.args	    -f unix/Makefile \
                CC="${configure.cc}"
set localflags ${configure.cc_archflags}
pre-build {
    # have to add this here so variants can modify it
    build.args-append LOCAL_UNZIP="${localflags}"
}

eval destroot.args	${build.args} \
				BINDIR=${destroot}${prefix}/bin \
				MANDIR=${destroot}${prefix}/share/man/man1

post-destroot {
	set docdir ${prefix}/share/doc/${name}-${version}
	xinstall -d ${destroot}${docdir}
	xinstall -m 0644 -W ${worksrcpath} BUGS LICENSE README ToDo \
		${destroot}${docdir}
}

variant universal {
    set localflags ${configure.universal_cflags}
	post-patch {
		reinplace -E "/-O3/s|(LF2=\")|\\1${configure.universal_ldflags}|" \
			${worksrcpath}/unix/Makefile
	}
}

platform darwin 8 {
    append localflags " -DNO_LCHMOD"
}

livecheck.type	regex
livecheck.url	${homepage}
livecheck.regex	"UnZip (\\d+(?:\\.\\d+)*)"
