summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/ploticus/package.py
blob: cff43fae29ab1e810af300e4a16fc9bd74df0854 (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
# 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 spack.package import *


class Ploticus(MakefilePackage):
    """Ploticus can produce various types of plots and graphs."""

    homepage = "http://ploticus.sourceforge.net/doc/welcome.html"

    maintainers("Christoph-TU")

    version("2.42", sha256="3f29e4b9f405203a93efec900e5816d9e1b4381821881e241c08cab7dd66e0b0")

    depends_on("zlib-api")
    depends_on("libpng")

    build_directory = "src"

    def url_for_version(self, version):
        # spack's default url_for_version may replace "242_src" with 2.42_src, causing a 404.
        # Returning the correct url here instead of as 'url =' fixes this issue:
        return (
            "https://sourceforge.net/projects/ploticus/files/ploticus/2.42/ploticus242_src.tar.gz"
        )

    def setup_run_environment(self, env):
        env.set("PLOTICUS_PREFABS", self.prefix.prefabs)

    def edit(self, spec, prefix):
        makefile = FileFilter("src/Makefile")
        makefile.filter("CC = .*", "CC = {0}".format(spack_cc))

    def install(self, spec, prefix):
        mkdir(prefix.bin)
        mkdir(prefix.prefabs)
        install("src/pl", prefix.bin)
        install_tree("prefabs", prefix.prefabs)