# -*- 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 52826 2009-06-23 22:45:09Z devans@macports.org $

PortSystem 1.0

name		galeon
version		2.0.7
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
platforms	darwin
homepage	http://galeon.sourceforge.net/
master_sites	sourceforge
use_bzip2	yes
checksums	md5 2eede1f43e3f6f2ac4ce7d4db99b15b2 \
			sha1 14ccb53a7b3f398eb3ac3f7ca6aeb63348689a62 \
			rmd160 a443dfc11447a006d21d9e7852c616b41492a6f6

depends_lib     port:gnome-session port:libiconv port:firefox-x11

configure.cflags-append -no-cpp-precomp
configure.args \
		--mandir=${prefix}/share/man \
		--enable-nautilus-view=no \
		--with-mozilla=firefox

set storagedir  ${prefix}/etc/macports/gconf
set storagefile $storagedir/${name}

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

	# schema installation procedure from #14729 (pending gnome portgroup)
    # Find all .schemas file in the destroot
	fs-traverse schema ${destroot}${prefix}/etc/gconf/schemas {
		if { [ file isfile $schema ] } {
			lappend schemafiles $schema
		}
	}

    # And put them in etc/macports/gconf/$name
	if { [ llength $schemafiles ] > 0 } {
		file mkdir ${destroot}${storagedir}
		set fh [open ${destroot}${storagefile} w]
		foreach file $schemafiles {
			puts $fh [exec basename $file]
		}
		close $fh
	}
}

post-activate {
	if { [file exists ${storagefile} ] } {
		set fh [open ${storagefile} r]
		while { ! [eof $fh] } {
			lappend schemafiles [gets $fh]
		}
		close $fh
	}

	set schemastring [join $schemafiles " "]

    system "cd ${prefix}/etc/gconf/schemas && \
         GCONF_CONFIG_SOURCE=`${prefix}/bin/gconftool-2 --get-default-source` ${prefix}/bin/gconftool-2 --makefile-install-rule $schemastring"
}

livecheck.regex  "<title>${name} .* (\\d+(?:\\.\\d+)*) released.*</title>"
