# -*- 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 80128 2011-07-05 01:40:02Z jmr@macports.org $

PortSystem              1.0
PortGroup               xcodeversion 1.0

name                    zlib
version                 1.2.5
categories              archivers
maintainers             landonf ryandesign openmaintainer
license                 zlib
homepage                http://www.zlib.net/
platforms               darwin freebsd
use_bzip2               yes

description             zlib lossless data-compression library

long_description        zlib is designed to be a free, general-purpose, \
                        legally unencumbered, lossless data-compression \
                        library for use on virtually any computer hardware \
                        and operating system.

master_sites            ${homepage}

checksums               md5     be1e89810e66150f5b0327984d8625a0 \
                        sha1    543fa9abff0442edca308772d6cef85557677e02 \
                        rmd160  c6c4c2a2a205061b21487e69234106f5517b4b32

minimum_xcodeversions   {8 2.4.1 9 3.1}

patchfiles              patch-Makefile.in.diff clang.patch

configure.universal_args

use_parallel_build      yes

test.run                yes

destroot.destdir        prefix=${destroot}${prefix}

post-destroot {
    platform darwin {
        foreach {neededfile} "${prefix}/lib/libz.dylib" {
            if {![file exists ${destroot}${neededfile}]} {
                ui_error "${neededfile} is not in the destroot. Please clean ${name} and try again."
                return -code error "missing ${neededfile} in destroot"
            }
        }
    }
    
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} ChangeLog FAQ README zlib.3.pdf ${destroot}${docdir}
    
    set examplesdir ${prefix}/share/examples/${name}
    xinstall -d ${destroot}${examplesdir}
    eval xinstall -m 0644 [glob ${worksrcpath}/example{.c,s/*}] ${destroot}${examplesdir}
}

livecheck.type          regex
livecheck.url           ${homepage}
livecheck.regex         ${name}-(\[0-9.\]+)\\.tar
