Skip to content

Commit

Permalink
bison: update 3.8.2 bottle.
Browse files Browse the repository at this point in the history
  • Loading branch information
gromgit committed Sep 4, 2024
1 parent ae8a409 commit e9b0b5c
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions Formula/b/bison.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
class Bison < Formula
desc "Parser generator"
homepage "https://www.gnu.org/software/bison/"
# X.Y.9Z are beta releases that sometimes get accidentally uploaded to the release FTP
url "https://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.xz"
mirror "https://ftpmirror.gnu.org/bison/bison-3.8.2.tar.xz"
sha256 "9bba0214ccf7f1079c5d59210045227bcf619519840ebfa80cd3849cff5a5bf2"
license "GPL-3.0-or-later"
version_scheme 1

bottle do
root_url "https://github.com/gromgit/homebrew-core-aarch64_linux/releases/download/bison-3.8.2"
sha256 cellar: :any_skip_relocation, aarch64_linux: "2a0732c30f659e4581b2c6eefc5a2a0acf5596302f6be2982a8517a9b3863e22"
end

keg_only :provided_by_macos

uses_from_macos "m4"

def install
system "./configure", "--disable-dependency-tracking",
"--enable-relocatable",
"--prefix=/output",
"M4=m4"
system "make", "install", "DESTDIR=#{buildpath}"
prefix.install Dir["#{buildpath}/output/*"]
end

test do
(testpath/"test.y").write <<~EOS
%{ #include <iostream>
using namespace std;
extern void yyerror (char *s);
extern int yylex ();
%}
%start prog
%%
prog: // empty
| prog expr '\\n' { cout << "pass"; exit(0); }
;
expr: '(' ')'
| '(' expr ')'
| expr expr
;
%%
char c;
void yyerror (char *s) { cout << "fail"; exit(0); }
int yylex () { cin.get(c); return c; }
int main() { yyparse(); }
EOS
system bin/"bison", "test.y"
system ENV.cxx, "test.tab.c", "-o", "test"
assert_equal "pass", shell_output("echo \"((()(())))()\" | ./test")
assert_equal "fail", shell_output("echo \"())\" | ./test")
end
end

0 comments on commit e9b0b5c

Please sign in to comment.