91 lines
3.5 KiB
Ruby
91 lines
3.5 KiB
Ruby
class Ccache < Formula
|
|
desc "Object-file caching compiler wrapper"
|
|
homepage "https://ccache.dev/"
|
|
url "https://github.com/ccache/ccache/releases/download/v4.6.1/ccache-4.6.1.tar.xz"
|
|
sha256 "e5d47bd3cbb504ada864124690e7c0d28ecb1f9aeac22a9976025aed9633f3d1"
|
|
license "GPL-3.0-or-later"
|
|
revision 1
|
|
head "https://github.com/ccache/ccache.git", branch: "master"
|
|
|
|
bottle do
|
|
rebuild 1
|
|
sha256 cellar: :any, arm64_monterey: "6c7df26513e64e81bd1c34bdecd3c0f244584de42861edc1a10eb47080a2f36e"
|
|
sha256 cellar: :any, arm64_big_sur: "47e5973227a3173eb22e18e12b39bc11fbc3b96c59fc2cf3b8b3c2962703f157"
|
|
sha256 cellar: :any, monterey: "a850bea227e005e5eeb4a06854c3dd409939f0a05921b493c78b0c3a6a4f3179"
|
|
sha256 cellar: :any, big_sur: "fc86f696e7533bbb5c5cb10e72d508667cd0013ed42a3082eceb5608005b4906"
|
|
sha256 cellar: :any, catalina: "0f1e9ffd25cdfc59a40b4ff0d4958aebd4ef6a63ec6adf2e59c2dc741a3a5416"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "5339cf0bd2c396f3aa646c0bb853b90276255d14a613c8173e888c7f630bf775"
|
|
end
|
|
|
|
depends_on "asciidoctor" => :build
|
|
depends_on "cmake" => :build
|
|
depends_on "pkg-config" => :build
|
|
|
|
depends_on "hiredis"
|
|
depends_on "zstd"
|
|
|
|
on_linux do
|
|
depends_on "gcc"
|
|
end
|
|
|
|
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
|