0
0
Fork 0
haikuports/net-voip/yate/patches/yate-6.1.1~git.patchset

155 lines
5.0 KiB
Plaintext

From d35adb5da7f1b060c52c857bf22808628478ffff Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Wed, 29 Apr 2020 14:25:19 +0000
Subject: Fix build on Haiku
diff --git a/clients/qtclient.pro b/clients/qtclient.pro
index 60c1b2a..48b9142 100644
--- a/clients/qtclient.pro
+++ b/clients/qtclient.pro
@@ -17,7 +17,7 @@ RCC_DIR = $${DESTDIR}/clients
UI_DIR = $${DESTDIR}/clients
INCLUDEPATH += .. qt4 ../modules/qt4
-unix:!mac:LIBS += -lpthread -lasound
+unix:!mac:!haiku:LIBS += -lpthread -lasound
mac:LIBS += -framework CoreFoundation -framework CoreServices -framework CoreAudio -framework AudioUnit -framework AudioToolbox
LIBS += -L$$DESTDIR -lyate -lbasemodules
@@ -32,7 +32,7 @@ SOURCES += main-qt4.cpp \
mac:SOURCES += ../modules/client/coreaudio.cpp
win32:SOURCES += ../modules/client/dsoundchan.cpp
-unix:!mac:SOURCES += ../modules/client/alsachan.cpp
+unix:!mac:!haiku:SOURCES += ../modules/client/alsachan.cpp
HEADERS += qt4/qt4client.h \
../modules/qt4/widgetlist.h \
@@ -103,4 +103,4 @@ mac {
unix:!mac {
QMAKE_POST_LINK += $$quote(ln -s libbasemodules.so.1.0.0 $${DESTDIR}/libbasemodules.yate $$escape_expand(\n\t))
-}
\ No newline at end of file
+}
diff --git a/engine/Mutex.cpp b/engine/Mutex.cpp
index 40c5d95..2ecccd7 100644
--- a/engine/Mutex.cpp
+++ b/engine/Mutex.cpp
@@ -32,7 +32,7 @@ typedef HANDLE HSEMAPHORE;
#ifdef MUTEX_HACK
extern "C" {
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(__HAIKU__)
extern int pthread_mutexattr_settype(pthread_mutexattr_t *__attr, int __kind);
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
#else
diff --git a/engine/Thread.cpp b/engine/Thread.cpp
index 4cf7120..dd77714 100644
--- a/engine/Thread.cpp
+++ b/engine/Thread.cpp
@@ -162,6 +162,7 @@ ThreadPrivate* ThreadPrivate::create(Thread* t,const char* name,Thread::Priority
default:
break;
}
+#ifndef __HAIKU__
int err = ::pthread_attr_setinheritsched(&attr,PTHREAD_EXPLICIT_SCHED);
if (!err)
err = ::pthread_attr_setschedpolicy(&attr,policy);
@@ -179,6 +180,7 @@ ThreadPrivate* ThreadPrivate::create(Thread* t,const char* name,Thread::Priority
#ifdef XDEBUG
else
Debug(DebugInfo,"Successfully set high thread priority %d",prio);
+#endif
#endif
}
#endif /* _WINDOWS */
@@ -211,7 +213,7 @@ ThreadPrivate* ThreadPrivate::create(Thread* t,const char* name,Thread::Priority
}
#else /* _WINDOWS */
e = ::pthread_create(&p->thread,&attr,startFunc,p);
-#ifdef PTHREAD_INHERIT_SCHED
+#if defined(PTHREAD_INHERIT_SCHED) && !defined(__HAIKU__)
if ((0 == i) && (EPERM == e) && (prio > Thread::Normal)) {
Debug(DebugWarn,"Failed to create thread with priority %d, trying with inherited",prio);
::pthread_attr_setinheritsched(&attr,PTHREAD_INHERIT_SCHED);
diff --git a/engine/engine.pro b/engine/engine.pro
index 1c6a7e2..ef5178f 100644
--- a/engine/engine.pro
+++ b/engine/engine.pro
@@ -12,7 +12,7 @@ mac|linux:DEFINES += ATOMIC_OPS HAVE_GMTOFF HAVE_INT_TZ HAVE_POLL HAVE_NTOP HAVE
# engine/regex/regex.c
mac:DEFINES += STDC_HEADERS
# engine/Mutex.cpp
-mac:DEFINES += MUTEX_HACK
+mac|haiku:DEFINES += MUTEX_HACK
linux:DEFINES += HAVE_TIMEDLOCK HAVE_TIMEDWAIT
# engine/Thread.cpp
linux:DEFINES += HAVE_PRCTL
@@ -25,8 +25,9 @@ mac:INCLUDEPATH += ./macosx
linux:INCLUDEPATH -= ./regex
win32:INCLUDEPATH += ../windows
-LIBS += -lresolv -lpthread
+!haiku:LIBS += -lresolv -lpthread
mac:LIBS += -lobjc -framework Foundation
+haiku:LIBS += -lnetwork
SOURCES += $$files(*.cpp) $$files(regex/*.c)
mac:SOURCES += $$files(macosx/*.mm)
@@ -34,4 +35,4 @@ linux:SOURCES -= $$files(regex/*.c)
HEADERS += $$files(*.h) $$files(tables/*.h) $$files(regex/*.h)
mac:HEADERS += $$files(macosx/*.h)
-linux:HEADERS -= $$files(regex/*.h)
\ No newline at end of file
+linux:HEADERS -= $$files(regex/*.h)
diff --git a/modules/modules.pro b/modules/modules.pro
index e2700dd..5d23226 100644
--- a/modules/modules.pro
+++ b/modules/modules.pro
@@ -7,7 +7,7 @@ DESTDIR = ../build
OBJECTS_DIR = $${DESTDIR}/modules
# unix and (:) not mac
-unix:!mac:DEFINES += HAVE_MALLINFO USE_TLS_METHOD
+unix:!mac:!haiku:DEFINES += HAVE_MALLINFO USE_TLS_METHOD
unix:mac:DEFINES += NO_AESCTR
INCLUDEPATH += .. ../libs/yrtp ../libs/ysip ../libs/ysdp ../libs/yiax ../libs/yjabber
mac:INCLUDEPATH += /opt/local/include
diff --git a/modules/rmanager.cpp b/modules/rmanager.cpp
index 3c3fe50..3bc236d 100644
--- a/modules/rmanager.cpp
+++ b/modules/rmanager.cpp
@@ -29,6 +29,11 @@
#include <stdio.h>
#include <fcntl.h>
+#ifdef __HAIKU__
+#undef HAVE_MALLINFO
+#undef HAVE_COREDUMPER
+#endif
+
#ifdef NDEBUG
#undef HAVE_MALLINFO
#undef HAVE_COREDUMPER
diff --git a/yatemath.h b/yatemath.h
index 2a42426..7207e3e 100644
--- a/yatemath.h
+++ b/yatemath.h
@@ -25,6 +25,9 @@
#include <yateclass.h>
#include <math.h>
#include <string.h>
+#ifdef __HAIKU__
+#undef bzero
+#endif
namespace TelEngine {
--
2.26.0