# -*- 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 118516 2014-04-03 17:52:48Z mojca@macports.org $

PortSystem          1.0
PortGroup           perl5 1.0
PortGroup           wxWidgets 1.0

perl5.branches      5.8 5.10 5.12 5.14 5.16 5.18
perl5.setup         Alien-wxWidgets 0.65
revision            1

platforms           darwin
maintainers         mojca openmaintainer
license             {Artistic-1 GPL}

supported_archs     noarch

description         Alien::wxWidgets - building, finding and using wxWidgets binaries.

long_description    ${description}

checksums           rmd160  3a0e7e312ca2c141d20b66ae123af53b1602fad4 \
                    sha256  b4772a319d78cd3c933e90d7bd2f766cd57216c5234abdfd2c43a10ba83c8f40

# this is needed to use Build.Pl instead of Makefile.PL - the proper way (per author)
# (else --wxWidgets-build=0 doesn't work)
perl5.use_module_build

if {${perl5.major} != ""} {
    wxWidgets.use       wxWidgets-3.0
    depends_lib-append  port:${wxWidgets.port}

    # author says that Makefile.PL shouldn't be there
    # this line is not really needed, but it's a guard
    # to make sure that the right building procedure is used
    # (it can be removed)
    post-patch {
        delete ${worksrcpath}/Makefile.PL
    }

    # WX_CONFIG doesn't seem to work in all circumstances,
    # so until the bug is fixed, one needs to either change PATH or specify --wxWidgets-build=0
    configure.args-append   --wxWidgets-build=0
    configure.env-append    WX_CONFIG=${wxWidgets.wxconfig}
    build.env-append        WX_CONFIG=${wxWidgets.wxconfig}
    # configure.env-append  WX_CONFIG=${wxWidgets.wxconfig} PATH=${wxWidgets.wxdir}:$env(PATH)
    # build.env-append      WX_CONFIG=${wxWidgets.wxconfig} PATH=${wxWidgets.wxdir}:$env(PATH)
}
