From nobody@FreeBSD.org  Fri Oct  5 13:50:47 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 1FDD21065742
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  5 Oct 2012 13:50:47 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 0AF118FC0C
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  5 Oct 2012 13:50:47 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id q95DokUC048269
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 5 Oct 2012 13:50:46 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id q95Dokqq048268;
	Fri, 5 Oct 2012 13:50:46 GMT
	(envelope-from nobody)
Message-Id: <201210051350.q95Dokqq048268@red.freebsd.org>
Date: Fri, 5 Oct 2012 13:50:46 GMT
From: arrowdodger <6yearold@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH] security/nmap: Fix build with clang.
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         172358
>Category:       ports
>Synopsis:       [PATCH] security/nmap: Fix build with clang.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ohauer
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 05 14:00:14 UTC 2012
>Closed-Date:    Sun Jan 06 18:46:13 UTC 2013
>Last-Modified:  Sun Jan 06 18:46:13 UTC 2013
>Originator:     arrowdodger
>Release:        
>Organization:
>Environment:
>Description:
This patch fixes build with clang and some buildsystem mess, which wasn't allowing me to build nmap with -stdlib=libc++.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

diff -ruN /usr/ports/security/nmap/Makefile ./Makefile
--- /usr/ports/security/nmap/Makefile	2012-10-05 17:48:36.428550058 +0400
+++ ./Makefile	2012-10-05 17:46:53.337549058 +0400
@@ -33,7 +33,7 @@
 CONFIGURE_ENV=	LUA_INCDIR="${LUA_INCDIR}" LUA_LIBDIR="${LUA_LIBDIR}"
 
 # fix for gcc from ports
-.if ${CC} != "cc"
+.if ${CC} != "cc" && ${CC} !="clang"
 GCCLIBDIR_CMDS=	${CC} -print-file-name=libstdc++.so | ${SED} -e 's/libstdc++.so//'
 CONFIGURE_ARGS+=LDFLAGS="-L$$(${GCCLIBDIR_CMDS})"
 NDCC=	true
diff -ruN /usr/ports/security/nmap/files/patch-Makefile-cxxflags-fix ./files/patch-Makefile-cxxflags-fix
--- /usr/ports/security/nmap/files/patch-Makefile-cxxflags-fix	1970-01-01 03:00:00.000000000 +0300
+++ ./files/patch-Makefile-cxxflags-fix	2012-10-05 11:07:04.000000000 +0400
@@ -0,0 +1,11 @@
+--- Makefile.in_	2012-10-05 10:17:36.037550752 +0400
++++ Makefile.in	2012-10-05 10:17:08.205548992 +0400
+@@ -46,7 +46,7 @@
+ # DEFS += -DMTRACE=1
+ CXXFLAGS = @CXXFLAGS@ $(DBGFLAGS) $(CCOPT)
+ CPPFLAGS = @CPPFLAGS@ $(DEFS)
+-export CFLAGS = $(CXXFLAGS)
++export CFLAGS = @CFLAGS@
+ # CFLAGS = $(DEFS) $(INCLS)
+ STATIC =
+ LDFLAGS = @LDFLAGS@ $(DBGFLAGS) $(STATIC)
diff -ruN /usr/ports/security/nmap/files/patch-clang-fixes ./files/patch-clang-fixes
--- /usr/ports/security/nmap/files/patch-clang-fixes	1970-01-01 03:00:00.000000000 +0300
+++ ./files/patch-clang-fixes	2012-10-05 17:45:06.143551658 +0400
@@ -0,0 +1,32 @@
+--- scan_engine.cc_	2012-10-05 11:13:12.003554110 +0400
++++ scan_engine.cc	2012-10-05 11:14:37.463551910 +0400
+@@ -2904,7 +2904,7 @@
+   }
+   if (o.spoofsource && !bind_failed) {
+     o.SourceSockAddr(&ss, &sslen);
+-    if (bind(sd, (struct sockaddr*)&ss, sslen) != 0) {
++    if (::bind(sd, (struct sockaddr*)&ss, sslen) != 0) {
+       error("%s: Problem binding source address (%s), errno: %d", __func__, inet_socktop(&ss), socket_errno());
+       perror("bind");
+       bind_failed = 1;
+--- traceroute.cc_	2012-10-05 11:33:54.413552510 +0400
++++ traceroute.cc	2012-10-05 11:34:15.976550750 +0400
+@@ -169,8 +169,6 @@
+ /* A global random token used to distinguish this traceroute's probes from
+    those of other traceroutes possibly running on the same machine. */
+ static u16 global_id;
+-/* A global cache of known hops, indexed by TTL and address. */
+-static std::map<struct HopIdent, Hop *> hop_cache;
+ /* A list of timedout hops, which are not kept in hop_cache, so we can delete
+    all hops on occasion. */
+ static std::list<Hop *> timedout_hops;
+@@ -204,6 +202,9 @@
+   }
+ };
+ 
++/* A global cache of known hops, indexed by TTL and address. */
++static std::map<struct HopIdent, Hop *> hop_cache;
++
+ struct Hop {
+   Hop *parent;
+   struct sockaddr_storage tag;
diff -ruN /usr/ports/security/nmap/files/patch-configure-cxxflags-fix ./files/patch-configure-cxxflags-fix
--- /usr/ports/security/nmap/files/patch-configure-cxxflags-fix	1970-01-01 03:00:00.000000000 +0300
+++ ./files/patch-configure-cxxflags-fix	2012-10-05 10:16:50.000000000 +0400
@@ -0,0 +1,11 @@
+--- _configure	2012-10-05 10:15:36.678551512 +0400
++++ configure	2012-10-05 10:15:45.366548872 +0400
+@@ -2398,7 +2398,7 @@
+      fi
+    if test -d /usr/local/include; then
+      CFLAGS="$CFLAGS -I/usr/local/include"
+-     CXXFLAGS="$CFLAGS -I/usr/local/include"
++     CXXFLAGS="$CXXFLAGS -I/usr/local/include"
+    fi
+ fi
+ 


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->ohauer 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Fri Oct 5 14:00:26 UTC 2012 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=172358 
State-Changed-From-To: open->closed 
State-Changed-By: ohauer 
State-Changed-When: Sun Jan 6 18:45:44 UTC 2013 
State-Changed-Why:  
Committed, 
Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=172358 
>Unformatted:
