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

name                wings
version             0.99.04a
categories          graphics erlang
platforms           darwin
maintainers         nomaintainer
description         Erlang 3D Modeler
long_description    Wings 3D is a subdivision modeler inspired by \
                    Nendo and Mirai from Izware.

homepage            http://www.wings3d.com/
master_sites        sourceforge
checksums           md5 148f28cd97c8d3d2426b34b53c385cb5

depends_build       port:esdl port:erlang

use_configure       no
use_bzip2           yes

build.env           ESDL_PATH=${prefix}/lib/erlang/lib/esdl-0.96.0626
build.target
destroot.target	

set wingsdest       ${destroot}${prefix}/lib/erlang/lib/wings-${version}

post-destroot  {
    xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}
    xinstall -m 0644 -W ${worksrcpath} README AUTHORS license.terms ${destroot}${prefix}/share/doc/${name}

    xinstall -d -m 0755 ${destroot}${prefix}/bin
    xinstall -m 755 ${filespath}/wings.sh ${destroot}${prefix}/bin
    reinplace "s|__PREFIX__|${prefix}|g" ${destroot}${prefix}/bin/wings.sh

    system "cd ${destroot}${prefix}/bin && ln -s wings.sh wings"

    xinstall -d -m 0755 ${wingsdest}/patches

    file copy ${worksrcpath}/plugins ${wingsdest}
    file copy ${worksrcpath}/ebin ${wingsdest}
    file copy ${worksrcpath}/fonts ${wingsdest}
    file copy ${worksrcpath}/icons ${wingsdest}

    # Get rid of bad files
    system "cd ${wingsdest}/icons/purpletube && rm \~*"
}
