2010-05-01 03:07:17 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Cppcheck < Formula
|
|
|
|
homepage 'http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Main_Page'
|
2012-08-06 22:13:34 +00:00
|
|
|
url 'https://github.com/danmar/cppcheck/tarball/1.55'
|
|
|
|
sha1 '5a888427b9303420a1a583a2cb3919fb5ba3c5ce'
|
2012-02-21 06:04:21 +00:00
|
|
|
|
2011-05-27 05:02:55 +00:00
|
|
|
head 'https://github.com/danmar/cppcheck.git'
|
2010-05-01 03:07:17 +00:00
|
|
|
|
2011-11-19 15:03:13 +00:00
|
|
|
depends_on 'pcre' unless ARGV.include? '--no-rules'
|
|
|
|
depends_on 'qt' if ARGV.include? '--with-gui'
|
|
|
|
|
|
|
|
def options
|
|
|
|
[
|
|
|
|
['--no-rules', "Build without rules (no pcre dependency)"],
|
|
|
|
['--with-gui', "Build the cppcheck gui."]
|
|
|
|
]
|
|
|
|
end
|
2011-09-27 05:45:53 +00:00
|
|
|
|
2010-07-13 15:07:57 +00:00
|
|
|
# Do not strip binaries, or else it fails to run.
|
2010-04-07 05:58:35 +00:00
|
|
|
skip_clean :all
|
2010-05-01 03:07:17 +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.
|
2011-11-19 15:03:13 +00:00
|
|
|
if ARGV.include? '--no-rules'
|
|
|
|
system "make", "HAVE_RULES=no"
|
|
|
|
else
|
|
|
|
system "make"
|
|
|
|
end
|
|
|
|
|
2010-07-13 15:07:57 +00:00
|
|
|
system "make", "DESTDIR=#{prefix}", "BIN=#{bin}", "install"
|
2011-11-19 15:03:13 +00:00
|
|
|
|
|
|
|
if ARGV.include? '--with-gui'
|
2012-02-21 06:04:21 +00:00
|
|
|
cd "gui" do
|
|
|
|
if ARGV.include? '--no-rules'
|
|
|
|
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
|
|
|
|
2011-11-19 15:03:13 +00:00
|
|
|
def caveats; <<-EOS.undent
|
|
|
|
--with-gui installs cppcheck-gui.app in:
|
|
|
|
#{bin}
|
|
|
|
|
|
|
|
To link the application to a normal Mac OS X location:
|
|
|
|
brew linkapps
|
|
|
|
or:
|
|
|
|
ln -s #{bin}/cppcheck-gui.app /Applications
|
|
|
|
EOS
|
|
|
|
end
|
2010-05-01 03:07:17 +00:00
|
|
|
end
|