# -*- 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
# $Id: Portfile 59862 2009-10-25 01:32:20Z landonf@macports.org $

PortSystem			1.0

name				zip
version				3.00
categories			archivers
platforms			darwin freebsd
description			compression utility
maintainers			nomaintainer

long_description	Zip is different from gzip in that it allows packing \
					multiple files into a single archive (without the \
					assistance of tar). It is compatible with pkzip, \
					pkunzip, and other Windows zip utilities.  This \
					utility is necessary to install several packages in a \
					pure Darwin installation, as Darwin does not come \
                    with zip/unzip.

homepage			http://www.info-zip.org/
master_sites		ftp://ftp.info-zip.org/pub/infozip/src/ \
					http://www.mirrorservice.org/sites/ftp.info-zip.org/pub/infozip/src/

distname                ${name}30

checksums               md5     7b74551e63f8ee6aab6fbc86676c0d37 \
                        sha1    c9f4099ecf2772b53c2dd4a8e508064ce015d182 \
                        rmd160  1fc99daf3e36494ba392c7514a714fe3d258d232

extract.suffix		.tgz

set args			"-f unix/Makefile"

configure.cmd		${build.cmd}
configure.dir		${worksrcpath}
configure.pre_args	CC=\"\${CC}\" flags \
					${args}

# The automake-specific --disable-dependency-tracking is added to all configure arguments
# when +universal is enabled -- we work around this behavior by removing the flag
# explicitly.
configure.universal_args-delete --disable-dependency-tracking

build.target		generic
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 CHANGES LICENSE README TODO WHATSNEW \
		${destroot}${docdir}
}

variant universal {
	configure.args	"LOCAL_ZIP=\"${configure.universal_cflags}\""

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

livecheck.type	regex
livecheck.url	${homepage}
livecheck.regex	">Zip.nbsp.(\\d+(?:\\.\\d+)*)<"
