2010-05-01 03:07:17 +00:00
|
|
|
class Cppcheck < Formula
|
2014-05-20 05:48:36 +00:00
|
|
|
homepage "http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Main_Page"
|
2015-03-08 21:01:31 +00:00
|
|
|
|
|
|
|
stable do
|
|
|
|
url "https://github.com/danmar/cppcheck/archive/1.68.tar.gz"
|
|
|
|
sha1 "f08ef07f750f92fafe4f960166072e9d1088d74e"
|
|
|
|
|
|
|
|
# Upstream patches for OS X + Clang compilation
|
|
|
|
patch do
|
|
|
|
url "https://github.com/danmar/cppcheck/commit/141a071.diff"
|
|
|
|
sha1 "4ccc8d814709d0e221c533a5556da4b1aa5fbead"
|
|
|
|
end
|
|
|
|
end
|
2012-02-21 06:04:21 +00:00
|
|
|
|
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-03-07 22:42:02 +00:00
|
|
|
revision 1
|
|
|
|
sha256 "fd979cd455c04c543bdb81be9c98d265cdab3a451302f1b506a5225c4b5d4bef" => :yosemite
|
|
|
|
sha256 "aa2e66721ab0f605c706c6366c0e92d50b6d1281c2f1656f0f25301b6db29d66" => :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-03-07 15:08:19 +00:00
|
|
|
|
2010-07-13 15:07:57 +00:00
|
|
|
def install
|
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
|
|
|
|
|
2014-01-27 03:11:34 +00:00
|
|
|
system "make", "DESTDIR=#{prefix}", "BIN=#{bin}", "CFGDIR=#{prefix}/cfg", "install"
|
2011-11-19 15:03:13 +00:00
|
|
|
|
2014-10-27 02:31:23 +00:00
|
|
|
# make sure cppcheck can find its configure directory, #26194
|
|
|
|
prefix.install "cfg"
|
|
|
|
|
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
|