summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/libjxl/package.py
blob: 2f7a826d804765ab6084b4d74fa1aac9c4df9fac (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
# 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 Libjxl(CMakePackage):
    """JPEG XL image format reference implementation."""

    homepage = "https://github.com/libjxl/libjxl"
    url = "https://github.com/libjxl/libjxl/archive/refs/tags/v0.6.1.tar.gz"
    git = "https://github.com/libjxl/libjxl.git"

    license("Apache-2.0")

    version("main", branch="main", submodules=True)
    version(
        "0.7.0", tag="v0.7.0", commit="f95da131cf7c7ccd4da256356fde2fec1fa23bb5", submodules=True
    )
    version(
        "0.6.1", tag="v0.6.1", commit="a205468bc5d3a353fb15dae2398a101dff52f2d3", submodules=True
    )

    depends_on("cmake@3.10:", type="build")
    depends_on("brotli")
    depends_on("highway")

    # Only needed at test time, but unfortunately "test" doesn't cause the dep to be added
    # by Spack's compiler wrappers. Solution of adding "link" means that dependency is now
    # always required...
    depends_on("googletest+gmock", type=("link", "test"))

    # https://github.com/libjxl/libjxl/pull/582
    conflicts("%clang", when="@0.6")
    conflicts("%apple-clang", when="@0.6")

    def cmake_args(self):
        args = [
            self.define("JPEGXL_FORCE_SYSTEM_BROTLI", True),
            self.define("JPEGXL_FORCE_SYSTEM_HWY", True),
        ]

        if self.run_tests:
            args.append(self.define("JPEGXL_FORCE_SYSTEM_GTEST", True))

        return args