From 9d1e4dd7bf10e1150c307b9f88072ff98176db86 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Tue, 13 Jan 2015 17:38:58 +0800 Subject: cppcheck 1.68 Also modernize and add real test Closes #35814. Signed-off-by: Mike McQuaid --- Library/Formula/cppcheck.rb | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'Library') diff --git a/Library/Formula/cppcheck.rb b/Library/Formula/cppcheck.rb index 33f2eb3b8..4c2ec8bba 100644 --- a/Library/Formula/cppcheck.rb +++ b/Library/Formula/cppcheck.rb @@ -1,10 +1,7 @@ -require "formula" - class Cppcheck < Formula homepage "http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Main_Page" - url "https://github.com/danmar/cppcheck/archive/1.67.tar.gz" - sha1 "14b886e5cac631cec11a3f8efbdeaed15ddcc7d3" - revision 1 + url "https://github.com/danmar/cppcheck/archive/1.68.tar.gz" + sha1 "f08ef07f750f92fafe4f960166072e9d1088d74e" head "https://github.com/danmar/cppcheck.git" @@ -14,20 +11,22 @@ class Cppcheck < Formula sha1 "ae6b9a60ed3e139814c647aabdb4df1c71058436" => :mountain_lion end - option "no-rules", "Build without rules (no pcre dependency)" + option "without-rules", "Build without rules (no pcre dependency)" option "with-gui", "Build the cppcheck gui (requires Qt)" - depends_on "pcre" unless build.include? "no-rules" + deprecated_option "no-rules" => "without-rules" + + depends_on "pcre" if build.with? "rules" depends_on "qt" if build.with? "gui" def install # Man pages aren't installed as they require docbook schemas. # Pass to make variables. - if build.include? "no-rules" - system "make", "HAVE_RULES=no", "CFGDIR=#{prefix}/cfg" - else + if build.with? "rules" system "make", "HAVE_RULES=yes", "CFGDIR=#{prefix}/cfg" + else + system "make", "HAVE_RULES=no", "CFGDIR=#{prefix}/cfg" end system "make", "DESTDIR=#{prefix}", "BIN=#{bin}", "CFGDIR=#{prefix}/cfg", "install" @@ -41,10 +40,10 @@ class Cppcheck < Formula # https://github.com/Homebrew/homebrew/issues/27756 inreplace "gui.qrc", "../cfg/", "#{prefix}/cfg/" - if build.include? "no-rules" - system "qmake", "HAVE_RULES=no" - else + if build.with? "rules" system "qmake" + else + system "qmake", "HAVE_RULES=no" end system "make" @@ -54,6 +53,16 @@ class Cppcheck < Formula end test do - system "#{bin}/cppcheck", "--version" + (testpath/"test.cpp").write <<-EOS.undent + #include + using namespace std; + + int main() + { + cout << "Hello World!" << endl; + return 0; + } + EOS + system "#{bin}/cppcheck", "test.cpp" end end -- cgit v1.2.3