aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2015-03-30 08:36:39 +0100
committerMike McQuaid2015-03-30 08:36:39 +0100
commit1d6cc4cf131c65d1853d97484ad5b8299b8208ac (patch)
treed8cf5f332dddc2763749f04aee61d29350c13d30 /Library
parentf11ef0ffa23da7149282a40e7e5f0039b8687a9e (diff)
downloadhomebrew-1d6cc4cf131c65d1853d97484ad5b8299b8208ac.tar.bz2
libantlr3c: enable exceptions by default.
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/libantlr3c.rb41
1 files changed, 33 insertions, 8 deletions
diff --git a/Library/Formula/libantlr3c.rb b/Library/Formula/libantlr3c.rb
index 66d25a677..1677e7cfd 100644
--- a/Library/Formula/libantlr3c.rb
+++ b/Library/Formula/libantlr3c.rb
@@ -1,9 +1,10 @@
-require 'formula'
-
class Libantlr3c < Formula
- homepage 'http://www.antlr3.org'
- url 'http://www.antlr3.org/download/C/libantlr3c-3.4.tar.gz'
- sha1 'faa9ab43ab4d3774f015471c3f011cc247df6a18'
+ homepage "http://www.antlr3.org"
+ url "http://www.antlr3.org/download/C/libantlr3c-3.4.tar.gz"
+ sha256 "ca914a97f1a2d2f2c8e1fca12d3df65310ff0286d35c48b7ae5f11dcc8b2eb52"
+ revision 1
+
+ option "without-exceptions", "Compile without support for exception handling"
bottle do
cellar :any
@@ -14,8 +15,32 @@ class Libantlr3c < Formula
end
def install
- system "./configure", "--disable-dependency-tracking",
- "--prefix=#{prefix}"
- system "make install"
+ args = ["--disable-dependency-tracking",
+ "--disable-antlrdebug",
+ "--prefix=#{prefix}"]
+ args << "--enable-64bit" if MacOS.prefer_64_bit?
+ system "./configure", *args
+ if build.with? "exceptions"
+ inreplace "Makefile" do |s|
+ cflags = s.get_make_var "CFLAGS"
+ cflags = cflags << " -fexceptions"
+ s.change_make_var! "CFLAGS", cflags
+ end
+ end
+ system "make", "install"
+ end
+
+ test do
+ (testpath/"hello.c").write <<-EOS.undent
+ #include <antlr3.h>
+ int main() {
+ if (0) {
+ antlr3GenericSetupStream(NULL);
+ }
+ return 0;
+ }
+ EOS
+ system ENV.cc, "hello.c", "-lantlr3c", "-o", "hello", "-O0"
+ system testpath/"hello"
end
end