aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/justniffer.rb
blob: ead516cb63c0d54b795a3f56324e19f279e1f199 (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
61
62
63
64
65
require 'formula'

class Justniffer < Formula
  url 'http://downloads.sourceforge.net/project/justniffer/justniffer/justniffer%200.5.11/justniffer_0.5.11.tar.gz'
  homepage 'http://justniffer.sourceforge.net/'
  sha1 '3f3222361794a6f79f47567753550995c318a037'

  depends_on "boost"

  fails_with :clang do
    build 421
    cause <<-EOS.undent
          Symbols declared inline in headers are then expected by the linker.
          Probably declaring them static would fix it properly.
          EOS
  end

  # Patch lib/libnids-1.21_patched/configure.gnu so that CFLAGS and/or
  # CXXFLAGS with multiple words doesn't cause an error -- e.g.:
  #
  # === configuring in lib/libnids-1.21_patched
  # (/private/tmp/homebrew-justniffer-0.5.11-yNmj/justniffer-0.5.11/lib/libnids-1.21_patched)
  # configure: running /bin/sh ./configure.gnu --disable-option-checking
  # '--prefix=/usr/local/Cellar/justniffer/0.5.11'  'CXX=/usr/bin/llvm-g++'
  # 'CXXFLAGS=-O3 -w -pipe -march=core2 -msse4' 'CC=/usr/bin/llvm-gcc'
  # 'CFLAGS=-O3 -w -pipe -march=core2 -msse4' --cache-file=/dev/null--srcdir=.
  # configure: error: unrecognized option: `-w'
  # Try `./configure --help' for more information
  # configure: error: ./configure.gnu failed for lib/libnids-1.21_patched
  #
  # I submitted this patch to the upstream author, Oreste Notelli, on
  # 2011-12-22, so this patch will probably not be necessary with future
  # justniffer versions after 0.5.11.
  def patches
    DATA
  end

  def install
    system "./configure", "--prefix=#{prefix}"
    system "make install"
  end

  def test
    system "#{bin}/justniffer --version | grep '^justniffer'"
  end

  def caveats; <<-EOS.undent
    Sample invocation to get you started:
      justniffer -i en1 -p "port 80"

    "en1" is my wireless inteface; "en0" is Ethernet; see output of ifconfig
    EOS
  end
end


__END__
--- a/lib/libnids-1.21_patched/configure.gnu	2011-12-21 22:48:23.000000000 -0800
+++ b/lib/libnids-1.21_patched/configure.gnu	2011-12-21 22:54:37.000000000 -0800
@@ -1,3 +1,3 @@
 #!/bin/sh

-./configure --disable-libnet --disable-libglib $@
\ No newline at end of file
+./configure --disable-libnet --disable-libglib "$@"