From 88775bc062b5fdb9ebbd56b72a29f8528d49a18f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Sun, 12 Aug 2018 11:12:30 +0200
Subject: Add Haiku to the supported OS list


diff --git a/configure.ac b/configure.ac
old mode 100755
new mode 100644
index f71b6ad..7d340a0
--- a/configure.ac
+++ b/configure.ac
@@ -128,6 +128,14 @@ case "$host" in
   AC_MSG_RESULT([freebsd])
   ;;
 #
+# HAIKU.
+#
+*86-*-haiku* | *86_64-*-haiku*) 
+  AC_DEFINE(HAVE_HAIKU, 1, [Define this if HAIKU was detected]) 
+  AC_DEFINE(HAVE_IEEE_754, 1, [Define this if IEEE_754 compliant]) 
+  AC_MSG_RESULT([haiku])
+  ;;
+#
 # NetBSD.
 #
 *86-*-netbsd* | *86_64-*-netbsd*) 
diff --git a/source/a68g.c b/source/a68g.c
old mode 100755
new mode 100644
index ab23ca1..110db97
--- a/source/a68g.c
+++ b/source/a68g.c
@@ -903,7 +903,7 @@ Accept various silent extensions.
 /*
 Compilation on Linux, FreeBSD or NetBSD using gcc
 */
-#if (defined HAVE_LINUX || defined HAVE_FREEBSD || defined HAVE_NETBSD)
+#if (defined HAVE_LINUX || defined HAVE_FREEBSD || defined HAVE_NETBSD || defined HAVE_HAIKU)
 #if defined HAVE_TUNING
       ASSERT (snprintf (options, SNPRINTF_SIZE, "%s %s %s -g", extra_inc, optimisation, HAVE_TUNING) >= 0);
 #else
diff --git a/source/a68g.h b/source/a68g.h
old mode 100755
new mode 100644
index d185338..a53daad
--- a/source/a68g.h
+++ b/source/a68g.h
@@ -54,7 +54,7 @@ Top level include file.
 #undef HAVE_COMPILER
 #elif ((defined HAVE_LINUX || defined HAVE_MAC_OS_X) && defined HAVE_DL)
 #define HAVE_COMPILER 1
-#elif (defined HAVE_FREEBSD || defined HAVE_NETBSD)
+#elif (defined HAVE_FREEBSD || defined HAVE_NETBSD || defined HAVE_HAIKU)
 #define HAVE_COMPILER 1
 #else
 #undef HAVE_COMPILER
-- 
2.19.1


From 40c61a9321533b41439b33555bf45daeb11c1743 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Tue, 1 Jan 2019 22:04:56 +0100
Subject: Enable dl and compiler


diff --git a/configure.ac b/configure.ac
index 7d340a0..d509a53 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,7 +82,8 @@ AC_DEFUN([A68G_AC_DL],
   [AC_CHECK_DECL([$1], [], [enable_compiler=no], [
 #include <dlfcn.h> 
 ])
-  AC_CHECK_LIB([dl], [$1], [a68g_unexpected=yes], [enable_compiler=no])
+  AC_CHECK_LIB([dl], [$1], [a68g_unexpected=yes])
+  AC_CHECK_LIB([root], [$1], [a68g_unexpected=yes], [enable_compiler=no])
   ])
 
 #
@@ -676,6 +677,7 @@ if test "x$enable_compiler" = "xyes"; then
   fi
   if test "x$enable_compiler" = "xyes"; then
     AC_CHECK_LIB([dl], [dlopen])
+    AC_CHECK_LIB([root], [dlopen])
     AC_DEFINE(HAVE_DL, 1, [Define this if a good DL installation was detected]) 
   fi
 fi
-- 
2.19.1


From 3b942710ef51294fe906976161aebcaa89d3fd35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Sun, 12 Aug 2018 12:07:34 +0200
Subject: Enable networking


diff --git a/source/a68g.h b/source/a68g.h
index a53daad..85518c5 100644
--- a/source/a68g.h
+++ b/source/a68g.h
@@ -63,7 +63,7 @@ Top level include file.
 /* Can we access the internet? */
 
 #if (defined HAVE_NETDB_H && defined HAVE_NETINET_IN_H && defined HAVE_SYS_SOCKET_H)
-#if (defined HAVE_LINUX || defined HAVE_MAC_OS_X || defined HAVE_FREEBSD || defined HAVE_NETBSD)
+#if (defined HAVE_LINUX || defined HAVE_MAC_OS_X || defined HAVE_FREEBSD || defined HAVE_NETBSD || defined HAVE_HAIKU)
 #define HAVE_HTTP
 #endif
 #endif
-- 
2.19.1


From 685942ff84dfbaa0703e459f898114fa217bf20a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Tue, 1 Jan 2019 21:28:31 +0100
Subject: Plotutils patch from AUR


diff --git a/source/plotutils.c b/source/plotutils.c
old mode 100755
new mode 100644
index 689d43f..4d9cd36
--- a/source/plotutils.c
+++ b/source/plotutils.c
@@ -1026,7 +1026,7 @@ set_up_device (NODE_T * p, A68_FILE * f)
     X_COORD (&DEVICE (f)) = 0;
     Y_COORD (&DEVICE (f)) = 0;
     return (PLOTTER (&DEVICE (f)));
-  } else if (!strcmp (device_type, "gif")) {
+  } else if (!strcmp (device_type, "gif") || !strcmp (device_type, "png")) {
 /*------------------------------------+
 | Supported plotter type - pseudo GIF |
 +------------------------------------*/
@@ -1067,7 +1067,7 @@ set_up_device (NODE_T * p, A68_FILE * f)
     (void) pl_setplparam (PLOTTER_PARAMS (&DEVICE (f)), "BITMAPSIZE", size);
     (void) pl_setplparam (PLOTTER_PARAMS (&DEVICE (f)), "BG_COLOR", (void *) "black");
     (void) pl_setplparam (PLOTTER_PARAMS (&DEVICE (f)), "GIF_ANIMATION", (void *) "no");
-    PLOTTER (&DEVICE (f)) = pl_newpl_r ("gif", NULL, STREAM (&DEVICE (f)), stderr, PLOTTER_PARAMS (&DEVICE (f)));
+    PLOTTER (&DEVICE (f)) = pl_newpl_r (device_type, NULL, STREAM (&DEVICE (f)), stderr, PLOTTER_PARAMS (&DEVICE (f)));
     if (PLOTTER (&DEVICE (f)) == NULL) {
       diagnostic_node (A68_RUNTIME_ERROR, p, ERROR_DEVICE_CANNOT_OPEN);
       exit_genie (p, A68_RUNTIME_ERROR);
-- 
2.19.1


From d6cafcf9cd113e20b94ba43f988b06300a4f96b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Wed, 2 Jan 2019 11:04:16 +0100
Subject: Config file PATH


diff --git a/source/a68g.h b/source/a68g.h
index 85518c5..38f718b 100644
--- a/source/a68g.h
+++ b/source/a68g.h
@@ -333,7 +333,11 @@ extern int a68g_snprintf (char *, size_t, char *, ...);
 /* Constants */
 /*************/
 
-#define A68_DIR ".a68g"
+#ifndef __HAIKU__
+# define A68_DIR ".a68g"
+#else
+# define A68_DIR "config/settings/a68g"
+#endif
 #define A68_FALSE ((BOOL_T) 0)
 #define A68_HISTORY_FILE ".a68g.edit.hist"
 #define A68_MAX_BITS (UINT_MAX)
-- 
2.19.1

