# -*- 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 92147 2012-04-20 07:07:58Z jeremyhu@macports.org $

PortSystem	1.0
PortGroup       muniversal 1.0

name		webkit-gtk
epoch           1
version		1.6.3
revision        2
description	Apple's WebKit HTML rendering library for GTK+
long_description ${description}
maintainers	devans
categories	www gnome
platforms	darwin freebsd
license     LGPL-2+ BSD
homepage	http://webkitgtk.org/
master_sites    http://webkitgtk.org/releases/

use_xz          yes
distname        webkit-${version}

checksums       md5     c476d9335419df061510d31e21175df1 \
                sha1    7df69608ef2ce9dd7328353b4ee34f69271cd43b \
                rmd160  cc319ffe4c2810663ae05b90e69d9495f5c3f0aa

depends_lib	\
        port:gtk2 \
        port:libsoup \
        port:icu \
        port:libxslt \
        port:sqlite3 \
        port:enchant \
        port:xorg-libXt
        
depends_build	\
        port:pkgconfig \
        port:gtk-doc

patchfiles \
        case-insensitive.patch \
        our-icu.patch \
        xrender-check.patch \
        pango.patch \
        quartz.patch \
        glib-2.32.patch

configure.args	\
        --with-gtk=2.0 \
        --enable-introspection=no \
        --disable-svg \
        --disable-video

autoreconf.env-append ACLOCAL="aclocal -I Source/autotools"
use_autoreconf  yes
autoreconf.args -fvi

# BUILD FIX TODO: clang C++
# clang has trouble with webkit-1.6.3's C++ as of 2012.04.19
if {${configure.compiler} == "clang"} {
    configure.compiler llvm-gcc-4.2 
}

# https://trac.macports.org/ticket/34044
if {${configure.compiler} == "gcc-4.0" && [vercmp ${xcodeversion} 3.0] >= 0} {
    configure.compiler gcc-4.2
}

post-patch {
    # For some reason, this isn't getting created for some people... ? /shrug
    file mkdir ${worksrcpath}/DerivedSources
}

# TODO: fix this for muniversal
# keep it for debug
#post-destroot {
#    file copy ${worksrcpath}/Programs/.libs/GtkLauncher ${destroot}${prefix}/bin
#}

# see bug #24622
variant quartz {
    configure.args-append --with-target=quartz
    depends_lib-delete port:xorg-libXt
}

variant pango description {Use the pango font backend instead of freetype} {
    configure.args-append --with-font-backend=pango
}

#
# video is now enabled by default so make the variant no_video
#

variant video description {Disable HTML5 video support using gstreamer} {
	depends_lib-append	port:gst-plugins-base
	configure.args-delete	--disable-video
}

#
# add new variant to support gnome_keyring
#

variant gnome_keyring description {Enable support for gnomekeyring} {
        depends_lib-append      port:libgnome-keyring
        configure.args-append   --enable-gnomekeyring
}

#
# variant to enable filter support which is disabled by default
#

variant filters description {Enable support for SVG filters (experimental)} {
	configure.args-append	--enable-filters
}

#
# all svg support (except filters) is enabled by default
#

variant svg description {Disable all SVG support} {
	configure.args-delete	--disable-svg
	configure.args-append	--enable-svg
}

default_variants +video +svg

livecheck.type  regex
livecheck.url   http://webkitgtk.org/?page=download
livecheck.regex webkit-(\[0-9\]+\\.\[0-9\]*\[02468\]\\.\[0-9\]+)
