homebrew-core/Formula/cppcheck.rb

57 lines
1.4 KiB
Ruby
Raw Normal View History

require 'formula'
class Cppcheck < Formula
homepage 'http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Main_Page'
url 'https://github.com/danmar/cppcheck/archive/1.60.1.tar.gz'
sha1 '733ee20f5a9f5c991e142dd4ea3bd997a93ddf51'
2011-05-27 05:02:55 +00:00
head 'https://github.com/danmar/cppcheck.git'
2012-08-27 05:20:50 +00:00
option 'no-rules', "Build without rules (no pcre dependency)"
option 'with-gui', "Build the cppcheck gui (requires Qt)"
depends_on 'pcre' unless build.include? 'no-rules'
depends_on 'qt' if build.include? 'with-gui'
def install
# Man pages aren't installed as they require docbook schemas.
# Pass to make variables.
2012-08-27 05:20:50 +00:00
if build.include? 'no-rules'
system "make", "HAVE_RULES=no"
else
system "make", "HAVE_RULES=yes"
end
system "make", "DESTDIR=#{prefix}", "BIN=#{bin}", "install"
2012-08-27 05:20:50 +00:00
if build.include? 'with-gui'
cd "gui" do
2012-08-27 05:20:50 +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
def test
system "#{bin}/cppcheck", "--version"
end
def caveats; <<-EOS.undent
--with-gui installs cppcheck-gui.app in:
#{bin}
To link the application to a normal Mac OS X location:
2012-11-25 19:42:57 +00:00
brew linkapps
or:
2012-11-25 19:42:57 +00:00
ln -s #{bin}/cppcheck-gui.app /Applications
EOS
end
end