# -*- 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 97436 2012-09-06 01:27:58Z takanori@macports.org $

PortSystem	1.0

name		asymptote
version		2.16
revision    1
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
license         LGPL-3+
platforms	darwin
configure.args  --with-latex=${prefix}/share/texmf-local/tex/latex \
                --mandir=${prefix}/share/man
master_sites	sourceforge
extract.suffix  .src.tgz
checksums       rmd160  0fa190cdf8f07a516376451b327477003627ce54 \
                sha256  523694782a6fe82652b2893482cbe314b139893721887517be3e6820466f48fa
depends_build   port:texinfo
depends_lib	port:readline \
                port:texlive \
                port:ghostscript \
                port:fftw-3 \
                port:gsl \
                port:libsigsegv \
                port:ncurses \
                path:lib/libgc.dylib: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
}
