PortSystem 1.0
PortGroup cmake 1.1

name            allegro
epoch           1
version         4.4.3.1
description     A game programming library for C/C++ developers.
long_description \
                Allegro is a game programming library for \
                C/C++ developers distributed freely, supporting \
                many platforms.
maintainers     nomaintainer
categories      devel games
platforms       darwin
license         Permissive
homepage        https://liballeg.org/
master_sites    https://github.com/liballeg/allegro5/releases/download/${version}/

checksums       rmd160 964f4dcb984e012915c08a6b6574e5a1e667e57e \
                sha256 ec19dbc9a021244582b4819b3583ee594b50141f9fcf6944a4ed8069cbf8d4d4

patchfiles      patch-main.m.diff patch-system.m.diff

# needed or it fails to install docs
cmake.out_of_source no

configure.args-append -DINFODIR=share/info -DDOCDIR=share/doc

post-destroot {
    # some additional tools were build, let's install them
    foreach tool {colormap dat dat2c dat2s exedat grabber pack pat2dat rgbmap textconv} {
        xinstall -m 0755 -W ${worksrcpath}/tools/ ${tool} ${destroot}${prefix}/bin/
    }
}

if {${os.platform} eq "darwin" && ${os.major} > 10} {
    known_fail  yes
    pre-fetch {
        ui_error "${name} uses deprecated API which has been removed as of Mac OS X 10.7."
        return -code error "incompatible Mac OS X version"
    }
}

# Does not compile 64-bit due to NSQuickDraw
# and probably other old API usage
supported_archs i386 ppc

livecheck.type  regex
livecheck.url   https://github.com/liballeg/allegro5/releases
livecheck.regex {allegro-(4\.[0-9.]+)\.tar\.gz}
