svn commit: r339526 - in head/security/nmap: . files

Olli Hauer ohauer at FreeBSD.org
Sun Jan 12 17:56:21 UTC 2014


Author: ohauer
Date: Sun Jan 12 17:56:20 2014
New Revision: 339526
URL: http://svnweb.freebsd.org/changeset/ports/339526

Log:
  - use internal liblua instead the one from ports [1]
  - update internal liblua from 5.2.2 -> 5.2.3
  - bump PORTREVISION
  
  [1] nmap use static lua for nmap, nping and ncat, after
      build lua is no longer needed.

Added:
  head/security/nmap/files/patch-liblua-lua523   (contents, props changed)
Modified:
  head/security/nmap/Makefile
  head/security/nmap/files/patch-configure   (contents, props changed)
Directory Properties:
  head/security/nmap/files/patch-Makefile.in   (props changed)
  head/security/nmap/files/patch-libdnet-stripped__configure   (props changed)
  head/security/nmap/files/patch-libdnet-stripped__src__eth-bsd.c   (props changed)
  head/security/nmap/files/patch-nmap.cc   (props changed)
  head/security/nmap/files/patch-tcpip.cc   (props changed)
  head/security/nmap/pkg-descr   (props changed)

Modified: head/security/nmap/Makefile
==============================================================================
--- head/security/nmap/Makefile	Sun Jan 12 17:39:19 2014	(r339525)
+++ head/security/nmap/Makefile	Sun Jan 12 17:56:20 2014	(r339526)
@@ -3,7 +3,7 @@
 
 PORTNAME=	nmap
 DISTVERSION=	6.40
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	security ipv6
 MASTER_SITES=	http://nmap.org/dist/ \
 		LOCAL/ohauer
@@ -19,10 +19,8 @@ LICENSE_FILE=	${WRKSRC}/COPYING
 
 LIB_DEPENDS=	libpcre.so:${PORTSDIR}/devel/pcre
 
-USE_LUA=	5.1 5.2
-LUA_COMPS=	lua
-USE_BZIP2=	yes
 USES=		gmake
+USE_BZIP2=	yes
 GNU_CONFIGURE=	yes
 
 OPTIONS_SUB=	yes
@@ -47,11 +45,9 @@ CONFIGURE_ARGS+=--without-localdirs \
 		--without-zenmap \
 		--without-ndiff \
 		--with-libpcre=${LOCALBASE} \
-		--with-liblua=${LOCALBASE} \
+		--with-liblua=included \
 		--without-nmap-update
 
-CONFIGURE_ENV=	LUA_INCDIR="${LUA_INCDIR}" LUA_LIBDIR="${LUA_LIBDIR}"
-
 # fix for gcc from ports
 .if ${CC} != "cc" && ${CC} !="clang"
 GCCLIBDIR_CMDS=	${CC} -print-file-name=libstdc++.so | ${SED} -e 's/libstdc++.so//'

Modified: head/security/nmap/files/patch-configure
==============================================================================
--- head/security/nmap/files/patch-configure	Sun Jan 12 17:39:19 2014	(r339525)
+++ head/security/nmap/files/patch-configure	Sun Jan 12 17:56:20 2014	(r339526)
@@ -1,6 +1,6 @@
 --- ./configure.orig	2010-09-29 18:09:26.000000000 +0200
 +++ ./configure	2011-01-07 19:27:04.000000000 +0100
-@@ -3265,7 +3265,7 @@
+@@ -3367,7 +3367,7 @@
  ac_compiler_gnu=$ac_cv_c_compiler_gnu
  if test -n "$ac_tool_prefix"; then
    # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
@@ -8,15 +8,4 @@
 +set dummy ${ac_tool_prefix}$CXX; ac_word=$2
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  $as_echo_n "checking for $ac_word... " >&6; }
- if test "${ac_cv_prog_CC+set}" = set; then :
-@@ -6452,8 +6452,8 @@
-     no_lua="yes"
-   ;;
-   *)
--    CPPFLAGS="-I$with_liblua/include $CPPFLAGS"
--    LDFLAGS="-L$with_liblua/lib $LDFLAGS"
-+    CPPFLAGS="-I${LUA_INCDIR} $CPPFLAGS"
-+    LDFLAGS="-L${LUA_LIBDIR} $LDFLAGS"
-   ;;
-   esac
- 
+ if ${ac_cv_prog_CC+:} false; then :

