From 55aabcadc9ec96985a69b0422e66673eaa34d174 Mon Sep 17 00:00:00 2001
From: Sergei Reznikov <diver@gelios.net>
Date: Tue, 3 Nov 2015 14:31:04 +0300
Subject: Haiku: implement processNameByPid


diff --git a/src/lib/corelib/tools/processutils.cpp b/src/lib/corelib/tools/processutils.cpp
index 060a057..22fcbe2 100644
--- a/src/lib/corelib/tools/processutils.cpp
+++ b/src/lib/corelib/tools/processutils.cpp
@@ -49,6 +49,8 @@
 #   include "fileinfo.h"
 #   include <unistd.h>
 #   include <cstdio>
+#elif defined(Q_OS_HAIKU)
+#   include <OS.h>
 #elif defined(Q_OS_BSD4)
 # include <QtCore/qfile.h>
 #   include <sys/cdefs.h>
@@ -94,6 +96,13 @@ QString processNameByPid(qint64 pid)
     sprintf(exePath, "/proc/%lld/exe", pid);
     readlink(exePath, buf, sizeof(buf));
     return FileInfo::fileName(QString::fromUtf8(buf));
+#elif defined(Q_OS_HAIKU)
+	team_info info;
+	if(get_team_info((team_id)pid, &info)==B_OK) {
+		if(info.argc >= 1)
+			return QString::fromUtf8(info.args);
+	}
+	return QString();
 #elif defined(Q_OS_BSD4)
 # if defined(Q_OS_NETBSD)
     struct kinfo_proc2 kp;
-- 
2.21.0


From aa68eea2f2803bb9678c9096e0863dc10fa714d7 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 4 May 2019 01:19:32 +0200
Subject: haiku changes for 1.13.0


diff --git a/src/lib/corelib/buildgraph/processcommandexecutor.cpp b/src/lib/corelib/buildgraph/processcommandexecutor.cpp
index 0818e12..fbcf74c 100644
--- a/src/lib/corelib/buildgraph/processcommandexecutor.cpp
+++ b/src/lib/corelib/buildgraph/processcommandexecutor.cpp
@@ -88,6 +88,7 @@ static QProcessEnvironment mergeEnvironments(const QProcessEnvironment &baseEnv,
         QStringLiteral("LD_LIBRARY_PATH"),
         QStringLiteral("DYLD_LIBRARY_PATH"),
         QStringLiteral("DYLD_FRAMEWORK_PATH"),
+        QStringLiteral("LIBRARY_PATH"),
     };
     for (const QString &key : additionalEnv.keys()) {
         QString newValue = additionalEnv.value(key);
diff --git a/src/lib/corelib/tools/hostosinfo.h b/src/lib/corelib/tools/hostosinfo.h
index cae4516..d1310ed 100644
--- a/src/lib/corelib/tools/hostosinfo.h
+++ b/src/lib/corelib/tools/hostosinfo.h
@@ -71,7 +71,7 @@ class QBS_EXPORT HostOsInfo // Exported for use by command-line tools.
 {
 public:
     // Add more as needed.
-    enum HostOs { HostOsWindows, HostOsLinux, HostOsMacos, HostOsOtherUnix, HostOsOther };
+    enum HostOs { HostOsWindows, HostOsLinux, HostOsMacos, HostOsHaiku, HostOsOtherUnix, HostOsOther };
 
     static inline std::string hostOSIdentifier();
     static inline std::vector<std::string> hostOSIdentifiers();
@@ -100,6 +100,7 @@ public:
     static bool isWindowsHost() { return hostOs() == HostOsWindows; }
     static bool isLinuxHost() { return hostOs() == HostOsLinux; }
     static bool isMacosHost() { return hostOs() == HostOsMacos; }
+    static bool isHaikuHost() { return hostOs() == HostOsHaiku; }
     static inline bool isAnyUnixHost();
     static inline QString rfc1034Identifier(const QString &str);
 
@@ -128,6 +129,8 @@ public:
             return QStringLiteral("PATH");
         if (isMacosHost())
             return QStringLiteral("DYLD_LIBRARY_PATH");
+        if (isHaikuHost())
+            return QStringLiteral("LIBRARY_PATH");
         return QStringLiteral("LD_LIBRARY_PATH");
     }
 
@@ -214,6 +217,8 @@ HostOsInfo::HostOs HostOsInfo::hostOs()
     return HostOsLinux;
 #elif defined(Q_OS_DARWIN)
     return HostOsMacos;
+#elif defined(Q_OS_HAIKU)
+    return HostOsHaiku;
 #elif defined(Q_OS_UNIX)
     return HostOsOtherUnix;
 #else
diff --git a/static-res.pro b/static-res.pro
index 86816bb..3c4d823 100644
--- a/static-res.pro
+++ b/static-res.pro
@@ -8,6 +8,7 @@ unix:qbs_disable_rpath {
     !isEmpty(QBS_DESTDIR): qbslibdir = $$QBS_DESTDIR
     else: qbslibdir = $$OUT_PWD/lib
     macos: envVar = DYLD_LIBRARY_PATH
+    else: haiku: envVar = LIBRARY_PATH
     else: envVar = LD_LIBRARY_PATH
     oldVal = $$getenv($$envVar)
     newVal = $$qbslibdir
-- 
2.21.0

