From 9309a5412ccb754634cca91ce1f43fd30ed4e0ce Mon Sep 17 00:00:00 2001
From: Augustin Cavalier <waddlesplash@gmail.com>
Date: Sat, 10 Jan 2015 20:13:41 -0500
Subject: [PATCH] Modifications so Doxygen works on Haiku.

---
 PLATFORMS                      |  1 +
 configure                      |  3 +++
 qtools/qglobal.h               |  6 +++--
 qtools/qthread_unix.cpp        |  2 +-
 src/doxygen.cpp                |  2 +-
 src/doxygen.pro.in             | 11 ++++-----
 tmake/lib/haiku-g++/app.t      |  2 ++
 tmake/lib/haiku-g++/lib.t      |  2 ++
 tmake/lib/haiku-g++/subdirs.t  |  2 ++
 tmake/lib/haiku-g++/tmake.conf | 51 ++++++++++++++++++++++++++++++++++++++++++
 10 files changed, 73 insertions(+), 9 deletions(-)
 create mode 100644 tmake/lib/haiku-g++/app.t
 create mode 100644 tmake/lib/haiku-g++/lib.t
 create mode 100644 tmake/lib/haiku-g++/subdirs.t
 create mode 100644 tmake/lib/haiku-g++/tmake.conf

diff --git a/PLATFORMS b/PLATFORMS
index c358a1d..18c4ed5 100644
--- a/PLATFORMS
+++ b/PLATFORMS
@@ -4,6 +4,7 @@ beos-g++
 dgux-g++
 freebsd-g++
 gnu-g++
+haiku-g++
 hpux-acc
 hpux-cc
 hpux-g++
diff --git a/configure b/configure
index 07b0ef0..a4625e2 100755
--- a/configure
+++ b/configure
@@ -180,6 +180,9 @@ if test -z "$f_platform"; then
         f_insttool=/usr/bin/install
       fi
       ;;
+    Haiku:*)
+      f_platform=haiku-g++
+      ;;
     HP-UX:*)
       f_platform=hpux-g++
       if test "$f_insttool" = NO; then
