From 2216f605e396f366f09dad8b3f236d893710553a Mon Sep 17 00:00:00 2001
From: Steven Kou <kouyongkang@gmail.com>
Date: Mon, 28 Dec 2015 00:24:06 +0000
Subject: Patched agent/interfaces.c to compile under Haiku.


diff --git a/agent/interfaces.c b/agent/interfaces.c
index f75f7cf..c1f81a0 100644
--- a/agent/interfaces.c
+++ b/agent/interfaces.c
@@ -46,7 +46,7 @@
 #include "interfaces.h"
 #include "agent-priv.h"
 
-#ifdef G_OS_UNIX
+#if defined(G_OS_UNIX)
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -60,7 +60,7 @@
 #include <netinet/in.h>
 #include <netdb.h>
 
-#ifdef __sun
+#if defined(__sun) || defined(__HAIKU__)
 #include <sys/sockio.h>
 #endif
 
@@ -119,7 +119,7 @@ sockaddr_to_string (const struct sockaddr *addr)
 }
 #endif
 
-#ifdef G_OS_UNIX
+#if defined(G_OS_UNIX)
 
 static GList *
 get_local_interfaces_ioctl (void)
-- 
2.30.0


From 43b20f05a16b090cf3f46dc1a30d2fa93c391abb Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Mon, 7 Jun 2021 19:19:51 +0200
Subject: Haiku patch


diff --git a/agent/interfaces.c b/agent/interfaces.c
index c1f81a0..3aa002d 100644
--- a/agent/interfaces.c
+++ b/agent/interfaces.c
@@ -308,6 +308,7 @@ get_local_ips_ioctl (gboolean include_loopback)
     if ((ifr->ifr_flags & IFF_UP) == 0)
       continue;
 
+#define IFF_RUNNING IFF_LINK
     /* no ip address from interface that isn't running */
     if ((ifr->ifr_flags & IFF_RUNNING) == 0)
       continue;
diff --git a/meson.build b/meson.build
index 8cbc178..6b9de66 100644
--- a/meson.build
+++ b/meson.build
@@ -64,6 +64,8 @@ elif host_machine.system() == 'sunos'
       error('Could not find right library for socket() on Solaris')
     endif
   endif
+elif host_machine.system() == 'haiku'
+   syslibs += [cc.find_library('network')]
 endif
 
 if not cc.has_function('clock_gettime')
-- 
2.30.0

