pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

brlcad: Add more NetBSD support



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Sun Oct 23 03:56:10 2016 +0200
Changeset:	4fff09c339654e62b4d3ffa9d3e1072e7732d3e8

Modified Files:
	brlcad/Makefile
	brlcad/TODO
	brlcad/distinfo
Added Files:
	brlcad/patches/patch-src_libbu_uce-dirent.h
	brlcad/patches/patch-src_other_libutahrle_rle__open__f.c
	brlcad/patches/patch-src_other_openscenegraph_src_OpenThreads_pthreads_PThread.cpp
	brlcad/patches/patch-src_other_openscenegraph_src_osgDB_FileUtils.cpp
	brlcad/patches/patch-src_other_openscenegraph_src_osg_GLExtensions.cpp
	brlcad/patches/patch-src_other_stepcode_src_base_sc__benchmark.cc
	brlcad/patches/patch-src_other_tcl_generic_tclInt.h
	brlcad/patches/patch-src_other_tcl_generic_tclPosixStr.c
	brlcad/patches/patch-src_other_tcl_tests_load.test
	brlcad/patches/patch-src_other_tcl_unix_tclUnixCompat.c
	brlcad/patches/patch-src_other_tcl_unix_tclUnixInit.c
	brlcad/patches/patch-src_other_tcl_unix_tclUnixPort.h

Log Message:
brlcad: Add more NetBSD support

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=4fff09c339654e62b4d3ffa9d3e1072e7732d3e8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 brlcad/Makefile                                    | 44 +++++++-----------
 brlcad/TODO                                        |  5 +-
 brlcad/distinfo                                    | 12 +++++
 brlcad/patches/patch-src_libbu_uce-dirent.h        | 13 ++++++
 .../patch-src_other_libutahrle_rle__open__f.c      | 21 +++++++++
 ...scenegraph_src_OpenThreads_pthreads_PThread.cpp | 22 +++++++++
 ...rc_other_openscenegraph_src_osgDB_FileUtils.cpp | 19 ++++++++
 ...c_other_openscenegraph_src_osg_GLExtensions.cpp | 13 ++++++
 ...ch-src_other_stepcode_src_base_sc__benchmark.cc | 41 ++++++++++++++++
 .../patches/patch-src_other_tcl_generic_tclInt.h   | 27 +++++++++++
 .../patch-src_other_tcl_generic_tclPosixStr.c      | 22 +++++++++
 brlcad/patches/patch-src_other_tcl_tests_load.test | 13 ++++++
 .../patch-src_other_tcl_unix_tclUnixCompat.c       | 54 ++++++++++++++++++++++
 .../patches/patch-src_other_tcl_unix_tclUnixInit.c | 44 ++++++++++++++++++
 .../patches/patch-src_other_tcl_unix_tclUnixPort.h | 17 +++++++
 15 files changed, 337 insertions(+), 30 deletions(-)

diffs:
diff --git a/brlcad/Makefile b/brlcad/Makefile
index 9e5d3bb..f61cd6f 100644
--- a/brlcad/Makefile
+++ b/brlcad/Makefile
@@ -19,12 +19,6 @@ USE_LANGUAGES=	c c++ fortran
 # compatible with existing libraries
 CMAKE_ARGS+=	-DBRLCAD_BUNDLED_LIBS=ON
 
-CMAKE_ARGS+=	-DTERMLIB_LIBRARY=${BUILDLINK_PREFIX.terminfo}/lib/lib${BUILDLINK_LIBNAME.terminfo}.so
-CMAKE_ARGS+=	-DTERMLIB_INCLUDE_DIR=${BUILDLINK_PREFIX.terminfo}/include
-
-CMAKE_ARGS+=	-DNETPBM_LIBRARIES=${BUILDLINK_PREFIX.netpbm}/lib/libnetpbm.so
-CMAKE_ARGS+=	-DNETPBM_INCLUDE_DIR=${BUILDLINK_PREFIX.netpbm}/include/netpbm
-
 # brlcad must be installed into subprefix as it has conflicting files and it
 # will try overwrite them. brlcad will also blacklist existing libraries in
 # install subprefix
