# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem           1.0

name                 mozart
version              1.4.0
revision             3
set tardate          20080704
set urldate          2008-07-02
categories           lang
platforms            darwin
maintainers          nomaintainer
homepage             https://mozart.github.io
description          Mozart-Oz multiparadigms programming language.
long_description     The Mozart system is a development platform focused on open \
			distributed computing and constraint-based inferrence.  \
			The system provides excellent support for logic and \
			constraint programming, making it an excellent choice \
			for implementing multi-agent systems.  The language has \
			recently been popularized by the book "Concepts, \
			Techniques, and Models of Computer Progamming."

depends_build	     port:flex port:gdbm port:gmp port:zlib
#depends_lib          port:emacs
depends_run          bin:wish:tk

master_sites         sourceforge:project/mozart-oz/v1/${version}-${urldate}-tar/
distname             ${name}-${version}.${tardate}-src
checksums            md5 d34156dce23a84925f7eae121feb3afe \
                     sha1 5a12a1d66c871f01dc1223aa614d4e0bf7717b3f \
                     rmd160 090c0af3cba9db422c58c37d5fa3e703c8cc82d7

patchfiles           patch-share-bin-oz.in \
                     patch-platform_dss_configure.ac \
                     casts.diff \
                     patch-platform_emulator_Makefile.in \
                     ozplatform.patch \
                     dgc_tl.hh.patch

worksrcdir           ${name}-${version}.${tardate}
configure.ldflags
configure.args       --prefix=${prefix}/share/mozart \
                     --enable-modules-static \
                     --disable-contrib-micq

use_autoconf         yes
autoconf.dir         ${worksrcpath}/platform/dss

# endless errors in 64-bit due to casting from pointer to int
supported_archs i386 ppc
# and it doesn't consistently use cxxflags
configure.env-append CPU_FLAGS=[get_canonical_archflags]
configure.cxx ${configure.cxx} {*}[get_canonical_archflags cxx]
configure.args-append --with-cxx="${configure.cxx}"

use_parallel_build no
build.target

destroot.args        PREFIX=${destroot}${prefix}/share/mozart

post-destroot {
	delete ${destroot}${prefix}/share/mozart/cache/x-oz/doc
	file delete -force ${destroot}${prefix}/share/mozart/doc

	xinstall -m 0644 ${filespath}/README.MacPorts ${destroot}${prefix}/share/mozart

	xinstall -d ${destroot}${prefix}/man/man1
	# foreach x [glob ${destroot}${prefix}/share/mozart/doc/man/*.1] { system "ln $x ${destroot}${prefix}/man/man1" }

	reinplace "s|^# OZHOME=.*|OZHOME=${prefix}/share/mozart|" ${destroot}${prefix}/share/mozart/bin/oz
	xinstall -d ${destroot}${prefix}/bin
	foreach x [glob -type {x} ${destroot}${prefix}/share/mozart/bin/*] { system "ln $x ${destroot}${prefix}/bin" }

	file delete -force ${destroot}${prefix}/share/mozart/doc/.htaccess
}
