# $Id: Portfile,v 1.44 2005/07/06 16:18:01 ssen Exp $

PortSystem 1.0
name		XFree86
version		4.5.0
categories	x11
revision	2
maintainers	darwinports@opendarwin.org
description	X11R6 windowing system
homepage        http://www.xfree86.org/
long_description The XFree86 project's X window system implementation

platforms	darwin freebsd
prefix		${x11prefix}
master_sites	opendarwin	xfree:${version}/source/

distfiles	XFree86-${version}-src-1.tgz \
		XFree86-${version}-src-2.tgz \
		XFree86-${version}-src-3.tgz \
		XFree86-${version}-src-4.tgz \
		XFree86-${version}-src-5.tgz
checksums	XFree86-${version}-src-1.tgz md5 6c0fcf8069c13d068276016bbf6ad712 \
		XFree86-${version}-src-2.tgz md5 cc296c71cbe58edc3ffdec1084e58f4c \
		XFree86-${version}-src-3.tgz md5 c0ad630bfec4545857c2877b3e2dcbeb \
		XFree86-${version}-src-4.tgz md5 217bb03a07cf94561b35815ce257c159 \
		XFree86-${version}-src-5.tgz md5 598ce329eb06b8189f92704a5698253c

patchfiles	GL_apple.diff applewmExt.h.diff darwinKeyboard.c.diff \
		detect.mk.diff darwin.cf.diff xterm_Imakefile.diff \
		XTerm.ad.diff

depends_build	bin:perl:perl5.8
configure	{}
worksrcdir	xc
build.target	World
destroot.target	install install.man

variant darwin {
	configure {
		set hostfd [open "${worksrcpath}/config/cf/host.def" a+]
		puts $hostfd "#define ProjectRoot ${prefix}"
		puts $hostfd "#define NothingOutsideProjectRoot YES"
		puts $hostfd "#define EtcX11Directory \"${prefix}/etc/X11\""
		puts $hostfd "#define StandardIncludes      \"-I${workpath}/include\""
		puts $hostfd "#define FontconfigFontsConfDir  \"${prefix}/etc/fonts\""
#		puts $hostfd "#define        BuildFontServer         NO"
#		puts $hostfd "#define        BuildFonts              NO"
		close $hostfd
	}

	post-patch {
		file mkdir "${workpath}/include"
		file link -symbolic "${workpath}/include/security" "/usr/include/pam"
	}
}


variant puredarwin {
	post-configure	{
		set hostfd [open "${worksrcpath}/config/cf/host.def" a+]
		puts $hostfd "#define DarwinQuartzSupport NO"
		puts $hostfd "#define BuildGlxExt YES"
		puts $hostfd "#define BuildGLXLibrary YES"
		close $hostfd
	}
}
