# $Id: Portfile,v 1.4 2004/12/02 19:44:11 gwright Exp $

PortSystem        1.0
name              isabelle
version           2004
revision 	  2
categories        lang
maintainers       dem5302@cs.rit.edu
description       Isabelle is a popular generic theorem proving environment.
long_description  Isabelle is a generic proof assistant. It allows mathematical \
                  formulas to be expressed in a formal language and provides \
                  tools for proving those formulas in a logical calculus. The \
                  main application is the formalization of mathematical proofs \
                  and in particular formal verification, which includes proving \
                  the correctness of computer hardware or software and proving \
                  properties of computer languages and protocols.

homepage          http://www.cl.cam.ac.uk/Research/HVG/Isabelle/
master_sites      ${homepage}/dist/

distfiles         Isabelle${version}${extract.suffix}
checksums         md5 8ea6985fde973453090abaa68aaa8446
worksrcdir        Isabelle2004

depends_lib       bin:poly:polyml \
                  lib:poly/ML_dbase:polyml

# The goal is to make polyml+isabelle "just work" out of the box. If
# a user wishes to use other implementations of ML, then they will
# have to edit the settings file directly.
#
# The settings file is limited to very few scenarios out of the box.
# We modify the linux entry, since it is the closest thing that will
# resemble our darwinports installation.

post-configure {
	reinplace "s|/.*/bin/poly|${prefix}/bin/poly|g" ${workpath}/${worksrcdir}/etc/settings
	reinplace "s|/usr/lib/poly|${prefix}/lib/poly|g" ${workpath}/${worksrcdir}/etc/settings
	reinplace "s|ML_PLATFORM=x86-linux|ML_PLATFORM=ppc-darwin|g" ${workpath}/${worksrcdir}/etc/settings
	reinplace "s|ML_HOME=/usr/bin|ML_HOME=${prefix}/bin|g" ${workpath}/${worksrcdir}/etc/settings
}

build {
    cd ${workpath}/${worksrcdir}
	system "./build -a"
}

destroot {
	file copy ${workpath}/${worksrcdir} ${destroot}${prefix}/lib/Isabelle2004
    system "${destroot}${prefix}/lib/Isabelle2004/bin/isatool install -p ${destroot}${prefix}/bin"
    reinplace "s|\"/.*/bin|\"${prefix}/lib/Isabelle2004/bin|g" \
              ${destroot}${prefix}/bin/isabelle-process \
              ${destroot}${prefix}/bin/isabelle-interface \
              ${destroot}${prefix}/bin/isatool
}
