# -*- 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
# $Id: Portfile 77486 2011-04-01 06:09:46Z takanori@macports.org $

PortSystem	1.0

name		asymptote
version		2.08
revision    2
categories	graphics
maintainers	gmail.com:loshea
description	a vector graphics language
long_description Asymptote is a powerful descriptive \
                 vector graphics language that provides a natural \
                 coordinate-based framework for technical drawing. \
                 Labels and equations are typeset with LaTeX, for \
                 high-quality PostScript output.
homepage	http://asymptote.sourceforge.net
platforms	darwin
configure.args  --with-latex=${prefix}/share/texmf-local/tex/latex \
                --mandir=${prefix}/share/man
master_sites	sourceforge
extract.suffix  .src.tgz
checksums       md5     ab7bc11c8110b6eb459285b9c206cfe6 \
                sha1    6b81336727458f7fdcc3db972f1e63b3bfc1a93b \
                rmd160  a9a2c80410eb9a7f9371a7a1a1634fed0e0be6ab
depends_build   port:texinfo
depends_lib	port:readline \
                port:texlive \
                port:ghostscript \
                port:fftw-3 \
                port:gsl \
                port:libsigsegv \
                port:ncurses \
                port:boehmgc

post-destroot {
    set python.bin ""
    if {[variant_isset python27]} {
        set python.bin ${prefix}/bin/python2.7
    } elseif {[variant_isset python26]} {
        set python.bin ${prefix}/bin/python2.6
    }
    if {${python.bin} != ""} {
        eval reinplace {"s|#!/usr/bin/env python|#!${python.bin}|"} \
            [glob -directory ${destroot}${prefix}/share/${name}/GUI *.py]
    } else {
        delete ${destroot}${prefix}/bin/xasy
    }
}

post-activate {
  # run `mktexlsr` to make sure the asymptote files are found:
  system "mktexlsr"
}
post-deactivate {
  system "mktexlsr"
}

variant python26 conflicts python27 description {Enable xasy GUI using Python 2.6} {
    depends_lib-append port:py26-tkinter port:py26-pil
}
variant python27 conflicts python26 description {Enable xasy GUI using Python 2.7} {
    depends_lib-append port:py27-tkinter port:py27-pil
}
if {![variant_isset python26]} {
    default_variants +python27
}
