# $Id: Portfile,v 1.14 2005/08/14 13:21:56 yves Exp $

PortSystem 1.0

name		glut
version		3.7
description	The OpenGL Utility Toolkit (GLUT)
long_description An indispensible toolkit for OpenGL programmers, this provides many of the windowing and input management primitives that OpenGL itself does not deal with.
maintainers	yves@opendarwin.org
categories	x11 graphics
platforms	darwin
master_sites	http://www.opengl.org/resources/libraries/glut/
homepage	http://www.opengl.org/resources/libraries/glut.html
checksums	md5 dc932666e2a1c8a0b148a4c32d111ef3
patchfiles	patch-glutbitmap.h patch-round_cap.c patch-segment.c

depends_lib	lib:libGL.1:XFree86 lib:libX11.6:XFree86

configure {
    system "cd ${worksrcpath} && ./mkmkfiles.imake"
}

pre-build {
	system "cp ${worksrcpath}/include/GL/glut.h ${worksrcpath}/lib/glut"
}

build {
	system "cd ${worksrcpath}/lib/glut ; xmkmf ; make"
	system "cd ${worksrcpath}/lib/glut ; c++ -flat_namespace -dynamiclib -o libglut.3.7.dylib -install_name ${prefix}/lib/libglut.3.dylib -compatibility_version 3.7 -current_version 3.7 -all_load libglut.a -L/usr/X11R6/lib -lGL -lGLU -lX11 -lXmu -lXi -lXext -lXt -lICE -lSM"
}

destroot {
	file mkdir ${destroot}/${prefix}/include/GL
	file mkdir ${destroot}/${prefix}/lib
	system "install -m 644 -c ${worksrcpath}/include/GL/glut.h ${destroot}/${prefix}/include/GL"
	system "install -m 644 -c ${worksrcpath}/lib/glut/libglut.a ${destroot}/${prefix}/lib"
	system "ranlib ${destroot}/${prefix}/lib/libglut.a"
	system "install -m 644 -c ${worksrcpath}/lib/glut/libglut.3.7.dylib ${destroot}/${prefix}/lib"
	system "ln -fs ${prefix}/lib/libglut.3.7.dylib ${destroot}/${prefix}/lib/libglut.3.dylib"
	system "ln -fs ${prefix}/lib/libglut.3.7.dylib ${destroot}/${prefix}/lib/libglut.dylib"
}
