# -*- 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$

PortSystem          1.0

name                coccinelle
version             1.0.4
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 \
                    port:ocaml-camlp4

master_sites        ${homepage}/distrib

extract.suffix      .tgz

checksums           rmd160  fb363fd359bf41fbde07748f9eae31ce34de95f9 \
                    sha256  7f823813a2ea299c0f6c01d8419b83c4dc6617116d32ba99d726443a1c22b06d

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 python27 conflicts python34 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 python34 conflicts python27 description {Build with python 3.4 support} {
    set mypydir ${frameworks_dir}/Python.framework/Versions/3.4
    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:python34
}

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+)?)"