# -*- 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           github 1.0
PortGroup           php 1.1

github.setup        iliaal php_excel 1.0.2 Excel-
name                php-excel
categories-append   textproc
platforms           darwin
maintainers         {ryandesign @ryandesign} openmaintainer
license             PHP-3.01

php.branches        5.3 5.4 5.5 5.6 7.0 7.1 7.2

description         PHP interface to LibXL for reading and writing \
                    Microsoft Excel spreadsheets

long_description    ${name} is a ${description}.

if {[vercmp ${php.branch} 7] >= 0} {
    git.branch      ${git.branch}-PHP7
    checksums       rmd160  c9a97835f6f22bf249f461db109a58d4b3cdcccf \
                    sha256  56e8df28f52d22223abae103e0d7a771523d4d84277e21680dd0c7fb128cfb36
} else {
    git.branch      ${git.branch}-PHP5
    checksums       rmd160  d5fb69d3834ddf03229bd0fbe554fde106b44d69 \
                    sha256  3620527fd821899747f52cfe4bb9e8243c00a5f5ca9c55c5fb320424d2be4673
}

github.tarball_from releases
distname            [string tolower ${git.branch}]
extract.suffix      .tgz
worksrcdir          excel-${version}

if {${name} ne ${subport}} {
    depends_build-append \
                        port:libxml2
    depends_lib-append  port:libxl
    
    # libxl is Intel-only
    supported_archs     i386 x86_64
    configure.universal_archs i386 x86_64
    
    configure.args      --with-libxl-incdir=${prefix}/include/libxl-c \
                        --with-libxl-libdir=${prefix}/lib \
                        --with-libxml-dir=${prefix}/include/libxml2
    
    post-destroot {
        xinstall -d ${destroot}${prefix}/share/doc
        copy ${worksrcpath}/docs ${destroot}${prefix}/share/doc/${subport}
        xinstall -m 644 -W ${worksrcpath} CREDITS ChangeLog README.markdown ${destroot}${prefix}/share/doc/${subport}
    }
}