From 2982e7fbeee2eafd5ebb65376c4883ea2b1cd5d6 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sat, 16 Jun 2018 22:51:55 +1000
Subject: Fix build for Haiku


diff --git a/phoenix.pro b/phoenix.pro
index 301ce0c..156b834 100644
--- a/phoenix.pro
+++ b/phoenix.pro
@@ -90,7 +90,38 @@ macx {
         LIBS += /System/Library/Frameworks/Carbon.framework/Carbon
         LIBS += /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
 }
-unix {
+haiku {
+        LIBS += -lz
+        BINDIR = $$PREFIX
+
+        DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\"
+
+        target.path =$$BINDIR
+
+        manpage.path = $$DATADIR/man/man1
+        manpage.files += Fritzing.1
+
+        parts.path = $$PKGDATADIR
+        parts.files += parts
+
+        help.path = $$PKGDATADIR
+        help.files += help
+
+        sketches.path = $$PKGDATADIR
+        sketches.files += sketches
+
+        bins.path = $$PKGDATADIR
+        bins.files += bins
+
+        translations.path = $$PKGDATADIR/translations
+        translations.extra = find $$PWD/translations -name "*.qm" -size +128c -exec cp -pr {} $(INSTALL_ROOT)$$PKGDATADIR/translations \\;
+
+        syntax.path = $$PKGDATADIR/translations/syntax
+        syntax.files += translations/syntax/*.xml
+
+        INSTALLS += target manpage parts sketches bins translations syntax help
+}
+unix:!haiku {
     !macx { # unix is defined on mac
         HARDWARE_PLATFORM = $$system(uname -m)
         contains( HARDWARE_PLATFORM, x86_64 ) {
@@ -164,6 +195,7 @@ RESOURCES += phoenixresources.qrc
 # Fritzing is using libgit2 since version 0.9.3
 
 LIBGIT2INCLUDE = ../libgit2/include
+haiku:LIBGIT2INCLUDE = /system/develop/headers
 exists($$LIBGIT2INCLUDE/git2.h) {
     message("found libgit2 include path at $$LIBGIT2INCLUDE")
 }
@@ -195,6 +227,7 @@ win32 {
 
 unix {
     LIBGIT2LIB = ../libgit2/build
+    haiku:LIBGIT2LIB = /system/develop/lib
     macx {
         exists($$LIBGIT2LIB/libgit2.dylib) {
             message("found libgit2 library in $$LIBGIT2LIB")
diff --git a/pri/utils.pri b/pri/utils.pri
index ae14ea8..eab99a0 100644
--- a/pri/utils.pri
+++ b/pri/utils.pri
@@ -17,46 +17,6 @@
 # $Date: 2013-01-12 07:45:08 +0100 (Sa, 12. Jan 2013) $
 # ********************************************************************/
 
-# boost_1_54_0 is buggy
-BOOSTS = 43 44 45 46 47 48 49 50 51 52 53 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
-LATESTBOOST = 0
-for(boost, BOOSTS) {
-        exists(../src/lib/boost_1_$${boost}_0) {
-                LATESTBOOST = $$boost
-        }
-}
-
-contains(LATESTBOOST, 0) {
-    unix {
-        !macx {
-             BOOSTINFO = $$system(dpkg -s libboost-dev | grep 'Version')
-             BADVERSION = $$find(BOOSTINFO, 1\.54)
-             !isEmpty(BADVERSION) {
-                 message("Boost 1.54 has a bug in a function that Fritzing uses, so download or install some other version")
-                 error("Easiest to copy the boost library to .../src/lib/, so that you have .../src/lib/boost_1_xx_0")
-             }
-             isEmpty(BADVERSION) {
-                 BOOSTVERSION = $$find(BOOSTINFO, 1\...\.0)
-                 !isEmpty(BOOSTVERSION) {
-                     LATESTBOOST = installed
-                     message("using installed BOOST library")
-                 }
-             }
-        }
-    }
-}
-
-contains(LATESTBOOST, 0) {
-        message("Please download the boost library--you can find it at http://www.boost.org/")
-        message("Note that boost 1.54 has a bug in a function that Fritzing uses, so download some other version")
-        error("Copy the boost library to .../src/lib/, so that you have .../src/lib/boost_1_xx_0")
-}
-
-!contains(LATESTBOOST, installed) {
-    message("using boost from src/lib/boost_1_$${LATESTBOOST}_0")
-    INCLUDEPATH += src/lib/boost_1_$${LATESTBOOST}_0
-}
-
 HEADERS += \
 src/utils/abstractstatesbutton.h \
 src/utils/autoclosemessagebox.h \
diff --git a/src/version/partschecker.cpp b/src/version/partschecker.cpp
index a3e3967..68775b9 100644
--- a/src/version/partschecker.cpp
+++ b/src/version/partschecker.cpp
@@ -121,7 +121,7 @@ bool PartsChecker::newPartsAvailable(const QString &repoPath, const QString & sh
     /**
      * Connect to the remote.
      */
-    error = git_remote_connect(remote, GIT_DIRECTION_FETCH, &callbacks);
+    error = git_remote_connect(remote, GIT_DIRECTION_FETCH, &callbacks, NULL, NULL);
     if (error) {
         partsCheckerResult.partsCheckerError = PARTS_CHECKER_ERROR_REMOTE;
         partsCheckerResult.errorMessage = QObject::tr("Unable to access network site for '%1'. %2").arg(repoPath).arg(sBoilerPlate1);
-- 
2.16.4


From 41bca8b2b94d8e0cb0bd12da8adf76726e79e957 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sat, 16 Jun 2018 22:52:27 +1000
Subject: Set current dir to applicaton dir


diff --git a/src/fapplication.cpp b/src/fapplication.cpp
index 5a2693c..246ec38 100644
--- a/src/fapplication.cpp
+++ b/src/fapplication.cpp
@@ -111,6 +111,11 @@ $Date: 2013-04-19 12:51:22 +0200 (Fr, 19. Apr 2013) $
 #endif
 #endif
 
+#ifdef Q_OS_HAIKU
+#include <QDir>
+#define PLATFORM_NAME "haiku"
+#endif
+
 #ifdef Q_OS_WIN
 #ifndef QT_NO_DEBUG
 #define WIN_DEBUG
@@ -356,6 +361,10 @@ FApplication::FApplication( int & argc, char ** argv) : QApplication(argc, argv)
 	m_serviceType = NoService;
 	m_splash = NULL;
 
+#ifdef Q_OS_HAIKU
+	QDir::setCurrent(QCoreApplication::applicationDirPath());
+#endif
+
 	m_arguments = arguments();
 }
 
-- 
2.16.4


From e7700375ec915c00883b2bc2a0ae52951c2cd816 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sat, 16 Jun 2018 23:17:21 +1000
Subject: Fix build for secondary arch


diff --git a/phoenix.pro b/phoenix.pro
index 156b834..9240b89 100644
--- a/phoenix.pro
+++ b/phoenix.pro
@@ -195,7 +195,13 @@ RESOURCES += phoenixresources.qrc
 # Fritzing is using libgit2 since version 0.9.3
 
 LIBGIT2INCLUDE = ../libgit2/include
-haiku:LIBGIT2INCLUDE = /system/develop/headers
+haiku {
+	LIBGIT2INCLUDE = /system/develop/headers/x86
+	!exists($$LIBGIT2INCLUDE/git2.h) {
+		LIBGIT2INCLUDE = /system/develop/headers
+	}
+}
+
 exists($$LIBGIT2INCLUDE/git2.h) {
     message("found libgit2 include path at $$LIBGIT2INCLUDE")
 }
@@ -227,7 +233,12 @@ win32 {
 
 unix {
     LIBGIT2LIB = ../libgit2/build
-    haiku:LIBGIT2LIB = /system/develop/lib
+	haiku {
+		LIBGIT2LIB = /system/develop/lib/x86
+		!exists($$LIBGIT2LIB/libgit2.so) {
+			LIBGIT2LIB = /system/develop/lib
+		}
+	}
     macx {
         exists($$LIBGIT2LIB/libgit2.dylib) {
             message("found libgit2 library in $$LIBGIT2LIB")
-- 
2.16.4