@@ -60,6 +54,9 @@ PKGCONFIG_OVERRIDE+=	src/other/libpng/scripts/libpng.pc.in
 PKGCONFIG_OVERRIDE+=	src/other/libpng/libpng.pc.in
 PKGCONFIG_OVERRIDE+=	src/other/libz/zlib.pc.in
 
+# What else?
+NOT_PAX_MPROTECT_SAFE+=	${BRLCAD_PREFIX:Q}/bin/mged
+
 BUILD_DEPENDS+=	astyle-[0-9]*:../../devel/astyle
 # BUILD_DEPENDS+=	lemon-[0-9]*:../../devel/lemon # built in
 # BUILD_DEPENDS+=	re2c-[0-9]*:../../devel/re2c # built in
@@ -77,8 +74,6 @@ BUILDLINK_TRANSFORM+=	rm:-pedantic rm:-pedantic-errors # C99 style comments..
 REPLACE_BASH+=		sh/footer.sh
 REPLACE_BASH+=		sh/fs2org.sh
 
-REPLACE_RUBY+=		doc/docbook/resources/other/standard/xsl/epub/bin/dbtoepub
-
 REPLACE_PYTHON+=	misc/flawfinder
 REPLACE_PYTHON+=	misc/svn2git/svnlog2csv
 REPLACE_PYTHON+=	src/conv/intaval-g.py
@@ -91,12 +86,6 @@ REPLACE_PYTHON+=	src/other/stepcode/misc/flawfinder
 REPLACE_PYTHON+=	src/other/stepcode/misc/wiki-scripts/update-matrix.py
 REPLACE_PYTHON+=	src/other/stepcode/src/exp2python/python/setup.py
 
-# Private copy of TCL
-REPLACE_INTERPRETER+=	tclsh
-REPLACE.tclsh.old=	.*tclsh
-REPLACE.tclsh.new=	${BRLCAD_PREFIX}/bin/tclsh
-REPLACE_FILES.tclsh=	src/other/tkhtml/doc/tkhtml_requirements.tcl
-
 REPLACE_INTERPRETER+=	awk
 REPLACE.awk.old=	.*awk
 REPLACE.awk.new=	${AWK}
@@ -105,20 +94,21 @@ REPLACE_FILES.awk=	src/other/freetype/builds/atari/deflinejoiner.awk
 REPLACE_PERL+=		src/proc-db/metaballs.pl
 REPLACE_PERL+=		src/proc-db/spiral.pl
 
-.include "../../wip/tk-itk3/buildlink3.mk"
-.include "../../wip/tkpng/buildlink3.mk"
-.include "../../wip/tcl-iwidgets/buildlink3.mk"
-.include "../../wip/tkhtml3/buildlink3.mk"
-.include "../../devel/tinycthread/buildlink3.mk"
-#.include "../../graphics/adaptagrams/buildlink3.mk" # not any longer compatible, unused by upstream
+TEST_TARGET=		benchmark test
+
+# .include "../../wip/tk-itk3/buildlink3.mk" # built-in
+# .include "../../wip/tkpng/buildlink3.mk" # built-in
+# .include "../../wip/tcl-iwidgets/buildlink3.mk" # built-in
+# .include "../../wip/tkhtml3/buildlink3.mk" # built-in
+# .include "../../devel/tinycthread/buildlink3.mk" # built-in
+# .include "../../graphics/adaptagrams/buildlink3.mk" # not any longer compatible, unused by upstream
 .include "../../graphics/freetype2/buildlink3.mk"
-.include "../../graphics/netpbm/buildlink3.mk"
-.include "../../graphics/png/buildlink3.mk"
+# .include "../../graphics/netpbm/buildlink3.mk" # built-in
+# .include "../../graphics/png/buildlink3.mk" # built-in
 .include "../../lang/python/application.mk"
