88 lines
3.7 KiB
Ruby
88 lines
3.7 KiB
Ruby
class Ccache < Formula
|
|
desc "Object-file caching compiler wrapper"
|
|
homepage "https://ccache.dev/"
|
|
url "https://github.com/ccache/ccache/releases/download/v4.7.3/ccache-4.7.3.tar.xz"
|
|
sha256 "65c53e8fd85956238670278854c02574094e61aecb09c4bf8a0d42657f8f0a6d"
|
|
license "GPL-3.0-or-later"
|
|
revision 1
|
|
head "https://github.com/ccache/ccache.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_ventura: "4f4b8db6359ebc3c1c6b191b44f9352760a8f38386dcc2b43f2d3856eff5e1cd"
|
|
sha256 cellar: :any, arm64_monterey: "2801323b7a1761699a29dc6b4b245b66bc28ed6568f6796e41f7642e57d3888f"
|
|
sha256 cellar: :any, arm64_big_sur: "345295d782fba7818f48269db5559073b618d576561d99ba75adc89b96b16f31"
|
|
sha256 cellar: :any, ventura: "aeeb93902c2f8a976c21fe1f5f40a737ead0373c68afb898c81527ede447b9e6"
|
|
sha256 cellar: :any, monterey: "9170eecefa1c27aa30824302850ac461f3e23af0c6253f2a2c25121750e0e811"
|
|
sha256 cellar: :any, big_sur: "8310e02104824ca5ee42eb62b5875ae64fac79729a9570c0b2499bd0c3b51c02"
|
|
sha256 cellar: :any, catalina: "c04cdeb0d777c40a2ff5200ba0027ad4a33f6a18b2e41660a1d56f32b5969827"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "fe58220d7c6d6b4dbf61761004146e6c227804b1caa473ac2dcdfd57c0a982b4"
|
|
end
|
|
|
|
depends_on "asciidoctor" => :build
|
|
depends_on "cmake" => :build
|
|
depends_on "pkg-config" => :build
|
|
|
|
depends_on "hiredis"
|
|
depends_on "zstd"
|
|
|
|
fails_with gcc: "5"
|
|
|
|
def install
|
|
system "cmake", "-S", ".", "-B", "build", *std_cmake_args, "-DENABLE_IPO=TRUE"
|
|
system "cmake", "--build", "build"
|
|
|
|
# Homebrew compiler shim actively prevents ccache usage (see caveats), which will break the test suite.
|
|
# We run the test suite for ccache because it provides a more in-depth functional test of the software
|
|
# (especially with IPO enabled), adds negligible time to the build process, and we don't actually test
|
|
# this formula properly in the test block since doing so would be too complicated.
|
|
# See https://github.com/Homebrew/homebrew-core/pull/83900#issuecomment-90624064
|
|
with_env(CC: DevelopmentTools.locate(DevelopmentTools.default_compiler)) do
|
|
system "ctest", "-j#{ENV.make_jobs}", "--test-dir", "build"
|
|
end
|
|
|
|
system "cmake", "--install", "build"
|
|
|
|
libexec.mkpath
|
|
|
|
%w[
|
|
clang
|
|
clang++
|
|
cc
|
|
gcc gcc2 gcc3 gcc-3.3 gcc-4.0
|
|
gcc-4.2 gcc-4.3 gcc-4.4 gcc-4.5 gcc-4.6 gcc-4.7 gcc-4.8 gcc-4.9
|
|
gcc-5 gcc-6 gcc-7 gcc-8 gcc-9 gcc-10 gcc-11 gcc-12
|
|
c++ c++3 c++-3.3 c++-4.0
|
|
c++-4.2 c++-4.3 c++-4.4 c++-4.5 c++-4.6 c++-4.7 c++-4.8 c++-4.9
|
|
c++-5 c++-6 c++-7 c++-8 c++-9 c++-10 c++-11 c++-12
|
|
g++ g++2 g++3 g++-3.3 g++-4.0
|
|
g++-4.2 g++-4.3 g++-4.4 g++-4.5 g++-4.6 g++-4.7 g++-4.8 g++-4.9
|
|
g++-5 g++-6 g++-7 g++-8 g++-9 g++-10 g++-11 g++-12
|
|
i686-w64-mingw32-gcc i686-w64-mingw32-g++
|
|
x86_64-w64-mingw32-gcc x86_64-w64-mingw32-g++
|
|
].each do |prog|
|
|
libexec.install_symlink bin/"ccache" => prog
|
|
end
|
|
end
|
|
|
|
def caveats
|
|
<<~EOS
|
|
To install symlinks for compilers that will automatically use
|
|
ccache, prepend this directory to your PATH:
|
|
#{opt_libexec}
|
|
|
|
If this is an upgrade and you have previously added the symlinks to
|
|
your PATH, you may need to modify it to the path specified above so
|
|
it points to the current version.
|
|
|
|
NOTE: ccache can prevent some software from compiling.
|
|
ALSO NOTE: The brew command, by design, will never use ccache.
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
ENV.prepend_path "PATH", opt_libexec
|
|
assert_equal "#{opt_libexec}/gcc", shell_output("which gcc").chomp
|
|
system "#{bin}/ccache", "-s"
|
|
end
|
|
end
|