2010-05-01 03:07:17 +00:00
|
|
|
class Cppcheck < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Static analysis of C and C++ code"
|
2015-06-29 07:26:19 +00:00
|
|
|
homepage "https://sourceforge.net/projects/cppcheck/"
|
2015-09-13 13:45:08 +00:00
|
|
|
url "https://github.com/danmar/cppcheck/archive/1.70.tar.gz"
|
|
|
|
sha256 "4095de598b5cce9a06e90458a90f46e0307baeaab8a947dae73f287eda3c171f"
|
2014-05-20 05:48:36 +00:00
|
|
|
head "https://github.com/danmar/cppcheck.git"
|
2010-05-01 03:07:17 +00:00
|
|
|
|
2014-08-05 11:35:19 +00:00
|
|
|
bottle do
|
2015-09-13 15:44:10 +00:00
|
|
|
revision 1
|
2015-09-23 12:10:37 +00:00
|
|
|
sha256 "7fa6bf8c61c9ff88a5cdf259693287427aa0885a1f1e30ce5d85cf52eef6ec47" => :el_capitan
|
2015-09-13 15:44:10 +00:00
|
|
|
sha256 "6c4b24741d60c941f2969afd39c1a5e1290263f7178ad78055a2dbbb307cb100" => :yosemite
|
|
|
|
sha256 "460d77d134fb009c9ac20ab9ce521251fd57c80a1ca7b77b76cab06109b89dad" => :mavericks
|
|
|
|
sha256 "595d3c1689fb381be84f16a41555eade205aee84e05e340ccfd18bcbc96cf4ef" => :mountain_lion
|
2014-08-05 11:35:19 +00:00
|
|
|
end
|
|
|
|
|
2015-01-13 09:38:58 +00:00
|
|
|
option "without-rules", "Build without rules (no pcre dependency)"
|
2014-05-20 05:48:36 +00:00
|
|
|
option "with-gui", "Build the cppcheck gui (requires Qt)"
|
2012-08-27 05:20:50 +00:00
|
|
|
|
2015-01-13 09:38:58 +00:00
|
|
|
deprecated_option "no-rules" => "without-rules"
|
|
|
|
|
|
|
|
depends_on "pcre" if build.with? "rules"
|
2014-05-20 05:48:36 +00:00
|
|
|
depends_on "qt" if build.with? "gui"
|
2011-09-27 05:45:53 +00:00
|
|
|
|
2015-06-28 14:20:56 +00:00
|
|
|
needs :cxx11
|
2015-03-07 15:08:19 +00:00
|
|
|
|
2010-07-13 15:07:57 +00:00
|
|
|
def install
|
2015-06-28 14:20:56 +00:00
|
|
|
ENV.cxx11
|
|
|
|
|
2012-01-09 22:40:52 +00:00
|
|
|
# Man pages aren't installed as they require docbook schemas.
|
|
|
|
|
2010-05-01 03:07:17 +00:00
|
|
|
# Pass to make variables.
|
2015-01-13 09:38:58 +00:00
|
|
|
if build.with? "rules"
|
2014-01-27 03:11:34 +00:00
|
|
|
system "make", "HAVE_RULES=yes", "CFGDIR=#{prefix}/cfg"
|
2015-01-13 09:38:58 +00:00
|
|
|
else
|
|
|
|
system "make", "HAVE_RULES=no", "CFGDIR=#{prefix}/cfg"
|
2011-11-19 15:03:13 +00:00
|
|
|
end
|
|
|
|
|
2015-09-13 13:45:08 +00:00
|
|
|
# CFGDIR is relative to the prefix for install, don't add #{prefix}.
|
|
|
|
system "make", "DESTDIR=#{prefix}", "BIN=#{bin}", "CFGDIR=/cfg", "install"
|
2014-10-27 02:31:23 +00:00
|
|
|
|
2014-03-06 20:40:26 +00:00
|
|
|
if build.with? "gui"
|
2012-02-21 06:04:21 +00:00
|
|
|
cd "gui" do
|
2015-01-13 09:38:58 +00:00
|
|
|
if build.with? "rules"
|
2015-03-07 15:08:19 +00:00
|
|
|
system "qmake", "HAVE_RULES=yes"
|
2015-01-13 09:38:58 +00:00
|
|
|
else
|
|
|
|
system "qmake", "HAVE_RULES=no"
|
2012-02-21 06:04:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
system "make"
|
2015-03-07 15:08:19 +00:00
|
|
|
prefix.install "cppcheck-gui.app"
|
2011-11-19 15:03:13 +00:00
|
|
|
end
|
|
|
|
end
|
2010-05-01 03:07:17 +00:00
|
|
|
end
|
2012-01-09 22:40:52 +00:00
|
|
|
|
2014-02-23 21:31:41 +00:00
|
|
|
test do
|
2015-01-13 09:38:58 +00:00
|
|
|
(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"
|
2012-09-16 02:17:30 +00:00
|
|
|
end
|
2010-05-01 03:07:17 +00:00
|
|
|
end
|