# $Id: Portfile 53858 2009-07-15 21:32:08Z blb@macports.org $

PortSystem		1.0

name			unzip
version			5.52
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	ftp://ftp.info-zip.org/pub/infozip/src/ \
				http://www.mirrorservice.org/sites/ftp.info-zip.org/pub/infozip/src/
distname		${name}[strsed ${version} {/\.//}]

checksums		md5 9d23919999d6eac9217d1f41472034a9 \
				sha1 1831bd59b9e607a69052f83b263384895e2d4a19 \
				rmd160 b749b0923bc4cceaa6f937aef688e9713a84328c

extract.suffix	.tgz

worksrcdir		${name}-${version}

set args		"-f unix/Makefile"

use_configure	no

build.target	macosx
build.args		${args}

destroot.args	${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 {
	build.args-append "LOCAL_UNZIP=\"${configure.universal_cflags}\""

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

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

