summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/additivefoam/package.py
blob: fc34d0c1f333ab1924e2f9b0d240c56f019718b7 (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
# 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)

import os

from spack.package import *
from spack.pkg.builtin.openfoam import add_extra_files


class Additivefoam(Package):
    """AdditiveFOAM is a heat and mass transfer software for Additive Manufacturing (AM)"""

    homepage = "https://github.com/ORNL/AdditiveFOAM"
    git = "https://github.com/ORNL/AdditiveFOAM.git"
    url = "https://github.com/ORNL/AdditiveFOAM/archive/1.0.0.tar.gz"

    maintainers("streeve", "colemanjs", "gknapp1")

    tags = ["ecp"]

    license("GPL-3.0-only")

    version("main", branch="main")
    version("1.0.0", sha256="abbdf1b0230cd2f26f526be76e973f508978611f404fe8ec4ecdd7d5df88724c")

    depends_on("openfoam-org@10")

    common = ["spack-derived-Allwmake"]
    assets = ["applications/Allwmake", "Allwmake"]

    build_script = "./spack-derived-Allwmake"

    phases = ["configure", "build", "install"]

    def patch(self):
        add_extra_files(self, self.common, self.assets)

    def configure(self, spec, prefix):
        pass

    def build(self, spec, prefix):
        """Build with Allwmake script, wrapped to source environment first."""
        args = []
        if self.parallel:  # Parallel build? - pass via environment
            os.environ["WM_NCOMPPROCS"] = str(make_jobs)
        builder = Executable(self.build_script)
        builder(*args)

    def install(self, spec, prefix):
        """Install under the prefix directory"""

        for f in ["README.md", "LICENSE"]:
            if os.path.isfile(f):
                install(f, join_path(self.prefix, f))

        dirs = ["tutorials", "applications"]
        for d in dirs:
            if os.path.isdir(d):
                install_tree(d, join_path(self.prefix, d), symlinks=True)