summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/wise2/package.py
blob: 8a0a8b11de1fba106288a69fa9e9db5b3eceeed4 (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
# Copyright 2013-2024 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 spack.package import *


class Wise2(MakefilePackage):
    """The Wise2 package is now a rather stately bioinformatics package that
    has be around for a while. Its key programs are genewise, a program
    for aligning proteins or protein HMMs to DNA, and dynamite a rather
    cranky "macro language" which automates the production of dynamic
    programming."""

    homepage = "https://www.ebi.ac.uk/~birney/wise2/"
    url = "https://www.ebi.ac.uk/~birney/wise2/wise2.4.1.tar.gz"

    maintainers("snehring")

    version("2.4.1", sha256="240e2b12d6cd899040e2efbcb85b0d3c10245c255f3d07c1db45d0af5a4d5fa1")

    depends_on("gettext")
    depends_on("glib")
    depends_on("libiconv")
    depends_on("pcre2")

    build_directory = "src"

    build_targets = ["all"]

    def edit(self, spec, prefix):
        glib_include_include = join_path(
            spec["glib"].prefix.include, "glib-" + str(spec["glib"].version[0]) + ".0"
        )
        glib_lib_include = join_path(
            spec["glib"].prefix.lib, "glib-" + str(spec["glib"].version[0]) + ".0", "include"
        )
        glib_lib = spec["glib"].prefix.lib
        glib_config_files = ["src/makefile", "src/network/makefile", "src/models/makefile"]
        for f in glib_config_files:
            filter_file(
                "`glib-config --cflags`",
                f"-I{glib_include_include} -I{glib_lib_include}",
                f,
                string=True,
            )
            filter_file("`glib-config --libs`", f"-L{glib_lib} -lglib-2.0", f, string=True)
        filter_file('"glib.h"', "<glib.h>", "src/dynlibsrc/subseqhash.h", string=True)
        filter_file("getline", "getlineseq", "src/HMMer2/sqio.c", string=True)
        filter_file("isnumber", "isdigit", "src/models/phasemodel.c", string=True)
        filter_file(r".*welcome.csh.*", "", "src/makefile")

    def install(self, spec, prefix):
        with working_dir("src"):
            install_tree("bin", prefix.bin)
        mkdirp(prefix.share.wise2)
        install_tree("wisecfg", prefix.share.wise2)