diff --git a/qtools/qglobal.h b/qtools/qglobal.h
index 352d985..20601e3 100644
--- a/qtools/qglobal.h
+++ b/qtools/qglobal.h
@@ -1,5 +1,5 @@
 /****************************************************************************
-** 
+**
 **
 ** Global type declarations and definitions
 **
@@ -153,6 +153,8 @@
 #define _OS_CYGWIN_
 #elif defined(__BEOS__)
 #define _OS_BEOS_
+#elif defined(__HAIKU__)
+#define _OS_HAIKU_
 #elif defined(__MINT__)
 #define _OS_MINT_
 #else
@@ -295,7 +297,7 @@
 #define _CC_V2002
 #else
 #define _CC_V1998
-#endif 
+#endif
 #endif
 
 #ifndef Q_PACKED
diff --git a/qtools/qthread_unix.cpp b/qtools/qthread_unix.cpp
index 5a7b788..0d4fd6e 100644
--- a/qtools/qthread_unix.cpp
+++ b/qtools/qthread_unix.cpp
@@ -124,7 +124,7 @@ void QThread::start()
     pthread_attr_t attr;
     pthread_attr_init(&attr);
     pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED);
-    pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED);
+    //pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED);
     if (d->stackSize>0)
     {
 #if defined(_POSIX_THREAD_ATTR_STACKSIZE) && (_POSIX_THREAD_ATTR_STACKSIZE-0>0)
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index b790410..117e639 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -9566,7 +9566,7 @@ void readConfiguration(int argc, char **argv)
         {
           if (optind+4<argc || QFileInfo("Doxyfile").exists())
           {
-            QCString df = optind+4<argc ? argv[optind+4] : QCString("Doxyfile");
+            QCString df = optind+4<argc ? (QCString)argv[optind+4] : QCString("Doxyfile");
             if (!Config::instance()->parse(df))
             {
               err("error opening or reading configuration file %s!\n",argv[optind+4]);
diff --git a/src/doxygen.pro.in b/src/doxygen.pro.in
index afdf242..bb64792 100644
--- a/src/doxygen.pro.in
+++ b/src/doxygen.pro.in
@@ -4,8 +4,8 @@
 # Copyright (C) 1997-2011 by Dimitri van Heesch.
 #
 # Permission to use, copy, modify, and distribute this software and its
-# documentation under the terms of the GNU General Public License is hereby 
-# granted. No representations are made about the suitability of this software 
+# documentation under the terms of the GNU General Public License is hereby
+# granted. No representations are made about the suitability of this software
 # for any purpose. It is provided "as is" without express or implied warranty.
 # See the GNU General Public License for more details.
 #
@@ -16,9 +16,10 @@
 
 TEMPLATE     =	app.t
 CONFIG       =	console warn_on $extraopts
-HEADERS      =	doxygen.h 
-SOURCES      =	main.cpp 
-unix:LIBS                  += -L../lib -ldoxygen -ldoxycfg -lqtools -lmd5 -lpthread
+HEADERS      =	doxygen.h
+SOURCES      =	main.cpp
+unix:LIBS                  += -L../lib -ldoxygen -ldoxycfg -lqtools -lmd5
+haiku-g++:LIBS             += -liconv
 win32:INCLUDEPATH          += .
 win32-mingw:LIBS           += -L../lib -ldoxygen -ldoxycfg -lqtools -lmd5 -lpthread
 win32-msvc:LIBS            += qtools.lib md5.lib doxygen.lib doxycfg.lib shell32.lib iconv.lib
diff --git a/tmake/lib/haiku-g++/app.t b/tmake/lib/haiku-g++/app.t
new file mode 100644
index 0000000..867725e
--- /dev/null
+++ b/tmake/lib/haiku-g++/app.t
@@ -0,0 +1,2 @@
+#! Use the common Unix template
+#$ IncludeTemplate("../unix/app.t");
diff --git a/tmake/lib/haiku-g++/lib.t b/tmake/lib/haiku-g++/lib.t
new file mode 100644
index 0000000..2523b2f
--- /dev/null
+++ b/tmake/lib/haiku-g++/lib.t
@@ -0,0 +1,2 @@
+#! Use the common Unix template
+#$ IncludeTemplate("../unix/lib.t");
diff --git a/tmake/lib/haiku-g++/subdirs.t b/tmake/lib/haiku-g++/subdirs.t
new file mode 100644
index 0000000..5e888af
--- /dev/null
+++ b/tmake/lib/haiku-g++/subdirs.t
@@ -0,0 +1,2 @@
+#! Use the common Unix template
+#$ IncludeTemplate("../unix/subdirs.t");
diff --git a/tmake/lib/haiku-g++/tmake.conf b/tmake/lib/haiku-g++/tmake.conf
new file mode 100644
index 0000000..3b8c103
--- /dev/null
+++ b/tmake/lib/haiku-g++/tmake.conf
@@ -0,0 +1,51 @@
+#
+#
+#
+# tmake configuration for haiku-g++
+#
+
+TEMPLATE		= app
+CONFIG			= qt warn_on release
+
+TMAKE_CC		= gcc
+TMAKE_CFLAGS		=
+TMAKE_CFLAGS_WARN_ON	= -Wall -W
+TMAKE_CFLAGS_WARN_OFF	=
+TMAKE_CFLAGS_RELEASE	=
+TMAKE_CFLAGS_DEBUG	= -g
+TMAKE_CFLAGS_SHLIB	= -fPIC
+TMAKE_CFLAGS_YACC	= -Wno-unused -Wno-parentheses
+
+TMAKE_CXX		= g++
+TMAKE_CXXFLAGS		= $$TMAKE_CFLAGS
+TMAKE_CXXFLAGS_WARN_ON	= $$TMAKE_CFLAGS_WARN_ON
+TMAKE_CXXFLAGS_WARN_OFF	= $$TMAKE_CFLAGS_WARN_OFF
+TMAKE_CXXFLAGS_RELEASE	= $$TMAKE_CFLAGS_RELEASE
+TMAKE_CXXFLAGS_DEBUG	= $$TMAKE_CFLAGS_DEBUG
+TMAKE_CXXFLAGS_SHLIB	= $$TMAKE_CFLAGS_SHLIB
+TMAKE_CXXFLAGS_YACC	= $$TMAKE_CFLAGS_YACC
+
+TMAKE_INCDIR		=
+TMAKE_LIBDIR		=
+TMAKE_INCDIR_QT		= $(QTDIR)/include
+TMAKE_LIBDIR_QT		= $(QTDIR)/lib
+
+TMAKE_LINK		= g++
+TMAKE_LINK_SHLIB	= g++
+TMAKE_LFLAGS		= -Wl,-rpath=/lib:$(QTDIR)/lib
+TMAKE_LFLAGS_RELEASE	=
+TMAKE_LFLAGS_DEBUG	=
+TMAKE_LFLAGS_SHLIB	= -shared
+TMAKE_LFLAGS_SONAME	= -Wl,-soname,
+
+TMAKE_LIBS		=
+TMAKE_LIBS_QT		= -lqt
+TMAKE_LIBS_QT_MT	= -lqt-mt
+
+TMAKE_MOC		= moc
+
+TMAKE_AR		= ar cqs
+TMAKE_RANLIB		=
+
+TMAKE_TAR		= tar -cf
+TMAKE_GZIP		= gzip -9f
-- 
1.8.3.4

