--- Portfile.orig	2008-10-22 23:11:12.000000000 +0100
+++ Portfile	2008-10-22 22:54:53.000000000 +0100
@@ -1,56 +1,111 @@
-# $Id: Portfile 38785 2008-07-31 09:10:05Z ryandesign@macports.org $
+# $Id: Portfile 40260 2008-09-27 11:20:42Z ryandesign@macports.org $
+
+PortSystem	1.0
 
-PortSystem  1.0
 name		swi-prolog-devel
-version		5.5.36
-epoch		20050503
+version		5.7.2
+epoch		20051223
 
 categories	lang
-maintainers	pmoura@mac.com
+maintainers	wielemak@science.uva.nl pmoura@logtalk.org
 platforms	darwin
-description	SWI-Prolog compiler plus extra packages (development version)
+description	SWI-Prolog compiler plus extra packages (stable version)
 
 long_description	\
-		ISO/Edinburgh-style Prolog compiler including modules, 		\
-		autoload, libraries, Garbage-collector, stack-expandor,		\
-		C/C++-interface, Multiple threads, GNU-readline interface, 	\
-		very fast compiler. Including packages clib (Unix process	\
-		control, sockets, MIME), cpp (C++ interface), sgml (reading \
-		XML/SGML), sgml/RDF (reading RDF into triples), ODBC 		\
-		interface and XPCE (Graphics UI toolkit, integrated editor 	\
-		(Emacs-clone) and graphical debugger).
+	ISO/Edinburgh-style Prolog compiler including modules,		\
+	autoload, libraries, Garbage-collector, stack-expandor,		\
+	C/C++-interface, Multiple threads, GNU-readline interface,	\
+	coroutining, constraint programming, global variables,		\
+	very fast compiler. Including packages clib (Unix process	\
+	control, sockets, MIME), cpp (C++ interface), sgml (reading	\
+	XML/SGML), sgml/RDF (reading RDF into triples), ODBC		\
+	interface and XPCE (Graphics UI toolkit, integrated editor	\
+	(Emacs-clone) and graphical debugger).
 
 homepage	http://www.swi-prolog.org/
 master_sites	http://gollem.science.uva.nl/cgi-bin/nph-download/SWI-Prolog/BETA/
 
-checksums	md5	8bba7daab3d402a0d21d23e6cd15f045
+checksums       \
+        md5     9197a4a6081f8e14a4d915933dd0aa71 \
+        sha1    51f64d906b4253ad5bc1ee832a2e7ea0d6480be5 \
+        rmd160  208b45b839048b85bc446850771b7f1776fe50bf
+
+depends_build   \
+	port:gawk	\
+	port:junit
 
 depends_lib		\
-		lib:libreadline:readline	\
-		lib:libncursesw:ncurses		\
-		lib:libjpeg:jpeg		\
-		lib:libmcrypt:libmcrypt		\
-		lib:libX11.6:XFree86		\
-		lib:libgmp:gmp
-
-platform darwin 6 { depends_lib-append lib:libdl:dlcompat }
+	port:readline		\
+	port:ncurses		\
+	port:jpeg		\
+	port:libmcrypt		\
+	port:gmp		\
+	port:zlib		\
+	lib:libX11.6:XFree86
+
+platform darwin 6 {
+	depends_lib-append port:dlcompat
+}
+
+platform darwin 9 {
+	depends_lib-append port:expat
+}
 
 distname	pl-${version}
 
-configure.cflags-append "-I${prefix}/include"
-configure.env	CIFLAGS=-I${prefix}/include
-
-configure.args	--mandir=${prefix}/share/man	\
-		--with-world
-
-build.env	LDFLAGS=-L${prefix}/lib		\
-		CFLAGS=-I${prefix}/include	\
-		CPPFLAGS=-I${prefix}/include	\
-		CIFLAGS=-I${prefix}/include
-
-default_variants +mt
-
-variant st	{ configure.args-append --disable-mt}
-
-variant mt	{ configure.args-append --enable-mt}
-
+configure.env	\
+	LIBRARY_PATH=/usr/lib:${x11prefix}/lib:${prefix}/lib 	\
+	CPATH=/usr/include:${x11prefix}/include:${prefix}/include	\
+	JUNIT=${prefix}/share/java/junit.jar
+
+configure.ldflags
+
+configure.args	\
+	--mandir=${prefix}/share/man	\
+	--with-world
+
+build.env	\
+	LIBRARY_PATH=/usr/lib:${x11prefix}/lib:${prefix}/lib	\
+	CPATH=/usr/include:${x11prefix}/include:${prefix}/include	\
+	JUNIT=${prefix}/share/java/junit.jar
+
+post-build {
+	file mkdir ${workpath}/macosx
+	file copy -force -- ${workpath}/pl-${version}/man/macosx/License.html ${workpath}/macosx/
+	file copy -force -- ${workpath}/pl-${version}/man/macosx/macosx.html ${workpath}/macosx/
+	file copy -force -- ${workpath}/pl-${version}/man/macosx/Welcome.html ${workpath}/macosx/
+}
+
+post-pkg {
+	set resources ${workpath}/${name}-${version}.pkg/Contents/Resources/
+	file copy -force -- ${workpath}/macosx/License.html ${resources}
+	file copy -force -- ${workpath}/macosx/macosx.html ${resources}
+	file copy -force -- ${workpath}/macosx/Welcome.html ${resources}
+	file rename ${resources}/macosx.html ${resources}/ReadMe.html
+	file delete -force -- ${resources}/Welcome.rtf
+}
+
+post-mpkg {
+	set resources ${workpath}/${name}-${version}.mpkg/Contents/Resources/
+	file copy -force -- ${workpath}/macosx/License.html ${resources}
+	file copy -force -- ${workpath}/macosx/macosx.html ${resources}
+	file copy -force -- ${workpath}/macosx/Welcome.html ${resources}
+	file rename ${resources}/macosx.html ${resources}/ReadMe.html
+	file delete -force -- ${resources}/Welcome.rtf
+}
+
+if {![variant_isset st]} {
+	default_variants +mt
+}
+
+variant st conflicts mt description {Single-threaded} {
+	configure.args-append --disable-mt
+}
+
+variant mt conflicts st description {Multi-threaded (default)} {
+	configure.args-append --enable-mt
+}
+
+livecheck.check     regexm
+livecheck.url       ${homepage}dl-stable.html
+livecheck.regex     "Gzipped tar file holding the sources for version <b>(\\d+\\.\\d+\\.\\d+)"
