mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-17 09:10:08 +02:00
753 lines
22 KiB
Plaintext
753 lines
22 KiB
Plaintext
From 75ee085f8a8842e3411d27003d9d47d415bca3a8 Mon Sep 17 00:00:00 2001
|
|
From: Ken Mays <kmays2000@gmail.com>
|
|
Date: Sat, 27 Jun 2020 00:09:11 +0200
|
|
Subject: Haiku support
|
|
|
|
|
|
diff --git a/configure.in b/configure.in
|
|
index 1a3e489..923d5f4 100644
|
|
--- a/configure.in
|
|
+++ b/configure.in
|
|
@@ -1396,6 +1396,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=_haiku.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)
|
|
@@ -1538,7 +1562,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
|
|
@@ -2336,7 +2360,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/_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..a9bde33
|
|
--- /dev/null
|
|
+++ b/pr/include/md/_haiku.h
|
|
@@ -0,0 +1,86 @@
|
|
+/* -*- 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_HAVE_POSIX_NAMED_SHARED_MEMORY
|
|
+
|
|
+#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/_linux.h b/pr/include/md/_linux.h
|
|
index ad57d08..c984457 100644
|
|
--- a/pr/include/md/_linux.h
|
|
+++ b/pr/include/md/_linux.h
|
|
@@ -315,7 +315,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
|
|
@@ -336,7 +336,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 92010d7..a9c15ed 100644
|
|
--- a/pr/include/md/_pth.h
|
|
+++ b/pr/include/md/_pth.h
|
|
@@ -66,7 +66,7 @@
|
|
|| defined(HPUX) || defined(FREEBSD) \
|
|
|| defined(NETBSD) || defined(OPENBSD) \
|
|
|| defined(NTO) || defined(DARWIN) \
|
|
- || defined(RISCOS)
|
|
+ || 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)
|
|
@@ -92,7 +92,7 @@
|
|
#if (defined(AIX) && !defined(AIX4_3_PLUS)) \
|
|
|| defined(LINUX) || defined(__GNU__)|| defined(__GLIBC__) \
|
|
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|
|
- || defined(DARWIN)
|
|
+ || defined(DARWIN) || defined(__HAIKU__)
|
|
#define PT_NO_SIGTIMEDWAIT
|
|
#endif
|
|
|
|
@@ -109,7 +109,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)
|
|
@@ -153,7 +153,7 @@ extern int (*_PT_aix_yield_fcn)();
|
|
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|
|
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|
|
|| defined(NTO) || defined(DARWIN) \
|
|
- || defined(RISCOS)
|
|
+ || 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 34d5e6c..448111c 100644
|
|
--- a/pr/include/md/prosdep.h
|
|
+++ b/pr/include/md/prosdep.h
|
|
@@ -40,6 +40,9 @@ PR_BEGIN_EXTERN_C
|
|
#elif defined(OPENBSD)
|
|
#include "md/_openbsd.h"
|
|
|
|
+#elif defined(HAIKU)
|
|
+#include "md/_haiku.h"
|
|
+
|
|
#elif defined(HPUX)
|
|
#include "md/_hpux.h"
|
|
|
|
diff --git a/pr/include/obsolete/protypes.h b/pr/include/obsolete/protypes.h
|
|
index 4ebf9b4..2c751d7 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
|
|
@@ -56,35 +59,43 @@ typedef PRUintn uint;
|
|
* uint64
|
|
*/
|
|
|
|
+#if !defined(__HAIKU__)
|
|
typedef PRUint64 uint64;
|
|
+#endif
|
|
|
|
/*
|
|
* uint32
|
|
*/
|
|
|
|
+#if !defined(__HAIKU__)
|
|
#if !defined(_WIN32) && !defined(NTO)
|
|
typedef PRUint32 uint32;
|
|
#else
|
|
typedef unsigned long uint32;
|
|
#endif
|
|
+#endif
|
|
|
|
/*
|
|
* 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 +104,7 @@ typedef PRInt64 int64;
|
|
*/
|
|
|
|
#if !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
|
- && !defined(HPUX)
|
|
+ && !defined(HPUX) && !defined(__HAIKU__)
|
|
#if !defined(_WIN32) && !defined(NTO)
|
|
typedef PRInt32 int32;
|
|
#else
|
|
@@ -106,7 +117,7 @@ typedef long int32;
|
|
*/
|
|
|
|
#if !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
|
- && !defined(HPUX)
|
|
+ && !defined(HPUX) && !defined(__HAIKU__)
|
|
typedef PRInt16 int16;
|
|
#endif
|
|
|
|
@@ -115,7 +126,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/include/prio.h b/pr/include/prio.h
|
|
index f726d47..d0daf62 100644
|
|
--- a/pr/include/prio.h
|
|
+++ b/pr/include/prio.h
|
|
@@ -152,6 +152,9 @@ union PRNetAddr {
|
|
PRUint16 port; /* port number */
|
|
PRUint32 ip; /* The actual 32 bits of address */
|
|
char pad[8];
|
|
+#if defined(HAIKU)
|
|
+ char pad2[16];
|
|
+#endif
|
|
} inet;
|
|
struct {
|
|
PRUint16 family; /* address family (AF_INET6) */
|
|
diff --git a/pr/include/prtypes.h b/pr/include/prtypes.h
|
|
index b81df40..4aa2909 100644
|
|
--- a/pr/include/prtypes.h
|
|
+++ b/pr/include/prtypes.h
|
|
@@ -64,7 +64,7 @@
|
|
#define PR_CALLBACK_DECL
|
|
#define PR_STATIC_CALLBACK(__x) static __x
|
|
|
|
-#elif defined(__declspec)
|
|
+#elif defined(__declspec) && !defined(__HAIKU__)
|
|
|
|
#define PR_EXPORT(__type) extern __declspec(dllexport) __type
|
|
#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
|
|
diff --git a/pr/src/linking/prlink.c b/pr/src/linking/prlink.c
|
|
index 511d992..4188f44 100644
|
|
--- a/pr/src/linking/prlink.c
|
|
+++ b/pr/src/linking/prlink.c
|
|
@@ -241,7 +241,11 @@ PR_GetLibraryPath(void) {
|
|
char* p = NULL;
|
|
int len;
|
|
|
|
+#if defined(HAIKU)
|
|
+ ev = getenv("LIBRARY_PATH");
|
|
+#else
|
|
ev = getenv("LD_LIBRARY_PATH");
|
|
+#endif
|
|
if (!ev) {
|
|
ev = "/usr/lib:/lib";
|
|
}
|
|
diff --git a/pr/src/md/unix/linux.c b/pr/src/md/unix/linux.c
|
|
index 75e47bb..9756882 100644
|
|
--- a/pr/src/md/unix/linux.c
|
|
+++ b/pr/src/md/unix/linux.c
|
|
@@ -22,9 +22,11 @@ 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 b4fc9c8..6447255 100644
|
|
--- a/pr/src/md/unix/uxrng.c
|
|
+++ b/pr/src/md/unix/uxrng.c
|
|
@@ -52,7 +52,7 @@ static size_t GetHighResClock(void* buf, size_t maxbytes) { return 0; }
|
|
|
|
#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 3438e30..d60d22d 100644
|
|
--- a/pr/src/misc/prnetdb.c
|
|
+++ b/pr/src/misc/prnetdb.c
|
|
@@ -1110,7 +1110,7 @@ PR_GetHostByAddr(const PRNetAddr* hostaddr, char* buf, PRIntn bufsize,
|
|
* 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 f045b8c..a9f723b 100644
|
|
--- a/pr/src/pthreads/ptio.c
|
|
+++ b/pr/src/pthreads/ptio.c
|
|
@@ -28,12 +28,13 @@
|
|
# 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)
|
|
# 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"
|
|
-
|
|
# if defined(LINUX) || defined(ANDROID)
|
|
# include <netinet/in.h>
|
|
# endif
|
|
@@ -190,7 +189,7 @@ static PRBool _pr_ipv6_v6only_on_by_default;
|
|
defined(HPUX10_30) || defined(HPUX11) || defined(LINUX) || \
|
|
defined(__GNU__) || defined(__GLIBC__) || defined(FREEBSD) || \
|
|
defined(NETBSD) || defined(OPENBSD) || defined(NTO) || \
|
|
- defined(DARWIN) || defined(RISCOS)
|
|
+ defined(DARWIN) || defined(RISCOS) || defined(__HAIKU__)
|
|
# define _PRSelectFdSetArg_t fd_set*
|
|
# else
|
|
# error "Cannot determine architecture"
|
|
@@ -3276,7 +3275,7 @@ static PRIOMethods _pr_socketpollfd_methods = {
|
|
# if defined(HPUX) || defined(SOLARIS) || defined(LINUX) || \
|
|
defined(__GNU__) || defined(__GLIBC__) || defined(AIX) || \
|
|
defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) || \
|
|
- defined(NTO) || defined(DARWIN) || defined(RISCOS)
|
|
+ defined(NTO) || defined(DARWIN) || 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 20e2f99..41eed36 100644
|
|
--- a/pr/tests/Makefile.in
|
|
+++ b/pr/tests/Makefile.in
|
|
@@ -311,7 +311,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
|
|
@@ -389,6 +389,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 $@
|
|
diff --git a/pr/tests/ipv6.c b/pr/tests/ipv6.c
|
|
index 78b0809..c7002d5 100644
|
|
--- a/pr/tests/ipv6.c
|
|
+++ b/pr/tests/ipv6.c
|
|
@@ -111,7 +111,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 37b231f..e5f59d8 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.45.2
|
|
|