diff --git a/net/libtnl/Makefile b/net/libtnl/Makefile index e3fcc4d54a62..8c4e90bae211 100644 --- a/net/libtnl/Makefile +++ b/net/libtnl/Makefile @@ -1,37 +1,43 @@ PORTNAME= libtnl PORTVERSION= 1.5.0 PORTREVISION= 8 CATEGORIES= net devel MASTER_SITES= SF/opentnl/TNL%20Source/${PORTVERSION} DISTNAME= tnl-${PORTVERSION}-source -MAINTAINER= ports@FreeBSD.org +MAINTAINER= bofh@FreeBSD.org COMMENT= Robust, secure, easy to use cross-platform C++ networking API WWW= https://sourceforge.net/projects/opentnl/ LICENSE= GPLv2+ LICENSE_FILE= ${WRKSRC}/../LICENSE.txt +# Other arches can be added easily, provided there is hardware to test: +ONLY_FOR_ARCHS= amd64 i386 powerpc powerpc64 powerpc64le + USES= uidfix USE_GCC= yes -WRKSRC= ${WRKDIR}/tnl/tnl USE_LDCONFIG= yes + MAKEFILE= ${FILESDIR}/Makefile.bsd -# Other arches can be added easily, provided there is hardware to test: -ONLY_FOR_ARCHS= i386 amd64 powerpc powerpc64 powerpc64le -.if defined(NO_PROFILE) || defined(NOPROFILE) + +WRKSRC= ${WRKDIR}/tnl/tnl + +.include + +.if defined(NO_PROFILE) || defined(NOPROFILE) || ( ${OPSYS} == FreeBSD && ${OSVERSION} >= 1400079 ) PLIST_SUB+= PROFILE='@comment ' .else PLIST_SUB+= PROFILE='' .endif # When security/libtomcrypt is fixed to provide a shared version, we'll # stop extracting our own and will LIB_DEPEND on theirs instead: #LIB_DEPENDS= tomcrypt:security/libtomcrypt # #EXTRACT_AFTER_ARGS=|${TAR} -xpf - --exclude tnl/libtomcrypt pre-install: @${MKDIR} ${STAGEDIR}${PREFIX}/include/tnl -.include +.include diff --git a/net/libtnl/files/patch-platform b/net/libtnl/files/patch-platform index 7cef84fa96e3..9b79b1939863 100644 --- a/net/libtnl/files/patch-platform +++ b/net/libtnl/files/patch-platform @@ -1,97 +1,105 @@ -Use defines instead of (partially incorrect) function-wrappers for -standard functions. - - -mi - ---- tnlPlatform.h 2004-09-28 14:45:25.000000000 -0400 -+++ tnlPlatform.h 2008-08-17 20:47:59.000000000 -0400 -@@ -31,4 +31,5 @@ - #include "tnlTypes.h" - #endif -+#include - - namespace TNL { -@@ -101,10 +102,11 @@ - /// - /// This will print into the specified string until the buffer size is reached. --extern int dSprintf(char *buffer, U32 bufferSize, const char *format, ...); -- --/// Vsprintf with buffer size argument. --/// --/// This will print into the specified string until the buffer size is reached. --extern int dVsprintf(char *buffer, U32 bufferSize, const char *format, void *arglist); ///< compiler independent -+#ifdef TNL_COMPILER_VISUALC -+# define dSprintf _snprintf -+# define dVsprintf _vsnprintf -+#else -+# define dSprintf snprintf -+# define dVsprintf vsnprintf -+#endif - - inline char dToupper(const char c) { if (c >= char('a') && c <= char('z')) return char(c + 'A' - 'a'); else return c; } ///< Converts an ASCII character to upper case. -@@ -120,6 +122,6 @@ - #if defined (__GNUC__) - --int stricmp(const char *str1, const char *str2); --int strnicmp(const char *str1, const char *str2, unsigned int len); -+#define stricmp(str1, str2) strcasecmp(str1, str2) -+#define strnicmp(str1, str2, size) strncasecmp(str1, str2, size) - - #endif ---- platform.cpp 2004-08-20 14:26:58.000000000 -0400 -+++ platform.cpp 2008-08-17 11:43:55.000000000 -0400 -@@ -435,54 +435,3 @@ +--- platform.cpp.orig 2004-08-20 18:26:58 UTC ++++ platform.cpp +@@ -434,55 +434,4 @@ bool atob(const char *str) + return !stricmp(str, "true") || atof(str); } -S32 dSprintf(char *buffer, U32 bufferSize, const char *format, ...) -{ - va_list args; - va_start(args, format); -#ifdef TNL_COMPILER_VISUALC - S32 len = _vsnprintf(buffer, bufferSize, format, args); -#else - S32 len = vsnprintf(buffer, bufferSize, format, args); -#endif - return (len); -} - - -S32 dVsprintf(char *buffer, U32 bufferSize, const char *format, void *arglist) -{ -#ifdef TNL_COMPILER_VISUALC - S32 len = _vsnprintf(buffer, bufferSize, format, (va_list) arglist); -#else - S32 len = vsnprintf(buffer, bufferSize, format, (char *) arglist); -#endif - return len; -} - }; - - -#if defined (__GNUC__) - -int stricmp(const char *str1, const char *str2) -{ - while(toupper(*str1) == toupper(*str2) && *str1) - { - str1++; - str2++; - } - return (toupper(*str1) > toupper(*str2)) ? 1 : ((toupper(*str1) < toupper(*str2)) ? -1 : 0); -} - -int strnicmp(const char *str1, const char *str2, unsigned int len) -{ - for(unsigned int i = 0; i < len; i++) - { - if(toupper(str1[i]) == toupper(str2[i])) - continue; - return (toupper(str1[i]) > toupper(str2[i])) ? 1 : ((toupper(str1[i]) < toupper(str2[i])) ? -1 : 0); - } - return 0; -} - -#endif - - +Use defines instead of (partially incorrect) function-wrappers for +standard functions. + + -mi + +--- tnlPlatform.h.orig 2004-09-28 18:45:25 UTC ++++ tnlPlatform.h +@@ -30,6 +30,7 @@ + #ifndef _TNL_TYPES_H_ + #include "tnlTypes.h" + #endif ++#include + + namespace TNL { + +@@ -100,13 +101,14 @@ extern bool atob(const char *str); ///< String + /// Printf into string with a buffer size. + /// + /// This will print into the specified string until the buffer size is reached. +-extern int dSprintf(char *buffer, U32 bufferSize, const char *format, ...); ++#ifdef TNL_COMPILER_VISUALC ++# define dSprintf _snprintf ++# define dVsprintf _vsnprintf ++#else ++# define dSprintf snprintf ++# define dVsprintf vsnprintf ++#endif + +-/// Vsprintf with buffer size argument. +-/// +-/// This will print into the specified string until the buffer size is reached. +-extern int dVsprintf(char *buffer, U32 bufferSize, const char *format, void *arglist); ///< compiler independent +- + inline char dToupper(const char c) { if (c >= char('a') && c <= char('z')) return char(c + 'A' - 'a'); else return c; } ///< Converts an ASCII character to upper case. + inline char dTolower(const char c) { if (c >= char('A') && c <= char('Z')) return char(c - 'A' + 'a'); else return c; } ///< Converts an ASCII character to lower case. + +@@ -119,8 +121,8 @@ inline char dTolower(const char c) { if (c >= char('A' + + #if defined (__GNUC__) + +-int stricmp(const char *str1, const char *str2); +-int strnicmp(const char *str1, const char *str2, unsigned int len); ++#define stricmp(str1, str2) strcasecmp(str1, str2) ++#define strnicmp(str1, str2, size) strncasecmp(str1, str2, size) + + #endif + diff --git a/net/libtnl/files/patch-platforms b/net/libtnl/files/patch-tnlTypes.h similarity index 58% rename from net/libtnl/files/patch-platforms rename to net/libtnl/files/patch-tnlTypes.h index a5131fae7dda..d8195f5d8877 100644 --- a/net/libtnl/files/patch-platforms +++ b/net/libtnl/files/patch-tnlTypes.h @@ -1,23 +1,27 @@ This allows building on amd64 and with gcc above 3.x. Adding support for other architectures is easy too. -mi ---- tnlTypes.h 2004-09-28 14:45:25.000000000 -0400 -+++ tnlTypes.h 2008-08-17 10:30:26.000000000 -0400 -@@ -285,6 +285,6 @@ +--- tnlTypes.h.orig 2004-09-28 18:45:25 UTC ++++ tnlTypes.h +@@ -284,8 +284,8 @@ typedef unsigned long long U64; ///< Compiler indepe + // Identify the target CPU and assembly language options //---------------------------------------------------------------------------------- -#if defined(_M_IX86) || defined(i386) -# define TNL_CPU_STRING "Intel x86" +#if defined(_M_IX86) || defined(i386) || defined(__amd64__) +# define TNL_CPU_STRING "x86" # define TNL_CPU_X86 # define TNL_LITTLE_ENDIAN -@@ -294,5 +294,5 @@ + # define TNL_SUPPORTS_NASM +@@ -293,7 +293,7 @@ typedef unsigned long long U64; ///< Compiler indepe + # if defined (__GNUC__) # if __GNUC__ == 2 # define TNL_GCC_2 -# elif __GNUC__ == 3 +# elif __GNUC__ >= 3 # define TNL_GCC_3 # else + # error "TNL: Unsupported version of GCC (see tnlMethodDispatch.cpp)"