aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/nmap.rb
blob: 55439fc8ac15076681f8eb98076c52e657f16e93 (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 Nmap < Formula
  url 'http://nmap.org/dist/nmap-5.51.tar.bz2'
  homepage 'http://nmap.org/5/'
  md5 '0b80d2cb92ace5ebba8095a4c2850275'
  head 'https://guest:@svn.nmap.org/nmap/', :using => :svn

  # Leopard's version of OpenSSL isn't new enough
  depends_on "openssl" if MacOS.leopard?

  fails_with_llvm :build => 2334

  def install
    ENV.deparallelize

    args = ["--prefix=#{prefix}", "--without-zenmap"]

    if MacOS.leopard?
      openssl = Formula.factory('openssl')
      args << "--with-openssl=#{openssl.prefix}"
    end

    system "./configure", *args
    system "make" # separate steps required otherwise the build fails
    system "make install"
  end

  def patches
      # The configure script has a C file to test for some functionality that
      # uses void main(void). This does not compile with clang but does compile
      # with GCC/gcc-llvm. This small patch fixes the issues so that the
      # project will compile without issues with clang as well.
      #
      # See: https://github.com/mxcl/homebrew/issues/10300
      DATA
  end
end

__END__
--- nmap-5.51/nbase/configure	2012-02-18 02:40:16.000000000 -0700
+++ nmap-5.51/nbase/configure.old	2012-02-18 02:40:01.000000000 -0700
@@ -4509,7 +4509,7 @@
 #include <sys/socket.h>
 #endif

-void main(void) {
+int main(void) {
     struct addrinfo hints, *ai;
     int error;

@@ -4641,7 +4641,7 @@
 #include <netinet/in.h>
 #endif

-void main(void) {
+int main(void) {
     struct sockaddr_in sa;
     char hbuf[256];
     int error;