# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 67528 2010-05-11 22:54:37Z jann@macports.org $

PortSystem      1.0

name            spin
version         5.2.5
set version_no_dot [join [split ${version} .] ""]
distname        ${name}${version_no_dot}
categories      devel
platforms       darwin
maintainers     jann
description     The Spin model checker

long_description \
    SPIN is a general tool for verifying the correctness of \
    distributed software (software design) in a rigorous and \
    mostly automated fashion.

homepage        http://spinroot.com
master_sites    http://spinroot.com/spin/Src/
checksums           md5     03345f9713e7b4f82d2d8ec319802b9c \
                    sha1    274649628c0c8ae3414b863c27a1b8d98a8e9921 \
                    rmd160  8d01f8dd0da8c8013fbb8c6d6e9a8c40b8c5f33f
depends_lib     port:tk port:tcl
patchfiles      patch-xspin.diff
worksrcdir      Spin/Src${version}
use_configure   no
use_parallel_build no

set xspin_dir   Xspin5.2
set xspin_name  xspin525.tcl

pre-patch   {
    file rename ${worksrcpath}/../${xspin_dir}/${xspin_name} ${worksrcpath}/../${xspin_dir}/xspin
}

post-patch  {
    reinplace "s,@prefix@,${prefix},g" ${worksrcpath}/../${xspin_dir}/xspin
}

build.target    ""
build.args      CC="${configure.cc} -DNXT" CFLAGS="${configure.cflags} -ansi -D_POSIX_SOURCE -Wno-format-security"

destroot    {
    xinstall -m 0444 ${worksrcpath}/../Man/${name}.1 \
        ${destroot}${prefix}/share/man/man1
    xinstall -m 0755 ${worksrcpath}/${name} \
        ${destroot}${prefix}/bin
    xinstall -m 0755 ${worksrcpath}/../${xspin_dir}/xspin \
        ${destroot}${prefix}/bin
}
