# -*- 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

github.setup            samtools htslib 1.23.1
revision                0
checksums               rmd160  ca8b83e44809a1aa9436626b58f95f94bb86ff8a \
                        sha256  f8a3f36effeec38f043c53ab1f2d9ed45064f14205c5ef8e3c815763b90803c4 \
                        size    4987046

categories              science
maintainers             {ryandesign @ryandesign} openmaintainer
license                 MIT BSD

description             C library for accessing SAM, CRAM, VCF, BCF and other \
                        file formats used for high-throughput sequencing data

long_description        HTSlib is an implementation of a unified C library for \
                        accessing common file formats, such as SAM, CRAM, VCF \
                        and BCF, used for high-throughput sequencing data. It \
                        is the core library used by SAMtools and BCFtools.

homepage                https://www.htslib.org
github.tarball_from     releases
use_bzip2               yes

depends_lib             port:bzip2 \
                        port:curl \
                        port:libdeflate \
                        port:xz \
                        port:zlib

# cpuid_count, get_cpuid_max
compiler.blacklist-append {clang < 503}

# https://trac.macports.org/wiki/WimplicitFunctionDeclaration#strchr
configure.checks.implicit_function_declaration.whitelist-append strchr

configure.args          --enable-bz2 \
                        --with-libdeflate \
                        --enable-gcs \
                        --enable-libcurl \
                        --enable-lzma

platform darwin {
    if {[vercmp ${macosx_deployment_target} < 10.10]} {
        # https://github.com/samtools/htslib/issues/1941
        configure.args-append \
                        --disable-ref-cache
    }
}

post-destroot {
    xinstall -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 0644 -W ${worksrcpath} \
        LICENSE NEWS README \
        ${destroot}${prefix}/share/doc/${name}
}
