diff options
| author | Xu Cheng | 2015-01-13 17:38:58 +0800 | 
|---|---|---|
| committer | Mike McQuaid | 2015-01-13 11:36:25 +0000 | 
| commit | 9d1e4dd7bf10e1150c307b9f88072ff98176db86 (patch) | |
| tree | 37f960879c15a00bfe9d46334dcddc31be7386af /Library/Formula/cppcheck.rb | |
| parent | 7fd740dd71b3aebd38c61832470be0a0594ec1a3 (diff) | |
| download | homebrew-9d1e4dd7bf10e1150c307b9f88072ff98176db86.tar.bz2 | |
cppcheck 1.68
Also modernize and add real test
Closes #35814.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Formula/cppcheck.rb')
| -rw-r--r-- | Library/Formula/cppcheck.rb | 37 | 
1 files changed, 23 insertions, 14 deletions
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 <iostream> +      using namespace std; + +      int main() +      { +        cout << "Hello World!" << endl; +        return 0; +      } +    EOS +    system "#{bin}/cppcheck", "test.cpp"    end  end  | 
