# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 118880 2014-04-13 23:15:29Z devans@macports.org $

PortSystem      1.0

name            upower
version         0.99.0
license         GPL-2+
description     UPower is an abstraction for enumerating power devices, \
                listening to device events and querying history and statistics.

long_description \
                ${description} \
                Any application or service on the system can access the \
                org.freedesktop.UPower service via the system message bus.

maintainers     devans openmaintainer
categories      devel
platforms       darwin
homepage        http://upower.freedesktop.org/
master_sites    http://upower.freedesktop.org/releases/

use_xz          yes

checksums       rmd160  3136af1c858605a9191d69669386eedc85e25c56 \
                sha256  5f354b9949108cb21180224ef3dba33b41c9221a79f71a8f76c47f56246a39a1

depends_build   port:pkgconfig \
                port:intltool \
                port:gtk-doc \
                port:libxslt \
                port:autoconf \
                port:automake \
                port:libtool

# upower uses xsltproc; using /usr/bin/xsltproc will fail without
# XML_CATALOG_FILES set because it'll attempt to download the DTDs. This
# doesn't show without trace mode, because policykit has a build dependency on
# libxslt, which hides this problem.

depends_lib     port:dbus-glib \
                port:gobject-introspection \
                port:policykit

patchfiles      patch-configure.ac.diff \
                patch-libupower-glib-up-client.c.diff \
                patch-doc-man-Makefile.am.diff

# reconfigure with our intltool.m4 using autogen.sh from upstream git

post-patch {
    xinstall -m 755 ${filespath}/autogen.sh ${worksrcpath}
}

configure.cmd   ./autogen.sh

configure.args  --enable-deprecated \
                --enable-introspection \
                --disable-silent-rules

# gobject-introspection uses g-ir-scanner, which uses $CC from env
build.args-append       CC="${configure.cc} ${configure.cc_archflags}"

# The rules enabled by gobject-introspection require GNU make 3.81+
platform darwin 8 {
    depends_build-append    port:gmake
    build.cmd               ${prefix}/bin/gmake
}

livecheck.type  regex
livecheck.url   ${master_sites}
livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
