summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/lhapdf/package.py
blob: db5f0601dfdc003bd137a3a1f0275c34831da5c8 (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
# 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 Lhapdf(AutotoolsPackage):
    """LHAPDF is a general purpose C++ interpolator,
    used for evaluating PDFs from discretised data files."""

    homepage = "https://lhapdf.hepforge.org/"
    git = "https://gitlab.com/hepcedar/lhapdf"
    # the tarballs from hepforge include bundled cython sources
    # that may break the build when using incompatible python versions
    # thus use the release tarball from gitlab that does not include lhapdf.cxx
    url = "https://gitlab.com/hepcedar/lhapdf/-/archive/lhapdf-6.4.0/lhapdf-lhapdf-6.4.0.tar.gz"

    tags = ["hep"]

    version("6.5.1", sha256="7a19ba4cdee7053bb79db317143fe768dd6abef1ec34e2d183225e13df96a983")
    version("6.4.0", sha256="155702c36df46de30c5f7fa249193a9a0eea614191de1606301e06cd8062fc29")
    version("6.3.0", sha256="864468439c7662bbceed6c61c7132682ec83381a23c9c9920502fdd7329dd816")
    version("6.2.3", sha256="37200a1ab70247250a141dfed7419d178f9a83bd23a4f8a38e203d4e27b41308")

    variant("python", default=True, description="Build python bindings")

    depends_on("autoconf", type="build")
    depends_on("automake", type="build")
    depends_on("libtool", type="build")
    depends_on("m4", type="build")

    extends("python", when="+python")
    depends_on("py-cython", type="build", when="+python")
    depends_on("py-setuptools", type="build", when="+python")
    depends_on("gettext", type="build", when="+python")

    def configure_args(self):
        args = [
            "FCFLAGS=-O3",
            "CFLAGS=-O3",
            "CXXFLAGS=-O3",
            "LIBS=-L" + self.spec["python"].prefix.lib + " -L" + self.spec["gettext"].prefix.lib,
        ]
        args.extend(self.enable_or_disable("python"))
        return args