class Icecream < Formula desc "Distributed compiler with a central scheduler to share build load" homepage "https://en.opensuse.org/Icecream" url "https://github.com/icecc/icecream/archive/1.3.tar.gz" sha256 "5e147544dcc557ae6f0b13246aa1445f0f244f010de8e137053078275613bd00" bottle do sha256 "6bebd258c4ad165dc3218fad1e34999fd61bb817f3e9b8d7edffc93b30d2ff1f" => :mojave sha256 "1b27b28324a463527ac2f25168b915eeca1fb754d26c098eeadfc10d51f10cae" => :high_sierra sha256 "400a0b2499cbd472afecc999a774f61867747099469a3aa6bc1eb607ae46c8cc" => :sierra end depends_on "autoconf" => :build depends_on "automake" => :build depends_on "docbook2x" => :build depends_on "libtool" => :build depends_on "libarchive" depends_on "lzo" depends_on "zstd" def install args = %W[ --disable-dependency-tracking --disable-silent-rules --prefix=#{prefix} --enable-clang-wrappers ] system "./autogen.sh" system "./configure", *args system "make", "install" # Manually install scheduler property list (prefix/"#{plist_name}-scheduler.plist").write scheduler_plist end def caveats; <<~EOS To override the toolset with icecc, add to your path: #{opt_libexec}/icecc/bin EOS end plist_options :manual => "iceccd" def plist; <<~EOS Label #{plist_name} ProgramArguments #{sbin}/iceccd RunAtLoad EOS end def scheduler_plist; <<~EOS Label #{plist_name}-scheduler ProgramArguments #{sbin}/icecc-scheduler RunAtLoad EOS end test do (testpath/"hello-c.c").write <<~EOS #include int main() { puts("Hello, world!"); return 0; } EOS system opt_libexec/"icecc/bin/gcc", "-o", "hello-c", "hello-c.c" assert_equal "Hello, world!\n", shell_output("./hello-c") (testpath/"hello-cc.cc").write <<~EOS #include int main() { std::cout << "Hello, world!" << std::endl; return 0; } EOS system opt_libexec/"icecc/bin/g++", "-o", "hello-cc", "hello-cc.cc" assert_equal "Hello, world!\n", shell_output("./hello-cc") (testpath/"hello-clang.c").write <<~EOS #include int main() { puts("Hello, world!"); return 0; } EOS system opt_libexec/"icecc/bin/clang", "-o", "hello-clang", "hello-clang.c" assert_equal "Hello, world!\n", shell_output("./hello-clang") (testpath/"hello-cclang.cc").write <<~EOS #include int main() { std::cout << "Hello, world!" << std::endl; return 0; } EOS system opt_libexec/"icecc/bin/clang++", "-o", "hello-cclang", "hello-cclang.cc" assert_equal "Hello, world!\n", shell_output("./hello-cclang") end end