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.2.tar.gz" sha256 "12d4132e5aacf6907877b691a8ac09e3e2f704ca016c49bc5eb566fc9185f544" bottle do sha256 "b87ca590dee1a7dcb5bc3d33e649a3a2c174e9901ab9b26900410adcd846fb0a" => :mojave sha256 "e1e83865487cbc7b38cd9bbbb157a1328f0b2441786a06e03bc488adc9260b7d" => :high_sierra sha256 "3026c93650786878ff45f7cb899ee2cfa1c21c44de3b9bb9cb44d9a9890773d0" => :sierra end depends_on "autoconf" => :build depends_on "automake" => :build depends_on "docbook2x" => :build depends_on "libtool" => :build depends_on "lzo" def install args = %W[ --disable-dependency-tracking --disable-silent-rules --prefix=#{prefix} --enable-clang-wrappers ] system "./autogen.sh" system "./configure", *args system "make", "install" (prefix/"org.opensuse.icecc.plist").write iceccd_plist (prefix/"org.opensuse.icecc-scheduler.plist").write scheduler_plist end def caveats; <<~EOS To override the toolset with icecc, add to your path: #{opt_libexec}/icecc/bin To have launchd start the icecc daemon at login: cp #{opt_prefix}/org.opensuse.icecc.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/org.opensuse.icecc.plist EOS end def iceccd_plist; <<~EOS Label Icecc Daemon ProgramArguments #{sbin}/iceccd -d RunAtLoad EOS end def scheduler_plist; <<~EOS Label Icecc Scheduler ProgramArguments #{sbin}/icecc-scheduler -d 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