homebrew-core/Formula/cppcheck.rb

51 lines
1.4 KiB
Ruby
Raw Normal View History

2014-05-20 05:48:36 +00:00
require "formula"
class Cppcheck < Formula
2014-05-20 05:48:36 +00:00
homepage "http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Main_Page"
url "https://github.com/danmar/cppcheck/archive/1.65.tar.gz"
sha1 "df1ebc45defb24c7f21af64bbf9515cedb5f2d8e"
2014-05-20 05:48:36 +00:00
head "https://github.com/danmar/cppcheck.git"
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"
def install
# Man pages aren't installed as they require docbook schemas.
# Pass to make variables.
2014-05-20 05:48:36 +00:00
if build.include? "no-rules"
system "make", "HAVE_RULES=no", "CFGDIR=#{prefix}/cfg"
else
system "make", "HAVE_RULES=yes", "CFGDIR=#{prefix}/cfg"
end
system "make", "DESTDIR=#{prefix}", "BIN=#{bin}", "CFGDIR=#{prefix}/cfg", "install"
prefix.install "cfg"
if build.with? "gui"
cd "gui" do
# 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"
system "qmake", "HAVE_RULES=no"
else
system "qmake"
end
system "make"
bin.install "cppcheck-gui.app"
end
end
end
test do
system "#{bin}/cppcheck", "--version"
end
end