# -*- 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
# $Id: Portfile 118883 2014-04-13 23:18:08Z devans@macports.org $

PortSystem      1.0

name            yelp
version         3.12.0
license         GPL-2
set branch      [join [lrange [split ${version} .] 0 1] .]
description     Help browser for GNOME.
long_description \
                Yelp is the default help browser for the \
                GNOME desktop. Yelp provides a simple graphical \
                interface for viewing DocBook, HTML, man, and info \
                formatted documentation.
maintainers     devans openmaintainer
categories      gnome
platforms       darwin
homepage        https://wiki.gnome.org/Apps/Yelp
master_sites    gnome:sources/${name}/${branch}/

use_xz          yes

checksums       rmd160  5c1e99493d63615ec66c80ce4603a1826d5c4640 \
                sha256  c83991b94b12617343c0b18845eee9fcf445459c1f6d273a4ab0b6f89e0b4a4c

depends_build   port:pkgconfig \
                port:intltool \
                port:itstool \
                port:gnome-common

depends_lib     port:desktop-file-utils \
                port:gnome-icon-theme \
                port:gnome-icon-theme-symbolic \
                port:gtk3 \
                path:lib/pkgconfig/webkitgtk-3.0.pc:webkit-gtk3 \
                port:sqlite3 \
                port:xz \
                port:bzip2 \
                port:yelp-xsl

#
# if yelp is invoked without a URI argument
# it defaults to ghelp:user-guide
#

depends_run     port:gnome-user-docs \
                port:gnome-settings-daemon

# update m4/intltool.m4 and autoreconf

pre-configure {
    copy -force ${prefix}/share/aclocal/intltool.m4 ${worksrcpath}/m4
}

use_autoreconf      yes
autoreconf.args     -fvi

configure.args  --x-includes=${prefix}/include \
                --x-libraries=${prefix}/lib \
                --disable-schemas-compile \
                --disable-silent-rules \
                --enable-debug

post-activate {
    system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas"
    system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"
}

# TODO: Check ${configure.cxx_stdlib} directly once MacPorts 2.3 is released
platform darwin {
    set cxxstdlib {}

    if {[info exists configure.cxx_stdlib] &&
        ${configure.cxx_stdlib} ne {} &&
        [string match *clang* ${configure.cxx}]} {
        set cxxstdlib ${configure.cxx_stdlib}
    } elseif {[string match *clang* ${configure.cxx}] &&
              ${os.major} >= 13} {
        set cxxstdlib libc++
    } else {
        set cxxstdlib libstdc++
    }

    if {${cxxstdlib} eq "libstdc++"} {
       depends_lib-delete path:lib/pkgconfig/webkitgtk-3.0.pc:webkit-gtk3
       depends_lib-append path:lib/pkgconfig/webkitgtk-3.0.pc:webkit-gtk3-2.0
    }
}

livecheck.type  gnome
