glib2-2.57.1.patchset revision eb64aff6
1From 74e3e83281b3472e010a44a30204b5cac4b1a29d Mon Sep 17 00:00:00 2001
2From: Jerome Duval <jerome.duval@gmail.com>
3Date: Sat, 19 Dec 2015 14:51:01 +0000
4Subject: glib_compile_schemas: links against gio, gobject and gmodule.
5
6Otherwise build fails on Haiku.
7
8diff --git a/gio/Makefile.am b/gio/Makefile.am
9index df4f240..b03e662 100644
10--- a/gio/Makefile.am
11+++ b/gio/Makefile.am
12@@ -827,7 +827,11 @@ gio_querymodules_LDADD	 = libgio-2.0.la 		\
13 gconstructor_as_data.h: $(top_srcdir)/glib/gconstructor.h data-to-c.py
14 	$(AM_V_GEN) $(srcdir)/data-to-c.py $(top_srcdir)/glib/gconstructor.h gconstructor_code $@
15 
16-glib_compile_schemas_LDADD = $(top_builddir)/glib/libglib-2.0.la
17+glib_compile_schemas_LDADD = libgio-2.0.la 		\
18+	$(top_builddir)/gobject/libgobject-2.0.la	\
19+	$(top_builddir)/gmodule/libgmodule-2.0.la	\
20+	$(top_builddir)/glib/libglib-2.0.la		\
21+	$(NULL)
22 glib_compile_schemas_SOURCES = \
23 	gconstructor_as_data.h \
24 	gvdb/gvdb-format.h		\
25-- 
262.21.0
27
28
29From d968dda5cb2ded7c7f0146e41081b9256962c5c5 Mon Sep 17 00:00:00 2001
30From: Jerome Duval <jerome.duval@gmail.com>
31Date: Sat, 19 Dec 2015 14:59:42 +0000
32Subject: configure.ac: on Haiku
33
34* don't use -pthread
35* use -lbe -lroot as thread related libs.
36
37diff --git a/configure.ac b/configure.ac
38index 7afeb87..dc3297c 100644
39--- a/configure.ac
40+++ b/configure.ac
41@@ -158,6 +158,9 @@ case "$host" in
42     ;;
43 esac
44 case $host in
45+  *-*-haiku*)
46+    LIBS="-lnetwork $LIBS"
47+    ;;
48   *-*-linux*)
49     glib_os_linux=yes
50     ;;
51@@ -2014,8 +2017,8 @@ AS_IF([ test x"$have_threads" = xposix], [
52   # One of them does for most gcc versions and some other platforms/compilers
53   # too and could be considered as the canonical way to go. 
54   case $host in
55-    *-*-cygwin*|*-*-darwin*)
56-       # skip cygwin and darwin -pthread or -pthreads test
57+    *-*-cygwin*|*-*-darwin*|*-*-haiku*)
58+       # skip cygwin, darwin and haiku -pthread or -pthreads test
59        ;;
60     *-solaris*)
61       # These compiler/linker flags work with both Sun Studio and gcc
62@@ -2180,6 +2183,15 @@ if test "x$G_THREAD_LIBS" = xerror; then
63         AC_MSG_ERROR($LIBS_NOT_FOUND_1$have_threads$LIBS_NOT_FOUND_2)
64 fi
65 
66+case $host in
67+  *-*-haiku*)
68+    G_THREAD_LIBS="-lbe -lroot"
69+    G_THREAD_LIBS_EXTRA="-L\$(top_builddir_full)/.libs"
70+    ;;
71+  *)
72+    ;;
73+esac
74+
75 AC_MSG_CHECKING(thread related libraries)
76 AC_MSG_RESULT($G_THREAD_LIBS)
77 
78-- 
792.21.0
80
81
82From d577ba25ece5e325739b7e91c5cad492430a5866 Mon Sep 17 00:00:00 2001
83From: Jerome Duval <jerome.duval@gmail.com>
84Date: Sat, 29 Jul 2017 12:13:00 +0200
85Subject: g_dbus_message_print: use B_PRIiDEV on Haiku
86
87because Haiku doesn't define major() and minor()
88
89diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c
90index be001ae..c8919a6 100644
91--- a/gio/gdbusmessage.c
92+++ b/gio/gdbusmessage.c
93@@ -33,8 +33,12 @@
94 #elif MAJOR_IN_SYSMACROS
95 #include <sys/sysmacros.h>
96 #else
97+#ifdef __HAIKU__
98+#include <SupportDefs.h>
99+#else
100 #define MAJOR_MINOR_NOT_FOUND 1
101 #endif
102+#endif
103 
104 #include "gdbusutils.h"
105 #include "gdbusmessage.h"
106@@ -3480,8 +3484,14 @@ g_dbus_message_print (GDBusMessage *message,
107               if (fstat (fds[n], &statbuf) == 0)
108                 {
109 #ifndef MAJOR_MINOR_NOT_FOUND                       
110+#ifdef __HAIKU__
111+                  g_string_append_printf (fs, "%s" "dev=%" B_PRIiDEV, fs->len > 0 ? "," : "",
112+                                          statbuf.st_dev);
113+#else
114+
115                   g_string_append_printf (fs, "%s" "dev=%d:%d", fs->len > 0 ? "," : "",
116                                           (gint) major (statbuf.st_dev), (gint) minor (statbuf.st_dev));
117+#endif
118 #endif                  
119                   g_string_append_printf (fs, "%s" "mode=0%o", fs->len > 0 ? "," : "",
120                                           (guint) statbuf.st_mode);
121@@ -3492,9 +3502,14 @@ g_dbus_message_print (GDBusMessage *message,
122                   g_string_append_printf (fs, "%s" "gid=%u", fs->len > 0 ? "," : "",
123                                           (guint) statbuf.st_gid);
124 #ifndef MAJOR_MINOR_NOT_FOUND                     
125+#ifdef __HAIKU__
126+                  g_string_append_printf (fs, "%s" "rdev=%" B_PRIiDEV, fs->len > 0 ? "," : "",
127+                                          statbuf.st_rdev);
128+#else
129                   g_string_append_printf (fs, "%s" "rdev=%d:%d", fs->len > 0 ? "," : "",
130                                           (gint) major (statbuf.st_rdev), (gint) minor (statbuf.st_rdev));
131 #endif                  
132+#endif
133                   g_string_append_printf (fs, "%s" "size=%" G_GUINT64_FORMAT, fs->len > 0 ? "," : "",
134                                           (guint64) statbuf.st_size);
135                   g_string_append_printf (fs, "%s" "atime=%" G_GUINT64_FORMAT, fs->len > 0 ? "," : "",
136-- 
1372.21.0
138
139
140From 1225be0329f92ce05292d47044227bed84a67ab1 Mon Sep 17 00:00:00 2001
141From: Jerome Duval <jerome.duval@gmail.com>
142Date: Sat, 29 Jul 2017 12:19:31 +0200
143Subject: gunixmounts.c: on Haiku
144
145* define get_mtab_minitor_file() and _g_get_unix_mounts()
146* like Inerix, _g_get_unix_mount_points() calls _g_get_unix_mounts().
147
148diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c
149index f2db27e..abf4c3d 100644
150--- a/gio/gunixmounts.c
151+++ b/gio/gunixmounts.c
152@@ -920,7 +920,18 @@ _g_get_unix_mounts (void)
153 
154   return return_list;
155 }
156+#elif defined(__HAIKU__)
157+static char *
158+get_mtab_monitor_file (void)
159+{
160+  return NULL;
161+}
162 
163+static GList *
164+_g_get_unix_mounts (void)
165+{
166+  return NULL;
167+}
168 /* Common code {{{2 */
169 #else
170 #error No _g_get_unix_mounts() implementation for system
171@@ -1436,8 +1447,8 @@ _g_get_unix_mount_points (void)
172   
173   return g_list_reverse (return_list);
174 }
175-/* Interix {{{2 */
176-#elif defined(__INTERIX)
177+/* Interix, Haiku {{{2 */
178+#elif defined(__INTERIX) || defined(__HAIKU__)
179 static GList *
180 _g_get_unix_mount_points (void)
181 {
182-- 
1832.21.0
184
185
186From 40d0e6168227335896a14b404bbad7ba46a9c16e Mon Sep 17 00:00:00 2001
187From: Jerome Duval <jerome.duval@gmail.com>
188Date: Sat, 29 Jul 2017 12:32:14 +0200
189Subject: glib/gutils.c: on Haiku define load_user_special_dirs()
190
191use find_directory() from SupportDefs.h
192
193diff --git a/glib/gutils.c b/glib/gutils.c
194index 5813b22..5b294a6 100644
195--- a/glib/gutils.c
196+++ b/glib/gutils.c
197@@ -70,6 +70,10 @@
198 #include "gwin32.h"
199 #endif
200 
201+#if defined(__HAIKU__)
202+#include <FindDirectory.h>
203+#include <fs_info.h>
204+#endif
205 
206 /**
207  * SECTION:misc_utils
208@@ -1451,6 +1455,35 @@ load_user_special_dirs (void)
209   g_user_special_dirs[G_USER_DIRECTORY_VIDEOS] = find_folder (kMovieDocumentsFolderType);
210 }
211 
212+#elif defined(__HAIKU__)
213+static void
214+load_user_special_dirs (void)
215+{
216+  char path[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
217+
218+  dev_t volume = dev_for_path("/boot");
219+  if (find_directory(B_DESKTOP_DIRECTORY, volume, false, path, sizeof(path))
220+      == B_OK) {
221+    g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] = g_strdup(path);
222+    g_user_special_dirs[G_USER_DIRECTORY_DOWNLOAD] = g_strdup(path);
223+  } else {
224+    g_user_special_dirs[G_USER_DIRECTORY_DOCUMENTS] = NULL;
225+    g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] = NULL;
226+  }
227+
228+  if (find_directory(B_USER_DIRECTORY, volume, false, path, sizeof(path))
229+      == B_OK) {
230+    g_user_special_dirs[G_USER_DIRECTORY_DOCUMENTS] = g_strdup(path);
231+  } else
232+    g_user_special_dirs[G_USER_DIRECTORY_DOWNLOAD] = NULL;
233+
234+  g_user_special_dirs[G_USER_DIRECTORY_MUSIC] = NULL;
235+  g_user_special_dirs[G_USER_DIRECTORY_PICTURES] = NULL;
236+  g_user_special_dirs[G_USER_DIRECTORY_PUBLIC_SHARE] = NULL;
237+  g_user_special_dirs[G_USER_DIRECTORY_TEMPLATES] = NULL;
238+  g_user_special_dirs[G_USER_DIRECTORY_VIDEOS] = NULL;
239+}
240+
241 #elif defined(G_OS_WIN32)
242 
243 static void
244-- 
2452.21.0
246
247
248From 23d15413eb7df653822c5a59ea8b08b4c3f61a86 Mon Sep 17 00:00:00 2001
249From: Jerome Duval <jerome.duval@gmail.com>
250Date: Wed, 20 Sep 2017 18:09:43 +0200
251Subject: configure.ac: define G_OS_HAIKU
252
253
254diff --git a/configure.ac b/configure.ac
255index dc3297c..387286a 100644
256--- a/configure.ac
257+++ b/configure.ac
258@@ -3348,6 +3348,10 @@ g_pid_format="\"$glib_pid_format\""
259 g_pollfd_format="\"$glib_pollfd_format\""
260 
261 case $host in
262+ *-*-haiku*)
263+    glib_os="#define G_OS_UNIX
264+#define G_OS_HAIKU"
265+    ;;
266   *-*-cygwin*)
267     glib_os="#define G_OS_UNIX
268 #define G_PLATFORM_WIN32
269-- 
2702.21.0
271
272
273From 7bd65b60714d8273fc17e5e1d9ab05ebb1c1b4d5 Mon Sep 17 00:00:00 2001
274From: Gerasim Troeglazov <3dEyes@gmail.com>
275Date: Sat, 18 May 2019 18:36:06 +1000
276Subject: Enable always_malloc by default
277
278
279diff --git a/glib/gslice.c b/glib/gslice.c
280index 6b0f226..789e083 100644
281--- a/glib/gslice.c
282+++ b/glib/gslice.c
283@@ -388,7 +388,9 @@ slice_config_init (SliceConfig *config)
284        * This way it's possible to force gslice to be enabled under
285        * valgrind just by setting G_SLICE to the empty string.
286        */
287+#ifndef __HAIKU__
288       if (RUNNING_ON_VALGRIND)
289+#endif
290         config->always_malloc = TRUE;
291     }
292 }
293-- 
2942.21.0
295
296