# -*- 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 76969 2011-03-15 20:43:17Z jeremyhu@macports.org $

PortSystem 1.0

name		galeon
version		2.0.7
revision        2
description	A GNOME web browser.
long_description        Galeon is a GNOME Web browser based on gecko (the \
			mozilla rendering engine). It's fast, it has a \
			light interface, and it is fully standards-compliant.
maintainers	nomaintainer
categories	gnome www
platforms	darwin
homepage	http://galeon.sourceforge.net/
master_sites	sourceforge
use_bzip2	yes
checksums	md5 2eede1f43e3f6f2ac4ce7d4db99b15b2 \
			sha1 14ccb53a7b3f398eb3ac3f7ca6aeb63348689a62 \
			rmd160 a443dfc11447a006d21d9e7852c616b41492a6f6

depends_build   port:pkgconfig \
                port:intltool

depends_lib     port:libgnomeui \
                port:libglade2 \
                port:gnome-vfs \
                port:gnome-desktop \
                port:xulrunner

#               path:lib/pkgconfig/libxul.pc:xulrunner

supported_archs i386 ppc

patchfiles      galeon-2.0.7-plugins.patch \
                galeon-2.0.7-gtkprint.patch \
                galeon-2.0.7-dfltfont.patch \
                galeon-2.0.7-warnings.patch \
                galeon-2.0.7-moz191.patch \
                galeon-2.0.7-jsconsole.patch \
                galeon-2.0.7-fix-str-fmt.patch \
                galeon-2.0.7-dockcrash.patch \
                galeon-2.0.7-moz192.patch \
                galeon-2.0.7-nojavaconsole.patch \
                galeon-2.0.7-spinnericon.patch \
                galeon-2.0.7-libX11.patch \
                galeon-2.0.7-bug418439.patch \
                0001-Workaround-embed-missing-crash.patch \
                0001-Workaround-tab-label-related-crashes.patch \
                0001-Use-existing-network-status-icons-for-the-online-off.patch \
                galeon-2.0.7-libxul-embedding.patch \
                galeon-2.0.7-macports-cflags.patch \
                patch-mozilla-MozRegisterComponents.cpp.diff

patch.pre_args  -p1

use_autoreconf  yes
autoreconf.args -fvi

pre-configure {
	set component_cflags "[ exec ${prefix}/bin/pkg-config --cflags libxul-embedding ]"
        if { ![ file exists ${prefix}/lib/pkgconfig/mozilla-nspr.pc ] } {
           set component_cflags "${component_cflags} -I${prefix}/include/nspr"
        }
        set component_libs [ exec ${prefix}/bin/pkg-config --libs libxul-embedding ]
        configure.env-append MOZILLA_COMPONENT_CFLAGS="${component_cflags}" \
                             MOZILLA_COMPONENT_LIBS="${component_libs}" \
                             XPCOM_COMPONENT_CFLAGS="${component_cflags}" \
                             XPCOM_COMPONENT_LIBS="${component_libs}"
}

configure.args \
		--mandir=${prefix}/share/man \
		--enable-nautilus-view=no \
                --with-mozilla=libxul-embedding

post-destroot {
	# make a da script happen
	file copy ${destroot}${prefix}/bin/galeon ${destroot}${prefix}/bin/galeon-bin
	file copy -force ${filespath}/galeon ${destroot}${prefix}/bin/galeon
	
	# use da ${prefix} Luke ...
    reinplace "s|/opt/local|${prefix}|g" ${destroot}${prefix}/bin/galeon
}

post-activate {
    system "export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` && \
        gconftool-2 --makefile-install-rule ${prefix}/etc/gconf/schemas/*.schemas"
}

livecheck.url           http://sourceforge.net/projects/${name}/files/
livecheck.regex         "${name}-(\\d+(?:\\.\\d+)*)\\.tar"
