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

PortSystem          1.0
PortGroup           python 1.0
PortGroup           deprecated 1.0

name                py-pycg
version             0.14.1
revision            11

platforms           darwin
license             GPL-2
maintainers         nomaintainer

description         Python bindings to NVIDIA's Cg package
long_description    This project provides Python bindings to NVIDIA's Cg runtime \
                    library, enabling GPUs to be controlled from Python.

homepage            https://launchpad.net/pycg


patchfiles          patch-darwin.conf.in.diff \
                    patch-swig-files.diff

deprecated.upstream_support no
livecheck.type      none

python.versions     27

if {${name} ne ${subport}} {
    depends_build-append    port:swig-python
    depends_lib-append      port:cg-toolkit \
                            port:py${python.version}-numpy

    fetch.type      bzr
    bzr.url         lp:~callelejdfors/pycg/trunk
    bzr.revision    release-${version}

    worksrcdir      py-PyCg-${version}

    post-patch {
        file copy ${worksrcpath}/Darwin.conf.in ${worksrcpath}/Darwin.conf
        reinplace "s|@CC@|${configure.compiler}|g" ${worksrcpath}/Darwin.conf
        reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/Darwin.conf
        reinplace "s|@PYTHON_BRANCH@|${python.branch}|g" ${worksrcpath}/Darwin.conf
    }

    build.cmd       make
    build.target    all

    destroot {
        set cgdir ${destroot}${python.pkgd}/Cg
        xinstall -d ${cgdir}
        file copy ${worksrcpath}/Cg.py ${cgdir}/__init__.py
        file copy ${worksrcpath}/_Cg.so ${cgdir}/
        foreach f {LICENSE README} {
            file copy ${worksrcpath}/${f} \
                ${destroot}${prefix}/share/doc/${subport}
        }
    }
}
