# $Id: Portfile 91967 2012-04-14 09:55:28Z saispo@macports.org $

PortSystem 1.0

name		yacas
version		1.3.2
revision        1
categories	math
platforms       darwin
homepage        http://yacas.sourceforge.net/
maintainers	saispo@macports.org
description	Yet Another Computer Algebra System
long_description YACAS is an easy to use, general purpose Computer Algebra\
	System, a program for symbolic manipulation of mathematical\
	expressions. It uses its own programming language designed for\
	symbolic as well as arbitrary-precision numerical computations.  The\
	system has a library of scripts that implement many of the symbolic\
	algebra operations - new algorithms can be easily added to the library.

master_sites	http://yacas.sourceforge.net/backups/

checksums   md5 a07347b9276a2b2180a5a4855323ea8e \
            sha1 1e2395a835eab64ad519abb2b816bd94d2a27a09 \
            rmd160 0f01763d029d078f0a156b0d8549c1de14b16341 


# perl is used to build documentation
# ${prefix}/share/yacas/manmake/txt2yacasdoc.pl requires perl after build
depends_lib	path:bin/perl:perl5

post-patch {
    #Ensure that the correct perl is used
    foreach f {ytxt2tex Makefile.in book2ys.sh book2xml.sh book2txt.sh book2TeX.sh} {
        reinplace -E "s|(\[^a-zA-Z_\])perl |\\1${prefix}/bin/perl |g" ${worksrcpath}/manmake/${f}
    }
    foreach f [glob -directory ${worksrcpath}/manmake *.pl] {
         reinplace  "s|/usr/bin/perl|${prefix}/bin/perl|g" ${f}
    }
}

configure.args-append   --with-html-dir=${prefix}/share/doc/${name}

default_variants +server

variant server description {Add the ability to run as server} {
    configure.args-append   --enable-server
}

test.run	yes

livecheck.url    http://yacas.sourceforge.net/downloads.html
livecheck.regex  "version (\\d(?:\\.\\d+)*)"