-.include "../../lang/ruby/replace.mk"
-.include "../../lang/tcl/buildlink3.mk"
-.include "../../mk/terminfo.buildlink3.mk"
+# .include "../../lang/tcl/buildlink3.mk" # built-in
+# .include "../../mk/terminfo.buildlink3.mk" # built-in
 .include "../../x11/libXext/buildlink3.mk"
-.include "../../x11/tk/buildlink3.mk"
-.include "../../x11/tktable/buildlink3.mk"
+# .include "../../x11/tk/buildlink3.mk" # built-in
+# .include "../../x11/tktable/buildlink3.mk" # built-in
 .include "../../mk/bsd.pkg.mk"
diff --git a/brlcad/TODO b/brlcad/TODO
index 1fd3a30..10041a9 100644
--- a/brlcad/TODO
+++ b/brlcad/TODO
@@ -1,3 +1,2 @@
-- update lemon (?) - -T option isn't supported by the pkgsrc version
-- switch to tk/tcl 8.5 as it's oficially supported
-- package itk for tk 8.5 as it's the version supported
+- add NetBSD support to upstream version of OpenThreads
+- add NetBSD support to upstream version of TCL
diff --git a/brlcad/distinfo b/brlcad/distinfo
index ea73036..6eee044 100644
--- a/brlcad/distinfo
+++ b/brlcad/distinfo
@@ -7,5 +7,17 @@ Size (brlcad-7.26.0.tar.bz2) = 113073230 bytes
 SHA1 (patch-CMakeLists.txt) = ec1955dc1543fd2b6ba5a56ebf350980ac42f7df
 SHA1 (patch-misc_CMake_CompilerFlags.cmake) = 0831bd3376e2838fbd4a08be2121db73fba3db56
 SHA1 (patch-misc_CMake_ThirdParty.cmake) = 03cb989aa4de0a07e146bc80facd649946a9688b
+SHA1 (patch-src_libbu_uce-dirent.h) = 152e5d0a9cd9dd5fae0f9088cd80664888265626
 SHA1 (patch-src_librt_primitives_bot_gct__decimation_meshdecimation.c) = c76104ad99c8714379ad7e01b806a2f30cda4f05
+SHA1 (patch-src_other_libutahrle_rle__open__f.c) = cc2bd85bd9893b0983550f5aeabd23d9a1186b49
 SHA1 (patch-src_other_openscenegraph_CMakeLists.txt) = df54a0a75d44bcab5d30b3a5f4b85bffc8fae8b1
