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/"
|
2016-01-11 16:19:53 +00:00
|
|
|
url "https://github.com/danmar/cppcheck/archive/1.72.tar.gz"
|
|
|
|
sha256 "c718949e1ec22a8a0dca7e2953a55c502ef65e53ff9922fb91759388618faa7f"
|
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
|
2016-01-11 23:22:07 +00:00
|
|
|
sha256 "95395daf0154293fba7b6254c278a128aad26fc3c9f0a73ac02200be7329eb60" => :el_capitan
|
|
|
|
sha256 "ea7ca38db3bb2e08a9cffd9f003df61d865dad098a140dbec5d5458f085be9d5" => :yosemite
|
|
|
|
sha256 "0e46747db20c2cb9fe2a505901db7f70be154a4326da528740e8cb1e3c1281a3" => :mavericks
|
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
|