summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/fasttree/package.py
blob: b8feb7b32c3741b74e6ff32083ea1d94275fbe9a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from os import symlink

from spack.package import *


class Fasttree(Package):
    """FastTree infers approximately-maximum-likelihood phylogenetic
    trees from alignments of nucleotide or protein sequences.
    """

    homepage = "http://www.microbesonline.org/fasttree"
    url = "http://www.microbesonline.org/fasttree/FastTree-2.1.10.c"
    maintainers("snehring")

    version(
        "2.1.11",
        sha256="9026ae550307374be92913d3098f8d44187d30bea07902b9dcbfb123eaa2050f",
        expand=False,
        url="http://www.microbesonline.org/fasttree/FastTree-2.1.11.c",
    )
    version(
        "2.1.10",
        sha256="54cb89fc1728a974a59eae7a7ee6309cdd3cddda9a4c55b700a71219fc6e926d",
        expand=False,
        url="http://www.microbesonline.org/fasttree/FastTree-2.1.10.c",
    )

    variant("openmp", default=True, description="Add openmp support to Fasttree.")

    def install(self, spec, prefix):
        cc = Executable(spack_cc)
        if "+openmp" in self.spec:
            cc(
                "-O3",
                self.compiler.openmp_flag,
                "-DOPENMP",
                "-finline-functions",
                "-funroll-loops",
                "-Wall",
                "-oFastTree",
                "FastTree-" + format(spec.version.dotted) + ".c",
                "-lm",
            )
        else:
            cc(
                "-O3",
                "-finline-functions",
                "-funroll-loops",
                "-Wall",
                "-oFastTree",
                "FastTree-" + format(spec.version.dotted) + ".c",
                "-lm",
            )

        mkdir(prefix.bin)
        install("FastTree", prefix.bin)

    @run_after("install")
    def create_fasttree_mp_symlink(self):
        with working_dir(prefix.bin):
            if "+openmp" in self.spec:
                symlink("FastTree", "FastTreeMP")