# -*- 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 87846 2011-12-09 01:03:00Z devans@macports.org $

PortSystem 1.0

name            policykit
version         0.103
description     PolicyKit is an application-level toolkit for defining and \
                handling the policy that allows unprivileged processes to \
                speak to privileged processes
long_description \
                ${description}
maintainers     devans openmaintainer
categories      security
platforms       darwin
license         LGPL-2+
homepage        http://www.freedesktop.org/wiki/Software/PolicyKit
master_sites    http://hal.freedesktop.org/releases/

distname        polkit-${version}

checksums       rmd160  50aad2a95649771727b8fc42e8bbbe2ad5f7b5e8 \
                sha256  36607c8ce576980ee55bd12bab1944f13217eb8e9d04ab56022545861ece3bc5

patchfiles      patch-configure.diff

pre-patch {
    if {${os.platform} == "darwin" && ${os.major} < 10} {
        patchfiles-append patch-fdatasync.diff
                        reinplace "s|security/pam|pam/pam|" ${worksrcpath}/configure \
                            ${worksrcpath}/src/polkitagent/polkitagenthelper-pam.c \
                            ${worksrcpath}/src/programs/pkexec.c
                    }
                }

configure.cflags-append -I/usr/include
configure.ldflags-append -L/usr/lib

configure.args  --with-authfw=pam \
                --with-pam-prefix=/etc/pam.d \
                --with-pam-module-dir=/usr/lib/pam \
                --disable-introspection \
                --disable-silent-rules \
                --enable-man-pages \
                --disable-gtk-doc

depends_build   port:pkgconfig \
                port:intltool \
                port:gnome-doc-utils

depends_lib     port:eggdbus

variant docs description {Build API docs using gtk-doc} {
        configure.args-delete --disable-gtk-doc
        depends_build-append  port:gtk-doc
}

pre-destroot {
        addgroup  polkituser
        adduser   polkituser gid=[existsgroup polkituser] realname=Policy\ Kit
}

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