mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-15 00:00:07 +02:00
403 lines
13 KiB
Plaintext
403 lines
13 KiB
Plaintext
From cd87dcbf617c39626938eb4e58ef69a42989556f Mon Sep 17 00:00:00 2001
|
||
From: Kacper Kasper <kacperkasper@gmail.com>
|
||
Date: Sat, 11 Aug 2018 00:33:28 +0200
|
||
Subject: Migrated previous patchsets
|
||
|
||
* 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 myself.
|
||
Fix build of NSS. NSS uses XP_BEOS and defs for BeOS fail on GCC7.
|
||
|
||
diff --git a/configure.in b/configure.in
|
||
index ea0ae7f..c9bc83f 100644
|
||
--- a/configure.in
|
||
+++ b/configure.in
|
||
@@ -1312,6 +1312,30 @@ case "$target" in
|
||
esac
|
||
;;
|
||
|
||
+*-haiku*)
|
||
+ AC_DEFINE(XP_UNIX)
|
||
+ AC_DEFINE(XP_HAIKU)
|
||
+ 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"])
|
||
+ ;;
|
||
+
|
||
*-bsdi*)
|
||
AC_DEFINE(XP_UNIX)
|
||
AC_DEFINE(BSDI)
|
||
@@ -2560,7 +2584,7 @@ dnl The same goes for BeOS.
|
||
dnl OS/2 has dlfcn in libc.
|
||
|
||
case $target in
|
||
-*-darwin*|*-beos*|*-os2*)
|
||
+*-darwin*|*-beos*|*-haiku*|*-os2*)
|
||
;;
|
||
*)
|
||
AC_CHECK_LIB(dl, dlopen,
|
||
@@ -2667,7 +2691,7 @@ fi
|
||
esac
|
||
|
||
case "$target_os" in
|
||
-darwin*)
|
||
+darwin*|haiku*)
|
||
_HAVE_PTHREADS=1
|
||
;;
|
||
*)
|
||
diff --git a/pr/include/md/_linux.h b/pr/include/md/_linux.h
|
||
index b4b298b..72acbd9 100644
|
||
--- a/pr/include/md/_linux.h
|
||
+++ b/pr/include/md/_linux.h
|
||
@@ -285,7 +285,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
|
||
@@ -306,7 +306,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 5603223..9d71422 100644
|
||
--- a/pr/include/md/_pth.h
|
||
+++ b/pr/include/md/_pth.h
|
||
@@ -89,7 +89,8 @@
|
||
|| defined(HPUX) || defined(FREEBSD) \
|
||
|| defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \
|
||
|| defined(NTO) || defined(DARWIN) \
|
||
- || defined(UNIXWARE) || defined(RISCOS) || defined(SYMBIAN)
|
||
+ || defined(UNIXWARE) || defined(RISCOS) || defined(SYMBIAN) \
|
||
+ || 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 +117,7 @@
|
||
|| defined(LINUX) || defined(__GNU__)|| defined(__GLIBC__) \
|
||
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|
||
|| defined(BSDI) || defined(UNIXWARE) \
|
||
- || defined(DARWIN) || defined(SYMBIAN)
|
||
+ || defined(DARWIN) || defined(SYMBIAN) || defined(HAIKU)
|
||
#define PT_NO_SIGTIMEDWAIT
|
||
#endif
|
||
|
||
@@ -140,7 +141,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(SYMBIAN)
|
||
+ || defined(FREEBSD) || defined(SYMBIAN) || 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)
|
||
@@ -198,7 +199,8 @@ 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(SYMBIAN)
|
||
+ || defined(UNIXWARE) || defined(RISCOS) || defined(SYMBIAN) \
|
||
+ || 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 ea46b3a..b8e6825 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) || defined(SYMBIAN)
|
||
+#if defined(AIX) || defined(SYMBIAN) || defined(HAIKU)
|
||
#include <sys/select.h>
|
||
#endif
|
||
|
||
diff --git a/pr/include/md/prosdep.h b/pr/include/md/prosdep.h
|
||
index 94d8945..3cd48da 100644
|
||
--- a/pr/include/md/prosdep.h
|
||
+++ b/pr/include/md/prosdep.h
|
||
@@ -52,7 +52,7 @@ PR_BEGIN_EXTERN_C
|
||
#elif defined(IRIX)
|
||
#include "md/_irix.h"
|
||
|
||
-#elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)
|
||
+#elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) || defined(HAIKU)
|
||
#include "md/_linux.h"
|
||
|
||
#elif defined(OSF1)
|
||
diff --git a/pr/include/obsolete/protypes.h b/pr/include/obsolete/protypes.h
|
||
index 2275bce..647fad0 100644
|
||
--- a/pr/include/obsolete/protypes.h
|
||
+++ b/pr/include/obsolete/protypes.h
|
||
@@ -31,7 +31,7 @@ typedef PRIntn intn;
|
||
* BeOS defines all the int types below in its standard header
|
||
* file SupportDefs.h.
|
||
*/
|
||
-#ifdef XP_BEOS
|
||
+#if defined(XP_BEOS) || defined(XP_HAIKU)
|
||
#include <support/SupportDefs.h>
|
||
#endif
|
||
|
||
@@ -56,7 +56,7 @@ typedef PRIntn intn;
|
||
* uint
|
||
*/
|
||
|
||
-#if !defined(XP_BEOS) && !defined(XP_OS2) && !defined(XP_UNIX) || defined(NTO)
|
||
+#if !defined(XP_BEOS) && !defined(XP_HAIKU) && !defined(XP_OS2) && !defined(XP_UNIX) || defined(NTO)
|
||
typedef PRUintn uint;
|
||
#endif
|
||
|
||
@@ -64,7 +64,7 @@ typedef PRUintn uint;
|
||
* uint64
|
||
*/
|
||
|
||
-#if !defined(XP_BEOS)
|
||
+#if !defined(XP_BEOS) && !defined(XP_HAIKU)
|
||
typedef PRUint64 uint64;
|
||
#endif
|
||
|
||
@@ -72,7 +72,7 @@ typedef PRUint64 uint64;
|
||
* uint32
|
||
*/
|
||
|
||
-#if !defined(XP_BEOS)
|
||
+#if !defined(XP_BEOS) && !defined(XP_HAIKU)
|
||
#if !defined(_WIN32) && !defined(XP_OS2) && !defined(NTO)
|
||
typedef PRUint32 uint32;
|
||
#else
|
||
@@ -84,7 +84,7 @@ typedef unsigned long uint32;
|
||
* uint16
|
||
*/
|
||
|
||
-#if !defined(XP_BEOS)
|
||
+#if !defined(XP_BEOS) && !defined(XP_HAIKU)
|
||
typedef PRUint16 uint16;
|
||
#endif
|
||
|
||
@@ -92,7 +92,7 @@ typedef PRUint16 uint16;
|
||
* uint8
|
||
*/
|
||
|
||
-#if !defined(XP_BEOS)
|
||
+#if !defined(XP_BEOS) && !defined(XP_HAIKU)
|
||
typedef PRUint8 uint8;
|
||
#endif
|
||
|
||
@@ -100,7 +100,7 @@ typedef PRUint8 uint8;
|
||
* int64
|
||
*/
|
||
|
||
-#if !defined(XP_BEOS) && !defined(_PR_AIX_HAVE_BSD_INT_TYPES)
|
||
+#if !defined(XP_BEOS) && !defined(XP_HAIKU) && !defined(_PR_AIX_HAVE_BSD_INT_TYPES)
|
||
typedef PRInt64 int64;
|
||
#endif
|
||
|
||
@@ -108,7 +108,7 @@ typedef PRInt64 int64;
|
||
* int32
|
||
*/
|
||
|
||
-#if !defined(XP_BEOS) && !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||
+#if !defined(XP_BEOS) && !defined(XP_HAIKU) && !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||
&& !defined(HPUX)
|
||
#if !defined(_WIN32) && !defined(XP_OS2) && !defined(NTO)
|
||
typedef PRInt32 int32;
|
||
@@ -121,7 +121,7 @@ typedef long int32;
|
||
* int16
|
||
*/
|
||
|
||
-#if !defined(XP_BEOS) && !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||
+#if !defined(XP_BEOS) && !defined(XP_HAIKU) && !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||
&& !defined(HPUX)
|
||
typedef PRInt16 int16;
|
||
#endif
|
||
@@ -130,7 +130,7 @@ typedef PRInt16 int16;
|
||
* int8
|
||
*/
|
||
|
||
-#if !defined(XP_BEOS) && !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||
+#if !defined(XP_BEOS) && !defined(XP_HAIKU) && !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||
&& !defined(HPUX)
|
||
typedef PRInt8 int8;
|
||
#endif
|
||
diff --git a/pr/include/prtypes.h b/pr/include/prtypes.h
|
||
index 94bca3c..2ae14be 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(XP_BEOS)
|
||
+#elif defined(XP_BEOS) && !defined(XP_HAIKU)
|
||
|
||
#define PR_EXPORT(__type) extern __declspec(dllexport) __type
|
||
#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
|
||
diff --git a/pr/src/md/unix/linux.c b/pr/src/md/unix/linux.c
|
||
index 1b485a0..8a17e4e 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 da2f7e9..cbef872 100644
|
||
--- a/pr/src/md/unix/uxrng.c
|
||
+++ b/pr/src/md/unix/uxrng.c
|
||
@@ -86,7 +86,7 @@ GetHighResClock(void *buf, size_t maxbytes)
|
||
|
||
#elif (defined(LINUX) || defined(FREEBSD) || defined(__FreeBSD_kernel__) \
|
||
|| defined(NETBSD) || defined(__NetBSD_kernel__) || defined(OPENBSD) \
|
||
- || defined(SYMBIAN) || defined(__GNU__))
|
||
+ || defined(SYMBIAN) || 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 affebf6..78d00a0 100644
|
||
--- a/pr/src/misc/prnetdb.c
|
||
+++ b/pr/src/misc/prnetdb.c
|
||
@@ -1153,7 +1153,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 f6aa567..4d08aca 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,8 @@ 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(SYMBIAN)
|
||
+ || defined(UNIXWARE) || defined(RISCOS) || defined(SYMBIAN) \
|
||
+ || defined(HAIKU)
|
||
#define _PRSelectFdSetArg_t fd_set *
|
||
#else
|
||
#error "Cannot determine architecture"
|
||
@@ -3352,7 +3353,7 @@ static PRIOMethods _pr_socketpollfd_methods = {
|
||
|| defined(AIX) || defined(FREEBSD) || defined(NETBSD) \
|
||
|| defined(OPENBSD) || defined(BSDI) || defined(NTO) \
|
||
|| defined(DARWIN) || defined(UNIXWARE) || defined(RISCOS) \
|
||
- || defined(SYMBIAN)
|
||
+ || defined(SYMBIAN) || defined(HAIKU)
|
||
#define _PR_FCNTL_FLAGS O_NONBLOCK
|
||
#else
|
||
#error "Can't determine architecture"
|
||
diff --git a/pr/src/pthreads/ptthread.c b/pr/src/pthreads/ptthread.c
|
||
index e61a4cb..ce22451 100644
|
||
--- a/pr/src/pthreads/ptthread.c
|
||
+++ b/pr/src/pthreads/ptthread.c
|
||
@@ -25,7 +25,7 @@
|
||
#include <pthread_np.h>
|
||
#endif
|
||
|
||
-#ifdef SYMBIAN
|
||
+#if defined(SYMBIAN) || defined(HAIKU)
|
||
/* In Open C sched_get_priority_min/max do not work properly, so we undefine
|
||
* _POSIX_THREAD_PRIORITY_SCHEDULING here.
|
||
*/
|
||
@@ -1371,7 +1371,7 @@ static void suspend_signal_handler(PRIntn sig)
|
||
#if !defined(FREEBSD) && !defined(NETBSD) && !defined(OPENBSD) \
|
||
&& !defined(BSDI) && !defined(UNIXWARE) \
|
||
&& !defined(DARWIN) && !defined(RISCOS) \
|
||
- && !defined(SYMBIAN) /*XXX*/
|
||
+ && !defined(SYMBIAN) && !defined(HAIKU)/*XXX*/
|
||
PRIntn rv;
|
||
sigwait(&sigwait_set, &rv);
|
||
#endif
|
||
diff --git a/pr/tests/Makefile.in b/pr/tests/Makefile.in
|
||
index 79a67f0..6a1dd4d 100644
|
||
--- a/pr/tests/Makefile.in
|
||
+++ b/pr/tests/Makefile.in
|
||
@@ -370,7 +370,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
|
||
@@ -448,6 +448,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.16.4
|
||
|