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

github.setup                BenLangmead bowtie2 2.5.4 v
github.tarball_from         archive
revision                    0

categories                  science biology
license                     GPL-3+
maintainers                 {mcalhoun @MarcusCalhoun-Lopez} openmaintainer

description                 Bowtie 2: Fast and sensitive read alignment
long_description            Bowtie 2 is an ultrafast and memory-efficient tool \
                            for aligning sequencing reads to long reference \
                            sequences. It is particularly good at aligning reads \
                            of about 50 up to 100s or 1,000s of characters, and \
                            particularly good at aligning to relatively long \
                            (e.g. mammalian) genomes. Bowtie 2 indexes the genome \
                            with an FM Index to keep its memory footprint small: \
                            for the human genome, its memory footprint is \
                            typically around 3.2 GB. Bowtie 2 supports gapped, \
                            local, and paired-end alignment modes.

homepage                    https://bowtie-bio.sourceforge.net/bowtie2/index.shtml

checksums                   rmd160  0f27144c80e3aed926a66b193fd4b4c62e9e8cf1 \
                            sha256  841a6a60111b690c11d1e123cb5c11560b4cd1502b5cee7e394fd50f83e74e13 \
                            size    10638569

patchfiles                  patch-src-Makefile.diff

set python_branch           3.11
set python_version          [string map {. {}} ${python_branch}]

post-patch {
    reinplace               -W ${worksrcpath} \
                            "s|^#!/usr/bin/env python3\$|#!${prefix}/bin/python${python_branch}|" \
                            bowtie2-build \
                            bowtie2-inspect
}

supported_archs             arm64 x86_64
installs_libs               no
compiler.cxx_standard       2011

depends_lib-append          port:zlib
if {${configure.build_arch} eq "arm64"} {
    depends_build-append    port:simde
}

depends_run-append          port:python${python_version}

# Makefile sets optimizations flags
configure.optflags-delete   -Os

makefile.override-append    PREFIX

post-destroot {
    xinstall                -m 755 \
                            -d \
                            ${destroot}${prefix}/share/doc/${name}
    xinstall                -m 644 \
                            -W ${worksrcpath} \
                            TUTORIAL \
                            README.md \
                            NEWS \
                            MANUAL.markdown \
                            MANUAL \
                            LICENSE \
                            AUTHORS \
                            ${destroot}${prefix}/share/doc/${name}
}

# do not find _new or -beta software
github.livecheck.regex      {([^"_-]+)}