+SHA1 (patch-src_other_openscenegraph_src_OpenThreads_pthreads_PThread.cpp) = 57d56e0f796546e39fac5524a97fbb002cd24e12
+SHA1 (patch-src_other_openscenegraph_src_osgDB_FileUtils.cpp) = 19417e481f05d6424f87062eb3cc9ab3b2ea3ffe
+SHA1 (patch-src_other_openscenegraph_src_osg_GLExtensions.cpp) = 92c26ea063553697c13f2d0d4f961de7483c53d0
+SHA1 (patch-src_other_stepcode_src_base_sc__benchmark.cc) = fcf862b90b5e9ae9eced5474ad8c21a66a1424cb
+SHA1 (patch-src_other_tcl_generic_tclInt.h) = de4bd07a03ea37e784123224dfe89cf1cffa4c29
+SHA1 (patch-src_other_tcl_generic_tclPosixStr.c) = 8a0ad84acdc362674f925ff515a549b3cf7ee0db
+SHA1 (patch-src_other_tcl_tests_load.test) = 3fdd33b66b020b57b20e23b0ab5d574b429e67a2
+SHA1 (patch-src_other_tcl_unix_tclUnixCompat.c) = d68112de91f642ea871612a52a66024d39cb5a44
+SHA1 (patch-src_other_tcl_unix_tclUnixInit.c) = 9b7d668d54e67fe944754f6bff5ce8a55fa4e4a4
+SHA1 (patch-src_other_tcl_unix_tclUnixPort.h) = 2dff0f7384c103d2aff7bf7641d23fc1a5d016c5
diff --git a/brlcad/patches/patch-src_libbu_uce-dirent.h b/brlcad/patches/patch-src_libbu_uce-dirent.h
new file mode 100644
index 0000000..73a24db
--- /dev/null
+++ b/brlcad/patches/patch-src_libbu_uce-dirent.h
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- src/libbu/uce-dirent.h.orig	2016-08-09 06:47:43.000000000 +0000
++++ src/libbu/uce-dirent.h
+@@ -123,6 +123,8 @@
+ #   define HAVE_DIRENT_H
+ # elif defined(__FreeBSD__)                    /* FreeBSD */
+ #   define HAVE_DIRENT_H
++# elif defined(__NetBSD__)                     /* NetBSD */
++#   define HAVE_DIRENT_H
+ # elif defined(__linux__)                      /* Linux */
+ #   define HAVE_DIRENT_H
+ # elif defined(__GNUC__)                       /* GNU C/C++ */
diff --git a/brlcad/patches/patch-src_other_libutahrle_rle__open__f.c b/brlcad/patches/patch-src_other_libutahrle_rle__open__f.c
new file mode 100644
index 0000000..397f439
--- /dev/null
+++ b/brlcad/patches/patch-src_other_libutahrle_rle__open__f.c
@@ -0,0 +1,21 @@
+$NetBSD$
+
+--- src/other/libutahrle/rle_open_f.c.orig	2016-08-09 06:47:00.000000000 +0000
++++ src/other/libutahrle/rle_open_f.c
+@@ -12,14 +12,14 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ 
+-#ifdef HAVE_UNISTD_H
++#if 1 /* def HAVE_UNISTD_H */
+ #  include <unistd.h>
+ #endif
+ 
+ #ifndef NO_OPEN_PIPES
+ /* Need to have a SIGCLD signal catcher. */
+ #include <signal.h>
+-#ifdef HAVE_SYS_WAIT_H
++#if 1 /* def HAVE_SYS_WAIT_H */
+ #  include <sys/wait.h>
+ #endif
+ #include <errno.h>
diff --git a/brlcad/patches/patch-src_other_openscenegraph_src_OpenThreads_pthreads_PThread.cpp b/brlcad/patches/patch-src_other_openscenegraph_src_OpenThreads_pthreads_PThread.cpp
new file mode 100644
index 0000000..e9f9abb
--- /dev/null
+++ b/brlcad/patches/patch-src_other_openscenegraph_src_OpenThreads_pthreads_PThread.cpp
@@ -0,0 +1,22 @@
+$NetBSD$
+
+--- src/other/openscenegraph/src/OpenThreads/pthreads/PThread.cpp.orig	2016-08-09 06:51:54.000000000 +0000
++++ src/other/openscenegraph/src/OpenThreads/pthreads/PThread.cpp
+@@ -31,7 +31,7 @@
+     #include <sys/unistd.h>
+ #endif
+ #endif
+-#if defined(__sgi)
++#if defined(__sgi) || defined(__NetBSD__)
+ #include <unistd.h>
+ #endif
+ #if defined(__hpux)
+@@ -1008,7 +1008,7 @@ int Thread::microSleep(unsigned int micr
+ //
+ int OpenThreads::GetNumberOfProcessors()
+ {
+-#if defined(__linux__)
++#if defined(__linux__) || defined(__NetBSD__)
+    long ret = sysconf(_SC_NPROCESSORS_ONLN);
+    if (ret == -1)
+       return 0;
diff --git a/brlcad/patches/patch-src_other_openscenegraph_src_osgDB_FileUtils.cpp b/brlcad/patches/patch-src_other_openscenegraph_src_osgDB_FileUtils.cpp
new file mode 100644
index 0000000..7cf11c4
--- /dev/null
+++ b/brlcad/patches/patch-src_other_openscenegraph_src_osgDB_FileUtils.cpp
@@ -0,0 +1,19 @@
+$NetBSD$
+
+--- src/other/openscenegraph/src/osgDB/FileUtils.cpp.orig	2016-08-09 06:52:02.000000000 +0000
++++ src/other/openscenegraph/src/osgDB/FileUtils.cpp
+@@ -76,7 +76,7 @@ typedef char TCHAR;
+     #if (MAC_OS_X_VERSION_MAX_ALLOWED <= 1040)
+         #define stat64 stat
+     #endif
+-#elif defined(__CYGWIN__) || defined(__FreeBSD__) || defined(__DragonFly__) || \
++#elif defined(__CYGWIN__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || \
+       (defined(__hpux) && !defined(_LARGEFILE64_SOURCE))
+     #define stat64 stat
+ #endif
+@@ -1250,5 +1250,3 @@ bool osgDB::containsCurrentWorkingDirect
+     {
+     }
+ #endif
+-
+-
diff --git a/brlcad/patches/patch-src_other_openscenegraph_src_osg_GLExtensions.cpp b/brlcad/patches/patch-src_other_openscenegraph_src_osg_GLExtensions.cpp
new file mode 100644
index 0000000..cfc97b8
--- /dev/null
+++ b/brlcad/patches/patch-src_other_openscenegraph_src_osg_GLExtensions.cpp
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- src/other/openscenegraph/src/osg/GLExtensions.cpp.orig	2016-08-09 06:51:57.000000000 +0000
++++ src/other/openscenegraph/src/osg/GLExtensions.cpp
+@@ -376,7 +376,7 @@ OSG_INIT_SINGLETON_PROXY(GLExtensionDisa
+         static void *handle = dlopen((const char *)0L, RTLD_LAZY);
+         return dlsym(handle, funcName);
+ 
+-    #elif defined (__FreeBSD__)
++    #elif defined (__FreeBSD__) || defined(__NetBSD__)
+ 
+         return dlsym( RTLD_DEFAULT, funcName );
+ 
diff --git a/brlcad/patches/patch-src_other_stepcode_src_base_sc__benchmark.cc b/brlcad/patches/patch-src_other_stepcode_src_base_sc__benchmark.cc
new file mode 100644
index 0000000..37c8b81
--- /dev/null
+++ b/brlcad/patches/patch-src_other_stepcode_src_base_sc__benchmark.cc
@@ -0,0 +1,41 @@
+$NetBSD$
+
+--- src/other/stepcode/src/base/sc_benchmark.cc.orig	2016-08-09 06:47:32.000000000 +0000
++++ src/other/stepcode/src/base/sc_benchmark.cc
+@@ -3,6 +3,12 @@
+ #include "sc_benchmark.h"
+ #include "sc_memmgr.h"
+ 
++#if defined(__NetBSD__)
++#include <sys/param.h>
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#endif
++
+ #ifdef __WIN32__
+ #include <Windows.h>
+ #include <psapi.h>
+@@ -69,6 +75,18 @@ benchVals getMemAndTime( ) {
+         vals.userMilliseconds = 0;
+         vals.sysMilliseconds = 0;
+     }
++#elif defined(__NetBSD__)
++    long page_size_kb = sysconf( _SC_PAGE_SIZE ) / 1024;
++
++    struct kinfo_proc2 kinfo = {};
++    int mib[6] = { CTL_KERN, KERN_PROC2, KERN_PROC_PID, getpid(), sizeof(struct kinfo_proc2), 1 };
++    size_t len = sizeof(kinfo);
++    if (sysctl(mib, __arraycount(mib), &kinfo, &len, NULL, 0) != 0) {
++        vals.physMemKB  = kinfo.p_vm_rssize * page_size_kb;
++        vals.virtMemKB  = (kinfo.p_vm_vsize - kinfo.p_vm_rssize) * page_size_kb;
++        vals.userMilliseconds = (long)kinfo.p_uutime_sec * 1000L + (long)kinfo.p_uutime_usec / 1000L;
++        vals.sysMilliseconds  = (long)kinfo.p_ustime_sec * 1000L + (long)kinfo.p_ustime_usec / 1000L;
++    }
+ #else
+ #warning Unknown platform!
+ #endif // __linux__
+@@ -142,4 +160,3 @@ std::string benchmark::str( const benchV
+     ss << "kb; User CPU time: " << bv.userMilliseconds << "ms; System CPU time: " << bv.sysMilliseconds << "ms";
+     return ss.str();
+ }
+-
diff --git a/brlcad/patches/patch-src_other_tcl_generic_tclInt.h b/brlcad/patches/patch-src_other_tcl_generic_tclInt.h
new file mode 100644
index 0000000..90f6856
--- /dev/null
+++ b/brlcad/patches/patch-src_other_tcl_generic_tclInt.h
@@ -0,0 +1,27 @@
+$NetBSD$
+
+--- src/other/tcl/generic/tclInt.h.orig	2016-08-09 06:47:11.000000000 +0000
++++ src/other/tcl/generic/tclInt.h
+@@ -40,21 +40,9 @@
+ #include <stdio.h>
+ 
+ #include <ctype.h>
+-#ifdef NO_STDLIB_H
+-#   include "../compat/stdlib.h"
+-#else
+-#   include <stdlib.h>
+-#endif
+-#ifdef NO_STRING_H
+-#include "../compat/string.h"
+-#else
++#include <stdlib.h>
+ #include <string.h>
+-#endif
+-#ifdef STDC_HEADERS
+ #include <stddef.h>
+-#else
+-typedef int ptrdiff_t;
+-#endif
+ 
+ /*
+  * Ensure WORDS_BIGENDIAN is defined correctly:
diff --git a/brlcad/patches/patch-src_other_tcl_generic_tclPosixStr.c b/brlcad/patches/patch-src_other_tcl_generic_tclPosixStr.c
new file mode 100644
index 0000000..08e4de4
--- /dev/null
+++ b/brlcad/patches/patch-src_other_tcl_generic_tclPosixStr.c
@@ -0,0 +1,22 @@
+$NetBSD$
+
+--- src/other/tcl/generic/tclPosixStr.c.orig	2016-08-09 06:47:08.000000000 +0000
++++ src/other/tcl/generic/tclPosixStr.c
+@@ -337,7 +337,7 @@ Tcl_ErrnoId(void)
+ #if defined(EOPNOTSUPP) &&  (!defined(ENOTSUP) || (ENOTSUP != EOPNOTSUPP))
+     case EOPNOTSUPP: return "EOPNOTSUPP";
+ #endif
+-#if defined(EOVERFLOW) && (!defined(EFBIG) || (EOVERFLOW != EFBIG)) && (!defined(EINVAL) || (EOVERFLOW != EINVAL))
++#if defined(EOVERFLOW) && (!defined(EFBIG) || (EOVERFLOW != EFBIG)) && (!defined(EINVAL) || (EOVERFLOW != EINVAL)) && (!defined(ERANGE) || (EOVERFLOW != ERANGE))
+     case EOVERFLOW: return "EOVERFLOW";
+ #endif
+ #ifdef EPERM
+@@ -785,7 +785,7 @@ Tcl_ErrnoMsg(
+ #if defined(EOPNOTSUPP) &&  (!defined(ENOTSUP) || (ENOTSUP != EOPNOTSUPP))
+     case EOPNOTSUPP: return "operation not supported on socket";
+ #endif
+-#if defined(EOVERFLOW) && (!defined(EFBIG) || (EOVERFLOW != EFBIG)) && (!defined(EINVAL) || (EOVERFLOW != EINVAL))
++#if defined(EOVERFLOW) && (!defined(EFBIG) || (EOVERFLOW != EFBIG)) && (!defined(EINVAL) || (EOVERFLOW != EINVAL)) && (!defined(ERANGE) || (EOVERFLOW != ERANGE))
+     case EOVERFLOW: return "file too big";
+ #endif
+ #ifdef EPERM
diff --git a/brlcad/patches/patch-src_other_tcl_tests_load.test b/brlcad/patches/patch-src_other_tcl_tests_load.test
new file mode 100644
index 0000000..727b56c
--- /dev/null
+++ b/brlcad/patches/patch-src_other_tcl_tests_load.test
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- src/other/tcl/tests/load.test.orig	2016-08-09 06:50:57.000000000 +0000
++++ src/other/tcl/tests/load.test
+@@ -23,7 +23,7 @@ if {![info exists ext]} {
+     set ext [info sharedlibextension]
+ }
+ # Tests require the existence of one of the DLLs in the dltest directory.
+-set testDir [file join [file dirname [info nameofexecutable]] dltest]
++set testDir [file join [file dirname [info nameofexecutable]] .. dltest .libs ]
+ set x [file join $testDir pkga$ext]
+ set dll "[file tail $x]Required"
+ testConstraint $dll [file readable $x]
diff --git a/brlcad/patches/patch-src_other_tcl_unix_tclUnixCompat.c b/brlcad/patches/patch-src_other_tcl_unix_tclUnixCompat.c
new file mode 100644
index 0000000..e74646c
--- /dev/null
+++ b/brlcad/patches/patch-src_other_tcl_unix_tclUnixCompat.c
@@ -0,0 +1,54 @@
+$NetBSD$
+
+--- src/other/tcl/unix/tclUnixCompat.c.orig	2016-08-09 06:47:10.000000000 +0000
++++ src/other/tcl/unix/tclUnixCompat.c
+@@ -101,7 +101,7 @@ static Tcl_ThreadDataKey dataKey;
+      (!defined(HAVE_MTSAFE_GETHOSTBYNAME) || \
+       !defined(HAVE_MTSAFE_GETHOSTBYADDR))) || \
+       !defined(HAVE_GETPWNAM_R) || !defined(HAVE_GETPWUID_R) || \
+-      !defined(HAVE_GETGRNAM_R) || !defined(HAVE_GETGRGID_R)
++      !defined(HAVE_GETGRNAM_R) || !defined(HAVE_GETGRGID_R) || defined(__NetBSD__)
+ /*
+  * Mutex to lock access to MT-unsafe calls. This is just to protect our own
+  * usage. It does not protect us from others calling the same functions
+@@ -382,13 +382,13 @@ TclpGetHostByName(
+ #else
+     ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+ 
+-#if defined(HAVE_GETHOSTBYNAME_R_5)
++#if defined(HAVE_GETHOSTBYNAME_R_5) && !defined(__NetBSD__)
+     int h_errno;
+ 
+     return gethostbyname_r(name, &tsdPtr->hent, tsdPtr->hbuf,
+ 			   sizeof(tsdPtr->hbuf), &h_errno);
+ 
+-#elif defined(HAVE_GETHOSTBYNAME_R_6)
++#elif defined(HAVE_GETHOSTBYNAME_R_6) && !defined(__NetBSD__)
+     struct hostent *hePtr = NULL;
+     int h_errno, result;
+ 
+@@ -396,7 +396,7 @@ TclpGetHostByName(
+ 	    sizeof(tsdPtr->hbuf), &hePtr, &h_errno);
+     return (result == 0) ? hePtr : NULL;
+ 
+-#elif defined(HAVE_GETHOSTBYNAME_R_3)
++#elif defined(HAVE_GETHOSTBYNAME_R_3) && !defined(__NetBSD__)
+     struct hostent_data data;
+ 
+     return (gethostbyname_r(name, &tsdPtr->hent, &data) == 0)
+@@ -452,13 +452,13 @@ TclpGetHostByAddr(
+ #else
+     ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+ 
+-#if defined(HAVE_GETHOSTBYADDR_R_7)
++#if defined(HAVE_GETHOSTBYADDR_R_7) && !defined(__NetBSD__)
+     int h_errno;
+ 
+     return gethostbyaddr_r(addr, length, type, &tsdPtr->hent, tsdPtr->hbuf,
+ 	    sizeof(tsdPtr->hbuf), &h_errno);
+ 
+-#elif defined(HAVE_GETHOSTBYADDR_R_8)
++#elif defined(HAVE_GETHOSTBYADDR_R_8) && !defined(__NetBSD__)
+     struct hostent *hePtr;
+     int h_errno;
+ 
diff --git a/brlcad/patches/patch-src_other_tcl_unix_tclUnixInit.c b/brlcad/patches/patch-src_other_tcl_unix_tclUnixInit.c
new file mode 100644
index 0000000..49d6c54
--- /dev/null
+++ b/brlcad/patches/patch-src_other_tcl_unix_tclUnixInit.c
@@ -0,0 +1,44 @@
+$NetBSD$
+
+--- src/other/tcl/unix/tclUnixInit.c.orig	2016-08-09 06:47:10.000000000 +0000
++++ src/other/tcl/unix/tclUnixInit.c
+@@ -54,6 +54,11 @@
+ #   endif
+ # endif
+ #endif
++#if defined(__NetBSD__)
++#include <sys/param.h>
++#include <sys/sysctl.h>
++#include <sys/utsname.h>
++#endif
+ 
+ /*
+  * Define TCL_NO_STACK_CHECK in the compiler options if you want to revert to
+@@ -789,6 +794,11 @@ TclpSetVariables(
+ #endif
+     int unameOK;
+     Tcl_DString ds;
++#if defined(__NetBSD__)
++    char machine_arch[SYS_NMLN];
++    int mib[2] = { CTL_HW, HW_MACHINE_ARCH };
++    size_t len = sizeof(machine_arch);
++#endif
+ 
+ #ifdef HAVE_COREFOUNDATION
+     char tclLibPath[MAXPATHLEN + 1];
+@@ -939,8 +949,15 @@ TclpSetVariables(
+ 
+ #endif /* DJGPP */
+ 	}
++#if defined(__NetBSD__)
++       if (sysctl(mib, sizeof(mib) / sizeof(int), machine_arch, &len, NULL, 0) < 0)
++           unameOK = 0;
++       else
++            Tcl_SetVar2(interp, "tcl_platform", "machine", machine_arch, TCL_GLOBAL_ONLY);
++#else
+ 	Tcl_SetVar2(interp, "tcl_platform", "machine", name.machine,
+ 		TCL_GLOBAL_ONLY);
++#endif /* __NetBSD__ */
+     }
+ #endif /* !NO_UNAME */
+     if (!unameOK) {
diff --git a/brlcad/patches/patch-src_other_tcl_unix_tclUnixPort.h b/brlcad/patches/patch-src_other_tcl_unix_tclUnixPort.h
new file mode 100644
index 0000000..f229613
--- /dev/null
+++ b/brlcad/patches/patch-src_other_tcl_unix_tclUnixPort.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+--- src/other/tcl/unix/tclUnixPort.h.orig	2016-08-09 06:47:12.000000000 +0000
++++ src/other/tcl/unix/tclUnixPort.h
+@@ -112,11 +112,7 @@ typedef off_t		Tcl_SeekOffset;
+ #if HAVE_STDINT_H
+ #   include <stdint.h>
+ #endif
+-#ifdef HAVE_UNISTD_H
+-#   include <unistd.h>
+-#else
+-#   include "../compat/unistd.h"
+-#endif
++#include <unistd.h>
+ 
+ MODULE_SCOPE int TclUnixSetBlockingMode(int fd, int mode);
+ 


Home | Main Index | Thread Index | Old Index