# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=portfile:et:sw=4:ts=4:sts=4
# $Id: Portfile 119020 2014-04-15 10:52:08Z g5pw@macports.org $

PortSystem          1.0

name                coccinelle
version             1.0.0-rc21
license             GPL-2
maintainers         g5pw openmaintainer

categories          devel textproc ml
description         ${name} is a semantic diff.
long_description    ${name} is a program matching and transformation engine which\
                    provides the language SmPL (Semantic Patch Language) for\
                    specifying desired matches and transformations in C code.

platforms           darwin

homepage            http://coccinelle.lip6.fr

depends_lib         port:ocaml \
                    port:ocaml-findlib \
                    port:ocaml-menhir

master_sites        ${homepage}/distrib

extract.suffix      .tgz

checksums           rmd160  d4e6e425a8161e5461c525c9f27c9dbf603342ec \
                    sha256  a6609a1f800f84d058c9b395edd0597171594b685f551a9b9c03728a1b416783

configure.args-append \
                    --enable-release \
                    --disable-dependency-tracking \
                    --disable-pycaml \
                    --enable-dynlink \
                    --enable-camlp4 \
                    --enable-menhirLib \
                    --enable-ocaml \
                    --enable-opt \
                    --disable-pcre \
                    --disable-python \
                    --with-menhir=${prefix}/bin/menhir

# Build optimized version only
# build.target        opt-only
                    
variant python26 conflicts python33 python32 python31 python27 description {Build with python 2.6 support} {
    set mypydir ${frameworks_dir}/Python.framework/Versions/2.6
    configure.args-delete   --disable-python
    configure.args-append   --enable-python \
                            --with-python=${mypydir}/bin/python

    configure.env-append \
                        PKG_CONFIG_PATH=${mypydir}/lib/pkgconfig
    depends_lib-append      port:python26
}

variant python27 conflicts python33 python32 python31 python26 description {Build with python 2.7 support} {
    set mypydir ${frameworks_dir}/Python.framework/Versions/2.7
    configure.args-delete   --disable-python
    configure.args-append   --enable-python \
                            -with-python=${mypydir}/bin/python
    configure.env-append \
                        PKG_CONFIG_PATH=${mypydir}/lib/pkgconfig
    depends_lib-append      port:python27
}

variant python31 conflicts python33 python32 python27 python26 description {Build with python 3.1 support} {
    set mypydir ${frameworks_dir}/Python.framework/Versions/3.1
    configure.args-delete   --disable-python
    configure.args-append   --enable-python \
                            --with-python=${mypydir}/bin/python3
    configure.env-append \
                        PKG_CONFIG_PATH=${mypydir}/lib/pkgconfig
    depends_lib-append      port:python31
}

variant python32 conflicts python33 python31 python27 python26 description {Build with python 3.2 support} {
    set mypydir ${frameworks_dir}/Python.framework/Versions/3.2
    configure.args-delete   --disable-python
    configure.args-append   --enable-python \
                            --with-python=${mypydir}/bin/python3
    configure.env-append \
                        PKG_CONFIG_PATH=${mypydir}/lib/pkgconfig
    depends_lib-append      port:python32
}

variant python33 conflicts python32 python31 python27 python26 description {Build with python 3.3 support} {
    set mypydir ${frameworks_dir}/Python.framework/Versions/3.3
    configure.args-delete   --disable-python
    configure.args-append   --enable-python \
                            --with-python=${mypydir}/bin/python3
    configure.env-append \
                        PKG_CONFIG_PATH=${mypydir}/lib/pkgconfig
    depends_lib-append      port:python33
}

variant pcre description {Enable PCRE support} {
    configure.args-delete   --disable-pcre
    configure.args-append   --enable-pcre

    depends_lib-append      port:ocaml-pcre
}

livecheck.type      regex
livecheck.url       ${homepage}/download.php
livecheck.regex     "Current version: (\\d+\\.\\d+\\.\\d+(-rc\\d+)?)"
