summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/uchardet/package.py
blob: b919b0b48a4d5c8623ee1830cea6b0cd4d03b7fe (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
# 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 Uchardet(CMakePackage):
    """uchardet is an encoding detector library, which takes a sequence of
    bytes in an unknown character encoding without any additional information,
    and attempts to determine the encoding of the text. Returned encoding names
    are iconv-compatible."""

    homepage = "https://www.freedesktop.org/wiki/Software/uchardet/"
    url = "https://www.freedesktop.org/software/uchardet/releases/uchardet-0.0.6.tar.xz"
    git = "https://gitlab.freedesktop.org/uchardet/uchardet.git"

    license("MPL-1.1")

    version("master", branch="master")
    version("0.0.7", sha256="8351328cdfbcb2432e63938721dd781eb8c11ebc56e3a89d0f84576b96002c61")
    version("0.0.6", sha256="8351328cdfbcb2432e63938721dd781eb8c11ebc56e3a89d0f84576b96002c61")
    version("0.0.5", sha256="7c5569c8ee1a129959347f5340655897e6a8f81ec3344de0012a243f868eabd1")
    version("0.0.4", sha256="9dbe41fc73ba6a70676c04b1f0dd812914c0bbb65940283f2d54c5a2338a2acd")
    version("0.0.3", sha256="8caba57524b6e306e764b4dabf5bfec48b6f9d89b73543ed7c95263890e2006f")
    version("0.0.2", sha256="eb59b5b36269212a0d5f44d654cdbeb02e4e43ff59e3ce0205d6a64670991e83")

    def url_for_version(self, version):
        if version >= Version("0.0.6"):
            url = "https://www.freedesktop.org/software/uchardet/releases/uchardet-0.0.6.tar.xz"
        else:
            url = "https://github.com/BYVoid/uchardet/archive/v0.0.5.tar.gz"
        return url

    def cmake_args(self):
        args = []
        if self.spec.satisfies("platform=darwin"):
            args += [
                # From https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/uchardet.rb
                self.define("CMAKE_INSTALL_NAME_DIR", self.prefix.lib),
                # From https://github.com/mutationpp/Mutationpp/issues/26
                self.define("CMAKE_MACOSX_RPATH", "ON"),
            ]
        return args