# -*- 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           perl5 1.0
PortGroup           wxWidgets 1.0

perl5.branches      5.24 5.26
perl5.setup         Wx 0.9932

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

description         Interface to the wxWidgets cross-platform GUI toolkit
long_description    ${description}

checksums           rmd160  5abb796f4998bc2cf49380271060082cbd4d4c16 \
                    sha256  1cfdb6535a0f4676e6f1aab2c9d8e16d577be3eb3b7cc04c8074d685e6651b70

if {${perl5.major} != ""} {
    wxWidgets.use   wxWidgets-3.0

    depends_build-append \
                    port:p${perl5.major}-extutils-xspp

    depends_lib-append \
                    port:p${perl5.major}-alien-wxwidgets \
                    port:${wxWidgets.port}

    # temporary change the mode
    # not an issue for version 0.9932
#    post-extract {
#        fs-traverse dir ${worksrcpath} {
#            if { [ file isdirectory ${dir} ] } {
#                file attributes ${dir} -permissions 0755
#            }
#        }
#    }

    # patch for apparent API change in wxWidgets 3.0.3
    # https://github.com/wxWidgets/wxWidgets/commit/6b335c8ca440a7adea8309c2272b53aaff59f526
    # https://rt.cpan.org/Public/Bug/Display.html?ShowHeaders=1;id=121603
patchfiles          patch-XS-PropertySheetDialog.xsp.diff

#   this is now fixed upstream
#    patchfiles      patch-build-Wx-build-MakeMaker-MacOSX_GCC.pm.diff \
#                    patch-cpp-wxPerl.osx-Makefile.diff
#    post-patch {
#        # try to find a better way to fix that problem
#        reinplace -W ${worksrcpath} "s|@@CC@@|${configure.cc}|g" cpp/wxPerl.osx/Makefile
#    }

    configure.args  installdirs=vendor
}
