# -*- 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 92962 2012-05-12 02:48:35Z ryandesign@macports.org $

PortSystem          1.0

name                libxl
version             3.2.4
categories          textproc
platforms           darwin
maintainers         ryandesign openmaintainer
license             LibXL

description         library for reading and writing Microsoft Excel files

long_description    LibXL is a ${description}.

homepage            http://www.libxl.com/
master_sites        ${homepage}download
distfiles           [suffix libxl-mac-${version}]

checksums           rmd160  d9c434717dcdb967c59bee45014588a50c3a9c88 \
                    sha256  63a618110d775db735c96c220ec8e6b5bf64ec4504900a0312bd1f25a9a9854d

use_configure       no

variant universal {}

supported_archs     i386 x86_64
configure.universal_archs i386 x86_64

set libxl           lib/libxl.dylib

build {
    system -W ${worksrcpath} "install_name_tool -id ${prefix}/${libxl} ${libxl}"
    if {![variant_isset universal]} {
        system -W ${worksrcpath} "lipo -extract ${configure.build_arch} ${libxl} -output ${libxl}"
    }
}

destroot {
    xinstall -m 644 ${worksrcpath}/${libxl} ${destroot}${prefix}/lib
    # I don't know where the developers intend these to be installed but they
    # need to be in separate directories because there are files of the same
    # names with different contents. Having them directly in ${prefix}/include
    # also seems inadvisable due to the generically-named enum.h and setup.h.
    # which could conflict with other projects.
    copy ${worksrcpath}/include_c ${destroot}${prefix}/include/libxl-c
    copy ${worksrcpath}/include_cpp ${destroot}${prefix}/include/libxl-cpp
}

# I'd use ${homepage}download.html except that their server sniffs for and
# prevents access from curl.
livecheck.url       http://www.softpedia.com/get/Programming/Components-Libraries/LibXL.shtml
livecheck.regex     {LibXL ([0-9.]+)}

notes "
LibXL is commercial software that requires a license to unlock all features.\
For more information, see:

${homepage}purchase.html
"
