aboutsummaryrefslogtreecommitdiffstats
path: root/net/libtnl
diff options
context:
space:
mode:
authormi <mi@FreeBSD.org>2008-08-18 09:48:41 +0800
committermi <mi@FreeBSD.org>2008-08-18 09:48:41 +0800
commit81bb4bdd15190a258a3f9e7f4b5cfc3b034194fb (patch)
tree88b51151b008ccc45e561d3393f0d52a566a4056 /net/libtnl
parent8f19bf1f7b92ac349ccba3fefc07e8c4943ec554 (diff)
downloadfreebsd-ports-gnome-81bb4bdd15190a258a3f9e7f4b5cfc3b034194fb.tar.gz
freebsd-ports-gnome-81bb4bdd15190a258a3f9e7f4b5cfc3b034194fb.tar.zst
freebsd-ports-gnome-81bb4bdd15190a258a3f9e7f4b5cfc3b034194fb.zip
Add patches to unbreak -- work with gcc above version 3. Also allow
building on amd64 and note, that support for other platforms is easy too, as long as one has a system to test on. Redirect a few functions directly to the standard implementations using defines, instead of using function-wrappers. This port ought to use a port-installed libtomcrypt instead of building its own version of same. Unfortunately, our security/libtomcrypt does not (yet?) install a shared version.
Diffstat (limited to 'net/libtnl')
-rw-r--r--net/libtnl/Makefile27
-rw-r--r--net/libtnl/files/Makefile.bsd1
-rw-r--r--net/libtnl/files/patch-platform97
-rw-r--r--net/libtnl/files/patch-platforms23
-rw-r--r--net/libtnl/pkg-plist2
5 files changed, 137 insertions, 13 deletions
diff --git a/net/libtnl/Makefile b/net/libtnl/Makefile
index daa9d9021453..6386e6ec3920 100644
--- a/net/libtnl/Makefile
+++ b/net/libtnl/Makefile
@@ -17,18 +17,23 @@ COMMENT= A robust, secure, easy to use cross-platform C++ networking API
WRKSRC= ${WRKDIR}/tnl/tnl
USE_LDCONFIG= yes
-ONLY_FOR_ARCHS= i386
+MAKEFILE= ${FILESDIR}/Makefile.bsd
+MAKE_ARGS= -j`${SYSCTL} -n hw.ncpu`
+# Other arches can be added easily, provided there is hardware to test:
+ONLY_FOR_ARCHS= i386 amd64
+.if defined(NO_PROFILE) || defined(NOPROFILE)
+PLIST_SUB+= PROFILE='@comment '
+.else
+PLIST_SUB+= PROFILE=''
+.endif
-post-extract:
- @${CP} ${PATCHDIR}/Makefile.bsd ${WRKSRC}/Makefile
+# 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:${PORTSDIR}/security/libtomcrypt
+#
+#EXTRACT_AFTER_ARGS=|${TAR} -xpf - --exclude tnl/libtomcrypt
-pre-install:
+pre-su-install:
${MKDIR} ${PREFIX}/include/tnl
-.include <bsd.port.pre.mk>
-
-.if ${OSVERSION} >= 700042
-BROKEN= Does not compile with GCC 4.2
-.endif
-
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff --git a/net/libtnl/files/Makefile.bsd b/net/libtnl/files/Makefile.bsd
index 7c048d07a416..6c1fc7de673e 100644
--- a/net/libtnl/files/Makefile.bsd
+++ b/net/libtnl/files/Makefile.bsd
@@ -64,4 +64,3 @@ INCLUDEDIR= ${PREFIX}/include/tnl
LIBDIR= ${PREFIX}/lib
.include <bsd.lib.mk>
-
diff --git a/net/libtnl/files/patch-platform b/net/libtnl/files/patch-platform
new file mode 100644
index 000000000000..7cef84fa96e3
--- /dev/null
+++ b/net/libtnl/files/patch-platform
@@ -0,0 +1,97 @@
+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 <stdio.h>
+
+ 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 @@
+ }
+
+-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
+-
+-
diff --git a/net/libtnl/files/patch-platforms b/net/libtnl/files/patch-platforms
new file mode 100644
index 000000000000..a5131fae7dda
--- /dev/null
+++ b/net/libtnl/files/patch-platforms
@@ -0,0 +1,23 @@
+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 @@
+ //----------------------------------------------------------------------------------
+
+-#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 @@
+ # if __GNUC__ == 2
+ # define TNL_GCC_2
+-# elif __GNUC__ == 3
++# elif __GNUC__ >= 3
+ # define TNL_GCC_3
+ # else
diff --git a/net/libtnl/pkg-plist b/net/libtnl/pkg-plist
index 3c72c696b680..2d0c48db2c35 100644
--- a/net/libtnl/pkg-plist
+++ b/net/libtnl/pkg-plist
@@ -34,5 +34,5 @@ include/tnl/tnlVector.h
lib/libtnl.a
lib/libtnl.so
lib/libtnl.so.1
-lib/libtnl_p.a
+%%PROFILE%%lib/libtnl_p.a
@dirrm include/tnl