# -*- 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.22.1
revision                0
checksums               rmd160  4f3a74cd46b37ef82b16847012588769ed1b40aa \
                        sha256  3dfa6eeb71db719907fe3ef7c72cb2ec9965b20b58036547c858c89b58c342f7 \
                        size    4840271

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}
}
