# $Id: Portfile,v 1.6 2006/03/03 00:35:05 yves Exp $

PortSystem 1.0
name		xorg
version		X11R6.8.2
categories	x11
maintainers	waqar@opendarwin.org
description	The X Window System
long_description	\
	X11, or X, is a vendor-neutral, system-architecture neutral 	\
	network-transparent window system and user interface standard. 	\
	In other words, it's a GUI for UNIX. X can use your network -- 	\
	you may run CPU-intensive programs on high powered workstations \
	and display the user interface (the windows) on inexpensive 	\
	desktop machines.

platforms	darwin
homepage	http://www.x.org
master_sites    http://ftp.sunet.se/pub/X11/ftp.x.org/${version}/src-single \
		http://www.mirror.ac.uk/mirror/ftp.x.org/pub/${version}/src-single \
		http://ftp.pl.debian.org/mirror/ftp.x.org/pub/${version}/src-single \
		http://www2.x.org/pub/${version}/src-single \
		http://sunsite.sut.ac.jp/pub/archives/X11/${version}/src-single

pre-fetch {
    ui_msg "Hi, my name is xorg"
    ui_msg "I am broken and looking for someone to fix me"
    ui_msg "What can I say ?"
    exit 1
}
use_bzip2	yes
distname	${version}-src
checksums	md5 8131cd7ea1e4566e6e05c438a93fcfe1 \
		sha1 632e25a202bc41bb9b1c5dbc8bbb0d775c6593b0

worksrcdir 	xc
configure	{
	set cfpath ${worksrcpath}/config/cf
	file copy -force ${cfpath}/xorgsite.def ${cfpath}/host.def
}

build.target	World
destroot.target install install.man

variant darwin 	{
	pre-configure {
		set hw ${worksrcpath}/programs/Xserver/hw
		reinplace "s|/Applications|/Applications/DarwinPorts|g"	\
			${hw}/darwin/quartz/Imakefile 	\
			${hw}/darwin/quartz/XDarwinStartup.man \
			${hw}/xfree86/doc/README.Darwin	\
			${hw}/xfree86/doc/sgml/Darwin.sgml \
			${hw}/xfree86/etc/bindist/Darwin-ppc/quartz-list \
			${worksrcpath}/programs/Xserver/Imakefile \
	}
}

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

