2014-05-20 05:48:36 +00:00
|
|
|
require "formula"
|
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"
|
2014-10-24 13:20:13 +00:00
|
|
|
url "https://github.com/danmar/cppcheck/archive/1.67.tar.gz"
|
|
|
|
sha1 "14b886e5cac631cec11a3f8efbdeaed15ddcc7d3"
|
2014-10-27 02:31:23 +00:00
|
|
|
revision 1
|
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
|
2014-10-27 02:40:57 +00:00
|
|
|
sha1 "f5be9595dfdbbc616cbd1f11d3ea59ec32045309" => :yosemite
|
|
|
|
sha1 "5fb0911b3ff750368cbbfed71a1809e298404d8b" => :mavericks
|
|
|
|
sha1 "ae6b9a60ed3e139814c647aabdb4df1c71058436" => :mountain_lion
|
2014-08-05 11:35:19 +00:00
|
|
|
end
|
|
|
|
|
2014-05-20 05:48:36 +00:00
|
|
|
option "no-rules", "Build without rules (no pcre dependency)"
|
|
|
|
option "with-gui", "Build the cppcheck gui (requires Qt)"
|
2012-08-27 05:20:50 +00:00
|
|
|
|
2014-05-20 05:48:36 +00:00
|
|
|
depends_on "pcre" unless build.include? "no-rules"
|
|
|
|
depends_on "qt" if build.with? "gui"
|
2011-09-27 05:45:53 +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.
|
2014-05-20 05:48:36 +00:00
|
|
|
if build.include? "no-rules"
|
2014-01-27 03:11:34 +00:00
|
|
|
system "make", "HAVE_RULES=no", "CFGDIR=#{prefix}/cfg"
|
2011-11-19 15:03:13 +00:00
|
|
|
else
|
2014-01-27 03:11:34 +00:00
|
|
|
system "make", "HAVE_RULES=yes", "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
|
2014-03-25 13:17:31 +00:00
|
|
|
# fix make not finding cfg directory:
|
|
|
|
# https://github.com/Homebrew/homebrew/issues/27756
|
|
|
|
inreplace "gui.qrc", "../cfg/", "#{prefix}/cfg/"
|
|
|
|
|
2014-05-20 05:48:36 +00:00
|
|
|
if build.include? "no-rules"
|
2012-02-21 06:04:21 +00:00
|
|
|
system "qmake", "HAVE_RULES=no"
|
|
|
|
else
|
|
|
|
system "qmake"
|
|
|
|
end
|
|
|
|
|
|
|
|
system "make"
|
|
|
|
bin.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
|
2012-09-16 02:17:30 +00:00
|
|
|
system "#{bin}/cppcheck", "--version"
|
|
|
|
end
|
2010-05-01 03:07:17 +00:00
|
|
|
end
|