# -*- 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                libinchi-1
version             1.03
set major           [lindex [split ${version} .] 0]
categories          devel science
license             LGPL-2.1
platforms           darwin
maintainers         nomaintainer

description         IUPAC InChI identifier generation library

long_description    IUPAC library for standard and non-standard \
                    International Chemical Identifier (InChI) non-proprietary \
                    identifiers for chemical substances.

homepage            http://www.iupac.org/inchi/
master_sites        https://www.inchi-trust.org/download/[string map {. {}} ${version}]
dist_subdir         inchi-1/${version}

use_zip             yes
distname            INCHI-1-API
distfiles-append    INCHI-1-DOC.zip

checksums           INCHI-1-API.zip \
                    rmd160  5a808be29e751c706b3ace7dfd8c1c7a0cdfb022 \
                    sha256  d84ed63f71cba6c8622d36870085b7a2a7ea4abaf433808ea4f202d2e4637a69 \
                    size    3642980 \
                    INCHI-1-DOC.zip \
                    rmd160  1390a48cd691a5b4d00cc74152ac4df6fb4e836b \
                    sha256  434575d37eedc4a4e3e77fa512c5f9fe904fded6d25fff8587717b56abac05bf \
                    size    2260288

use_configure       no

build.args          -CINCHI_API/gcc_so_makefile/ -f makefile
build.target        result/libinchi.so.${version}.00

patchfiles          patch-INCHI-1-API_INCHI_API_gcc_so_makefile-makefile.diff

destroot {
    xinstall -m 644 -W ${worksrcpath}/INCHI_API/gcc_so_makefile/result libinchi.so.${version}.00 libinchi.so.${major} ${destroot}${prefix}/lib/
    xinstall -m 644 ${worksrcpath}/INCHI_API/inchi_dll/inchi_api.h ${destroot}${prefix}/include/

    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${docdir}
    xinstall -m 644 -W ${workpath}/INCHI-1-DOC \
        InChI_API_Reference.pdf \
        InChI_TechMan.pdf \
        InChI_UserGuide.pdf \
        RelNotes.pdf \
        readme.txt \
        ${docdir}
}

livecheck.type      regex
livecheck.url       https://www.inchi-trust.org/downloads/
livecheck.regex     {InChI version 1 \(software version ([^)]+)\)}