# -*- 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

PortSystem          1.0
PortGroup           xcode 1.0

name                class-dump
version             3.5
categories          devel
license             GPL-2
maintainers         nomaintainer

description         Utility for examining the Objective-C segment of \
                    Mach-O files.
long_description    It generates declarations for the classes, \
                    categories and protocols. This is the same \
                    information provided by using 'otool -ov', \
                    but presented as normal Objective-C declarations.
homepage            http://stevenygard.com/projects/class-dump/

master_sites        http://stevenygard.com/download/
use_bzip2           yes
checksums           rmd160  408c0baf4d384007310761585caff5e9c31a331f \
                    sha256  eb9df1b697c02f66f84f93510772cdf434b63c6d79ee23528d24ac208c1a52f2

# error: -fobjc-arc is not supported on platforms using the legacy runtime
supported_archs     x86_64

worksrcdir          ${distname}/src

# 3.5+ must be built against the 10.9 SDK, as it requires LC_* constants
# and other definitions unavailable in earlier SDKs. It will, however,
# run against 10.8+.
configure.sdkroot   "$developer_dir/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk"
xcode.target        class-dump deprotect

xcode.configuration Release
xcode.destroot.path ${prefix}/bin

if {${os.major} < 12} {
    known_fail      yes
    pre-fetch {
        ui_error "${name} @${version} requires OS X 10.8 or later."
        return -code error "incompatible OS X version"
    }
}

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 ${worksrcpath}/../README.md ${destroot}${docdir}

    delete ${destroot}${prefix}/bin/libMachObjC.a
}

livecheck.type  regex
livecheck.url   ${homepage}changes/
livecheck.regex {Version (\d+(?:\.\d+)*) -}
