# $Id: Portfile 76441 2011-02-23 20:20:12Z raimue@macports.org $

PortSystem      1.0

name            afsctool
version         1.6.4
set distversion 34
revision        1
categories      sysutils
platforms       macosx
license         GPL-3
maintainers     raimue openmaintainer
description     Utility for manipulating HFS+ compressed files
long_description \
    AFSC (Apple File System Compression) tool is an utility that can be used to \
    apply HFS+ compression to file(s), decompress HFS+ compressed file(s), or \
    get information about existing HFS+ compressed file(s). Mac OS 10.6 or \
    later is required.

homepage        http://web.me.com/brkirch/brkirchs_Software/afsctool/afsctool.html
master_sites    http://web.me.com/brkirch/
distname        ${name}_${distversion}
use_zip yes

checksums       md5     d0f2b79676c0f3d8c22e95fcf859a05f \
                sha1    216d7ff54bad947781d9b49f9754c5d3c07349be \
                rmd160  d692dc656deb32da090f4f40b4e94a62d808332d

depends_lib     port:zlib

pre-fetch {
    if {"darwin" == ${os.platform} && ${os.major} < 10} {
        ui_error "${name} ${version} is only compatible with Mac OS X 10.6 or later"
        return -code error "incompatible Mac OS X version"
    }
}

use_configure   no
universal_variant yes

build {
    if {![variant_isset universal]} {
        set archflags ${configure.cc_archflags}
    } else {
        set archflags ${configure.universal_cflags}
    }
    system "cd ${worksrcpath} && ${configure.cc} ${configure.cflags} ${configure.ldflags} ${archflags} -lz -framework CoreServices -o afsctool afsctool.c"
}

destroot {
    xinstall -W ${worksrcpath} -m 755 ${name} ${destroot}${prefix}/bin
    xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}
    xinstall -W ${worksrcpath} -m 644 License.txt ${destroot}${prefix}/share/doc/${name}
}

livecheck.type regex
livecheck.url http://web.me.com/brkirch/brkirchs_Software/afsctool/rss.xml
livecheck.regex ${name}\\s+(\\d+(?:\\.\\d+)+)
