# $Id: Portfile,v 1.12 2006/03/07 07:40:38 yves Exp $
PortSystem 1.0
name		mozilla	
version		1.7.12
categories	www	
description	Mozilla browser.
long_description	${description}
homepage	http://www.mozilla.org/
platforms	darwin
maintainers	darwinports@opendarwin.org
distname	${name}-${version}-source
worksrcdir	${name}
master_sites	ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/releases/mozilla${version}/source/
checksums	md5 f1ad6adbbc0510eb76d352c94c801fac
use_bzip2	yes
depends_build	bin:zip:zip bin:gmake:gmake bin:libIDL-config-2:libidl
depends_lib	lib:libgtk.2:gtk2

configure.args	\
    --enable-default-toolkit=gtk2 \
    --mandir=${prefix}/share/man \
    --enable-macos-target=10.3 \
	--enable-optimize \
	--disable-prebinding \
	--with-pthreads \
	--enable-crypto \
	--disable-freetype2 \
	--disable-debug \
	--enable-application=suite \
	--disable-tests \
	--enable-xft \
	--enable-extensions=all \
	--with-system-jpeg=${prefix} \
	--with-system-zlib=${prefix} \
	--with-system-png=${prefix} \
	--with-system-mng=${prefix} \
	--disable-short-wchar \
	--enable-strip \
	--enable-mathml \
	--enable-xinerama
	
post-configure {
    reinplace "/MOZ_GTK2_LIBS/ s/lpangocairo/lpangox-1.0 -lpangocairo/" \
        ${worksrcpath}/config/autoconf.mk
}

variant nomail {
		configure.args-append  --disable-mailnews 
}

variant calendar {
		configure.args-append --enable-calendar
}

variant no-crypto {
		configure.args-delete --enable-crypto
		configure.args-append --disable-crypto
}

variant gtk1 { 
		configure.args-delete --enable-default-toolkit=gtk2
		configure.args-append --enable-default-toolkit=gtk 
		depends_lib-delete lib:libgtk.2:gtk2
		depends_lib-append lib:libgtk.1:gtk1
}

# needs to be build on HFS 
variant aqua { 
		configure.args-delete --enable-default-toolkit=gtk2
		configure.args-append --enable-default-toolkit=mac
		configure.args-append --enable-prebinding
		
		depends_lib-append lib:libIDL:libidl1
		depends_lib-delete lib:libgtk.2:gtk2
}

platform darwin 8 {
    pre-fetch {
        set fl [open "| gcc --version"]
        set data [read $fl]
        if {[regexp "build 4061" $data]} {
            ui_msg "\n\
                Xcode 2.0 has a buggy gcc and won't build mozilla \n\
                Upgrades are available at http://connect.apple.com/"
            exit 1
        }
    }
    patchfiles                292530.aviary_10x.2.patch patch-oiddata.h
    patch.pre_args            -p1
}

