aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/ettercap.rb
blob: de5f38d8ba27aa107e346552cef82484bdf5fe80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
require 'formula'

class Ettercap < Formula
  homepage 'http://ettercap.github.io/ettercap/'

  stable do
    url "https://github.com/Ettercap/ettercap/archive/v0.8.0.tar.gz"
    sha1 "008fca94bbd67b578699300eb321766cd41fbfff"

    patch do
      # Fixes issue #326: redefinition of 'bpf_program', 'bpf_version',
      #  and 'bpf_insn' in ec_send.c on Mac OS X.
      # url: https://github.com/Ettercap/ettercap/issues/326
      url "https://github.com/Ettercap/ettercap/commit/4aaaa2.diff"
      sha1 "c1c78b38f3f1ffcdbb1d16a292c0fc6d96991ed0"
    end

    patch do
      # Fixes issue #344: undefined symbol safe_free_mem caused by the previous fix.
      # url: https://github.com/Ettercap/ettercap/issues/344
      url "https://github.com/Ettercap/ettercap/commit/33ac95.diff"
      sha1 "cdaff33bec2a73e2c44230c28f3727b8f36e45e2"
    end
  end

  head "https://github.com/Ettercap/ettercap.git"

  option "without-curses", "Install without curses interface"
  option "without-plugins", "Install without plugins support"
  option "with-ipv6", "Install with IPv6 support"

  depends_on 'cmake' => :build
  depends_on 'ghostscript' => [:build, :optional]
  depends_on 'pcre'
  depends_on 'libnet'
  depends_on 'curl' # require libcurl >= 7.26.0
  depends_on 'gtk+' => :optional
  depends_on 'luajit' => :optional

  def install
    args = std_cmake_args

    # specify build type manually since std_cmake_args sets the build type to "None".
    args << "-DCMAKE_BUILD_TYPE=Release"

    args << "-DINSTALL_SYSCONFDIR=#{etc}"
    args << "-DENABLE_CURSES=OFF" if build.without? "curses"
    args << "-DENABLE_PLUGINS=OFF" if build.without? "plugins"
    args << "-DENABLE_IPV6=ON" if build.with? "ipv6"
    args << "-DENABLE_PDF_DOCS=ON" if build.with? "ghostscript"
    args << "-DENABLE_GTK=OFF" if build.without? "gtk+"
    args << "-DENABLE_LUA=ON" if build.with? "luajit"
    args << ".."

    mkdir "build" do
      system "cmake", *args
      system "make install"
    end
  end
end