mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-14 15:50:07 +02:00
807 lines
23 KiB
Plaintext
807 lines
23 KiB
Plaintext
From 4b77ba361db250c1a59829dfaf97d64c0f8351c5 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.30.0
|
||
|
||
|
||
From 4140a54407dc15ec54dfa0e4ff07779265a83cce Mon Sep 17 00:00:00 2001
|
||
From: Jerome Duval <jerome.duval@gmail.com>
|
||
Date: Mon, 22 Feb 2021 19:11:19 +0100
|
||
Subject: Haiku library path
|
||
|
||
|
||
diff --git a/pr/src/linking/prlink.c b/pr/src/linking/prlink.c
|
||
index 1f34307..dd0b1e9 100644
|
||
--- a/pr/src/linking/prlink.c
|
||
+++ b/pr/src/linking/prlink.c
|
||
@@ -275,7 +275,11 @@ PR_GetLibraryPath(void)
|
||
char *p=NULL;
|
||
int len;
|
||
|
||
+#if defined(XP_HAIKU)
|
||
+ ev = getenv("LIBRARY_PATH");
|
||
+#else
|
||
ev = getenv("LD_LIBRARY_PATH");
|
||
+#endif
|
||
if (!ev) {
|
||
ev = "/usr/lib:/lib";
|
||
}
|
||
diff --git a/pr/tests/ipv6.c b/pr/tests/ipv6.c
|
||
index cc323e1..01a31ee 100644
|
||
--- a/pr/tests/ipv6.c
|
||
+++ b/pr/tests/ipv6.c
|
||
@@ -122,7 +122,11 @@ int main(int argc, char **argv)
|
||
#define NSPR_LIB "nspr4"
|
||
#endif
|
||
const PRVersionDescription *version_info;
|
||
+#ifdef __HAIKU__
|
||
+ char *nspr_path = PR_GetEnv("LIBRARY_PATH");
|
||
+#else
|
||
char *nspr_path = PR_GetEnv("LD_LIBRARY_PATH");
|
||
+#endif
|
||
char *nspr_name = PR_GetLibraryName(nspr_path, NSPR_LIB);
|
||
PRLibrary *runtime = PR_LoadLibrary(nspr_name);
|
||
if (NULL == runtime) {
|
||
diff --git a/pr/tests/runtests.sh b/pr/tests/runtests.sh
|
||
index 8d31440..e5e6b1f 100755
|
||
--- a/pr/tests/runtests.sh
|
||
+++ b/pr/tests/runtests.sh
|
||
@@ -16,6 +16,7 @@ cd -
|
||
|
||
export DYLD_LIBRARY_PATH=${ABS_LIB}:${DYLD_LIBRARY_PATH}
|
||
export LD_LIBRARY_PATH=${ABS_LIB}:${LD_LIBRARY_PATH}
|
||
+export LIBRARY_PATH=${ABS_LIB}:${LIBRARY_PATH}
|
||
export PATH=${ABS_LIB}:${PATH}
|
||
|
||
#
|
||
--
|
||
2.30.0
|
||
|
||
|
||
From 847bc98cf2148b0a3829922bc5f2181fbace208c Mon Sep 17 00:00:00 2001
|
||
From: Jerome Duval <jerome.duval@gmail.com>
|
||
Date: Sat, 27 Feb 2021 17:33:32 +0100
|
||
Subject: _haiku.cfg for Haiku
|
||
|
||
|
||
diff --git a/configure.in b/configure.in
|
||
index a3b6610..8b3003e 100644
|
||
--- a/configure.in
|
||
+++ b/configure.in
|
||
@@ -1492,7 +1492,7 @@ tools are selected during the Xcode/Developer Tools installation.])
|
||
DSO_CFLAGS="-fPIC"
|
||
USE_PTHREADS=1
|
||
IMPL_STRATEGY=_PTH
|
||
- MDCPUCFG_H=_linux.cfg
|
||
+ MDCPUCFG_H=_haiku.cfg
|
||
if test -n "$USE_64"; then
|
||
PR_MD_ASFILES=os_Linux_x86_64.s
|
||
else
|
||
diff --git a/pr/include/md/_haiku.cfg b/pr/include/md/_haiku.cfg
|
||
new file mode 100644
|
||
index 0000000..3cf3cd9
|
||
--- /dev/null
|
||
+++ b/pr/include/md/_haiku.cfg
|
||
@@ -0,0 +1,220 @@
|
||
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||
+/* This Source Code Form is subject to the terms of the Mozilla Public
|
||
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
|
||
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||
+
|
||
+#ifndef nspr_cpucfg___
|
||
+#define nspr_cpucfg___
|
||
+
|
||
+#ifndef XP_UNIX
|
||
+#define XP_UNIX
|
||
+#endif
|
||
+
|
||
+#if !defined(HAIKU) && defined(__HAIKU__)
|
||
+#define HAIKU
|
||
+#endif
|
||
+
|
||
+#define PR_AF_INET6 5 /* same as AF_INET6 */
|
||
+
|
||
+#if defined(__x86_64__)
|
||
+
|
||
+#ifdef __ILP32__
|
||
+
|
||
+#define IS_LITTLE_ENDIAN 1
|
||
+#undef IS_BIG_ENDIAN
|
||
+
|
||
+#define PR_BYTES_PER_BYTE 1
|
||
+#define PR_BYTES_PER_SHORT 2
|
||
+#define PR_BYTES_PER_INT 4
|
||
+#define PR_BYTES_PER_INT64 8
|
||
+#define PR_BYTES_PER_LONG 4
|
||
+#define PR_BYTES_PER_FLOAT 4
|
||
+#define PR_BYTES_PER_DOUBLE 8
|
||
+#define PR_BYTES_PER_WORD 4
|
||
+#define PR_BYTES_PER_DWORD 8
|
||
+
|
||
+#define PR_BITS_PER_BYTE 8
|
||
+#define PR_BITS_PER_SHORT 16
|
||
+#define PR_BITS_PER_INT 32
|
||
+#define PR_BITS_PER_INT64 64
|
||
+#define PR_BITS_PER_LONG 32
|
||
+#define PR_BITS_PER_FLOAT 32
|
||
+#define PR_BITS_PER_DOUBLE 64
|
||
+#define PR_BITS_PER_WORD 32
|
||
+
|
||
+#define PR_BITS_PER_BYTE_LOG2 3
|
||
+#define PR_BITS_PER_SHORT_LOG2 4
|
||
+#define PR_BITS_PER_INT_LOG2 5
|
||
+#define PR_BITS_PER_INT64_LOG2 6
|
||
+#define PR_BITS_PER_LONG_LOG2 5
|
||
+#define PR_BITS_PER_FLOAT_LOG2 5
|
||
+#define PR_BITS_PER_DOUBLE_LOG2 6
|
||
+#define PR_BITS_PER_WORD_LOG2 5
|
||
+
|
||
+#define PR_ALIGN_OF_SHORT 2
|
||
+#define PR_ALIGN_OF_INT 4
|
||
+#define PR_ALIGN_OF_LONG 4
|
||
+#define PR_ALIGN_OF_INT64 8
|
||
+#define PR_ALIGN_OF_FLOAT 4
|
||
+#define PR_ALIGN_OF_DOUBLE 8
|
||
+#define PR_ALIGN_OF_POINTER 4
|
||
+#define PR_ALIGN_OF_WORD 4
|
||
+
|
||
+#define PR_BYTES_PER_WORD_LOG2 2
|
||
+#define PR_BYTES_PER_DWORD_LOG2 3
|
||
+
|
||
+#else
|
||
+
|
||
+#define IS_LITTLE_ENDIAN 1
|
||
+#undef IS_BIG_ENDIAN
|
||
+#define IS_64
|
||
+
|
||
+#define PR_BYTES_PER_BYTE 1
|
||
+#define PR_BYTES_PER_SHORT 2
|
||
+#define PR_BYTES_PER_INT 4
|
||
+#define PR_BYTES_PER_INT64 8
|
||
+#define PR_BYTES_PER_LONG 8
|
||
+#define PR_BYTES_PER_FLOAT 4
|
||
+#define PR_BYTES_PER_DOUBLE 8
|
||
+#define PR_BYTES_PER_WORD 8
|
||
+#define PR_BYTES_PER_DWORD 8
|
||
+
|
||
+#define PR_BITS_PER_BYTE 8
|
||
+#define PR_BITS_PER_SHORT 16
|
||
+#define PR_BITS_PER_INT 32
|
||
+#define PR_BITS_PER_INT64 64
|
||
+#define PR_BITS_PER_LONG 64
|
||
+#define PR_BITS_PER_FLOAT 32
|
||
+#define PR_BITS_PER_DOUBLE 64
|
||
+#define PR_BITS_PER_WORD 64
|
||
+
|
||
+#define PR_BITS_PER_BYTE_LOG2 3
|
||
+#define PR_BITS_PER_SHORT_LOG2 4
|
||
+#define PR_BITS_PER_INT_LOG2 5
|
||
+#define PR_BITS_PER_INT64_LOG2 6
|
||
+#define PR_BITS_PER_LONG_LOG2 6
|
||
+#define PR_BITS_PER_FLOAT_LOG2 5
|
||
+#define PR_BITS_PER_DOUBLE_LOG2 6
|
||
+#define PR_BITS_PER_WORD_LOG2 6
|
||
+
|
||
+#define PR_ALIGN_OF_SHORT 2
|
||
+#define PR_ALIGN_OF_INT 4
|
||
+#define PR_ALIGN_OF_LONG 8
|
||
+#define PR_ALIGN_OF_INT64 8
|
||
+#define PR_ALIGN_OF_FLOAT 4
|
||
+#define PR_ALIGN_OF_DOUBLE 8
|
||
+#define PR_ALIGN_OF_POINTER 8
|
||
+#define PR_ALIGN_OF_WORD 8
|
||
+
|
||
+#define PR_BYTES_PER_WORD_LOG2 3
|
||
+#define PR_BYTES_PER_DWORD_LOG2 3
|
||
+
|
||
+#endif
|
||
+
|
||
+#elif defined(__i386__)
|
||
+
|
||
+#define IS_LITTLE_ENDIAN 1
|
||
+#undef IS_BIG_ENDIAN
|
||
+
|
||
+#define PR_BYTES_PER_BYTE 1
|
||
+#define PR_BYTES_PER_SHORT 2
|
||
+#define PR_BYTES_PER_INT 4
|
||
+#define PR_BYTES_PER_INT64 8
|
||
+#define PR_BYTES_PER_LONG 4
|
||
+#define PR_BYTES_PER_FLOAT 4
|
||
+#define PR_BYTES_PER_DOUBLE 8
|
||
+#define PR_BYTES_PER_WORD 4
|
||
+#define PR_BYTES_PER_DWORD 8
|
||
+
|
||
+#define PR_BITS_PER_BYTE 8
|
||
+#define PR_BITS_PER_SHORT 16
|
||
+#define PR_BITS_PER_INT 32
|
||
+#define PR_BITS_PER_INT64 64
|
||
+#define PR_BITS_PER_LONG 32
|
||
+#define PR_BITS_PER_FLOAT 32
|
||
+#define PR_BITS_PER_DOUBLE 64
|
||
+#define PR_BITS_PER_WORD 32
|
||
+
|
||
+#define PR_BITS_PER_BYTE_LOG2 3
|
||
+#define PR_BITS_PER_SHORT_LOG2 4
|
||
+#define PR_BITS_PER_INT_LOG2 5
|
||
+#define PR_BITS_PER_INT64_LOG2 6
|
||
+#define PR_BITS_PER_LONG_LOG2 5
|
||
+#define PR_BITS_PER_FLOAT_LOG2 5
|
||
+#define PR_BITS_PER_DOUBLE_LOG2 6
|
||
+#define PR_BITS_PER_WORD_LOG2 5
|
||
+
|
||
+#define PR_ALIGN_OF_SHORT 2
|
||
+#define PR_ALIGN_OF_INT 4
|
||
+#define PR_ALIGN_OF_LONG 4
|
||
+#define PR_ALIGN_OF_INT64 4
|
||
+#define PR_ALIGN_OF_FLOAT 4
|
||
+#define PR_ALIGN_OF_DOUBLE 4
|
||
+#define PR_ALIGN_OF_POINTER 4
|
||
+#define PR_ALIGN_OF_WORD 4
|
||
+
|
||
+#define PR_BYTES_PER_WORD_LOG2 2
|
||
+#define PR_BYTES_PER_DWORD_LOG2 3
|
||
+
|
||
+#else
|
||
+
|
||
+#error "Unknown CPU architecture"
|
||
+
|
||
+#endif
|
||
+
|
||
+#ifndef HAVE_LONG_LONG
|
||
+#define HAVE_LONG_LONG
|
||
+#endif
|
||
+#if PR_ALIGN_OF_DOUBLE == 8
|
||
+#define HAVE_ALIGNED_DOUBLES
|
||
+#endif
|
||
+#if PR_ALIGN_OF_INT64 == 8
|
||
+#define HAVE_ALIGNED_LONGLONGS
|
||
+#endif
|
||
+
|
||
+#ifndef NO_NSPR_10_SUPPORT
|
||
+
|
||
+#define BYTES_PER_BYTE PR_BYTES_PER_BYTE
|
||
+#define BYTES_PER_SHORT PR_BYTES_PER_SHORT
|
||
+#define BYTES_PER_INT PR_BYTES_PER_INT
|
||
+#define BYTES_PER_INT64 PR_BYTES_PER_INT64
|
||
+#define BYTES_PER_LONG PR_BYTES_PER_LONG
|
||
+#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
|
||
+#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
|
||
+#define BYTES_PER_WORD PR_BYTES_PER_WORD
|
||
+#define BYTES_PER_DWORD PR_BYTES_PER_DWORD
|
||
+
|
||
+#define BITS_PER_BYTE PR_BITS_PER_BYTE
|
||
+#define BITS_PER_SHORT PR_BITS_PER_SHORT
|
||
+#define BITS_PER_INT PR_BITS_PER_INT
|
||
+#define BITS_PER_INT64 PR_BITS_PER_INT64
|
||
+#define BITS_PER_LONG PR_BITS_PER_LONG
|
||
+#define BITS_PER_FLOAT PR_BITS_PER_FLOAT
|
||
+#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
|
||
+#define BITS_PER_WORD PR_BITS_PER_WORD
|
||
+
|
||
+#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
|
||
+#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
|
||
+#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
|
||
+#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
|
||
+#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
|
||
+#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
|
||
+#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
|
||
+#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
|
||
+
|
||
+#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
|
||
+#define ALIGN_OF_INT PR_ALIGN_OF_INT
|
||
+#define ALIGN_OF_LONG PR_ALIGN_OF_LONG
|
||
+#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
|
||
+#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
|
||
+#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
|
||
+#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
|
||
+#define ALIGN_OF_WORD PR_ALIGN_OF_WORD
|
||
+
|
||
+#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
|
||
+#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
|
||
+#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
|
||
+
|
||
+#endif /* NO_NSPR_10_SUPPORT */
|
||
+
|
||
+#endif /* nspr_cpucfg___ */
|
||
diff --git a/pr/include/md/_haiku.h b/pr/include/md/_haiku.h
|
||
new file mode 100644
|
||
index 0000000..fb9dbc7
|
||
--- /dev/null
|
||
+++ b/pr/include/md/_haiku.h
|
||
@@ -0,0 +1,85 @@
|
||
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||
+/* This Source Code Form is subject to the terms of the Mozilla Public
|
||
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
|
||
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||
+
|
||
+#ifndef nspr_haiku_defs_h___
|
||
+#define nspr_haiku_defs_h___
|
||
+
|
||
+#include "prthread.h"
|
||
+
|
||
+#define PR_LINKER_ARCH "haiku"
|
||
+#define _PR_SI_SYSNAME "HAIKU"
|
||
+#if defined(__i386__)
|
||
+#define _PR_SI_ARCHITECTURE "x86"
|
||
+#elif defined(__alpha__)
|
||
+#define _PR_SI_ARCHITECTURE "alpha"
|
||
+#elif defined(__sparc__)
|
||
+#define _PR_SI_ARCHITECTURE "sparc"
|
||
+#elif defined(__ia64__)
|
||
+#define _PR_SI_ARCHITECTURE "ia64"
|
||
+#elif defined(__amd64__)
|
||
+#define _PR_SI_ARCHITECTURE "amd64"
|
||
+#elif defined(__powerpc64__)
|
||
+#define _PR_SI_ARCHITECTURE "powerpc64"
|
||
+#elif defined(__powerpc__)
|
||
+#define _PR_SI_ARCHITECTURE "powerpc"
|
||
+#elif defined(__aarch64__)
|
||
+#define _PR_SI_ARCHITECTURE "aarch64"
|
||
+#elif defined(__arm__)
|
||
+#define _PR_SI_ARCHITECTURE "arm"
|
||
+#elif defined(__mips64__)
|
||
+#define _PR_SI_ARCHITECTURE "mips64"
|
||
+#elif defined(__mips__)
|
||
+#define _PR_SI_ARCHITECTURE "mips"
|
||
+#else
|
||
+#error "Unknown CPU architecture"
|
||
+#endif
|
||
+#if defined(__ELF__)
|
||
+#define PR_DLL_SUFFIX ".so"
|
||
+#else
|
||
+#define PR_DLL_SUFFIX ".so.1.0"
|
||
+#endif
|
||
+
|
||
+#define _PR_VMBASE 0x30000000
|
||
+#define _PR_STACK_VMBASE 0x50000000
|
||
+#define _MD_DEFAULT_STACK_SIZE 65536L
|
||
+#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||
+
|
||
+#undef HAVE_STACK_GROWING_UP
|
||
+#define HAVE_DLL
|
||
+#define USE_DLFCN
|
||
+#define _PR_HAVE_SOCKADDR_LEN
|
||
+#define _PR_STAT_HAS_ST_ATIM
|
||
+#define _PR_HAVE_LARGE_OFF_T
|
||
+
|
||
+#define _PR_POLL_AVAILABLE
|
||
+#undef _PR_USE_POLL
|
||
+
|
||
+#define _PR_HAVE_SYSV_SEMAPHORES
|
||
+
|
||
+#define _PR_INET6
|
||
+#define _PR_HAVE_INET_NTOP
|
||
+#define _PR_HAVE_GETHOSTBYNAME2
|
||
+#define _PR_HAVE_GETADDRINFO
|
||
+#define _PR_INET6_PROBE
|
||
+#define _PR_IPV6_V6ONLY_PROBE
|
||
+
|
||
+#define USE_SETJMP
|
||
+
|
||
+extern void _MD_EarlyInit(void);
|
||
+
|
||
+#define _MD_EARLY_INIT _MD_EarlyInit
|
||
+#define _MD_FINAL_INIT _PR_UnixInit
|
||
+#define _PR_HAVE_CLOCK_MONOTONIC
|
||
+
|
||
+/* freebsd has INADDR_LOOPBACK defined, but in /usr/include/rpc/types.h, and I didn't
|
||
+ want to be including that.. */
|
||
+#ifndef INADDR_LOOPBACK
|
||
+#define INADDR_LOOPBACK (u_long)0x7F000001
|
||
+#endif
|
||
+
|
||
+/* For writev() */
|
||
+#include <sys/uio.h>
|
||
+
|
||
+#endif /* nspr_haiku_defs_h___ */
|
||
diff --git a/pr/include/md/prosdep.h b/pr/include/md/prosdep.h
|
||
index e372315..4ee4f67 100644
|
||
--- a/pr/include/md/prosdep.h
|
||
+++ b/pr/include/md/prosdep.h
|
||
@@ -46,10 +46,13 @@ PR_BEGIN_EXTERN_C
|
||
#elif defined(BSDI)
|
||
#include "md/_bsdi.h"
|
||
|
||
+#elif defined(HAIKU)
|
||
+#include "md/_haiku.h"
|
||
+
|
||
#elif defined(HPUX)
|
||
#include "md/_hpux.h"
|
||
|
||
-#elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) || defined(__HAIKU__)
|
||
+#elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)
|
||
#include "md/_linux.h"
|
||
|
||
#elif defined(DARWIN)
|
||
diff --git a/pr/src/pthreads/ptio.c b/pr/src/pthreads/ptio.c
|
||
index 8f685c9..34119e4 100644
|
||
--- a/pr/src/pthreads/ptio.c
|
||
+++ b/pr/src/pthreads/ptio.c
|
||
@@ -34,6 +34,7 @@
|
||
#if defined(SOLARIS) || defined(UNIXWARE)
|
||
#include <sys/filio.h> /* to pick up FIONREAD */
|
||
#endif
|
||
+#include "primpl.h"
|
||
#ifdef _PR_POLL_AVAILABLE
|
||
#include <poll.h>
|
||
#endif
|
||
@@ -153,8 +154,6 @@ static ssize_t (*pt_aix_sendfile_fptr)() = NULL;
|
||
#include <sys/sendfile.h>
|
||
#endif
|
||
|
||
-#include "primpl.h"
|
||
-
|
||
#ifdef HAVE_NETINET_TCP_H
|
||
#include <netinet/tcp.h> /* TCP_NODELAY, TCP_MAXSEG */
|
||
#endif
|
||
--
|
||
2.30.0
|
||
|