summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/sloccount/package.py
blob: b09853f375dae9ff735506c1294f9466b2091f6d (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
# 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 Sloccount(MakefilePackage):
    """SLOCCount is a set of tools for counting physical Source Lines of Code
    (SLOC) in a large number of languages of a potentially large set of
    programs."""

    homepage = "https://dwheeler.com/sloccount/"
    url = "https://dwheeler.com/sloccount/sloccount-2.26.tar.gz"

    license("GPL-2.0-or-later")

    version("2.26", sha256="fa7fa2bbf2f627dd2d0fdb958bd8ec4527231254c120a8b4322405d8a4e3d12b")

    # md5sum needed at run-time
    depends_on("coreutils", type=("build", "run"))
    depends_on("flex", type="build")

    def edit(self, spec, prefix):
        makefile = FileFilter("makefile")
        makefile.filter("^PREFIX=.*", "PREFIX=" + prefix)
        makefile.filter("^CC=.*", "CC=" + spack_cc)

        # Needed for `make test` to pass
        makefile.filter("PATH=.:${PATH}", "PATH=$(CURDIR):${PATH}", string=True)

    def install(self, spec, prefix):
        mkdir(prefix.bin)
        make("install")