summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/sox/package.py
blob: f21c34222cc03dccfa35fa35749375a6cf45997d (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
# Copyright 2013-2024 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 Sox(AutotoolsPackage):
    """SoX, the Swiss Army knife of sound processing programs."""

    homepage = "https://sox.sourceforge.net/Main/HomePage"
    url = "https://downloads.sourceforge.net/project/sox/sox/14.4.2/sox-14.4.2.tar.bz2"

    version("14.4.2", sha256="81a6956d4330e75b5827316e44ae381e6f1e8928003c6aa45896da9041ea149c")

    depends_on("c", type="build")

    variant("mp3", default=False, description="Build with mp3 support")

    depends_on("bzip2")
    depends_on("flac")
    depends_on("libvorbis")
    depends_on("opus")
    depends_on("lame", when="+mp3")
    depends_on("libmad", when="+mp3")

    def flag_handler(self, name, flags):
        # https://github.com/Homebrew/homebrew-core/blob/master/Formula/s/sox.rb
        if name == "cflags":
            if self.spec.satisfies("%apple-clang@15:"):
                flags.append("-Wno-incompatible-function-pointer-types")
        return (flags, None, None)