Added: head/security/nmap/files/patch-liblua-lua523
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/security/nmap/files/patch-liblua-lua523	Sun Jan 12 17:56:20 2014	(r339526)
@@ -0,0 +1,361 @@
+diff -nruEbw -I'[$]Id:.*' ./liblua/Makefile ./liblua/Makefile
+--- ./liblua/Makefile	2013-05-02 16:59:06.000000000 +0200
++++ ./liblua/Makefile	2014-01-12 15:13:44.000000000 +0100
+@@ -6,8 +6,8 @@
+ # Your platform. See PLATS for possible values.
+ PLAT= none
+ 
+-CC= gcc
+-CFLAGS= -O2 -Wall $(SYSCFLAGS) $(MYCFLAGS)
++CC?= gcc
++CFLAGS= -Wall -DLUA_COMPAT_ALL $(SYSCFLAGS) $(MYCFLAGS)
+ LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
+ LIBS= -lm $(SYSLIBS) $(MYLIBS)
+ 
+@@ -106,7 +106,7 @@
+ 	$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"
+ 
+ macosx:
+-	$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline"
++	$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" CC=cc
+ 
+ mingw:
+ 	$(MAKE) "LUA_A=lua52.dll" "LUA_T=lua.exe" \
+diff -nruEbw -I'[$]Id:.*' ./liblua/lbitlib.c ./liblua/lbitlib.c
+--- ./liblua/lbitlib.c	2013-05-02 16:59:06.000000000 +0200
++++ ./liblua/lbitlib.c	2014-01-11 10:57:12.000000000 +0100
+@@ -129,6 +129,7 @@
+   b_uint r = luaL_checkunsigned(L, 1);
+   i &= (LUA_NBITS - 1);  /* i = i % NBITS */
+   r = trim(r);
++  if (i != 0)  /* avoid undefined shift of LUA_NBITS when i == 0 */
+   r = (r << i) | (r >> (LUA_NBITS - i));
+   lua_pushunsigned(L, trim(r));
+   return 1;
+diff -nruEbw -I'[$]Id:.*' ./liblua/ldebug.c ./liblua/ldebug.c
+--- ./liblua/ldebug.c	2013-05-02 16:59:06.000000000 +0200
++++ ./liblua/ldebug.c	2014-01-11 10:57:12.000000000 +0100
+@@ -327,12 +327,20 @@
+ }
+ 
+ 
++static int filterpc (int pc, int jmptarget) {
++  if (pc < jmptarget)  /* is code conditional (inside a jump)? */
++    return -1;  /* cannot know who sets that register */
++  else return pc;  /* current position sets that register */
++}
++
++
+ /*
+ ** try to find last instruction before 'lastpc' that modified register 'reg'
+ */
+ static int findsetreg (Proto *p, int lastpc, int reg) {
+   int pc;
+   int setreg = -1;  /* keep last instruction that changed 'reg' */
++  int jmptarget = 0;  /* any code before this address is conditional */
+   for (pc = 0; pc < lastpc; pc++) {
+     Instruction i = p->code[pc];
+     OpCode op = GET_OPCODE(i);
+@@ -341,33 +349,38 @@
+       case OP_LOADNIL: {
+         int b = GETARG_B(i);
+         if (a <= reg && reg <= a + b)  /* set registers from 'a' to 'a+b' */
+-          setreg = pc;
++          setreg = filterpc(pc, jmptarget);
+         break;
+       }
+       case OP_TFORCALL: {
+-        if (reg >= a + 2) setreg = pc;  /* affect all regs above its base */
++        if (reg >= a + 2)  /* affect all regs above its base */
++          setreg = filterpc(pc, jmptarget);
+         break;
+       }
+       case OP_CALL:
+       case OP_TAILCALL: {
+-        if (reg >= a) setreg = pc;  /* affect all registers above base */
++        if (reg >= a)  /* affect all registers above base */
++          setreg = filterpc(pc, jmptarget);
+         break;
+       }
+       case OP_JMP: {
+         int b = GETARG_sBx(i);
+         int dest = pc + 1 + b;
+         /* jump is forward and do not skip `lastpc'? */
+-        if (pc < dest && dest <= lastpc)
+-          pc += b;  /* do the jump */
++        if (pc < dest && dest <= lastpc) {
++          if (dest > jmptarget)
++            jmptarget = dest;  /* update 'jmptarget' */
++        }
+         break;
+       }
+       case OP_TEST: {
+-        if (reg == a) setreg = pc;  /* jumped code can change 'a' */
++        if (reg == a)  /* jumped code can change 'a' */
++          setreg = filterpc(pc, jmptarget);
+         break;
+       }
+       default:
+         if (testAMode(op) && reg == a)  /* any instruction that set A */
+-          setreg = pc;
++          setreg = filterpc(pc, jmptarget);
+         break;
+     }
+   }
+@@ -518,7 +531,7 @@
+ 
+ l_noret luaG_concaterror (lua_State *L, StkId p1, StkId p2) {
+   if (ttisstring(p1) || ttisnumber(p1)) p1 = p2;
+-  lua_assert(!ttisstring(p1) && !ttisnumber(p2));
++  lua_assert(!ttisstring(p1) && !ttisnumber(p1));
+   luaG_typeerror(L, p1, "concatenate");
+ }
+ 
+diff -nruEbw -I'[$]Id:.*' ./liblua/ldo.c ./liblua/ldo.c
+--- ./liblua/ldo.c	2013-05-02 16:59:06.000000000 +0200
++++ ./liblua/ldo.c	2014-01-11 10:57:12.000000000 +0100
+@@ -260,6 +260,7 @@
+   StkId base, fixed;
+   lua_assert(actual >= nfixargs);
+   /* move fixed parameters to final position */
++  luaD_checkstack(L, p->maxstacksize);  /* check again for new 'base' */
+   fixed = L->top - actual;  /* first fixed argument */
+   base = L->top;  /* final position of first argument */
+   for (i=0; i<nfixargs; i++) {
+@@ -324,12 +325,18 @@
+     case LUA_TLCL: {  /* Lua function: prepare its call */
+       StkId base;
+       Proto *p = clLvalue(func)->p;
+-      luaD_checkstack(L, p->maxstacksize);
+-      func = restorestack(L, funcr);
+       n = cast_int(L->top - func) - 1;  /* number of real arguments */
++      luaD_checkstack(L, p->maxstacksize);
+       for (; n < p->numparams; n++)
+         setnilvalue(L->top++);  /* complete missing arguments */
+-      base = (!p->is_vararg) ? func + 1 : adjust_varargs(L, p, n);
++      if (!p->is_vararg) {
++        func = restorestack(L, funcr);
++        base = func + 1;
++      }
++      else {
++        base = adjust_varargs(L, p, n);
++        func = restorestack(L, funcr);  /* previous call can change stack */
++      }
+       ci = next_ci(L);  /* now 'enter' new function */
+       ci->nresults = nresults;
+       ci->func = func;
+@@ -527,6 +534,7 @@
+ 
+ LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) {
+   int status;
++  int oldnny = L->nny;  /* save 'nny' */
+   lua_lock(L);
+   luai_userstateresume(L, nargs);
+   L->nCcalls = (from) ? from->nCcalls + 1 : 1;
+@@ -548,7 +556,7 @@
+     }
+     lua_assert(status == L->status);
+   }
+-  L->nny = 1;  /* do not allow yields */
++  L->nny = oldnny;  /* restore 'nny' */
+   L->nCcalls--;
+   lua_assert(L->nCcalls == ((from) ? from->nCcalls : 0));
+   lua_unlock(L);
+diff -nruEbw -I'[$]Id:.*' ./liblua/lgc.c ./liblua/lgc.c
+--- ./liblua/lgc.c	2013-05-02 16:59:06.000000000 +0200
++++ ./liblua/lgc.c	2014-01-11 10:57:12.000000000 +0100
+@@ -493,17 +493,24 @@
+ 
+ 
+ static lu_mem traversestack (global_State *g, lua_State *th) {
++  int n = 0;
+   StkId o = th->stack;
+   if (o == NULL)
+     return 1;  /* stack not completely built yet */
+-  for (; o < th->top; o++)
++  for (; o < th->top; o++)  /* mark live elements in the stack */
+     markvalue(g, o);
+   if (g->gcstate == GCSatomic) {  /* final traversal? */
+     StkId lim = th->stack + th->stacksize;  /* real end of stack */
+     for (; o < lim; o++)  /* clear not-marked stack slice */
+       setnilvalue(o);
+   }
+-  return sizeof(lua_State) + sizeof(TValue) * th->stacksize;
++  else {  /* count call infos to compute size */
++    CallInfo *ci;
++    for (ci = &th->base_ci; ci != th->ci; ci = ci->next)
++      n++;
++  }
++  return sizeof(lua_State) + sizeof(TValue) * th->stacksize +
++         sizeof(CallInfo) * n;
+ }
+ 
+ 
+diff -nruEbw -I'[$]Id:.*' ./liblua/liolib.c ./liblua/liolib.c
+--- ./liblua/liolib.c	2013-05-02 16:59:06.000000000 +0200
++++ ./liblua/liolib.c	2014-01-12 15:13:21.000000000 +0100
+@@ -6,11 +6,11 @@
+ 
+ 
+ /*
+-** POSIX idiosyncrasy!
+ ** This definition must come before the inclusion of 'stdio.h'; it
+ ** should not affect non-POSIX systems
+ */
+ #if !defined(_FILE_OFFSET_BITS)
++#define	_LARGEFILE_SOURCE	1
+ #define _FILE_OFFSET_BITS 64
+ #endif
+ 
+@@ -19,6 +19,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <unistd.h>
+ 
+ #define liolib_c
+ #define LUA_LIB
+@@ -80,36 +81,37 @@
+ 
+ /*
+ ** {======================================================
+-** lua_fseek/lua_ftell: configuration for longer offsets
++** lua_fseek: configuration for longer offsets
+ ** =======================================================
+ */
+ 
+-#if !defined(lua_fseek)	/* { */
++#if !defined(lua_fseek)	&& !defined(LUA_ANSI)	/* { */
+ 
+-#if defined(LUA_USE_POSIX)
++#if defined(LUA_USE_POSIX)	/* { */
+ 
+ #define l_fseek(f,o,w)		fseeko(f,o,w)
+ #define l_ftell(f)		ftello(f)
+ #define l_seeknum		off_t
+ 
+ #elif defined(LUA_WIN) && !defined(_CRTIMP_TYPEINFO) \
+-   && defined(_MSC_VER) && (_MSC_VER >= 1400)
++   && defined(_MSC_VER) && (_MSC_VER >= 1400)	/* }{ */
+ /* Windows (but not DDK) and Visual C++ 2005 or higher */
+ 
+ #define l_fseek(f,o,w)		_fseeki64(f,o,w)
+ #define l_ftell(f)		_ftelli64(f)
+ #define l_seeknum		__int64
+ 
+-#else
++#endif	/* } */
++
++#endif			/* } */
++
+ 
++#if !defined(l_fseek)		/* default definitions */
+ #define l_fseek(f,o,w)		fseek(f,o,w)
+ #define l_ftell(f)		ftell(f)
+ #define l_seeknum		long
+-
+ #endif
+ 
+-#endif			/* } */
+-
+ /* }====================================================== */
+ 
+ 
+diff -nruEbw -I'[$]Id:.*' ./liblua/llex.c ./liblua/llex.c
+--- ./liblua/llex.c	2013-05-02 16:59:06.000000000 +0200
++++ ./liblua/llex.c	2014-01-11 10:57:12.000000000 +0100
+@@ -133,6 +133,9 @@
+     setbvalue(o, 1);  /* t[string] = true */
+     luaC_checkGC(L);
+   }
++  else {  /* string already present */
++    ts = rawtsvalue(keyfromval(o));  /* re-use value previously stored */
++  }
+   L->top--;  /* remove string from stack */
+   return ts;
+ }
+diff -nruEbw -I'[$]Id:.*' ./liblua/lstate.c ./liblua/lstate.c
+--- ./liblua/lstate.c	2013-05-02 16:59:06.000000000 +0200
++++ ./liblua/lstate.c	2014-01-11 10:57:12.000000000 +0100
+@@ -192,6 +192,8 @@
+   g->memerrmsg = luaS_newliteral(L, MEMERRMSG);
+   luaS_fix(g->memerrmsg);  /* it should never be collected */
+   g->gcrunning = 1;  /* allow gc */
++  g->version = lua_version(NULL);
++  luai_userstateopen(L);
+ }
+ 
+ 
+@@ -222,6 +224,8 @@
+   global_State *g = G(L);
+   luaF_close(L, L->stack);  /* close all upvalues for this thread */
+   luaC_freeallobjects(L);  /* collect all objects */
++  if (g->version)  /* closing a fully built state? */
++    luai_userstateclose(L);
+   luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size);
+   luaZ_freebuffer(L, &g->buff);
+   freestack(L);
+@@ -287,7 +291,7 @@
+   setnilvalue(&g->l_registry);
+   luaZ_initbuffer(L, &g->buff);
+   g->panic = NULL;
+-  g->version = lua_version(NULL);
++  g->version = NULL;
+   g->gcstate = GCSpause;
+   g->allgc = NULL;
+   g->finobj = NULL;
+@@ -306,8 +310,6 @@
+     close_state(L);
+     L = NULL;
+   }
+-  else
+-    luai_userstateopen(L);
+   return L;
+ }
+ 
+@@ -315,7 +317,6 @@
+ LUA_API void lua_close (lua_State *L) {
+   L = G(L)->mainthread;  /* only the main thread can be closed */
+   lua_lock(L);
+-  luai_userstateclose(L);
+   close_state(L);
+ }
+ 
+diff -nruEbw -I'[$]Id:.*' ./liblua/ltable.h ./liblua/ltable.h
+--- ./liblua/ltable.h	2012-05-27 10:53:32.000000000 +0200
++++ ./liblua/ltable.h	2014-01-11 10:57:12.000000000 +0100
+@@ -17,6 +17,10 @@
+ 
+ #define invalidateTMcache(t)	((t)->flags = 0)
+ 
++/* returns the key, given the value of a table entry */
++#define keyfromval(v) \
++  (gkey(cast(Node *, cast(char *, (v)) - offsetof(Node, i_val))))
++
+ 
+ LUAI_FUNC const TValue *luaH_getint (Table *t, int key);
+ LUAI_FUNC void luaH_setint (lua_State *L, Table *t, int key, TValue *value);
+diff -nruEbw -I'[$]Id:.*' ./liblua/lua.h ./liblua/lua.h
+--- ./liblua/lua.h	2013-05-02 16:59:06.000000000 +0200
++++ ./liblua/lua.h	2014-01-11 10:57:12.000000000 +0100
+@@ -19,7 +19,7 @@
+ #define LUA_VERSION_MAJOR	"5"
+ #define LUA_VERSION_MINOR	"2"
+ #define LUA_VERSION_NUM		502
+-#define LUA_VERSION_RELEASE	"2"
++#define LUA_VERSION_RELEASE	"3"
+ 
+ #define LUA_VERSION	"Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
+ #define LUA_RELEASE	LUA_VERSION "." LUA_VERSION_RELEASE
+diff -nruEbw -I'[$]Id:.*' ./liblua/luac.c ./liblua/luac.c
+--- ./liblua/luac.c	2012-05-27 10:53:32.000000000 +0200
++++ ./liblua/luac.c	2014-01-11 10:57:12.000000000 +0100
+@@ -251,7 +251,7 @@
+ static void PrintConstant(const Proto* f, int i)
+ {
+  const TValue* o=&f->k[i];
+- switch (ttype(o))
++ switch (ttypenv(o))
+  {
+   case LUA_TNIL:
+ 	printf("nil");


More information about the svn-ports-all mailing list