# -*- 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           cmake 1.1
PortGroup           github 1.0

# Allegro 4 releases are published on the liballeg/allegro5 repository;
# liballeg/allegro4 has no tags or releases.
github.setup        liballeg allegro5 4.4.3.1
github.tarball_from releases
name                allegro
epoch               1
distname            allegro-${version}

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
# The native macOS backend uses QuickDraw and other APIs removed in 10.7.
platforms           {darwin < 11}
license             Permissive
homepage            https://liballeg.org/

checksums           rmd160  964f4dcb984e012915c08a6b6574e5a1e667e57e \
                    sha256  ec19dbc9a021244582b4819b3583ee594b50141f9fcf6944a4ed8069cbf8d4d4 \
                    size    4663634

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

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

# loadpng and logg would link libpng/libvorbis opportunistically
configure.args-append \
                    -DINFODIR=share/info \
                    -DDOCDIR=share/doc \
                    -DWANT_LOADPNG=OFF \
                    -DWANT_LOGG=OFF

post-destroot {
    # some additional tools were built, 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/
    }
}

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

# The allegro5 repository's release and tag pages only list 5.x versions.
livecheck.type      regex
livecheck.url       https://liballeg.org/old.html
livecheck.regex     {allegro-(4\.[0-9.]+)\.tar\.gz}
