# $Id$

PortSystem	1.0

name		swi-prolog
conflicts	swi-prolog-devel swi-prolog-lite
epoch		20051223
version		7.2.3
revision    1

categories	lang
license		LGPL-2.1
maintainers	uva.nl:J.Wielemaker logtalk.org:pmoura
platforms	darwin
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,	\
	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://www.swi-prolog.org/download/stable/src/

dist_subdir	swi-prolog

checksums       \
    rmd160  ae537fbbd7de81dc9b67def1a8fed8bbb4f6cb88 \
    sha256  43657d51b7c5887bc2d2bced50a9822b86a08a6841399b8e76ee877f51d646b5


depends_build   \
	port:gawk	\
	port:junit	\
	port:pkgconfig

depends_lib		\
	port:readline		\
	port:ncurses		\
	port:jpeg		\
	port:libmcrypt		\
	port:gmp		\
	port:zlib		\
	port:Xft2		\
	port:xorg-libXinerama	\
	port:xpm		\
	port:xorg-libXt \
	port:ossp-uuid		\
	port:libarchive

use_parallel_build	no

distname	swipl-${version}

configure.env	\
	LIBRARY_PATH=/usr/lib:${prefix}/lib 	\
	CPATH=/usr/include:${prefix}/include	\
	PKG_CONFIG_PATH=${prefix}/lib/pkgconfig \
	JUNIT=${prefix}/share/java/junit.jar

configure.ldflags

configure.args	\
	--mandir=${prefix}/share/man	\
	--x-includes=${prefix}/include	\
	--x-libraries=${prefix}/lib	\
	--with-world

build.env	\
	LIBRARY_PATH=/usr/lib:${prefix}/lib	\
	CPATH=/usr/include:${prefix}/include	\
	PKG_CONFIG_PATH=${prefix}/lib/pkgconfig \
	JUNIT=${prefix}/share/java/junit.jar	\
	CC=${configure.cc}

post-build {
	file mkdir ${workpath}/macosx
	file copy -force -- ${workpath}/swipl-${version}/man/macosx/License.html ${workpath}/macosx/
	file copy -force -- ${workpath}/swipl-${version}/man/macosx/macosx.html ${workpath}/macosx/
	file copy -force -- ${workpath}/swipl-${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} {
	configure.args-append --enable-mt
}

universal_variant   no

livecheck.type      regexm
livecheck.url       ${homepage}download/stable
livecheck.regex     "/download/stable/src/swipl-(\\d+\\.\\d+\\.\\d+).tar.gz"