From 1e9681c8659dd586e0ade5f29334ceee195c88e3 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Tue, 17 Jun 2014 19:57:08 +0000 Subject: applying patch glib2-2.38.1.patch diff --git a/configure.ac b/configure.ac index f0840d5..f7df259 100644 --- a/configure.ac +++ b/configure.ac @@ -122,6 +122,10 @@ case $host in *-*-beos*) glib_native_beos="yes" ;; + *-*-haiku*) + glib_native_beos="yes" + LIBS="-lnetwork $LIBS" + ;; *) glib_native_beos="no" ;; @@ -2062,8 +2066,8 @@ AS_IF([ test x"$have_threads" = xposix], [ # One of them does for most gcc versions and some other platforms/compilers # too and could be considered as the canonical way to go. case $host in - *-*-cygwin*|*-*-darwin*) - # skip cygwin and darwin -pthread or -pthreads test + *-*-cygwin*|*-*-darwin*|*-*-haiku*) + # skip cygwin, darwin and haiku -pthread or -pthreads test ;; *-solaris*) # These compiler/linker flags work with both Sun Studio and gcc @@ -2232,8 +2236,8 @@ if test "x$G_THREAD_LIBS" = xerror; then fi case $host in - *-*-beos*) - G_THREAD_LIBS="-lbe -lroot -lglib-2.0 " + *-*-beos*|*-*-haiku*) + G_THREAD_LIBS="-lbe -lroot" G_THREAD_LIBS_EXTRA="-L\$(top_builddir_full)/.libs" ;; *) @@ -3574,6 +3578,9 @@ case $host in *-*-beos*) glib_os="#define G_OS_BEOS" ;; + *-*-haiku*) + glib_os="#define G_OS_HAIKU" + ;; *-*-cygwin*) glib_os="#define G_OS_UNIX #define G_PLATFORM_WIN32 diff --git a/gio/data-to-c.pl b/gio/data-to-c.pl index 20ba2fb..539b7e0 100755 --- a/gio/data-to-c.pl +++ b/gio/data-to-c.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Copyright © 2011 Red Hat, Inc # diff --git a/gio/gapplicationcommandline.c b/gio/gapplicationcommandline.c index 9a0840f..896a889 100644 --- a/gio/gapplicationcommandline.c +++ b/gio/gapplicationcommandline.c @@ -29,7 +29,7 @@ #include #include -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) #include "gunixinputstream.h" #endif @@ -201,7 +201,7 @@ g_application_command_line_real_printerr_literal (GApplicationCommandLine *cmdli static GInputStream * g_application_command_line_real_get_stdin (GApplicationCommandLine *cmdline) { -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) return g_unix_input_stream_new (0, FALSE); #else return g_win32_input_stream_new (GetStdHandle (STD_INPUT_HANDLE), FALSE); diff --git a/gio/gdbusauthmechanismsha1.c b/gio/gdbusauthmechanismsha1.c index e4f75eb..2c70803 100644 --- a/gio/gdbusauthmechanismsha1.c +++ b/gio/gdbusauthmechanismsha1.c @@ -252,7 +252,7 @@ ensure_keyring_directory (GError **error) { if (g_getenv ("G_DBUS_COOKIE_SHA1_KEYRING_DIR_IGNORE_PERMISSION") == NULL) { -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) struct stat statbuf; if (stat (path, &statbuf) != 0) { @@ -947,7 +947,7 @@ mechanism_server_initiate (GDBusAuthMechanism *mechanism, if (initial_response != NULL && strlen (initial_response) > 0) { -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) gint64 uid; gchar *endp; @@ -1114,7 +1114,7 @@ mechanism_client_initiate (GDBusAuthMechanism *mechanism, *out_initial_response_len = -1; -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) initial_response = g_strdup_printf ("%" G_GINT64_FORMAT, (gint64) getuid ()); #elif defined (G_OS_WIN32) initial_response = _g_dbus_win32_get_user_sid (); diff --git a/gio/glocalfile.c b/gio/glocalfile.c index 345214d..11eae36 100644 --- a/gio/glocalfile.c +++ b/gio/glocalfile.c @@ -27,7 +27,7 @@ #include #include #include -#if G_OS_UNIX +#if HAVE_DIRENT_H #include #endif #ifdef HAVE_UNISTD_H @@ -67,7 +67,7 @@ #include "gioerror.h" #include #include "glibintl.h" -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) #include "glib-unix.h" #endif #include "glib-private.h" @@ -1818,7 +1818,7 @@ _g_local_file_has_trash_dir (const char *dirname, dev_t dir_dev) return res; } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) gboolean _g_local_file_is_lost_found_dir (const char *path, dev_t path_dev) { diff --git a/gio/glocalfileinfo.h b/gio/glocalfileinfo.h index 6d35be5..e286098 100644 --- a/gio/glocalfileinfo.h +++ b/gio/glocalfileinfo.h @@ -58,7 +58,7 @@ typedef struct gboolean _g_local_file_has_trash_dir (const char *dirname, dev_t dir_dev); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) gboolean _g_local_file_is_lost_found_dir (const char *path, dev_t path_dev); #endif diff --git a/gio/gsocket.c b/gio/gsocket.c index 18e6137..689d3c0 100644 --- a/gio/gsocket.c +++ b/gio/gsocket.c @@ -29,7 +29,7 @@ #include "gsocket.h" -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) #include "glib-unix.h" #endif diff --git a/gio/gthreadedresolver.c b/gio/gthreadedresolver.c index 1ffaf15..702cf00 100644 --- a/gio/gthreadedresolver.c +++ b/gio/gthreadedresolver.c @@ -245,7 +245,7 @@ lookup_by_address_finish (GResolver *resolver, } -#if defined(G_OS_UNIX) +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) #ifdef __BIONIC__ /* Copy from bionic/libc/private/arpa_nameser_compat.h @@ -813,7 +813,7 @@ do_lookup_records (GTask *task, GList *records; GError *error = NULL; -#if defined(G_OS_UNIX) +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) gint len = 512; gint herr; GByteArray *answer; diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c index 03f1720..cb438a4 100644 --- a/gio/gunixmounts.c +++ b/gio/gunixmounts.c @@ -72,7 +72,6 @@ #include "glibintl.h" #include "gthemedicon.h" - #ifdef HAVE_MNTENT_H static const char *_resolve_dev_root (void); #endif @@ -716,6 +715,18 @@ _g_get_unix_mounts (void) return return_list; } +#elif defined(G_OS_HAIKU) +static char * +get_mtab_monitor_file (void) +{ + return NULL; +} + +static GList * +_g_get_unix_mounts (void) +{ + return NULL; +} #else #error No _g_get_unix_mounts() implementation for system #endif @@ -1106,7 +1117,7 @@ _g_get_unix_mount_points (void) return g_list_reverse (return_list); } -#elif defined(__INTERIX) +#elif defined(__INTERIX) || defined(G_OS_HAIKU) static GList * _g_get_unix_mount_points (void) { diff --git a/glib/gbacktrace.c b/glib/gbacktrace.c index 4d19d6f..1c46778 100644 --- a/glib/gbacktrace.c +++ b/glib/gbacktrace.c @@ -228,7 +228,7 @@ g_on_error_query (const gchar *prg_name) void g_on_error_stack_trace (const gchar *prg_name) { -#if defined(G_OS_UNIX) || defined(G_OS_BEOS) +#if defined(G_OS_UNIX) || defined(G_OS_BEOS) || defined(G_OS_HAIKU) pid_t pid; gchar buf[16]; gchar *args[4] = { "gdb", NULL, NULL, NULL }; diff --git a/glib/glib-unix.h b/glib/glib-unix.h index 66ccf74..a03a0cf 100644 --- a/glib/glib-unix.h +++ b/glib/glib-unix.h @@ -34,7 +34,7 @@ #include -#ifndef G_OS_UNIX +#if !defined(G_OS_UNIX) && !defined(G_OS_HAIKU) #error "This header may only be used on UNIX" #endif diff --git a/glib/gmain.c b/glib/gmain.c index 738e69c..4f5dfab 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -47,7 +47,7 @@ #define G_MAIN_POLL_DEBUG #endif -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) #include "glib-unix.h" #include #ifdef HAVE_EVENTFD @@ -73,10 +73,11 @@ #include #endif /* G_OS_WIN32 */ -#ifdef G_OS_BEOS +#if defined G_OS_BEOS || defined G_OS_HAIKU #include #include -#endif /* G_OS_BEOS */ +#include +#endif /* G_OS_BEOS || G_OS_HAIKU */ #include "gmain.h" @@ -391,7 +392,7 @@ static gboolean g_child_watch_dispatch (GSource *source, GSourceFunc callback, gpointer user_data); static void g_child_watch_finalize (GSource *source); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) static void g_unix_signal_handler (int signum); static gboolean g_unix_signal_watch_prepare (GSource *source, gint *timeout); @@ -2259,7 +2260,7 @@ g_source_remove_by_funcs_user_data (GSourceFuncs *funcs, return FALSE; } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) /** * g_source_add_unix_fd: * @source: a #GSource @@ -2425,7 +2426,7 @@ g_source_query_unix_fd (GSource *source, return poll_fd->revents; } -#endif /* G_OS_UNIX */ +#endif /* G_OS_UNIX || G_OS_HAIKU */ /** * g_get_current_time: @@ -5471,7 +5472,7 @@ glib_worker_main (gpointer data) { g_main_context_iteration (glib_worker_context, TRUE); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) if (any_unix_signal_pending) dispatch_unix_signals (); #endif @@ -5488,7 +5489,7 @@ g_get_worker_context (void) if (g_once_init_enter (&initialised)) { /* mask all signals in the worker thread */ -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) sigset_t prev_mask; sigset_t all; @@ -5497,7 +5498,7 @@ g_get_worker_context (void) #endif glib_worker_context = g_main_context_new (); g_thread_new ("gmain", glib_worker_main, NULL); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) pthread_sigmask (SIG_SETMASK, &prev_mask, NULL); #endif g_once_init_leave (&initialised, TRUE); diff --git a/glib/gmain.h b/glib/gmain.h index c455353..ad7b330 100644 --- a/glib/gmain.h +++ b/glib/gmain.h @@ -471,7 +471,7 @@ void g_source_set_ready_time (GSource *source, GLIB_AVAILABLE_IN_2_36 gint64 g_source_get_ready_time (GSource *source); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) GLIB_AVAILABLE_IN_2_36 gpointer g_source_add_unix_fd (GSource *source, gint fd, @@ -606,7 +606,7 @@ void g_main_context_invoke (GMainContext *context, GLIB_VAR GSourceFuncs g_timeout_funcs; GLIB_VAR GSourceFuncs g_child_watch_funcs; GLIB_VAR GSourceFuncs g_idle_funcs; -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) || defined(G_OS_HAIKU) GLIB_VAR GSourceFuncs g_unix_signal_funcs; GLIB_VAR GSourceFuncs g_unix_fd_source_funcs; #endif diff --git a/glib/gstdio.c b/glib/gstdio.c index cca4ff5..6f4ae9c 100644 --- a/glib/gstdio.c +++ b/glib/gstdio.c @@ -46,7 +46,7 @@ #include "gstdio.h" -#if !defined (G_OS_UNIX) && !defined (G_OS_WIN32) && !defined (G_OS_BEOS) +#if !defined (G_OS_UNIX) && !defined (G_OS_WIN32) && !defined (G_OS_BEOS) && !defined (G_OS_HAIKU) #error Please port this to your operating system #endif diff --git a/glib/gutils.c b/glib/gutils.c index 2620cb6..34f1edd 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -77,6 +77,11 @@ #include "gwin32.h" #endif +#if defined(G_OS_HAIKU) +#include +#include +#endif + /** * SECTION:misc_utils @@ -421,7 +426,7 @@ g_find_program_in_path (const gchar *program) } path = g_getenv ("PATH"); -#if defined(G_OS_UNIX) || defined(G_OS_BEOS) +#if defined(G_OS_UNIX) || defined(G_OS_BEOS) || defined(G_OS_HAIKU) if (path == NULL) { /* There is no 'PATH' in the environment. The default @@ -1467,6 +1472,36 @@ load_user_special_dirs (void) #endif /* HAVE_CARBON */ +#if defined(G_OS_HAIKU) +static void +load_user_special_dirs (void) +{ + char path[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH]; + + dev_t volume = dev_for_path("/boot"); + if (find_directory(B_DESKTOP_DIRECTORY, volume, false, path, sizeof(path)) + == B_OK) { + g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] = g_strdup(path); + g_user_special_dirs[G_USER_DIRECTORY_DOWNLOAD] = g_strdup(path); + } else { + g_user_special_dirs[G_USER_DIRECTORY_DOCUMENTS] = NULL; + g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] = NULL; + } + + if (find_directory(B_USER_DIRECTORY, volume, false, path, sizeof(path)) + == B_OK) { + g_user_special_dirs[G_USER_DIRECTORY_DOCUMENTS] = g_strdup(path); + } else + g_user_special_dirs[G_USER_DIRECTORY_DOWNLOAD] = NULL; + + g_user_special_dirs[G_USER_DIRECTORY_MUSIC] = NULL; + g_user_special_dirs[G_USER_DIRECTORY_PICTURES] = NULL; + g_user_special_dirs[G_USER_DIRECTORY_PUBLIC_SHARE] = NULL; + g_user_special_dirs[G_USER_DIRECTORY_TEMPLATES] = NULL; + g_user_special_dirs[G_USER_DIRECTORY_VIDEOS] = NULL; +} +#endif /* G_OS_HAIKU */ + #if defined(G_OS_WIN32) static void load_user_special_dirs (void) -- 1.8.3.4 From 092577e9398f25dc86c5dff1b9baea92a13c78e4 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Thu, 21 Aug 2014 17:08:30 +0000 Subject: strings.h for strcasecmp diff --git a/glib/glib-init.c b/glib/glib-init.c index 0032ee8..384257f 100644 --- a/glib/glib-init.c +++ b/glib/glib-init.c @@ -27,6 +27,7 @@ #include "gconstructor.h" #include +#include #include #include #include diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c index 4fcd91c..676c2df 100644 --- a/glib/gstrfuncs.c +++ b/glib/gstrfuncs.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include /* For tolower() */ -- 1.8.3.4