PortSystem      1.0

name            afsctool
version         1.6.4
set distversion 34
revision        3
categories      sysutils
platforms       macosx
license         GPL-3
maintainers     nomaintainer
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        https://brkirch.wordpress.com/afsctool/
master_sites    https://docs.google.com/uc?export=download&id=0BwQlnXqL939ZQjBQNEhRQUo0aUk&dummy=
distname        ${name}_${distversion}
use_zip yes

checksums       md5     d0f2b79676c0f3d8c22e95fcf859a05f \
                sha1    216d7ff54bad947781d9b49f9754c5d3c07349be \
                rmd160  d692dc656deb32da090f4f40b4e94a62d808332d

depends_lib     port:zlib

pre-fetch {
    if {${os.platform} eq "darwin" && ${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"
    }
}

patchfiles      patch-apfs.diff

use_configure   no
universal_variant yes

build {
    system "cd ${worksrcpath} && ${configure.cc} ${configure.cflags} ${configure.ldflags} [get_canonical_archflags cc] -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 none
