homebrew-core/Formula/cppcheck.rb
Ted Pennings 4cd0935be7 Convert all 'def test' formulae to 'test do'
Closes Homebrew/homebrew#26942.
Closes Homebrew/homebrew#26946.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2014-02-24 19:54:02 -08:00

46 lines
1.2 KiB
Ruby

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.63.1.tar.gz'
sha1 '19ad7251603356a82dc75a836dfad9629a3d12a0'
head 'https://github.com/danmar/cppcheck.git'
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.
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.include? 'with-gui'
cd "gui" do
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