mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-21 19:20:08 +02:00
372 lines
11 KiB
Plaintext
372 lines
11 KiB
Plaintext
From 84edf90a3246ec87f4f28104d327d9d4e7a197fe Mon Sep 17 00:00:00 2001
|
||
From: Ken Mays <kmays2000@gmail.com>
|
||
Date: Sat, 27 Jun 2020 00:09:11 +0200
|
||
Subject: Migrated NSPR 4.19 patchset to NSPR 4.26
|
||
|
||
* NSPR 4.19 migration by Kacper Kasper
|
||
* Old patchset wouldn't apply anymore.
|
||
* Platform code by korli.
|
||
* pr/include/obsolete/prototypes.h by pulkomandy.
|
||
* Fix build of libpurple.
|
||
* pr/include/prtypes.h by Kacper Kasper.
|
||
Fix build of NSS. NSS uses XP_BEOS and defs for BeOS fail on GCC7.
|
||
|
||
diff --git a/configure.in b/configure.in
|
||
index b62f1cd..a3b6610 100644
|
||
--- a/configure.in
|
||
+++ b/configure.in
|
||
@@ -1483,6 +1483,30 @@ tools are selected during the Xcode/Developer Tools installation.])
|
||
PR_MD_CSRCS=freebsd.c
|
||
;;
|
||
|
||
+*-haiku*)
|
||
+ AC_DEFINE(XP_UNIX)
|
||
+ AC_DEFINE(HAIKU)
|
||
+ AC_DEFINE(Haiku)
|
||
+ AC_DEFINE(HAVE_SOCKLEN_T)
|
||
+ AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
|
||
+ DSO_CFLAGS="-fPIC"
|
||
+ USE_PTHREADS=1
|
||
+ IMPL_STRATEGY=_PTH
|
||
+ MDCPUCFG_H=_linux.cfg
|
||
+ if test -n "$USE_64"; then
|
||
+ PR_MD_ASFILES=os_Linux_x86_64.s
|
||
+ else
|
||
+ PR_MD_ASFILES=os_Linux_x86.s
|
||
+ fi
|
||
+ PR_MD_CSRCS=linux.c
|
||
+ MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
|
||
+ DSO_CFLAGS=-fPIC
|
||
+ DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
|
||
+ _OPTIMIZE_FLAGS=-O2
|
||
+ AC_CHECK_LIB(network, gethostbyaddr, [OS_LIBS="$OS_LIBS -lnetwork"])
|
||
+ ;;
|
||
+
|
||
+
|
||
*-hpux*)
|
||
AC_DEFINE(XP_UNIX)
|
||
AC_DEFINE(HPUX)
|
||
@@ -1632,7 +1656,7 @@ tools are selected during the Xcode/Developer Tools installation.])
|
||
fi
|
||
;;
|
||
|
||
-*-linux*|*-gnu*|*-k*bsd*-gnu|*-android*|*-linuxandroid*)
|
||
+*-linux*|*-gnu*|*-k*bsd*-gnu|*-android*|*-linuxandroid*|*-haiku*)
|
||
if test -z "$USE_NSPR_THREADS"; then
|
||
USE_PTHREADS=1
|
||
IMPL_STRATEGY=_PTH
|
||
@@ -2514,7 +2538,7 @@ if test -n "$USE_PTHREADS"; then
|
||
_PTHREAD_LDFLAGS=-pthread
|
||
fi
|
||
;;
|
||
- *-linux*|*-gnu*|*-k*bsd*-gnu)
|
||
+ *-linux*|*-gnu*|*-k*bsd*-gnu|*-haiku*)
|
||
AC_DEFINE(_REENTRANT)
|
||
;;
|
||
esac
|
||
diff --git a/pr/include/md/_linux.h b/pr/include/md/_linux.h
|
||
index 9c0cff3..3e9874c 100644
|
||
--- a/pr/include/md/_linux.h
|
||
+++ b/pr/include/md/_linux.h
|
||
@@ -299,7 +299,7 @@ static inline PRInt32 _MD_ATOMIC_SET(PRInt32 *ptr, PRInt32 nv)
|
||
#endif /* __arm__ */
|
||
|
||
#define USE_SETJMP
|
||
-#if (defined(__GLIBC__) && __GLIBC__ >= 2) || defined(ANDROID)
|
||
+#if (defined(__GLIBC__) && __GLIBC__ >= 2) || defined(ANDROID) || defined(__HAIKU__)
|
||
#define _PR_POLL_AVAILABLE
|
||
#endif
|
||
#undef _PR_USE_POLL
|
||
@@ -320,7 +320,7 @@ static inline PRInt32 _MD_ATOMIC_SET(PRInt32 *ptr, PRInt32 nv)
|
||
#define _PR_HAVE_GETADDRINFO
|
||
#define _PR_INET6_PROBE
|
||
#endif
|
||
-#ifndef ANDROID
|
||
+#if !defined(ANDROID) && !defined(__HAIKU__)
|
||
#define _PR_HAVE_SYSV_SEMAPHORES
|
||
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
|
||
#endif
|
||
diff --git a/pr/include/md/_pth.h b/pr/include/md/_pth.h
|
||
index 37d26e7..7c1d4c3 100644
|
||
--- a/pr/include/md/_pth.h
|
||
+++ b/pr/include/md/_pth.h
|
||
@@ -89,7 +89,7 @@
|
||
|| defined(HPUX) || defined(FREEBSD) \
|
||
|| defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \
|
||
|| defined(NTO) || defined(DARWIN) \
|
||
- || defined(UNIXWARE) || defined(RISCOS)
|
||
+ || defined(UNIXWARE) || defined(RISCOS) || defined(__HAIKU__)
|
||
#define _PT_PTHREAD_INVALIDATE_THR_HANDLE(t) (t) = 0
|
||
#define _PT_PTHREAD_THR_HANDLE_IS_INVALID(t) (t) == 0
|
||
#define _PT_PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st)
|
||
@@ -116,7 +116,7 @@
|
||
|| defined(LINUX) || defined(__GNU__)|| defined(__GLIBC__) \
|
||
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|
||
|| defined(BSDI) || defined(UNIXWARE) \
|
||
- || defined(DARWIN)
|
||
+ || defined(DARWIN) || defined(__HAIKU__)
|
||
#define PT_NO_SIGTIMEDWAIT
|
||
#endif
|
||
|
||
@@ -133,7 +133,7 @@
|
||
#define PT_PRIO_MIN sched_get_priority_min(SCHED_OTHER)
|
||
#define PT_PRIO_MAX sched_get_priority_max(SCHED_OTHER)
|
||
#elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|
||
- || defined(FREEBSD)
|
||
+ || defined(FREEBSD) || defined(__HAIKU__)
|
||
#define PT_PRIO_MIN sched_get_priority_min(SCHED_OTHER)
|
||
#define PT_PRIO_MAX sched_get_priority_max(SCHED_OTHER)
|
||
#elif defined(NTO)
|
||
@@ -177,7 +177,7 @@ extern int (*_PT_aix_yield_fcn)();
|
||
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|
||
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|
||
|| defined(BSDI) || defined(NTO) || defined(DARWIN) \
|
||
- || defined(UNIXWARE) || defined(RISCOS)
|
||
+ || defined(UNIXWARE) || defined(RISCOS) || defined(__HAIKU__)
|
||
#define _PT_PTHREAD_YIELD() sched_yield()
|
||
#else
|
||
#error "Need to define _PT_PTHREAD_YIELD for this platform"
|
||
diff --git a/pr/include/md/_unixos.h b/pr/include/md/_unixos.h
|
||
index 7d444cd..0cc560b 100644
|
||
--- a/pr/include/md/_unixos.h
|
||
+++ b/pr/include/md/_unixos.h
|
||
@@ -15,7 +15,7 @@
|
||
* not be redefined.
|
||
*/
|
||
#if !defined(LINUX) && !defined(__GNU__) && !defined(__GLIBC__) \
|
||
- && !defined(DARWIN)
|
||
+ && !defined(DARWIN) && !defined(__HAIKU__)
|
||
#ifndef FD_SETSIZE
|
||
#define FD_SETSIZE 4096
|
||
#endif
|
||
@@ -46,7 +46,7 @@
|
||
*/
|
||
#include <sys/time.h>
|
||
#include <sys/types.h>
|
||
-#if defined(AIX)
|
||
+#if defined(AIX) || defined(__HAIKU__)
|
||
#include <sys/select.h>
|
||
#endif
|
||
|
||
diff --git a/pr/include/md/prosdep.h b/pr/include/md/prosdep.h
|
||
index 42eba3d..e372315 100644
|
||
--- a/pr/include/md/prosdep.h
|
||
+++ b/pr/include/md/prosdep.h
|
||
@@ -49,7 +49,7 @@ PR_BEGIN_EXTERN_C
|
||
#elif defined(HPUX)
|
||
#include "md/_hpux.h"
|
||
|
||
-#elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)
|
||
+#elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) || defined(__HAIKU__)
|
||
#include "md/_linux.h"
|
||
|
||
#elif defined(DARWIN)
|
||
diff --git a/pr/include/obsolete/protypes.h b/pr/include/obsolete/protypes.h
|
||
index 5400afb..65eb0f5 100644
|
||
--- a/pr/include/obsolete/protypes.h
|
||
+++ b/pr/include/obsolete/protypes.h
|
||
@@ -9,6 +9,9 @@
|
||
* possible time. The NSPR API is implemented and documented using
|
||
* the new definitions.
|
||
*/
|
||
+#if defined(__HAIKU__)
|
||
+#include <SupportDefs.h>
|
||
+#endif
|
||
|
||
#if !defined(PROTYPES_H)
|
||
#define PROTYPES_H
|
||
@@ -35,7 +38,7 @@ typedef PRIntn intn;
|
||
*
|
||
* On OS/2, sys/types.h defines uint.
|
||
*/
|
||
-#if defined(XP_UNIX) || defined(XP_OS2)
|
||
+#if defined(XP_UNIX) || defined(XP_OS2) || defined(__HAIKU__)
|
||
#include <sys/types.h>
|
||
#endif
|
||
|
||
@@ -48,7 +51,7 @@ typedef PRIntn intn;
|
||
* uint
|
||
*/
|
||
|
||
-#if !defined(XP_OS2) && !defined(XP_UNIX) || defined(NTO)
|
||
+#if !defined(XP_OS2) && !defined(XP_UNIX) && !defined(__HAIKU__) || defined(NTO)
|
||
typedef PRUintn uint;
|
||
#endif
|
||
|
||
@@ -56,13 +59,15 @@ typedef PRUintn uint;
|
||
* uint64
|
||
*/
|
||
|
||
+#if !defined(__HAIKU__)
|
||
typedef PRUint64 uint64;
|
||
+#endif
|
||
|
||
/*
|
||
* uint32
|
||
*/
|
||
|
||
-#if !defined(_WIN32) && !defined(XP_OS2) && !defined(NTO)
|
||
+#if !defined(_WIN32) && !defined(XP_OS2) && !defined(NTO) && defined(__HAIKU__)
|
||
typedef PRUint32 uint32;
|
||
#else
|
||
typedef unsigned long uint32;
|
||
@@ -72,19 +77,23 @@ typedef unsigned long uint32;
|
||
* uint16
|
||
*/
|
||
|
||
+#if !defined(__HAIKU__)
|
||
typedef PRUint16 uint16;
|
||
+#endif
|
||
|
||
/*
|
||
* uint8
|
||
*/
|
||
|
||
+#if !defined(__HAIKU__)
|
||
typedef PRUint8 uint8;
|
||
+#endif
|
||
|
||
/*
|
||
* int64
|
||
*/
|
||
|
||
-#if !defined(_PR_AIX_HAVE_BSD_INT_TYPES)
|
||
+#if !defined(_PR_AIX_HAVE_BSD_INT_TYPES) && !defined(__HAIKU__)
|
||
typedef PRInt64 int64;
|
||
#endif
|
||
|
||
@@ -93,7 +102,7 @@ typedef PRInt64 int64;
|
||
*/
|
||
|
||
#if !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||
- && !defined(HPUX)
|
||
+ && !defined(HPUX) && !defined(__HAIKU__)
|
||
#if !defined(_WIN32) && !defined(XP_OS2) && !defined(NTO)
|
||
typedef PRInt32 int32;
|
||
#else
|
||
@@ -106,7 +115,7 @@ typedef long int32;
|
||
*/
|
||
|
||
#if !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||
- && !defined(HPUX)
|
||
+ && !defined(HPUX) && !defined(__HAIKU__)
|
||
typedef PRInt16 int16;
|
||
#endif
|
||
|
||
@@ -115,7 +124,7 @@ typedef PRInt16 int16;
|
||
*/
|
||
|
||
#if !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||
- && !defined(HPUX)
|
||
+ && !defined(HPUX) && !defined(__HAIKU__)
|
||
typedef PRInt8 int8;
|
||
#endif
|
||
|
||
diff --git a/pr/src/md/unix/linux.c b/pr/src/md/unix/linux.c
|
||
index 6bfc7a8..976085f 100644
|
||
--- a/pr/src/md/unix/linux.c
|
||
+++ b/pr/src/md/unix/linux.c
|
||
@@ -25,12 +25,14 @@ PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np)
|
||
|
||
#ifdef _PR_PTHREADS
|
||
|
||
+#ifndef HAIKU
|
||
extern void _MD_unix_terminate_waitpid_daemon(void);
|
||
|
||
void _MD_CleanupBeforeExit(void)
|
||
{
|
||
_MD_unix_terminate_waitpid_daemon();
|
||
}
|
||
+#endif
|
||
|
||
#else /* ! _PR_PTHREADS */
|
||
|
||
diff --git a/pr/src/md/unix/uxrng.c b/pr/src/md/unix/uxrng.c
|
||
index 4798590..ad10a18 100644
|
||
--- a/pr/src/md/unix/uxrng.c
|
||
+++ b/pr/src/md/unix/uxrng.c
|
||
@@ -64,7 +64,7 @@ GetHighResClock(void *buf, size_t maxbytes)
|
||
|
||
#elif (defined(LINUX) || defined(FREEBSD) || defined(__FreeBSD_kernel__) \
|
||
|| defined(NETBSD) || defined(__NetBSD_kernel__) || defined(OPENBSD) \
|
||
- || defined(__GNU__))
|
||
+ || defined(__GNU__)) || defined(__HAIKU__)
|
||
#include <sys/types.h>
|
||
#include <sys/stat.h>
|
||
#include <fcntl.h>
|
||
diff --git a/pr/src/misc/prnetdb.c b/pr/src/misc/prnetdb.c
|
||
index 6ad0242..32984fa 100644
|
||
--- a/pr/src/misc/prnetdb.c
|
||
+++ b/pr/src/misc/prnetdb.c
|
||
@@ -1198,7 +1198,7 @@ PR_IMPLEMENT(PRStatus) PR_GetHostByAddr(
|
||
* any usable implementation.
|
||
*/
|
||
|
||
-#if defined(ANDROID)
|
||
+#if defined(ANDROID) || defined(__HAIKU__)
|
||
/* Android's Bionic libc system includes prototypes for these in netdb.h,
|
||
* but doesn't actually include implementations. It uses the 5-arg form,
|
||
* so these functions end up not matching the prototype. So just rename
|
||
diff --git a/pr/src/pthreads/ptio.c b/pr/src/pthreads/ptio.c
|
||
index 3ad2d80..8f685c9 100644
|
||
--- a/pr/src/pthreads/ptio.c
|
||
+++ b/pr/src/pthreads/ptio.c
|
||
@@ -28,7 +28,7 @@
|
||
#include <sys/uio.h>
|
||
#include <sys/file.h>
|
||
#include <sys/ioctl.h>
|
||
-#if defined(DARWIN)
|
||
+#if defined(DARWIN) || defined(__HAIKU__)
|
||
#include <sys/utsname.h> /* for uname */
|
||
#endif
|
||
#if defined(SOLARIS) || defined(UNIXWARE)
|
||
@@ -183,7 +183,7 @@ static PRBool _pr_ipv6_v6only_on_by_default;
|
||
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|
||
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|
||
|| defined(BSDI) || defined(NTO) || defined(DARWIN) \
|
||
- || defined(UNIXWARE) || defined(RISCOS)
|
||
+ || defined(UNIXWARE) || defined(RISCOS) || defined(__HAIKU__)
|
||
#define _PRSelectFdSetArg_t fd_set *
|
||
#else
|
||
#error "Cannot determine architecture"
|
||
@@ -3477,7 +3477,7 @@ static PRIOMethods _pr_socketpollfd_methods = {
|
||
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|
||
|| defined(AIX) || defined(FREEBSD) || defined(NETBSD) \
|
||
|| defined(OPENBSD) || defined(BSDI) || defined(NTO) \
|
||
- || defined(DARWIN) || defined(UNIXWARE) || defined(RISCOS)
|
||
+ || defined(DARWIN) || defined(UNIXWARE) || defined(RISCOS) || defined(__HAIKU__)
|
||
#define _PR_FCNTL_FLAGS O_NONBLOCK
|
||
#else
|
||
#error "Can't determine architecture"
|
||
diff --git a/pr/tests/Makefile.in b/pr/tests/Makefile.in
|
||
index a58a846..c5bd9a7 100644
|
||
--- a/pr/tests/Makefile.in
|
||
+++ b/pr/tests/Makefile.in
|
||
@@ -327,7 +327,7 @@ LIBPTHREAD = -lpthread
|
||
ifeq ($(OS_ARCH),AIX)
|
||
LIBPTHREAD = -lpthreads
|
||
endif
|
||
-ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS QNX Darwin OpenUNIX,$(OS_ARCH)))
|
||
+ifeq (,$(filter-out Haiku FreeBSD OpenBSD BSD_OS QNX Darwin OpenUNIX,$(OS_ARCH)))
|
||
LIBPTHREAD =
|
||
endif
|
||
endif
|
||
@@ -405,6 +405,15 @@ $(OBJDIR)/prpoll: $(OBJDIR)/prpoll.o
|
||
$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) -lsocket $(EXTRA_LIBS) -o $@
|
||
endif
|
||
|
||
+ifeq ($(OS_ARCH),Haiku)
|
||
+ifeq ($(USE_IPV6),1)
|
||
+$(OBJDIR)/gethost: $(OBJDIR)/gethost.o
|
||
+ $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) -lnetwork $(EXTRA_LIBS) -o $@
|
||
+endif
|
||
+$(OBJDIR)/prpoll: $(OBJDIR)/prpoll.o
|
||
+ $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) -lnetwork $(EXTRA_LIBS) -o $@
|
||
+endif
|
||
+
|
||
ifeq ($(USE_PTHREADS), 1)
|
||
$(OBJDIR)/attach: $(OBJDIR)/attach.o
|
||
$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
|
||
--
|
||
2.27.0
|