mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-10 05:40:07 +02:00
341 lines
11 KiB
Plaintext
341 lines
11 KiB
Plaintext
From 0462165bf3b651859b56a2fac78c5ebe1abc46ad Mon Sep 17 00:00:00 2001
|
||
From: Jerome Duval <jerome.duval@gmail.com>
|
||
Date: Sat, 27 Sep 2014 10:57:28 +0000
|
||
Subject: Patch from 4.10.6
|
||
|
||
|
||
diff --git a/configure.in b/configure.in
|
||
index 2ab2383..7406732 100644
|
||
--- a/configure.in
|
||
+++ b/configure.in
|
||
@@ -1277,6 +1277,28 @@ case "$target" in
|
||
;;
|
||
esac
|
||
;;
|
||
+
|
||
+*-haiku*)
|
||
+ AC_DEFINE(XP_UNIX)
|
||
+ 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)
|
||
@@ -2515,7 +2537,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,
|
||
@@ -2622,7 +2644,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..98fcd34 100644
|
||
--- a/pr/include/md/_linux.h
|
||
+++ b/pr/include/md/_linux.h
|
||
@@ -285,7 +285,8 @@ 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 +307,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 eeeef04..ef60438 100644
|
||
--- a/pr/include/md/_pth.h
|
||
+++ b/pr/include/md/_pth.h
|
||
@@ -117,7 +117,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)
|
||
@@ -170,7 +171,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
|
||
|
||
@@ -201,7 +202,7 @@
|
||
#endif /* defined(_PR_DCETHREADS) */
|
||
|
||
#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)
|
||
@@ -261,7 +262,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/src/io/prmapopt.c b/pr/src/io/prmapopt.c
|
||
index f92a76b..d155e48 100644
|
||
--- a/pr/src/io/prmapopt.c
|
||
+++ b/pr/src/io/prmapopt.c
|
||
@@ -102,15 +102,15 @@ PRStatus PR_CALLBACK _PR_SocketGetSocketOption(PRFileDesc *fd, PRSocketOptionDat
|
||
case PR_SockOpt_McastLoopback:
|
||
{
|
||
#ifdef WIN32 /* Winsock */
|
||
- BOOL bool;
|
||
+ BOOL value;
|
||
#else
|
||
- PRUint8 bool;
|
||
+ PRUint8 value;
|
||
#endif
|
||
- length = sizeof(bool);
|
||
+ length = sizeof(value);
|
||
rv = _PR_MD_GETSOCKOPT(
|
||
- fd, level, name, (char*)&bool, &length);
|
||
+ fd, level, name, (char*)&value, &length);
|
||
if (PR_SUCCESS == rv)
|
||
- data->value.mcast_loopback = (0 == bool) ? PR_FALSE : PR_TRUE;
|
||
+ data->value.mcast_loopback = (0 == value) ? PR_FALSE : PR_TRUE;
|
||
break;
|
||
}
|
||
case PR_SockOpt_RecvBufferSize:
|
||
@@ -252,13 +252,13 @@ PRStatus PR_CALLBACK _PR_SocketSetSocketOption(PRFileDesc *fd, const PRSocketOpt
|
||
case PR_SockOpt_McastLoopback:
|
||
{
|
||
#ifdef WIN32 /* Winsock */
|
||
- BOOL bool;
|
||
+ BOOL value;
|
||
#else
|
||
- PRUint8 bool;
|
||
+ PRUint8 value;
|
||
#endif
|
||
- bool = data->value.mcast_loopback ? 1 : 0;
|
||
+ value = data->value.mcast_loopback ? 1 : 0;
|
||
rv = _PR_MD_SETSOCKOPT(
|
||
- fd, level, name, (char*)&bool, sizeof(bool));
|
||
+ fd, level, name, (char*)&value, sizeof(value));
|
||
break;
|
||
}
|
||
case PR_SockOpt_RecvBufferSize:
|
||
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 b2f6e43..6ff29e7 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 e4fe519..98278da 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)
|
||
@@ -180,7 +180,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"
|
||
@@ -3256,7 +3257,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 9e12606..351c0bd 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.
|
||
*/
|
||
@@ -1423,7 +1423,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
|
||
@@ -1467,7 +1467,7 @@ static void pt_SuspendSet(PRThread *thred)
|
||
PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS,
|
||
("doing pthread_kill in pt_SuspendSet thred %p tid = %X\n",
|
||
thred, thred->id));
|
||
-#if defined(SYMBIAN)
|
||
+#if defined(SYMBIAN)
|
||
/* All signal group functions are not implemented in Symbian OS */
|
||
rv = 0;
|
||
#else
|
||
diff --git a/pr/tests/Makefile.in b/pr/tests/Makefile.in
|
||
index df1f1f2..fd7e7bd 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
|
||
ifeq ($(OS_ARCH)$(basename $(OS_RELEASE)),HP-UXB.10)
|
||
@@ -451,6 +451,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.2.2
|
||
|