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

name            AfterStep
version         2.2.11
revision        2
categories      x11
license         GPL-2+
maintainers     nomaintainer
description     Window Manager based on NeXTStep interface.
long_description \
    AfterStep is a window manager for the Unix X Window System. \
    Originally based on the look and feel of the NeXTStep interface,\
    it provides end users with a consistent, clean, and elegant \
    desktop. The goal of AfterStep development is to provide for \
    flexibility of desktop configuration, improving aestetics, \
    and efficient use of system resources.
homepage        http://www.afterstep.org
platforms       darwin
master_sites    afterstep:stable
use_bzip2       yes

checksums       rmd160  a82a4b3fddcbcd97862212669c11d14629e51a4d \
                sha256  ca7e872fc4d8320899667087d934e0672a3f38264a5207ea314d3c20242903aa \
                size    6126237

depends_build-append \
                port:bison \
                port:cctools \
                port:flex \
                port:gettext \
                port:m4 \
                port:pkgconfig

depends_lib-append  \
                path:lib/pkgconfig/cairo.pc:cairo \
                port:dbus \
                port:freetype \
                path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
                port:gettext-runtime \
                path:lib/pkgconfig/glib-2.0.pc:glib2 \
                path:lib/pkgconfig/gtk+-2.0.pc:gtk2 \
                path:include/turbojpeg.h:libjpeg-turbo \
                port:libpng \
                path:lib/pkgconfig/librsvg-2.0.pc:librsvg \
                port:tiff \
                port:xorg-libX11 \
                port:xorg-libXext \
                port:xorg-libXinerama \
                port:xorg-libice \
                port:xorg-libsm \
                port:zlib

require_active_variants gdk-pixbuf2 x11

patchfiles      libpng.patch

configure.args  --mandir=${prefix}/share/man \
                --infodir=${prefix}/share/info \
                --enable-i18n \
                --with-svg \
                --with-x

# The code is written using gnu89 inline semantics that aren't
# compatible with c99 and later.
compiler.c_standard 1989
configure.cflags-append -std=gnu89

require_active_variants \
                path:lib/pkgconfig/gtk+-2.0.pc:gtk2 x11

platform darwin {
    patchfiles-append \
                parser.c.patch

    configure.ldflags-append \
                "-bind_at_load"

    pre-configure {
        reinplace "s|-rdynamic|-dynamic|g" \
            ${worksrcpath}/configure \
            ${worksrcpath}/libAfterBase/configure \
            ${worksrcpath}/libAfterBase/configure.in \
            ${worksrcpath}/libAfterImage/configure \
            ${worksrcpath}/libAfterImage/configure.in
    }
}

# Fix conflict with ImageMagick
# See https://trac.macports.org/ticket/18700
post-destroot {
    file rename ${destroot}${prefix}/bin/Animate \
        ${destroot}${prefix}/bin/Animate.as
}

livecheck.type      regex
livecheck.url       ${homepage}
livecheck.regex     Version (\[0-9.\]+)
