class Pachi < Formula desc "Software for the Board Game of Go/Weiqi/Baduk" homepage "https://pachi.or.cz/" url "https://github.com/pasky/pachi/archive/pachi-12.40.tar.gz" sha256 "f523d23aa855f78a171df334b9712bca540d3ef4ef69b7306b84e4c35446d097" head "https://github.com/pasky/pachi.git" bottle do cellar :any_skip_relocation sha256 "68178d442f276e166ee301a8e92531c9dc13e338af3f1cf7ec645287a015cef1" => :catalina sha256 "eb9d538220d7b2e18242db23ef2ab568d4e139b57c6d4ee1ac1f0b63a2c58f50" => :mojave sha256 "f8e699003d58a6b8da8401ba6ed75228448b7922c0de6f1fc23db655cd61e2f0" => :high_sierra end fails_with :clang if MacOS.version == :mavericks resource "patterns" do url "https://sainet-dist.s3.amazonaws.com/pachi_patterns.zip" sha256 "73045eed2a15c5cb54bcdb7e60b106729009fa0a809d388dfd80f26c07ca7cbc" end resource "book" do url "https://gnugo.baduk.org/books/ra6.zip" sha256 "1e7ffc75c424e94338308c048aacc479da6ac5cbe77c0df8adc733956872485a" end def install ENV["MAC"] = "1" ENV["DOUBLE_FLOATING"] = "1" # Work around Xcode 11 clang bug inreplace "Makefile", "CFLAGS :=", "CFLAGS := -fno-stack-check" if DevelopmentTools.clang_build_version >= 1010 # https://github.com/pasky/pachi/issues/78 inreplace "Makefile", "build.h: .git/HEAD .git/index", "build.h:" inreplace "Makefile", "DCNN=1", "DCNN=0" system "make" bin.install "pachi" pkgshare.install resource("patterns") pkgshare.install resource("book") end def caveats; <<~EOS This formula also downloads additional data, such as opening books and pattern files. They are stored in #{opt_pkgshare}. At present, pachi cannot be pointed to external files, so make sure to set the working directory to #{opt_pkgshare} if you want pachi to take advantage of these additional files. EOS end test do assert_match /^= [A-T][0-9]+$/, pipe_output("#{bin}/pachi", "genmove b\n", 0) end end