summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/ioapi/package.py
blob: 448dd7e7d605bbd1ee0d87313efa23cd8fbbe4d7 (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
68
69
70
71
72
# 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 *


class Ioapi(MakefilePackage):
    """Models-3/EDSS Input/Output Applications Programming Interface."""

    homepage = "https://www.cmascenter.org/ioapi/"
    url = "https://www.cmascenter.org/ioapi/download/ioapi-3.2.tar.gz"
    maintainers("omsai")
    # This checksum is somewhat meaningless because upstream updates the tarball
    # without incrementing the version despite requests no to do this.
    # Therefore the checksum fails everytime upstream silently updates the
    # source tarball (#28247).  This also means that one must test for breaking
    # changes when updating the checksum and avoid #22633.
    version("3.2", sha256="0a3cbf236ffbd9fb5f6509e35308c3353f1f53096efe0c51b84883d2da86924b")
    depends_on("netcdf-c@4:")
    depends_on("netcdf-fortran@4:")
    depends_on("sed", type="build")

    def edit(self, spec, prefix):
        # No default Makefile bundled; edit the template.
        os.symlink("Makefile.template", "Makefile")
        # The makefile uses stubborn assignments of = instead of ?= so
        # edit the makefile instead of using environmental variables.
        makefile = FileFilter("Makefile")
        makefile.filter(
            "(^VERSION.*)",
            """
CPLMODE = nocpl
\\1
        """.strip(),
        )
        makefile.filter(
            "^BASEDIR.*",
            (
                """
BASEDIR = """
                + self.build_directory
                + """
INSTALL = """
                + prefix
                + """
BININST = """
                + prefix.bin
                + """
LIBINST = """
                + prefix.lib
                + """
BIN = Linux2_x86_64
        """
            ).strip(),
        )
        # Fix circular dependency bug for generating subdirectory Makefiles.
        makefile.filter("^configure:.*", "configure:")
        # Generate the subdirectory Makefiles.
        make("configure")

    def install(self, spec, prefix):
        make("install")
        # Install the header files.
        mkdirp(prefix.include.fixed132)
        install("ioapi/*.EXT", prefix.include)
        # Install the header files for CMAQ and SMOKE in the
        # non-standard -ffixed-line-length-132 format.
        install("ioapi/fixed_src/*.EXT", prefix.include.fixed132)