summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/pkg-config/package.py
blob: c4380765c25f61639b479bb3ee31ba029721e54c (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
# 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 PkgConfig(AutotoolsPackage):
    """pkg-config is a helper tool used when compiling applications
    and libraries"""

    homepage = "https://www.freedesktop.org/wiki/Software/pkg-config/"
    # URL must remain http:// so Spack can bootstrap curl
    url = "https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz"

    license("GPL-2.0-only")

    version("0.29.2", sha256="6fc69c01688c9458a57eb9a1664c9aba372ccda420a02bf4429fe610e7e7d591")
    version("0.29.1", sha256="beb43c9e064555469bd4390dcfd8030b1536e0aa103f08d7abf7ae8cac0cb001")
    version("0.28", sha256="6b6eb31c6ec4421174578652c7e141fdaae2dabad1021f420d8713206ac1f845")

    provides("pkgconfig")

    variant("internal_glib", default=True, description="Builds with internal glib")

    # The following patch is needed for gcc-6.1
    patch("g_date_strftime.patch", when="@:0.29.1")

    # https://github.com/spack/spack/issues/3525
    conflicts("%pgi")

    parallel = False

    tags = ["build-tools"]

    executables = ["^pkg-config$"]

    @classmethod
    def determine_version(cls, exe):
        exe = Executable(exe)

        # Make sure this is actually pkg-config, not pkgconf
        if "usage: pkgconf" in exe("--help", output=str, error=str):
            return None

        version = exe("--version", output=str, error=str).rstrip()

        return version

    def setup_dependent_build_environment(self, env, dependent_spec):
        """Adds the ACLOCAL path for autotools."""
        env.append_path("ACLOCAL_PATH", self.prefix.share.aclocal)

    def configure_args(self):
        config_args = ["--enable-shared"]

        if "+internal_glib" in self.spec:
            # There's a bootstrapping problem here;
            # glib uses pkg-config as well, so break
            # the cycle by using the internal glib.
            config_args.append("--with-internal-glib")

        return config_args