homebrew-core/Formula/lemon.rb

40 lines
1.4 KiB
Ruby

class Lemon < Formula
desc "LALR(1) parser generator like yacc or bison"
homepage "https://www.hwaci.com/sw/lemon/"
url "https://sqlite.org/2021/sqlite-src-3340100.zip"
version "3.34.1"
sha256 "dddd237996b096dee8b37146c7a37a626a80306d6695103d2ec16ee3b852ff49"
license "blessing"
livecheck do
url "https://sqlite.org/news.html"
regex(%r{v?(\d+(?:\.\d+)+)</h3>}i)
end
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "33b7865addc98907551329c54d597a648495a8a737402870b6835dc83ffa5e98"
sha256 cellar: :any_skip_relocation, big_sur: "d93678613765dacef1f52234e82bcd1dd60f9acd55000d44a9cff8f571572b5b"
sha256 cellar: :any_skip_relocation, catalina: "d6bb8a9909be8ce608481df23023b89c618b6c61508bde8d70df26d2ab781df2"
sha256 cellar: :any_skip_relocation, mojave: "8f834c886dcf821b8381bb40a085a8730368e78680a4d40a34d81badf31cd5ba"
end
def install
pkgshare.install "tool/lempar.c"
# patch the parser generator to look for the 'lempar.c' template file where we've installed it
inreplace "tool/lemon.c", "lempar.c", "#{pkgshare}/lempar.c"
system ENV.cc, "-o", "lemon", "tool/lemon.c"
bin.install "lemon"
pkgshare.install "test/lemon-test01.y"
doc.install "doc/lemon.html"
end
test do
system "#{bin}/lemon", "-d#{testpath}", "#{pkgshare}/lemon-test01.y"
system ENV.cc, "lemon-test01.c"
assert_match "tests pass", shell_output("./a.out")
end
end