# -*- 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            BenLangmead bowtie 1.3.1 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from     tarball
revision                1
categories              science biology
maintainers             {mcalhoun @MarcusCalhoun-Lopez} openmaintainer
license                 Artistic-1 LGPL-3+

description             an ultrafast, memory-efficient short read aligner

long_description        Bowtie is {*}${description}. It aligns short DNA sequences \
                        (reads) to the human genome at a rate of over 25 million \
                        35-bp reads per hour. Bowtie indexes the genome with \
                        a Burrows-Wheeler index to keep its memory footprint small: \
                        typically about 2.2 GB for the human genome (2.9 GB for \
                        paired-end).

homepage                https://bowtie-bio.sourceforge.net

checksums               rmd160  c4aeaa1135bd40bbcbc38235878644d3b2b219da \
                        sha256  1e087c6bef7415419902d06b5a4f9d5180fd1daf39b3752044e6b448e46e6a1b \
                        size    7673131

patchfiles-append       patch-Makefile.diff \
                        patch-powerpc.diff

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

# fix build on case insensitive FS
#  In file included from bowtie_inspect.cpp:1:
#  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/c++/v1/string:519:
#  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/c++/v1/__debug:21:
#  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/c++/v1/cstddef:37:
#  ./version:1:1: error: expected unqualified-id
#  1.3.1
post-extract {
    file delete ${worksrcpath}/VERSION
}

compiler.cxx_standard   2011

supported_archs         x86_64 ppc64 ppc
installs_libs           no

depends_build-append    port:seqan-1

depends_lib-append      port:zlib

depends_run-append      port:python313

# replicate values from Makefile prior to patching
configure.optflags      -O3
configure.cppflags-prepend \
                        -I${prefix}/include/seqan-1

configure.cmd           printenv
configure.pre_args
configure.universal_args
configure.post_args     {>> Makefile.macports.inc}

destroot.args-append    prefix=${prefix}

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