summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/libtiff/package.py
blob: 6efc7bf661243436575f62255addf09a881706ec (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Copyright 2013-2022 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 Libtiff(AutotoolsPackage):
    """LibTIFF - Tag Image File Format (TIFF) Library and Utilities."""

    homepage = "http://www.simplesystems.org/libtiff/"
    url = "https://download.osgeo.org/libtiff/tiff-4.1.0.tar.gz"

    maintainers = ["adamjstewart"]

    version("4.4.0", sha256="917223b37538959aca3b790d2d73aa6e626b688e02dcda272aec24c2f498abed")
    version("4.3.0", sha256="0e46e5acb087ce7d1ac53cf4f56a09b221537fc86dfc5daaad1c2e89e1b37ac8")
    version("4.2.0", sha256="eb0484e568ead8fa23b513e9b0041df7e327f4ee2d22db5a533929dfc19633cb")
    version("4.1.0", sha256="5d29f32517dadb6dbcd1255ea5bbc93a2b54b94fbf83653b4d65c7d6775b8634")
    version("4.0.10", sha256="2c52d11ccaf767457db0c46795d9c7d1a8d8f76f68b0b800a3dfe45786b996e4")
    version("4.0.9", sha256="6e7bdeec2c310734e734d19aae3a71ebe37a4d842e0e23dbb1b8921c0026cfcd")
    version("4.0.8", sha256="59d7a5a8ccd92059913f246877db95a2918e6c04fb9d43fd74e5c3390dac2910")
    version("4.0.7", sha256="9f43a2cfb9589e5cecaa66e16bf87f814c945f22df7ba600d63aac4632c4f019")
    version("4.0.6", sha256="4d57a50907b510e3049a4bba0d7888930fdfc16ce49f1bf693e5b6247370d68c")
    version("3.9.7", sha256="f5d64dd4ce61c55f5e9f6dc3920fbe5a41e02c2e607da7117a35eb5c320cef6a")

    variant("zlib", default=False, description="Enable Zlib usage")
    variant("libdeflate", default=False, description="Enable libdeflate usage")
    variant("pixarlog", default=False, description="Enable support for Pixar log-format algorithm")
    variant("jpeg", default=False, description="Enable IJG JPEG library usage")
    variant("old-jpeg", default=False, description="Enable support for Old JPEG compression")
    variant("jpeg12", default=False, description="Enable libjpeg 8/12bit dual mode")
    variant("jbig", default=False, description="Enable JBIG-KIT usage")
    variant("lerc", default=False, description="Enable liblerc usage")
    variant("lzma", default=False, description="Enable liblzma usage")
    variant("zstd", default=False, description="Enable libzstd usage")
    variant("webp", default=False, description="Enable libwebp usage")

    depends_on("zlib", when="+zlib")
    depends_on("zlib", when="+pixarlog")
    depends_on("jpeg@5:", when="+jpeg")
    depends_on("jbigkit", when="+jbig")
    depends_on("lerc", when="+lerc")
    depends_on("xz", when="+lzma")
    depends_on("zstd@1:", when="+zstd")
    depends_on("libwebp", when="+webp")

    conflicts("+libdeflate", when="~zlib")
    conflicts("+libdeflate", when="@:4.1")
    conflicts("+jpeg12", when="~jpeg")
    conflicts("+jpeg12", when="@:3")
    conflicts("+lerc", when="~zlib")
    conflicts("+lerc", when="@:4.2")
    conflicts("+lzma", when="@:3")
    conflicts("+zstd", when="@:4.0.9")
    conflicts("+webp", when="@:4.0.9")

    # 4.3.0 contains a bug that breaks the build on case-sensitive filesystems when
    # using a C++20-capable compiler (commonly the case on macOS). Not an easy way to
    # check for this, so add a conflict for macOS overall. For more details, see:
    # https://gitlab.com/libtiff/libtiff/-/merge_requests/243
    conflicts("platform=darwin", when="@4.3.0")

    def patch(self):
        # Remove flags not recognized by the NVIDIA compiler
        if self.spec.satisfies("%nvhpc@:20.11"):
            filter_file(
                'vl_cv_prog_cc_warnings="-Wall -W"', 'vl_cv_prog_cc_warnings="-Wall"', "configure"
            )

    def configure_args(self):
        args = []
        args += self.enable_or_disable("zlib")
        if self.spec.satisfies("@4.2:"):
            args += self.enable_or_disable("libdeflate")
        args += self.enable_or_disable("pixarlog")
        args += self.enable_or_disable("jpeg")
        args += self.enable_or_disable("old-jpeg")
        if self.spec.satisfies("@4:"):
            args += self.enable_or_disable("jpeg12")
        args += self.enable_or_disable("jbig")
        if self.spec.satisfies("@4.3:"):
            args += self.enable_or_disable("lerc")
        if self.spec.satisfies("@4:"):
            args += self.enable_or_disable("lzma")
        if self.spec.satisfies("@4.0.10:"):
            args += self.enable_or_disable("zstd")
            args += self.enable_or_disable("webp")
        return args