diff --git a/ports/cairo/fix-HAVE_FT_PALETTE_SELECT-assumption.patch b/ports/cairo/fix-HAVE_FT_PALETTE_SELECT-assumption.patch new file mode 100644 index 00000000000000..ddea7f8f1c3d58 --- /dev/null +++ b/ports/cairo/fix-HAVE_FT_PALETTE_SELECT-assumption.patch @@ -0,0 +1,54 @@ +diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c +index 75d6f8c16..cb506b600 100644 +--- a/src/cairo-ft-font.c ++++ b/src/cairo-ft-font.c +@@ -2518,20 +2518,20 @@ _cairo_ft_glyph_fini (cairo_scaled_glyph_private_t *glyph_private, + } + + +-#ifdef HAVE_FT_PALETTE_SELECT + static void + _cairo_ft_scaled_glyph_set_palette (cairo_ft_scaled_font_t *scaled_font, + FT_Face face, + unsigned int *num_entries_ret, + FT_Color **entries_ret) + { +- FT_Palette_Data palette_data; +- unsigned int num_entries; +- FT_Color *entries; ++ unsigned int num_entries = 0; ++ FT_Color *entries = NULL; + + num_entries = 0; + entries = NULL; + ++#ifdef HAVE_FT_PALETTE_SELECT ++ FT_Palette_Data palette_data; + if (FT_Palette_Data_Get (face, &palette_data) == 0 && palette_data.num_palettes > 0) { + FT_UShort palette_index = CAIRO_COLOR_PALETTE_DEFAULT; + if (scaled_font->base.options.palette_index < palette_data.num_palettes) +@@ -2552,13 +2552,13 @@ _cairo_ft_scaled_glyph_set_palette (cairo_ft_scaled_font_t *scaled_font, + } + } + } ++#endif + if (num_entries_ret) + *num_entries_ret = num_entries; + + if (entries_ret) + *entries_ret = entries; + } +-#endif + + /* returns TRUE if foreground color used */ + static cairo_bool_t +@@ -2628,9 +2628,7 @@ _cairo_ft_scaled_glyph_init_surface (cairo_ft_scaled_font_t *scaled_font, + scaled_glyph, + face, + foreground_color); +-#ifdef HAVE_FT_PALETTE_SELECT + _cairo_ft_scaled_glyph_set_palette (scaled_font, face, NULL, NULL); +-#endif + + load_flags &= ~FT_LOAD_MONOCHROME; + /* clear load target mode */ diff --git a/ports/cairo/fix-emscripten-linux-build.patch b/ports/cairo/fix-emscripten-linux-build.patch new file mode 100644 index 00000000000000..a567dd076d38e9 --- /dev/null +++ b/ports/cairo/fix-emscripten-linux-build.patch @@ -0,0 +1,32 @@ +diff --git a/meson.build b/meson.build +index a238763..810cdca 100644 +--- a/meson.build ++++ b/meson.build +@@ -819,7 +819,7 @@ else + cairoboilerplate_dep = dependency('', required: false) + endif + +-subdir('util') ++#subdir('util') + + if not get_option('tests').disabled() and feature_conf.get('CAIRO_HAS_PNG_FUNCTIONS', 0) == 1 + subdir('test') +diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c +index a37af4c..8e1c0f9 100644 +--- a/src/cairo-ps-surface.c ++++ b/src/cairo-ps-surface.c +@@ -103,12 +103,14 @@ + #endif + + #ifndef HAVE_CTIME_R ++#ifndef __EMSCRIPTEN__ + static char *ctime_r(const time_t *timep, char *buf) + { + (void)buf; + return ctime(timep); + } + #endif ++#endif + + /** + * SECTION:cairo-ps diff --git a/ports/cairo/portfile.cmake b/ports/cairo/portfile.cmake index 4b237c8f069ce6..54690d0cf9aa5c 100644 --- a/ports/cairo/portfile.cmake +++ b/ports/cairo/portfile.cmake @@ -13,7 +13,9 @@ vcpkg_from_gitlab( disable-atomic-ops-check.patch # See https://gitlab.freedesktop.org/cairo/cairo/-/issues/554 mingw-dllexport.patch fix-static-missing-lib-msimg32.patch + fix-HAVE_FT_PALETTE_SELECT-assumption.patch disable-lzo.patch + fix-emscripten-linux-build.patch ${PATCHES} ) diff --git a/ports/cairo/vcpkg.json b/ports/cairo/vcpkg.json index 995deec38e1498..77fdd7a6bcbf15 100644 --- a/ports/cairo/vcpkg.json +++ b/ports/cairo/vcpkg.json @@ -35,12 +35,6 @@ "freetype" ] }, - "gobject": { - "description": "build gobject module", - "dependencies": [ - "glib" - ] - }, "x11": { "description": "build with x11 support", "supports": "!windows" diff --git a/ports/fontconfig/fix-emscripten-build.patch b/ports/fontconfig/fix-emscripten-build.patch new file mode 100644 index 00000000000000..dbdcac7cafc80d --- /dev/null +++ b/ports/fontconfig/fix-emscripten-build.patch @@ -0,0 +1,13 @@ +diff --git a/src/meson.build b/src/meson.build +index 34ccd8c..7edfa4a 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -37,6 +37,8 @@ elif cc.get_id() == 'msvc' + cpp += ['/EP'] + elif cc.get_id() == 'clang' + cpp += ['-E', '-P'] ++elif cc.get_id() == 'emscripten' ++ cpp += ['-E', '-P'] + else + error('FIXME: implement cc.preprocess') + endif diff --git a/ports/fontconfig/portfile.cmake b/ports/fontconfig/portfile.cmake index 2b35e1fab138c2..02164a389eeed0 100644 --- a/ports/fontconfig/portfile.cmake +++ b/ports/fontconfig/portfile.cmake @@ -9,6 +9,7 @@ vcpkg_from_gitlab( no-etc-symlinks.patch libgetopt.patch fix-preprocessor-clang-cl.patch + fix-emscripten-build.patch ) vcpkg_add_to_path(PREPEND "${CURRENT_HOST_INSTALLED_DIR}/tools/gperf") @@ -19,6 +20,7 @@ vcpkg_configure_meson( -Ddoc=disabled -Dcache-build=disabled -Dtests=disabled + -Dtools=disabled ) #https://www.freedesktop.org/software/fontconfig/fontconfig-user.html # Adding OPTIONS for e.g. baseconfig-dir etc. won't work since meson will try to install into those dirs! @@ -79,10 +81,10 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") endforeach() endif() -vcpkg_copy_tools( - TOOL_NAMES fc-match fc-cat fc-list fc-pattern fc-query fc-scan fc-cache fc-validate fc-conflist - AUTO_CLEAN -) +#vcpkg_copy_tools( +# TOOL_NAMES fc-match fc-cat fc-list fc-pattern fc-query fc-scan fc-cache fc-validate fc-conflist +# AUTO_CLEAN +#) configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY) file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/ports/glib/emscripten.patch b/ports/glib/emscripten.patch new file mode 100644 index 00000000000000..a548b6b9aa906f --- /dev/null +++ b/ports/glib/emscripten.patch @@ -0,0 +1,5082 @@ +diff --git a/README.md b/README.md +index acf2e0f83..07a67406f 100644 +--- a/README.md ++++ b/README.md +@@ -1,9 +1,8 @@ +-# GLib ++# GLib for Emscripten + +-GLib is the low-level core library that forms the basis for projects such +-as GTK and GNOME. It provides data structure handling for C, portability +-wrappers, and interfaces for such runtime functionality as an event loop, +-threads, dynamic loading, and an object system. ++This is an Emscripten-compatible port of GLib 2.75.0. The port *mostly* works. However, some parts ++that are incompatible with Emscripten are either no-ops, or will fail at runtime. Do not use this in ++production until you've thoroughly tested your use-case. + + The official download locations are: + +diff --git a/README_glib.md b/README_glib.md +new file mode 100644 +index 000000000..e78a28c2c +--- /dev/null ++++ b/README_glib.md +@@ -0,0 +1,93 @@ ++# GLib ++ ++GLib is the low-level core library that forms the basis for projects such ++as GTK and GNOME. It provides data structure handling for C, portability ++wrappers, and interfaces for such runtime functionality as an event loop, ++threads, dynamic loading, and an object system. ++ ++The official download locations are: ++ ++ ++The official web site is: ++ ++ ++## Installation ++ ++See the file '[INSTALL.md](INSTALL.md)' ++ ++## Supported versions ++ ++Only the most recent unstable and stable release series are supported. All ++older versions are not supported upstream and may contain bugs, some of ++which may be exploitable security vulnerabilities. ++ ++See [SECURITY.md](SECURITY.md) for more details. ++ ++## Documentation ++ ++API documentation is available online for GLib for the: ++ * [GLib](https://docs.gtk.org/glib/) ++ * [GObject](https://docs.gtk.org/gobject/) ++ * [GModule](https://docs.gtk.org/gmodule/) ++ * [GIO](https://docs.gtk.org/gio/) ++ ++## Discussion ++ ++If you have a question about how to use GLib, seek help on [GNOME’s Discourse ++instance](https://discourse.gnome.org/tags/glib). Alternatively, ask a question ++on [StackOverflow and tag it `glib`](https://stackoverflow.com/questions/tagged/glib). ++ ++## Reporting bugs ++ ++Bugs should be [reported to the GNOME issue tracking system](https://gitlab.gnome.org/GNOME/glib/issues/new). ++You will need to create an account for yourself. You may also submit bugs by ++e-mail (without an account) by e-mailing , ++but this will give you a degraded experience. ++ ++Bugs are for reporting problems in GLib itself, not for asking questions about ++how to use it. To ask questions, use one of our [discussion forums](#discussion). ++ ++In bug reports please include: ++ ++* Information about your system. For instance: ++ * What operating system and version ++ * For Linux, what version of the C library ++ * And anything else you think is relevant. ++* How to reproduce the bug. ++ * If you can reproduce it with one of the test programs that are built ++ in the `tests/` subdirectory, that will be most convenient. Otherwise, ++ please include a short test program that exhibits the behavior. ++ As a last resort, you can also provide a pointer to a larger piece ++ of software that can be downloaded. ++* If the bug was a crash, the exact text that was printed out ++ when the crash occurred. ++* Further information such as stack traces may be useful, but ++ is not necessary. ++ ++## Contributing to GLib ++ ++Please follow the [contribution guide](./CONTRIBUTING.md) to know how to ++start contributing to GLib. ++ ++Patches should be [submitted as merge requests](https://gitlab.gnome.org/GNOME/glib/-/merge_requests/new) ++to gitlab.gnome.org. If the patch fixes an existing issue, please refer to the ++issue in your commit message with the following notation (for issue 123): ++``` ++Closes: #123 ++``` ++ ++Otherwise, create a new merge request that introduces the change. Filing a ++separate issue is not required. ++ ++## Default branch renamed to `main` ++ ++The default development branch of GLib has been renamed to `main`. To update ++your local checkout, use: ++```sh ++git checkout master ++git branch -m master main ++git fetch ++git branch --unset-upstream ++git branch -u origin/main ++git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main ++``` +diff --git a/emscripten-crossfile.meson b/emscripten-crossfile.meson +new file mode 100644 +index 000000000..ca4e058c6 +--- /dev/null ++++ b/emscripten-crossfile.meson +@@ -0,0 +1,25 @@ ++[binaries] ++c = 'emcc' ++cpp = 'em++' ++ld = 'wasm-ld' ++ar = 'emar' ++ranlib = 'emranlib' ++pkgconfig = ['emconfigure', 'pkg-config'] ++ ++# https://docs.gtk.org/glib/cross-compiling.html#cross-properties ++[properties] ++growing_stack = true ++have_c99_vsnprintf = true ++have_c99_snprintf = true ++have_unix98_printf = true ++ ++# Ensure that `-s PTHREAD_POOL_SIZE=*` is not injected into .pc files ++[built-in options] ++c_thread_count = 0 ++cpp_thread_count = 0 ++ ++[host_machine] ++system = 'emscripten' ++cpu_family = 'wasm32' ++cpu = 'wasm32' ++endian = 'little' +diff --git a/gio/gappinfo.c b/gio/gappinfo.c +index 42feb9d7c..a4ff67854 100644 +--- a/gio/gappinfo.c ++++ b/gio/gappinfo.c +@@ -1020,7 +1020,7 @@ g_app_info_launch_default_for_uri (const char *uri, + g_object_unref (app_info); + } + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + if (!res && glib_should_use_portal ()) + { + const char *parent_window = NULL; +@@ -1072,7 +1072,7 @@ launch_default_for_uri_portal_open_uri_cb (GObject *object, + static void + launch_default_for_uri_portal_open_uri (GTask *task, GError *error) + { +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + LaunchDefaultForUriData *data = g_task_get_task_data (task); + GCancellable *cancellable = g_task_get_cancellable (task); + +diff --git a/gio/gapplication.c b/gio/gapplication.c +index 3708e812c..0b2dbbd24 100644 +--- a/gio/gapplication.c ++++ b/gio/gapplication.c +@@ -287,8 +287,10 @@ enum + + static guint g_application_signals[NR_SIGNALS]; + +-static void g_application_action_group_iface_init (GActionGroupInterface *); +-static void g_application_action_map_iface_init (GActionMapInterface *); ++static void g_application_action_group_iface_init (GActionGroupInterface *iface, ++ gpointer iface_data); ++static void g_application_action_map_iface_init (GActionMapInterface *iface, ++ gpointer iface_data); + G_DEFINE_TYPE_WITH_CODE (GApplication, g_application, G_TYPE_OBJECT, + G_ADD_PRIVATE (GApplication) + G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_GROUP, g_application_action_group_iface_init) +@@ -314,7 +316,8 @@ typedef struct + } GApplicationExportedActions; + + static GType g_application_exported_actions_get_type (void); +-static void g_application_exported_actions_iface_init (GRemoteActionGroupInterface *iface); ++static void g_application_exported_actions_iface_init (GRemoteActionGroupInterface *iface, ++ gpointer iface_data); + G_DEFINE_TYPE_WITH_CODE (GApplicationExportedActions, g_application_exported_actions, G_TYPE_SIMPLE_ACTION_GROUP, + G_IMPLEMENT_INTERFACE (G_TYPE_REMOTE_ACTION_GROUP, g_application_exported_actions_iface_init)) + +@@ -358,7 +361,8 @@ g_application_exported_actions_init (GApplicationExportedActions *actions) + } + + static void +-g_application_exported_actions_iface_init (GRemoteActionGroupInterface *iface) ++g_application_exported_actions_iface_init (GRemoteActionGroupInterface *iface, ++ gpointer iface_data) + { + iface->activate_action_full = g_application_exported_actions_activate_action_full; + iface->change_action_state_full = g_application_exported_actions_change_action_state_full; +@@ -2733,7 +2737,8 @@ g_application_remove_action (GActionMap *action_map, + } + + static void +-g_application_action_group_iface_init (GActionGroupInterface *iface) ++g_application_action_group_iface_init (GActionGroupInterface *iface, ++ gpointer iface_data) + { + iface->list_actions = g_application_list_actions; + iface->query_action = g_application_query_action; +@@ -2742,7 +2747,8 @@ g_application_action_group_iface_init (GActionGroupInterface *iface) + } + + static void +-g_application_action_map_iface_init (GActionMapInterface *iface) ++g_application_action_map_iface_init (GActionMapInterface *iface, ++ gpointer iface_data) + { + iface->lookup_action = g_application_lookup_action; + iface->add_action = g_application_add_action; +diff --git a/gio/gapplicationcommandline.c b/gio/gapplicationcommandline.c +index e9a6f46c6..49de5eae2 100644 +--- a/gio/gapplicationcommandline.c ++++ b/gio/gapplicationcommandline.c +@@ -297,7 +297,9 @@ g_application_command_line_real_printerr_literal (GApplicationCommandLine *cmdli + static GInputStream * + g_application_command_line_real_get_stdin (GApplicationCommandLine *cmdline) + { +-#ifdef G_OS_UNIX ++#ifdef G_PLATFORM_WASM ++ return NULL; ++#elif defined(G_OS_UNIX) + return g_unix_input_stream_new (0, FALSE); + #else + return g_win32_input_stream_new (GetStdHandle (STD_INPUT_HANDLE), FALSE); +diff --git a/gio/gbufferedinputstream.c b/gio/gbufferedinputstream.c +index 55450ce0e..8f144c6fa 100644 +--- a/gio/gbufferedinputstream.c ++++ b/gio/gbufferedinputstream.c +@@ -115,7 +115,8 @@ static gssize g_buffered_input_stream_real_fill_finish (GBufferedInputStream *s + GAsyncResult *result, + GError **error); + +-static void g_buffered_input_stream_seekable_iface_init (GSeekableIface *iface); ++static void g_buffered_input_stream_seekable_iface_init (GSeekableIface *iface, ++ gpointer iface_data); + static goffset g_buffered_input_stream_tell (GSeekable *seekable); + static gboolean g_buffered_input_stream_can_seek (GSeekable *seekable); + static gboolean g_buffered_input_stream_seek (GSeekable *seekable, +@@ -302,7 +303,8 @@ g_buffered_input_stream_finalize (GObject *object) + } + + static void +-g_buffered_input_stream_seekable_iface_init (GSeekableIface *iface) ++g_buffered_input_stream_seekable_iface_init (GSeekableIface *iface, ++ gpointer iface_data) + { + iface->tell = g_buffered_input_stream_tell; + iface->can_seek = g_buffered_input_stream_can_seek; +diff --git a/gio/gbufferedoutputstream.c b/gio/gbufferedoutputstream.c +index 4999a7d69..af5581c55 100644 +--- a/gio/gbufferedoutputstream.c ++++ b/gio/gbufferedoutputstream.c +@@ -107,7 +107,8 @@ static gboolean g_buffered_output_stream_close_finish (GOutputStream *str + GAsyncResult *result, + GError **error); + +-static void g_buffered_output_stream_seekable_iface_init (GSeekableIface *iface); ++static void g_buffered_output_stream_seekable_iface_init (GSeekableIface *iface, ++ gpointer iface_data); + static goffset g_buffered_output_stream_tell (GSeekable *seekable); + static gboolean g_buffered_output_stream_can_seek (GSeekable *seekable); + static gboolean g_buffered_output_stream_seek (GSeekable *seekable, +@@ -348,7 +349,8 @@ g_buffered_output_stream_init (GBufferedOutputStream *stream) + } + + static void +-g_buffered_output_stream_seekable_iface_init (GSeekableIface *iface) ++g_buffered_output_stream_seekable_iface_init (GSeekableIface *iface, ++ gpointer iface_data) + { + iface->tell = g_buffered_output_stream_tell; + iface->can_seek = g_buffered_output_stream_can_seek; +diff --git a/gio/gbytesicon.c b/gio/gbytesicon.c +index b402a5178..8a88f8da0 100644 +--- a/gio/gbytesicon.c ++++ b/gio/gbytesicon.c +@@ -59,8 +59,10 @@ enum + PROP_BYTES + }; + +-static void g_bytes_icon_icon_iface_init (GIconIface *iface); +-static void g_bytes_icon_loadable_icon_iface_init (GLoadableIconIface *iface); ++static void g_bytes_icon_icon_iface_init (GIconIface *iface, ++ gpointer iface_data); ++static void g_bytes_icon_loadable_icon_iface_init (GLoadableIconIface *iface, ++ gpointer iface_data); + G_DEFINE_TYPE_WITH_CODE (GBytesIcon, g_bytes_icon, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (G_TYPE_ICON, g_bytes_icon_icon_iface_init) + G_IMPLEMENT_INTERFACE (G_TYPE_LOADABLE_ICON, g_bytes_icon_loadable_icon_iface_init)) +@@ -210,7 +212,8 @@ g_bytes_icon_serialize (GIcon *icon) + } + + static void +-g_bytes_icon_icon_iface_init (GIconIface *iface) ++g_bytes_icon_icon_iface_init (GIconIface *iface, ++ gpointer iface_data) + { + iface->hash = g_bytes_icon_hash; + iface->equal = g_bytes_icon_equal; +@@ -263,7 +266,8 @@ g_bytes_icon_load_finish (GLoadableIcon *icon, + } + + static void +-g_bytes_icon_loadable_icon_iface_init (GLoadableIconIface *iface) ++g_bytes_icon_loadable_icon_iface_init (GLoadableIconIface *iface, ++ gpointer iface_data) + { + iface->load = g_bytes_icon_load; + iface->load_async = g_bytes_icon_load_async; +diff --git a/gio/gcharsetconverter.c b/gio/gcharsetconverter.c +index 499319999..ab22439a7 100644 +--- a/gio/gcharsetconverter.c ++++ b/gio/gcharsetconverter.c +@@ -47,8 +47,10 @@ enum { + * GIConv. + */ + +-static void g_charset_converter_iface_init (GConverterIface *iface); +-static void g_charset_converter_initable_iface_init (GInitableIface *iface); ++static void g_charset_converter_iface_init (GConverterIface *iface, ++ gpointer iface_data); ++static void g_charset_converter_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + + /** + * GCharsetConverter: +@@ -423,7 +425,8 @@ g_charset_converter_get_num_fallbacks (GCharsetConverter *converter) + } + + static void +-g_charset_converter_iface_init (GConverterIface *iface) ++g_charset_converter_iface_init (GConverterIface *iface, ++ gpointer iface_data) + { + iface->convert = g_charset_converter_convert; + iface->reset = g_charset_converter_reset; +@@ -468,7 +471,8 @@ g_charset_converter_initable_init (GInitable *initable, + } + + static void +-g_charset_converter_initable_iface_init (GInitableIface *iface) ++g_charset_converter_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + iface->init = g_charset_converter_initable_init; + } +diff --git a/gio/gconverterinputstream.c b/gio/gconverterinputstream.c +index 59277bf83..306d1235f 100644 +--- a/gio/gconverterinputstream.c ++++ b/gio/gconverterinputstream.c +@@ -93,8 +93,8 @@ static gssize g_converter_input_stream_read_nonblocking (GPollableInputStream + static GSource *g_converter_input_stream_create_source (GPollableInputStream *stream, + GCancellable *cancellable); + +-static void g_converter_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface); +- ++static void g_converter_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface, ++ gpointer iface_data); + G_DEFINE_TYPE_WITH_CODE (GConverterInputStream, + g_converter_input_stream, + G_TYPE_FILTER_INPUT_STREAM, +@@ -129,7 +129,8 @@ g_converter_input_stream_class_init (GConverterInputStreamClass *klass) + } + + static void +-g_converter_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface) ++g_converter_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface, ++ gpointer iface_data) + { + iface->can_poll = g_converter_input_stream_can_poll; + iface->is_readable = g_converter_input_stream_is_readable; +diff --git a/gio/gconverteroutputstream.c b/gio/gconverteroutputstream.c +index b26f645d4..4e563c0ff 100644 +--- a/gio/gconverteroutputstream.c ++++ b/gio/gconverteroutputstream.c +@@ -108,7 +108,8 @@ static gssize g_converter_output_stream_write_nonblocking (GPollableOutputStre + static GSource *g_converter_output_stream_create_source (GPollableOutputStream *stream, + GCancellable *cancellable); + +-static void g_converter_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface); ++static void g_converter_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface, ++ gpointer iface_data); + + G_DEFINE_TYPE_WITH_CODE (GConverterOutputStream, + g_converter_output_stream, +@@ -145,7 +146,8 @@ g_converter_output_stream_class_init (GConverterOutputStreamClass *klass) + } + + static void +-g_converter_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface) ++g_converter_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface, ++ gpointer iface_data) + { + iface->can_poll = g_converter_output_stream_can_poll; + iface->is_writable = g_converter_output_stream_is_writable; +diff --git a/gio/gdataoutputstream.c b/gio/gdataoutputstream.c +index f2d1f3988..4484089d8 100644 +--- a/gio/gdataoutputstream.c ++++ b/gio/gdataoutputstream.c +@@ -60,7 +60,8 @@ static void g_data_output_stream_get_property (GObject *object, + GValue *value, + GParamSpec *pspec); + +-static void g_data_output_stream_seekable_iface_init (GSeekableIface *iface); ++static void g_data_output_stream_seekable_iface_init (GSeekableIface *iface, ++ gpointer iface_data); + static goffset g_data_output_stream_tell (GSeekable *seekable); + static gboolean g_data_output_stream_can_seek (GSeekable *seekable); + static gboolean g_data_output_stream_seek (GSeekable *seekable, +@@ -162,7 +163,8 @@ g_data_output_stream_init (GDataOutputStream *stream) + } + + static void +-g_data_output_stream_seekable_iface_init (GSeekableIface *iface) ++g_data_output_stream_seekable_iface_init (GSeekableIface *iface, ++ gpointer iface_data) + { + iface->tell = g_data_output_stream_tell; + iface->can_seek = g_data_output_stream_can_seek; +diff --git a/gio/gdbusactiongroup.c b/gio/gdbusactiongroup.c +index 275c5fc01..34c6c080f 100644 +--- a/gio/gdbusactiongroup.c ++++ b/gio/gdbusactiongroup.c +@@ -131,8 +131,10 @@ action_info_new_from_iter (GVariantIter *iter) + return info; + } + +-static void g_dbus_action_group_remote_iface_init (GRemoteActionGroupInterface *iface); +-static void g_dbus_action_group_iface_init (GActionGroupInterface *iface); ++static void g_dbus_action_group_remote_iface_init (GRemoteActionGroupInterface *iface, ++ gpointer iface_data); ++static void g_dbus_action_group_iface_init (GActionGroupInterface *iface, ++ gpointer iface_data); + G_DEFINE_TYPE_WITH_CODE (GDBusActionGroup, g_dbus_action_group, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_GROUP, g_dbus_action_group_iface_init) + G_IMPLEMENT_INTERFACE (G_TYPE_REMOTE_ACTION_GROUP, g_dbus_action_group_remote_iface_init)) +@@ -459,14 +461,16 @@ g_dbus_action_group_class_init (GDBusActionGroupClass *class) + } + + static void +-g_dbus_action_group_remote_iface_init (GRemoteActionGroupInterface *iface) ++g_dbus_action_group_remote_iface_init (GRemoteActionGroupInterface *iface, ++ gpointer iface_data) + { + iface->activate_action_full = g_dbus_action_group_activate_action_full; + iface->change_action_state_full = g_dbus_action_group_change_action_state_full; + } + + static void +-g_dbus_action_group_iface_init (GActionGroupInterface *iface) ++g_dbus_action_group_iface_init (GActionGroupInterface *iface, ++ gpointer iface_data) + { + iface->list_actions = g_dbus_action_group_list_actions; + iface->query_action = g_dbus_action_group_query_action; +diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c +index 65ece54b2..f5fa3bcff 100644 +--- a/gio/gdbusconnection.c ++++ b/gio/gdbusconnection.c +@@ -510,8 +510,10 @@ static void schedule_method_call (GDBusConnection *connection, + + static guint signals[LAST_SIGNAL] = { 0 }; + +-static void initable_iface_init (GInitableIface *initable_iface); +-static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface); ++static void initable_iface_init (GInitableIface *initable_iface, ++ gpointer iface_data); ++static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface, ++ gpointer iface_data); + + G_DEFINE_TYPE_WITH_CODE (GDBusConnection, g_dbus_connection, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init) +@@ -2672,7 +2674,8 @@ initable_init (GInitable *initable, + } + + static void +-initable_iface_init (GInitableIface *initable_iface) ++initable_iface_init (GInitableIface *initable_iface, ++ gpointer iface_data) + { + initable_iface->init = initable_init; + } +@@ -2680,7 +2683,8 @@ initable_iface_init (GInitableIface *initable_iface) + /* ---------------------------------------------------------------------------------------------------- */ + + static void +-async_initable_iface_init (GAsyncInitableIface *async_initable_iface) ++async_initable_iface_init (GAsyncInitableIface *async_initable_iface, ++ gpointer iface_data) + { + /* Use default */ + } +diff --git a/gio/gdbusdaemon.c b/gio/gdbusdaemon.c +index 70009f970..8da84eda6 100644 +--- a/gio/gdbusdaemon.c ++++ b/gio/gdbusdaemon.c +@@ -90,8 +90,10 @@ enum + static guint g_dbus_daemon_signals[NR_SIGNALS]; + + +-static void initable_iface_init (GInitableIface *initable_iface); +-static void g_dbus_daemon_iface_init (_GFreedesktopDBusIface *iface); ++static void initable_iface_init (GInitableIface *initable_iface, ++ gpointer iface_data); ++static void g_dbus_daemon_iface_init (_GFreedesktopDBusIface *iface, ++ gpointer iface_data); + + #define g_dbus_daemon_get_type _g_dbus_daemon_get_type + G_DEFINE_TYPE_WITH_CODE (GDBusDaemon, g_dbus_daemon, _G_TYPE_FREEDESKTOP_DBUS_SKELETON, +@@ -1702,7 +1704,8 @@ g_dbus_daemon_class_init (GDBusDaemonClass *klass) + } + + static void +-g_dbus_daemon_iface_init (_GFreedesktopDBusIface *iface) ++g_dbus_daemon_iface_init (_GFreedesktopDBusIface *iface, ++ gpointer iface_data) + { + iface->handle_add_match = handle_add_match; + iface->handle_get_connection_selinux_security_context = handle_get_connection_selinux_security_context; +@@ -1724,7 +1727,8 @@ g_dbus_daemon_iface_init (_GFreedesktopDBusIface *iface) + } + + static void +-initable_iface_init (GInitableIface *initable_iface) ++initable_iface_init (GInitableIface *initable_iface, ++ gpointer iface_data) + { + initable_iface->init = initable_init; + } +diff --git a/gio/gdbusobjectmanagerclient.c b/gio/gdbusobjectmanagerclient.c +index b6b3b212c..6df10373b 100644 +--- a/gio/gdbusobjectmanagerclient.c ++++ b/gio/gdbusobjectmanagerclient.c +@@ -174,9 +174,12 @@ enum + + static guint signals[LAST_SIGNAL] = { 0 }; + +-static void initable_iface_init (GInitableIface *initable_iface); +-static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface); +-static void dbus_object_manager_interface_init (GDBusObjectManagerIface *iface); ++static void initable_iface_init (GInitableIface *initable_iface, ++ gpointer iface_data); ++static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface, ++ gpointer iface_data); ++static void dbus_object_manager_interface_init (GDBusObjectManagerIface *iface, ++ gpointer iface_data); + + G_DEFINE_TYPE_WITH_CODE (GDBusObjectManagerClient, g_dbus_object_manager_client, G_TYPE_OBJECT, + G_ADD_PRIVATE (GDBusObjectManagerClient) +@@ -1515,13 +1518,15 @@ initable_init (GInitable *initable, + } + + static void +-initable_iface_init (GInitableIface *initable_iface) ++initable_iface_init (GInitableIface *initable_iface, ++ gpointer iface_data) + { + initable_iface->init = initable_init; + } + + static void +-async_initable_iface_init (GAsyncInitableIface *async_initable_iface) ++async_initable_iface_init (GAsyncInitableIface *async_initable_iface, ++ gpointer iface_data) + { + /* for now, just use default: run GInitable code in thread */ + } +@@ -1862,7 +1867,8 @@ g_dbus_object_manager_client_get_objects (GDBusObjectManager *_manager) + + + static void +-dbus_object_manager_interface_init (GDBusObjectManagerIface *iface) ++dbus_object_manager_interface_init (GDBusObjectManagerIface *iface, ++ gpointer iface_data) + { + iface->get_object_path = g_dbus_object_manager_client_get_object_path; + iface->get_objects = g_dbus_object_manager_client_get_objects; +diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c +index afc6fe94e..0f7e4fe4f 100644 +--- a/gio/gdbusproxy.c ++++ b/gio/gdbusproxy.c +@@ -177,9 +177,12 @@ enum + + static guint signals[LAST_SIGNAL] = {0}; + +-static void dbus_interface_iface_init (GDBusInterfaceIface *dbus_interface_iface); +-static void initable_iface_init (GInitableIface *initable_iface); +-static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface); ++static void dbus_interface_iface_init (GDBusInterfaceIface *dbus_interface_iface, ++ gpointer iface_data); ++static void initable_iface_init (GInitableIface *initable_iface, ++ gpointer iface_data); ++static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface, ++ gpointer iface_data); + + G_DEFINE_TYPE_WITH_CODE (GDBusProxy, g_dbus_proxy, G_TYPE_OBJECT, + G_ADD_PRIVATE (GDBusProxy) +@@ -1842,7 +1845,8 @@ async_initable_init_finish (GAsyncInitable *initable, + } + + static void +-async_initable_iface_init (GAsyncInitableIface *async_initable_iface) ++async_initable_iface_init (GAsyncInitableIface *async_initable_iface, ++ gpointer iface_data) + { + async_initable_iface->init_async = async_initable_init_async; + async_initable_iface->init_finish = async_initable_init_finish; +@@ -1929,7 +1933,8 @@ initable_init (GInitable *initable, + } + + static void +-initable_iface_init (GInitableIface *initable_iface) ++initable_iface_init (GInitableIface *initable_iface, ++ gpointer iface_data) + { + initable_iface->init = initable_init; + } +@@ -3184,7 +3189,8 @@ _g_dbus_proxy_set_object (GDBusInterface *interface, + } + + static void +-dbus_interface_iface_init (GDBusInterfaceIface *dbus_interface_iface) ++dbus_interface_iface_init (GDBusInterfaceIface *dbus_interface_iface, ++ gpointer iface_data) + { + dbus_interface_iface->get_info = _g_dbus_proxy_get_info; + dbus_interface_iface->get_object = _g_dbus_proxy_get_object; +diff --git a/gio/gdbusserver.c b/gio/gdbusserver.c +index db0c9ab50..cd40a20bd 100644 +--- a/gio/gdbusserver.c ++++ b/gio/gdbusserver.c +@@ -165,7 +165,8 @@ enum + + static guint _signals[LAST_SIGNAL] = {0}; + +-static void initable_iface_init (GInitableIface *initable_iface); ++static void initable_iface_init (GInitableIface *initable_iface, ++ gpointer iface_data); + + G_DEFINE_TYPE_WITH_CODE (GDBusServer, g_dbus_server, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init)) +@@ -1182,7 +1183,8 @@ initable_init (GInitable *initable, + + + static void +-initable_iface_init (GInitableIface *initable_iface) ++initable_iface_init (GInitableIface *initable_iface, ++ gpointer iface_data) + { + initable_iface->init = initable_init; + } +diff --git a/gio/gdebugcontrollerdbus.c b/gio/gdebugcontrollerdbus.c +index ce0f70383..4b70982d1 100644 +--- a/gio/gdebugcontrollerdbus.c ++++ b/gio/gdebugcontrollerdbus.c +@@ -161,8 +161,10 @@ static GDBusInterfaceInfo *org_gtk_Debugging; + + #define G_DEBUG_CONTROLLER_DBUS_GET_INITABLE_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_INITABLE, GInitable)) + +-static void g_debug_controller_dbus_iface_init (GDebugControllerInterface *iface); +-static void g_debug_controller_dbus_initable_iface_init (GInitableIface *iface); ++static void g_debug_controller_dbus_iface_init (GDebugControllerInterface *iface, ++ gpointer iface_data); ++static void g_debug_controller_dbus_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + static gboolean g_debug_controller_dbus_authorize_default (GDebugControllerDBus *self, + GDBusMethodInvocation *invocation); + +@@ -616,12 +618,14 @@ g_debug_controller_dbus_class_init (GDebugControllerDBusClass *klass) + } + + static void +-g_debug_controller_dbus_iface_init (GDebugControllerInterface *iface) ++g_debug_controller_dbus_iface_init (GDebugControllerInterface *iface, ++ gpointer iface_data) + { + } + + static void +-g_debug_controller_dbus_initable_iface_init (GInitableIface *iface) ++g_debug_controller_dbus_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + iface->init = g_debug_controller_dbus_initable_init; + } +diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c +index 1f161328a..6c4c24afc 100644 +--- a/gio/gdesktopappinfo.c ++++ b/gio/gdesktopappinfo.c +@@ -42,7 +42,7 @@ + + #include "gcontenttypeprivate.h" + #include "gdesktopappinfo.h" +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + #include "glib-unix.h" + #endif + #include "gfile.h" +@@ -58,7 +58,7 @@ + #include "glocalfilemonitor.h" + #include "gutilsprivate.h" + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + #include "gdocumentportal.h" + #endif + +@@ -90,7 +90,8 @@ enum { + PROP_FILENAME + }; + +-static void g_desktop_app_info_iface_init (GAppInfoIface *iface); ++static void g_desktop_app_info_iface_init (GAppInfoIface *iface, ++ gpointer iface_data); + static gboolean g_desktop_app_info_ensure_saved (GDesktopAppInfo *info, + GError **error); + static gboolean g_desktop_app_info_load_file (GDesktopAppInfo *self); +@@ -3282,7 +3283,7 @@ g_desktop_app_info_launch_uris_with_dbus (GDesktopAppInfo *info, + + g_return_val_if_fail (info != NULL, FALSE); + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + app_id = g_desktop_app_info_get_string (info, "X-Flatpak"); + if (app_id && *app_id) + { +@@ -4385,7 +4386,8 @@ g_app_info_create_from_commandline (const char *commandline, + /* GAppInfo interface init */ + + static void +-g_desktop_app_info_iface_init (GAppInfoIface *iface) ++g_desktop_app_info_iface_init (GAppInfoIface *iface, ++ gpointer iface_data) + { + iface->dup = g_desktop_app_info_dup; + iface->equal = g_desktop_app_info_equal; +diff --git a/gio/gdummyfile.c b/gio/gdummyfile.c +index 4ec352c6e..36d55ceea 100644 +--- a/gio/gdummyfile.c ++++ b/gio/gdummyfile.c +@@ -33,7 +33,8 @@ + #include "gfile.h" + + +-static void g_dummy_file_file_iface_init (GFileIface *iface); ++static void g_dummy_file_file_iface_init (GFileIface *iface, ++ gpointer iface_data); + + typedef struct { + char *scheme; +@@ -398,7 +399,8 @@ g_dummy_file_get_uri_scheme (GFile *file) + + + static void +-g_dummy_file_file_iface_init (GFileIface *iface) ++g_dummy_file_file_iface_init (GFileIface *iface, ++ gpointer iface_data) + { + iface->dup = g_dummy_file_dup; + iface->hash = g_dummy_file_hash; +diff --git a/gio/gdummyproxyresolver.c b/gio/gdummyproxyresolver.c +index 1cac1db74..fe354166f 100644 +--- a/gio/gdummyproxyresolver.c ++++ b/gio/gdummyproxyresolver.c +@@ -38,7 +38,8 @@ struct _GDummyProxyResolver { + GObject parent_instance; + }; + +-static void g_dummy_proxy_resolver_iface_init (GProxyResolverInterface *iface); ++static void g_dummy_proxy_resolver_iface_init (GProxyResolverInterface *iface, ++ gpointer iface_data); + + #define g_dummy_proxy_resolver_get_type _g_dummy_proxy_resolver_get_type + G_DEFINE_TYPE_WITH_CODE (GDummyProxyResolver, g_dummy_proxy_resolver, G_TYPE_OBJECT, +@@ -127,7 +128,8 @@ g_dummy_proxy_resolver_class_init (GDummyProxyResolverClass *resolver_class) + } + + static void +-g_dummy_proxy_resolver_iface_init (GProxyResolverInterface *iface) ++g_dummy_proxy_resolver_iface_init (GProxyResolverInterface *iface, ++ gpointer iface_data) + { + iface->is_supported = g_dummy_proxy_resolver_is_supported; + iface->lookup = g_dummy_proxy_resolver_lookup; +diff --git a/gio/gdummytlsbackend.c b/gio/gdummytlsbackend.c +index 1ec00c99e..d2f73c5f3 100644 +--- a/gio/gdummytlsbackend.c ++++ b/gio/gdummytlsbackend.c +@@ -53,7 +53,8 @@ struct _GDummyTlsBackend { + GTlsDatabase *database; + }; + +-static void g_dummy_tls_backend_iface_init (GTlsBackendInterface *iface); ++static void g_dummy_tls_backend_iface_init (GTlsBackendInterface *iface, ++ gpointer iface_data); + + #define g_dummy_tls_backend_get_type _g_dummy_tls_backend_get_type + G_DEFINE_TYPE_WITH_CODE (GDummyTlsBackend, g_dummy_tls_backend, G_TYPE_OBJECT, +@@ -105,7 +106,8 @@ g_dummy_tls_backend_get_default_database (GTlsBackend *backend) + } + + static void +-g_dummy_tls_backend_iface_init (GTlsBackendInterface *iface) ++g_dummy_tls_backend_iface_init (GTlsBackendInterface *iface, ++ gpointer iface_data) + { + iface->get_certificate_type = _g_dummy_tls_certificate_get_type; + iface->get_client_connection_type = _g_dummy_tls_connection_get_type; +@@ -140,7 +142,8 @@ enum + PROP_CERT_ISSUER + }; + +-static void g_dummy_tls_certificate_initable_iface_init (GInitableIface *iface); ++static void g_dummy_tls_certificate_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + + #define g_dummy_tls_certificate_get_type _g_dummy_tls_certificate_get_type + G_DEFINE_TYPE_WITH_CODE (GDummyTlsCertificate, g_dummy_tls_certificate, G_TYPE_TLS_CERTIFICATE, +@@ -199,7 +202,8 @@ g_dummy_tls_certificate_initable_init (GInitable *initable, + } + + static void +-g_dummy_tls_certificate_initable_iface_init (GInitableIface *iface) ++g_dummy_tls_certificate_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + iface->init = g_dummy_tls_certificate_initable_init; + } +@@ -242,7 +246,8 @@ enum + PROP_CONN_NEGOTIATED_PROTOCOL, + }; + +-static void g_dummy_tls_connection_initable_iface_init (GInitableIface *iface); ++static void g_dummy_tls_connection_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + + #define g_dummy_tls_connection_get_type _g_dummy_tls_connection_get_type + G_DEFINE_TYPE_WITH_CODE (GDummyTlsConnection, g_dummy_tls_connection, G_TYPE_TLS_CONNECTION, +@@ -325,7 +330,8 @@ g_dummy_tls_connection_initable_init (GInitable *initable, + } + + static void +-g_dummy_tls_connection_initable_iface_init (GInitableIface *iface) ++g_dummy_tls_connection_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + iface->init = g_dummy_tls_connection_initable_init; + } +@@ -363,7 +369,8 @@ enum + PROP_DTLS_CONN_AUTHENTICATION_MODE, + }; + +-static void g_dummy_dtls_connection_initable_iface_init (GInitableIface *iface); ++static void g_dummy_dtls_connection_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + + #define g_dummy_dtls_connection_get_type _g_dummy_dtls_connection_get_type + G_DEFINE_TYPE_WITH_CODE (GDummyDtlsConnection, g_dummy_dtls_connection, G_TYPE_OBJECT, +@@ -427,7 +434,8 @@ g_dummy_dtls_connection_initable_init (GInitable *initable, + } + + static void +-g_dummy_dtls_connection_initable_iface_init (GInitableIface *iface) ++g_dummy_dtls_connection_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + iface->init = g_dummy_dtls_connection_initable_init; + } +@@ -453,8 +461,10 @@ enum + PROP_ANCHORS, + }; + +-static void g_dummy_tls_database_file_database_iface_init (GTlsFileDatabaseInterface *iface); +-static void g_dummy_tls_database_initable_iface_init (GInitableIface *iface); ++static void g_dummy_tls_database_file_database_iface_init (GTlsFileDatabaseInterface *iface, ++ gpointer iface_data); ++static void g_dummy_tls_database_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + + #define g_dummy_tls_database_get_type _g_dummy_tls_database_get_type + G_DEFINE_TYPE_WITH_CODE (GDummyTlsDatabase, g_dummy_tls_database, G_TYPE_TLS_DATABASE, +@@ -502,7 +512,8 @@ g_dummy_tls_database_init (GDummyTlsDatabase *database) + } + + static void +-g_dummy_tls_database_file_database_iface_init (GTlsFileDatabaseInterface *iface) ++g_dummy_tls_database_file_database_iface_init (GTlsFileDatabaseInterface *iface, ++ gpointer iface_data) + { + } + +@@ -517,7 +528,8 @@ g_dummy_tls_database_initable_init (GInitable *initable, + } + + static void +-g_dummy_tls_database_initable_iface_init (GInitableIface *iface) ++g_dummy_tls_database_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + iface->init = g_dummy_tls_database_initable_init; + } +diff --git a/gio/gemblem.c b/gio/gemblem.c +index af1ba0006..7f926f2b6 100644 +--- a/gio/gemblem.c ++++ b/gio/gemblem.c +@@ -44,7 +44,8 @@ + * supported. More may be added in the future. + */ + +-static void g_emblem_iface_init (GIconIface *iface); ++static void g_emblem_iface_init (GIconIface *iface, ++ gpointer iface_data); + + struct _GEmblem + { +@@ -371,7 +372,8 @@ g_emblem_serialize (GIcon *icon) + } + + static void +-g_emblem_iface_init (GIconIface *iface) ++g_emblem_iface_init (GIconIface *iface, ++ gpointer iface_data) + { + iface->hash = g_emblem_hash; + iface->equal = g_emblem_equal; +diff --git a/gio/gemblemedicon.c b/gio/gemblemedicon.c +index 8b72f12f9..84070224e 100644 +--- a/gio/gemblemedicon.c ++++ b/gio/gemblemedicon.c +@@ -58,7 +58,8 @@ struct _GEmblemedIconPrivate { + + static GParamSpec *properties[NUM_PROPERTIES] = { NULL, }; + +-static void g_emblemed_icon_icon_iface_init (GIconIface *iface); ++static void g_emblemed_icon_icon_iface_init (GIconIface *iface, ++ gpointer iface_data); + + G_DEFINE_TYPE_WITH_CODE (GEmblemedIcon, g_emblemed_icon, G_TYPE_OBJECT, + G_ADD_PRIVATE (GEmblemedIcon) +@@ -459,7 +460,8 @@ g_emblemed_icon_serialize (GIcon *icon) + } + + static void +-g_emblemed_icon_icon_iface_init (GIconIface *iface) ++g_emblemed_icon_icon_iface_init (GIconIface *iface, ++ gpointer iface_data) + { + iface->hash = g_emblemed_icon_hash; + iface->equal = g_emblemed_icon_equal; +diff --git a/gio/gfile.c b/gio/gfile.c +index 94786c84a..19af0973d 100644 +--- a/gio/gfile.c ++++ b/gio/gfile.c +@@ -58,7 +58,7 @@ + + #include "gfile.h" + #include "glib/gstdio.h" +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + #include "glib-unix.h" + #endif + #include "gvfs.h" +diff --git a/gio/gfileicon.c b/gio/gfileicon.c +index bd727cd7a..2abe576aa 100644 +--- a/gio/gfileicon.c ++++ b/gio/gfileicon.c +@@ -43,8 +43,10 @@ + * + **/ + +-static void g_file_icon_icon_iface_init (GIconIface *iface); +-static void g_file_icon_loadable_icon_iface_init (GLoadableIconIface *iface); ++static void g_file_icon_icon_iface_init (GIconIface *iface, ++ gpointer iface_data); ++static void g_file_icon_loadable_icon_iface_init (GLoadableIconIface *iface, ++ gpointer iface_data); + static void g_file_icon_load_async (GLoadableIcon *icon, + int size, + GCancellable *cancellable, +@@ -280,7 +282,8 @@ g_file_icon_serialize (GIcon *icon) + } + + static void +-g_file_icon_icon_iface_init (GIconIface *iface) ++g_file_icon_icon_iface_init (GIconIface *iface, ++ gpointer iface_data) + { + iface->hash = g_file_icon_hash; + iface->equal = g_file_icon_equal; +@@ -360,7 +363,8 @@ g_file_icon_load_finish (GLoadableIcon *icon, + } + + static void +-g_file_icon_loadable_icon_iface_init (GLoadableIconIface *iface) ++g_file_icon_loadable_icon_iface_init (GLoadableIconIface *iface, ++ gpointer iface_data) + { + iface->load = g_file_icon_load; + iface->load_async = g_file_icon_load_async; +diff --git a/gio/gfileinputstream.c b/gio/gfileinputstream.c +index 44eb07c68..f5c19c80e 100644 +--- a/gio/gfileinputstream.c ++++ b/gio/gfileinputstream.c +@@ -49,7 +49,8 @@ + * To position a file input stream, use g_seekable_seek(). + **/ + +-static void g_file_input_stream_seekable_iface_init (GSeekableIface *iface); ++static void g_file_input_stream_seekable_iface_init (GSeekableIface *iface, ++ gpointer iface_data); + static goffset g_file_input_stream_seekable_tell (GSeekable *seekable); + static gboolean g_file_input_stream_seekable_can_seek (GSeekable *seekable); + static gboolean g_file_input_stream_seekable_seek (GSeekable *seekable, +@@ -90,7 +91,8 @@ g_file_input_stream_class_init (GFileInputStreamClass *klass) + } + + static void +-g_file_input_stream_seekable_iface_init (GSeekableIface *iface) ++g_file_input_stream_seekable_iface_init (GSeekableIface *iface, ++ gpointer iface_data) + { + iface->tell = g_file_input_stream_seekable_tell; + iface->can_seek = g_file_input_stream_seekable_can_seek; +diff --git a/gio/gfileiostream.c b/gio/gfileiostream.c +index 97dbc322f..8080aab9a 100644 +--- a/gio/gfileiostream.c ++++ b/gio/gfileiostream.c +@@ -62,7 +62,8 @@ + * Since: 2.22 + **/ + +-static void g_file_io_stream_seekable_iface_init (GSeekableIface *iface); ++static void g_file_io_stream_seekable_iface_init (GSeekableIface *iface, ++ gpointer iface_data); + static goffset g_file_io_stream_seekable_tell (GSeekable *seekable); + static gboolean g_file_io_stream_seekable_can_seek (GSeekable *seekable); + static gboolean g_file_io_stream_seekable_seek (GSeekable *seekable, +@@ -95,7 +96,8 @@ G_DEFINE_TYPE_WITH_CODE (GFileIOStream, g_file_io_stream, G_TYPE_IO_STREAM, + g_file_io_stream_seekable_iface_init)) + + static void +-g_file_io_stream_seekable_iface_init (GSeekableIface *iface) ++g_file_io_stream_seekable_iface_init (GSeekableIface *iface, ++ gpointer iface_data) + { + iface->tell = g_file_io_stream_seekable_tell; + iface->can_seek = g_file_io_stream_seekable_can_seek; +diff --git a/gio/gfileoutputstream.c b/gio/gfileoutputstream.c +index d767c53a1..495bfa893 100644 +--- a/gio/gfileoutputstream.c ++++ b/gio/gfileoutputstream.c +@@ -54,7 +54,8 @@ + * stream, use g_seekable_truncate(). + **/ + +-static void g_file_output_stream_seekable_iface_init (GSeekableIface *iface); ++static void g_file_output_stream_seekable_iface_init (GSeekableIface *iface, ++ gpointer iface_data); + static goffset g_file_output_stream_seekable_tell (GSeekable *seekable); + static gboolean g_file_output_stream_seekable_can_seek (GSeekable *seekable); + static gboolean g_file_output_stream_seekable_seek (GSeekable *seekable, +@@ -94,7 +95,8 @@ g_file_output_stream_class_init (GFileOutputStreamClass *klass) + } + + static void +-g_file_output_stream_seekable_iface_init (GSeekableIface *iface) ++g_file_output_stream_seekable_iface_init (GSeekableIface *iface, ++ gpointer iface_data) + { + iface->tell = g_file_output_stream_seekable_tell; + iface->can_seek = g_file_output_stream_seekable_can_seek; +diff --git a/gio/ghttpproxy.c b/gio/ghttpproxy.c +index 605a72994..28e367471 100644 +--- a/gio/ghttpproxy.c ++++ b/gio/ghttpproxy.c +@@ -53,7 +53,8 @@ struct _GHttpProxyClass + GObjectClass parent_class; + }; + +-static void g_http_proxy_iface_init (GProxyInterface *proxy_iface); ++static void g_http_proxy_iface_init (GProxyInterface *proxy_iface, ++ gpointer iface_data); + + #define g_http_proxy_get_type _g_http_proxy_get_type + G_DEFINE_TYPE_WITH_CODE (GHttpProxy, g_http_proxy, G_TYPE_OBJECT, +@@ -379,7 +380,8 @@ g_http_proxy_class_init (GHttpProxyClass *class) + } + + static void +-g_http_proxy_iface_init (GProxyInterface *proxy_iface) ++g_http_proxy_iface_init (GProxyInterface *proxy_iface, ++ gpointer iface_data) + { + proxy_iface->connect = g_http_proxy_connect; + proxy_iface->connect_async = g_http_proxy_connect_async; +diff --git a/gio/ginetaddressmask.c b/gio/ginetaddressmask.c +index c0704db14..e9a190618 100644 +--- a/gio/ginetaddressmask.c ++++ b/gio/ginetaddressmask.c +@@ -56,7 +56,8 @@ struct _GInetAddressMaskPrivate + guint length; + }; + +-static void g_inet_address_mask_initable_iface_init (GInitableIface *iface); ++static void g_inet_address_mask_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + + G_DEFINE_TYPE_WITH_CODE (GInetAddressMask, g_inet_address_mask, G_TYPE_OBJECT, + G_ADD_PRIVATE (GInetAddressMask) +@@ -230,7 +231,8 @@ g_inet_address_mask_initable_init (GInitable *initable, + } + + static void +-g_inet_address_mask_initable_iface_init (GInitableIface *iface) ++g_inet_address_mask_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + iface->init = g_inet_address_mask_initable_init; + } +diff --git a/gio/ginetsocketaddress.c b/gio/ginetsocketaddress.c +index 769303558..f09158cb7 100644 +--- a/gio/ginetsocketaddress.c ++++ b/gio/ginetsocketaddress.c +@@ -57,7 +57,8 @@ struct _GInetSocketAddressPrivate + guint32 scope_id; + }; + +-static void g_inet_socket_address_connectable_iface_init (GSocketConnectableIface *iface); ++static void g_inet_socket_address_connectable_iface_init (GSocketConnectableIface *iface, ++ gpointer iface_data); + static gchar *g_inet_socket_address_connectable_to_string (GSocketConnectable *connectable); + + G_DEFINE_TYPE_WITH_CODE (GInetSocketAddress, g_inet_socket_address, G_TYPE_SOCKET_ADDRESS, +@@ -311,7 +312,8 @@ g_inet_socket_address_class_init (GInetSocketAddressClass *klass) + } + + static void +-g_inet_socket_address_connectable_iface_init (GSocketConnectableIface *iface) ++g_inet_socket_address_connectable_iface_init (GSocketConnectableIface *iface, ++ gpointer iface_data) + { + GSocketConnectableIface *parent_iface = g_type_interface_peek_parent (iface); + +diff --git a/gio/gkeyfilesettingsbackend.c b/gio/gkeyfilesettingsbackend.c +index 79a02668b..74371b1cf 100644 +--- a/gio/gkeyfilesettingsbackend.c ++++ b/gio/gkeyfilesettingsbackend.c +@@ -79,7 +79,7 @@ typedef struct + GFileMonitor *dir_monitor; + } GKeyfileSettingsBackend; + +-#ifdef G_OS_WIN32 ++#if defined(G_OS_WIN32) || defined(G_PLATFORM_WASM) + #define EXTENSION_PRIORITY 10 + #else + #define EXTENSION_PRIORITY (glib_should_use_portal () && !glib_has_dconf_access_in_sandbox () ? 110 : 10) +diff --git a/gio/gliststore.c b/gio/gliststore.c +index f405abd79..28460ee4a 100644 +--- a/gio/gliststore.c ++++ b/gio/gliststore.c +@@ -68,7 +68,8 @@ enum + N_PROPERTIES + }; + +-static void g_list_store_iface_init (GListModelInterface *iface); ++static void g_list_store_iface_init (GListModelInterface *iface, ++ gpointer iface_data); + + G_DEFINE_TYPE_WITH_CODE (GListStore, g_list_store, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, g_list_store_iface_init)); +@@ -229,7 +230,8 @@ g_list_store_get_item (GListModel *list, + } + + static void +-g_list_store_iface_init (GListModelInterface *iface) ++g_list_store_iface_init (GListModelInterface *iface, ++ gpointer iface_data) + { + iface->get_item_type = g_list_store_get_item_type; + iface->get_n_items = g_list_store_get_n_items; +diff --git a/gio/glocalfile.c b/gio/glocalfile.c +index 67d4b99fb..2d57d7b4d 100644 +--- a/gio/glocalfile.c ++++ b/gio/glocalfile.c +@@ -27,7 +27,7 @@ + #include + #include + #include +-#if G_OS_UNIX ++#ifdef G_OS_UNIX + #include + #include + #endif +@@ -69,7 +69,7 @@ + #include + #include + #include "glibintl.h" +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + #include "glib-unix.h" + #include "gportalsupport.h" + #include "gtrashportal.h" +@@ -99,7 +99,8 @@ + #endif + + +-static void g_local_file_file_iface_init (GFileIface *iface); ++static void g_local_file_file_iface_init (GFileIface *iface, ++ gpointer iface_data); + + static GFileAttributeInfoList *local_writable_attributes = NULL; + static /* GFileAttributeInfoList * */ gsize local_writable_namespaces = 0; +@@ -1929,7 +1930,7 @@ _g_local_file_has_trash_dir (const char *dirname, dev_t dir_dev) + return res; + } + +-#ifndef G_OS_WIN32 ++#if !defined(G_OS_WIN32) && !defined(G_PLATFORM_WASM) + gboolean + _g_local_file_is_lost_found_dir (const char *path, dev_t path_dev) + { +@@ -1993,8 +1994,10 @@ g_local_file_trash (GFile *file, + GVfs *vfs; + int errsv; + ++#ifndef G_PLATFORM_WASM + if (glib_should_use_portal ()) + return g_trash_portal_trash_file (file, error); ++#endif + + if (g_lstat (local->filename, &file_stat) != 0) + { +@@ -3002,7 +3005,8 @@ g_local_file_measure_disk_usage (GFile *file, + } + + static void +-g_local_file_file_iface_init (GFileIface *iface) ++g_local_file_file_iface_init (GFileIface *iface, ++ gpointer iface_data) + { + iface->dup = g_local_file_dup; + iface->hash = g_local_file_hash; +diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c +index bccad04b9..8db9b453d 100644 +--- a/gio/glocalfileinfo.c ++++ b/gio/glocalfileinfo.c +@@ -62,8 +62,10 @@ + + #ifdef G_OS_UNIX + #include ++#ifndef G_PLATFORM_WASM + #include "glib-unix.h" +-#endif ++#endif /*!G_PLATFORM_WASM*/ ++#endif /*G_OS_UNIX*/ + + #include "glib-private.h" + +diff --git a/gio/glocalfileinputstream.c b/gio/glocalfileinputstream.c +index 933f31714..c370eba84 100644 +--- a/gio/glocalfileinputstream.c ++++ b/gio/glocalfileinputstream.c +@@ -37,9 +37,11 @@ + + #ifdef G_OS_UNIX + #include ++#ifndef G_PLATFORM_WASM + #include "glib-unix.h" + #include "gfiledescriptorbased.h" +-#endif ++#endif /*!G_PLATFORM_WASM*/ ++#endif /*G_OS_UNIX*/ + + #ifdef G_OS_WIN32 + #include +@@ -50,12 +52,13 @@ struct _GLocalFileInputStreamPrivate { + guint do_close : 1; + }; + +-#ifdef G_OS_UNIX +-static void g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface); ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) ++static void g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, ++ gpointer iface_data); + #endif + + #define g_local_file_input_stream_get_type _g_local_file_input_stream_get_type +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + G_DEFINE_TYPE_WITH_CODE (GLocalFileInputStream, g_local_file_input_stream, G_TYPE_FILE_INPUT_STREAM, + G_ADD_PRIVATE (GLocalFileInputStream) + G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED, +@@ -84,7 +87,7 @@ static GFileInfo *g_local_file_input_stream_query_info (GFileInputStream *strea + const char *attributes, + GCancellable *cancellable, + GError **error); +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + static int g_local_file_input_stream_get_fd (GFileDescriptorBased *stream); + #endif + +@@ -109,9 +112,10 @@ g_local_file_input_stream_class_init (GLocalFileInputStreamClass *klass) + file_stream_class->query_info = g_local_file_input_stream_query_info; + } + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + static void +-g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface) ++g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, ++ gpointer iface_data) + { + iface->get_fd = g_local_file_input_stream_get_fd; + } +@@ -297,7 +301,7 @@ g_local_file_input_stream_query_info (GFileInputStream *stream, + error); + } + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + static int + g_local_file_input_stream_get_fd (GFileDescriptorBased *fd_based) + { +diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c +index 6875811d0..0f5f95584 100644 +--- a/gio/glocalfileoutputstream.c ++++ b/gio/glocalfileoutputstream.c +@@ -44,9 +44,11 @@ + + #ifdef G_OS_UNIX + #include ++#ifndef G_PLATFORM_WASM + #include "gfiledescriptorbased.h" + #include +-#endif ++#endif /*!G_PLATFORM_WASM*/ ++#endif /*G_OS_UNIX*/ + + #include "glib-private.h" + #include "gioprivate.h" +@@ -81,12 +83,13 @@ struct _GLocalFileOutputStreamPrivate { + int fd; + }; + +-#ifdef G_OS_UNIX +-static void g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface); ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) ++static void g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, ++ gpointer iface_data); + #endif + + #define g_local_file_output_stream_get_type _g_local_file_output_stream_get_type +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + G_DEFINE_TYPE_WITH_CODE (GLocalFileOutputStream, g_local_file_output_stream, G_TYPE_FILE_OUTPUT_STREAM, + G_ADD_PRIVATE (GLocalFileOutputStream) + G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED, +@@ -108,7 +111,7 @@ static gssize g_local_file_output_stream_write (GOutputStream *s + gsize count, + GCancellable *cancellable, + GError **error); +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + static gboolean g_local_file_output_stream_writev (GOutputStream *stream, + const GOutputVector *vectors, + gsize n_vectors, +@@ -136,7 +139,7 @@ static gboolean g_local_file_output_stream_truncate (GFileOutputStream *s + goffset size, + GCancellable *cancellable, + GError **error); +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + static int g_local_file_output_stream_get_fd (GFileDescriptorBased *stream); + #endif + +@@ -165,7 +168,7 @@ g_local_file_output_stream_class_init (GLocalFileOutputStreamClass *klass) + gobject_class->finalize = g_local_file_output_stream_finalize; + + stream_class->write_fn = g_local_file_output_stream_write; +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + stream_class->writev_fn = g_local_file_output_stream_writev; + #endif + stream_class->close_fn = g_local_file_output_stream_close; +@@ -178,9 +181,10 @@ g_local_file_output_stream_class_init (GLocalFileOutputStreamClass *klass) + file_stream_class->truncate_fn = g_local_file_output_stream_truncate; + } + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + static void +-g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface) ++g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, ++ gpointer iface_data) + { + iface->get_fd = g_local_file_output_stream_get_fd; + } +@@ -234,7 +238,7 @@ g_local_file_output_stream_write (GOutputStream *stream, + * things, that each chunk is the size of a whole page and in memory aligned + * to a page. We can't possibly guarantee that in GLib. + */ +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + /* Macro to check if struct iovec and GOutputVector have the same ABI */ + #define G_OUTPUT_VECTOR_IS_IOVEC (sizeof (struct iovec) == sizeof (GOutputVector) && \ + G_SIZEOF_MEMBER (struct iovec, iov_base) == G_SIZEOF_MEMBER (GOutputVector, buffer) && \ +@@ -1333,7 +1337,7 @@ _g_local_file_output_stream_get_fd (GLocalFileOutputStream *stream) + return stream->priv->fd; + } + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + static int + g_local_file_output_stream_get_fd (GFileDescriptorBased *fd_based) + { +diff --git a/gio/glocalvfs.c b/gio/glocalvfs.c +index a830cc350..bb7909740 100644 +--- a/gio/glocalvfs.c ++++ b/gio/glocalvfs.c +@@ -28,7 +28,7 @@ + #include "gvfs.h" + #include + #include +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + #include "glib-unix.h" + #include + #endif +@@ -147,7 +147,7 @@ g_local_vfs_parse_name (GVfs *vfs, + { + if (*parse_name == '~') + { +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + const char *user_start; + user_start = parse_name + 1; + #endif +@@ -158,7 +158,7 @@ g_local_vfs_parse_name (GVfs *vfs, + + user_end = parse_name; + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + if (user_end == user_start) + user_prefix = g_strdup (g_get_home_dir ()); + else +diff --git a/gio/gmemoryinputstream.c b/gio/gmemoryinputstream.c +index 80f77d107..ec02e057d 100644 +--- a/gio/gmemoryinputstream.c ++++ b/gio/gmemoryinputstream.c +@@ -80,7 +80,8 @@ static gboolean g_memory_input_stream_close_finish (GInputStream *stream + GAsyncResult *result, + GError **error); + +-static void g_memory_input_stream_seekable_iface_init (GSeekableIface *iface); ++static void g_memory_input_stream_seekable_iface_init (GSeekableIface *iface, ++ gpointer iface_data); + static goffset g_memory_input_stream_tell (GSeekable *seekable); + static gboolean g_memory_input_stream_can_seek (GSeekable *seekable); + static gboolean g_memory_input_stream_seek (GSeekable *seekable, +@@ -94,7 +95,8 @@ static gboolean g_memory_input_stream_truncate (GSeekable *seek + GCancellable *cancellable, + GError **error); + +-static void g_memory_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface); ++static void g_memory_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface, ++ gpointer iface_data); + static gboolean g_memory_input_stream_is_readable (GPollableInputStream *stream); + static GSource *g_memory_input_stream_create_source (GPollableInputStream *stream, + GCancellable *cancellable); +@@ -145,7 +147,8 @@ g_memory_input_stream_finalize (GObject *object) + } + + static void +-g_memory_input_stream_seekable_iface_init (GSeekableIface *iface) ++g_memory_input_stream_seekable_iface_init (GSeekableIface *iface, ++ gpointer iface_data) + { + iface->tell = g_memory_input_stream_tell; + iface->can_seek = g_memory_input_stream_can_seek; +@@ -155,7 +158,8 @@ g_memory_input_stream_seekable_iface_init (GSeekableIface *iface) + } + + static void +-g_memory_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface) ++g_memory_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface, ++ gpointer iface_data) + { + iface->is_readable = g_memory_input_stream_is_readable; + iface->create_source = g_memory_input_stream_create_source; +diff --git a/gio/gmemorymonitordbus.c b/gio/gmemorymonitordbus.c +index 37542f75c..995b7bf96 100644 +--- a/gio/gmemorymonitordbus.c ++++ b/gio/gmemorymonitordbus.c +@@ -33,8 +33,10 @@ + + #define G_MEMORY_MONITOR_DBUS_GET_INITABLE_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_INITABLE, GInitable)) + +-static void g_memory_monitor_dbus_iface_init (GMemoryMonitorInterface *iface); +-static void g_memory_monitor_dbus_initable_iface_init (GInitableIface *iface); ++static void g_memory_monitor_dbus_iface_init (GMemoryMonitorInterface *iface, ++ gpointer iface_data); ++static void g_memory_monitor_dbus_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + + struct _GMemoryMonitorDBus + { +@@ -176,12 +178,14 @@ g_memory_monitor_dbus_class_init (GMemoryMonitorDBusClass *nl_class) + } + + static void +-g_memory_monitor_dbus_iface_init (GMemoryMonitorInterface *monitor_iface) ++g_memory_monitor_dbus_iface_init (GMemoryMonitorInterface *monitor_iface, ++ gpointer iface_data) + { + } + + static void +-g_memory_monitor_dbus_initable_iface_init (GInitableIface *iface) ++g_memory_monitor_dbus_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + iface->init = g_memory_monitor_dbus_initable_init; + } +diff --git a/gio/gmemorymonitorportal.c b/gio/gmemorymonitorportal.c +index 1517d61a9..235d45a93 100644 +--- a/gio/gmemorymonitorportal.c ++++ b/gio/gmemorymonitorportal.c +@@ -29,8 +29,10 @@ + + #define G_MEMORY_MONITOR_PORTAL_GET_INITABLE_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_INITABLE, GInitable)) + +-static void g_memory_monitor_portal_iface_init (GMemoryMonitorInterface *iface); +-static void g_memory_monitor_portal_initable_iface_init (GInitableIface *iface); ++static void g_memory_monitor_portal_iface_init (GMemoryMonitorInterface *iface, ++ gpointer iface_data); ++static void g_memory_monitor_portal_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + + struct _GMemoryMonitorPortal + { +@@ -143,12 +145,14 @@ g_memory_monitor_portal_class_init (GMemoryMonitorPortalClass *nl_class) + } + + static void +-g_memory_monitor_portal_iface_init (GMemoryMonitorInterface *monitor_iface) ++g_memory_monitor_portal_iface_init (GMemoryMonitorInterface *monitor_iface, ++ gpointer iface_data) + { + } + + static void +-g_memory_monitor_portal_initable_iface_init (GInitableIface *iface) ++g_memory_monitor_portal_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + iface->init = g_memory_monitor_portal_initable_init; + } +diff --git a/gio/gmemorymonitorwin32.c b/gio/gmemorymonitorwin32.c +index 83fef504f..36d5ff0ea 100644 +--- a/gio/gmemorymonitorwin32.c ++++ b/gio/gmemorymonitorwin32.c +@@ -35,8 +35,10 @@ G_DECLARE_FINAL_TYPE (GMemoryMonitorWin32, g_memory_monitor_win32, G, MEMORY_MON + + #define G_MEMORY_MONITOR_WIN32_GET_INITABLE_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_INITABLE, GInitable)) + +-static void g_memory_monitor_win32_iface_init (GMemoryMonitorInterface *iface); +-static void g_memory_monitor_win32_initable_iface_init (GInitableIface *iface); ++static void g_memory_monitor_win32_iface_init (GMemoryMonitorInterface *iface, ++ gpointer iface_data); ++static void g_memory_monitor_win32_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + + struct _GMemoryMonitorWin32 + { +@@ -252,12 +254,14 @@ g_memory_monitor_win32_class_init (GMemoryMonitorWin32Class *nl_class) + } + + static void +-g_memory_monitor_win32_iface_init (GMemoryMonitorInterface *monitor_iface) ++g_memory_monitor_win32_iface_init (GMemoryMonitorInterface *monitor_iface, ++ gpointer iface_data) + { + } + + static void +-g_memory_monitor_win32_initable_iface_init (GInitableIface *iface) ++g_memory_monitor_win32_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + iface->init = g_memory_monitor_win32_initable_init; + } +diff --git a/gio/gmemoryoutputstream.c b/gio/gmemoryoutputstream.c +index 0339a7ad7..119554ee6 100644 +--- a/gio/gmemoryoutputstream.c ++++ b/gio/gmemoryoutputstream.c +@@ -99,7 +99,8 @@ static gboolean g_memory_output_stream_close_finish (GOutputStream *strea + GAsyncResult *result, + GError **error); + +-static void g_memory_output_stream_seekable_iface_init (GSeekableIface *iface); ++static void g_memory_output_stream_seekable_iface_init (GSeekableIface *iface, ++ gpointer iface_data); + static goffset g_memory_output_stream_tell (GSeekable *seekable); + static gboolean g_memory_output_stream_can_seek (GSeekable *seekable); + static gboolean g_memory_output_stream_seek (GSeekable *seekable, +@@ -117,7 +118,8 @@ static gboolean g_memory_output_stream_is_writable (GPollableOutputStream + static GSource *g_memory_output_stream_create_source (GPollableOutputStream *stream, + GCancellable *cancellable); + +-static void g_memory_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface); ++static void g_memory_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface, ++ gpointer iface_data); + + G_DEFINE_TYPE_WITH_CODE (GMemoryOutputStream, g_memory_output_stream, G_TYPE_OUTPUT_STREAM, + G_ADD_PRIVATE (GMemoryOutputStream) +@@ -224,7 +226,8 @@ g_memory_output_stream_class_init (GMemoryOutputStreamClass *klass) + } + + static void +-g_memory_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface) ++g_memory_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface, ++ gpointer iface_data) + { + iface->is_writable = g_memory_output_stream_is_writable; + iface->create_source = g_memory_output_stream_create_source; +@@ -313,7 +316,8 @@ g_memory_output_stream_finalize (GObject *object) + } + + static void +-g_memory_output_stream_seekable_iface_init (GSeekableIface *iface) ++g_memory_output_stream_seekable_iface_init (GSeekableIface *iface, ++ gpointer iface_data) + { + iface->tell = g_memory_output_stream_tell; + iface->can_seek = g_memory_output_stream_can_seek; +diff --git a/gio/gnetworkaddress.c b/gio/gnetworkaddress.c +index 598917de2..68f607a22 100644 +--- a/gio/gnetworkaddress.c ++++ b/gio/gnetworkaddress.c +@@ -94,7 +94,8 @@ static void g_network_address_get_property (GObject *object, + GValue *value, + GParamSpec *pspec); + +-static void g_network_address_connectable_iface_init (GSocketConnectableIface *iface); ++static void g_network_address_connectable_iface_init (GSocketConnectableIface *iface, ++ gpointer iface_data); + static GSocketAddressEnumerator *g_network_address_connectable_enumerate (GSocketConnectable *connectable); + static GSocketAddressEnumerator *g_network_address_connectable_proxy_enumerate (GSocketConnectable *connectable); + static gchar *g_network_address_connectable_to_string (GSocketConnectable *connectable); +@@ -153,7 +154,8 @@ g_network_address_class_init (GNetworkAddressClass *klass) + } + + static void +-g_network_address_connectable_iface_init (GSocketConnectableIface *connectable_iface) ++g_network_address_connectable_iface_init (GSocketConnectableIface *connectable_iface, ++ gpointer iface_data) + { + connectable_iface->enumerate = g_network_address_connectable_enumerate; + connectable_iface->proxy_enumerate = g_network_address_connectable_proxy_enumerate; +diff --git a/gio/gnetworkmonitorbase.c b/gio/gnetworkmonitorbase.c +index 4654d22e3..51ceaf7df 100644 +--- a/gio/gnetworkmonitorbase.c ++++ b/gio/gnetworkmonitorbase.c +@@ -33,8 +33,10 @@ + #include "gtask.h" + #include "glibintl.h" + +-static void g_network_monitor_base_iface_init (GNetworkMonitorInterface *iface); +-static void g_network_monitor_base_initable_iface_init (GInitableIface *iface); ++static void g_network_monitor_base_iface_init (GNetworkMonitorInterface *iface, ++ gpointer iface_data); ++static void g_network_monitor_base_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + + enum + { +@@ -344,7 +346,8 @@ g_network_monitor_base_can_reach_finish (GNetworkMonitor *monitor, + } + + static void +-g_network_monitor_base_iface_init (GNetworkMonitorInterface *monitor_iface) ++g_network_monitor_base_iface_init (GNetworkMonitorInterface *monitor_iface, ++ gpointer iface_data) + { + monitor_iface->can_reach = g_network_monitor_base_can_reach; + monitor_iface->can_reach_async = g_network_monitor_base_can_reach_async; +@@ -366,7 +369,8 @@ g_network_monitor_base_initable_init (GInitable *initable, + } + + static void +-g_network_monitor_base_initable_iface_init (GInitableIface *iface) ++g_network_monitor_base_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + iface->init = g_network_monitor_base_initable_init; + } +diff --git a/gio/gnetworkmonitornetlink.c b/gio/gnetworkmonitornetlink.c +index 9d4b0f9c5..64ce26e5f 100644 +--- a/gio/gnetworkmonitornetlink.c ++++ b/gio/gnetworkmonitornetlink.c +@@ -42,8 +42,10 @@ + #include + + static GInitableIface *initable_parent_iface; +-static void g_network_monitor_netlink_iface_init (GNetworkMonitorInterface *iface); +-static void g_network_monitor_netlink_initable_iface_init (GInitableIface *iface); ++static void g_network_monitor_netlink_iface_init (GNetworkMonitorInterface *iface, ++ gpointer iface_data); ++static void g_network_monitor_netlink_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + + struct _GNetworkMonitorNetlinkPrivate + { +@@ -502,12 +504,14 @@ g_network_monitor_netlink_class_init (GNetworkMonitorNetlinkClass *nl_class) + } + + static void +-g_network_monitor_netlink_iface_init (GNetworkMonitorInterface *monitor_iface) ++g_network_monitor_netlink_iface_init (GNetworkMonitorInterface *monitor_iface, ++ gpointer iface_data) + { + } + + static void +-g_network_monitor_netlink_initable_iface_init (GInitableIface *iface) ++g_network_monitor_netlink_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + initable_parent_iface = g_type_interface_peek_parent (iface); + +diff --git a/gio/gnetworkmonitornm.c b/gio/gnetworkmonitornm.c +index 207d50d5e..22eea24f1 100644 +--- a/gio/gnetworkmonitornm.c ++++ b/gio/gnetworkmonitornm.c +@@ -34,8 +34,10 @@ + #include "gnetworkmonitor.h" + #include "gdbusproxy.h" + +-static void g_network_monitor_nm_iface_init (GNetworkMonitorInterface *iface); +-static void g_network_monitor_nm_initable_iface_init (GInitableIface *iface); ++static void g_network_monitor_nm_iface_init (GNetworkMonitorInterface *iface, ++ gpointer iface_data); ++static void g_network_monitor_nm_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + + enum + { +@@ -365,12 +367,14 @@ g_network_monitor_nm_class_init (GNetworkMonitorNMClass *nl_class) + } + + static void +-g_network_monitor_nm_iface_init (GNetworkMonitorInterface *monitor_iface) ++g_network_monitor_nm_iface_init (GNetworkMonitorInterface *monitor_iface, ++ gpointer iface_data) + { + } + + static void +-g_network_monitor_nm_initable_iface_init (GInitableIface *iface) ++g_network_monitor_nm_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + iface->init = g_network_monitor_nm_initable_init; + } +diff --git a/gio/gnetworkmonitorportal.c b/gio/gnetworkmonitorportal.c +index bc51178b1..cc170dd21 100644 +--- a/gio/gnetworkmonitorportal.c ++++ b/gio/gnetworkmonitorportal.c +@@ -27,8 +27,10 @@ + #include "gportalsupport.h" + + static GInitableIface *initable_parent_iface; +-static void g_network_monitor_portal_iface_init (GNetworkMonitorInterface *iface); +-static void g_network_monitor_portal_initable_iface_init (GInitableIface *iface); ++static void g_network_monitor_portal_iface_init (GNetworkMonitorInterface *iface, ++ gpointer iface_data); ++static void g_network_monitor_portal_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + + enum + { +@@ -613,7 +615,8 @@ g_network_monitor_portal_can_reach_finish (GNetworkMonitor *monitor, + } + + static void +-g_network_monitor_portal_iface_init (GNetworkMonitorInterface *monitor_iface) ++g_network_monitor_portal_iface_init (GNetworkMonitorInterface *monitor_iface, ++ gpointer iface_data) + { + monitor_iface->can_reach = g_network_monitor_portal_can_reach; + monitor_iface->can_reach_async = g_network_monitor_portal_can_reach_async; +@@ -621,7 +624,8 @@ g_network_monitor_portal_iface_init (GNetworkMonitorInterface *monitor_iface) + } + + static void +-g_network_monitor_portal_initable_iface_init (GInitableIface *iface) ++g_network_monitor_portal_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + initable_parent_iface = g_type_interface_peek_parent (iface); + +diff --git a/gio/gnetworkservice.c b/gio/gnetworkservice.c +index 8fa74eca3..beeeb9cae 100644 +--- a/gio/gnetworkservice.c ++++ b/gio/gnetworkservice.c +@@ -88,7 +88,8 @@ static void g_network_service_get_property (GObject *object, + GValue *value, + GParamSpec *pspec); + +-static void g_network_service_connectable_iface_init (GSocketConnectableIface *iface); ++static void g_network_service_connectable_iface_init (GSocketConnectableIface *iface, ++ gpointer iface_data); + static GSocketAddressEnumerator *g_network_service_connectable_enumerate (GSocketConnectable *connectable); + static GSocketAddressEnumerator *g_network_service_connectable_proxy_enumerate (GSocketConnectable *connectable); + static gchar *g_network_service_connectable_to_string (GSocketConnectable *connectable); +@@ -158,7 +159,8 @@ g_network_service_class_init (GNetworkServiceClass *klass) + } + + static void +-g_network_service_connectable_iface_init (GSocketConnectableIface *connectable_iface) ++g_network_service_connectable_iface_init (GSocketConnectableIface *connectable_iface, ++ gpointer iface_data) + { + connectable_iface->enumerate = g_network_service_connectable_enumerate; + connectable_iface->proxy_enumerate = g_network_service_connectable_proxy_enumerate; +diff --git a/gio/gosxappinfo.m b/gio/gosxappinfo.m +index 60b088641..671baa064 100644 +--- a/gio/gosxappinfo.m ++++ b/gio/gosxappinfo.m +@@ -43,7 +43,8 @@ + * Note that `` is unique to OSX. + */ + +-static void g_osx_app_info_iface_init (GAppInfoIface *iface); ++static void g_osx_app_info_iface_init (GAppInfoIface *iface, ++ gpointer iface_data); + static const char *g_osx_app_info_get_id (GAppInfo *appinfo); + + /** +@@ -557,7 +558,8 @@ g_osx_app_info_can_delete (GAppInfo *appinfo) + } + + static void +-g_osx_app_info_iface_init (GAppInfoIface *iface) ++g_osx_app_info_iface_init (GAppInfoIface *iface, ++ gpointer iface_data) + { + iface->dup = g_osx_app_info_dup; + iface->equal = g_osx_app_info_equal; +diff --git a/gio/gportalsupport.c b/gio/gportalsupport.c +index 7e1da2273..1b779d11c 100644 +--- a/gio/gportalsupport.c ++++ b/gio/gportalsupport.c +@@ -61,6 +61,7 @@ snap_plug_is_connected (const gchar *plug_name) + return g_spawn_check_wait_status (wait_status, NULL); + } + ++#ifndef G_PLATFORM_WASM + static void + sandbox_info_read (void) + { +@@ -136,21 +137,29 @@ sandbox_info_read (void) + + g_once_init_leave (&sandbox_info_is_read, 1); + } ++#endif + + gboolean + glib_should_use_portal (void) + { ++#ifdef G_PLATFORM_WASM ++ return FALSE; ++#else + sandbox_info_read (); + + if (sandbox_type == G_SANDBOX_TYPE_SNAP) + return snap_plug_is_connected ("desktop"); + + return use_portal; ++#endif + } + + gboolean + glib_network_available_in_sandbox (void) + { ++#ifdef G_PLATFORM_WASM ++ return FALSE; ++#else + sandbox_info_read (); + + if (sandbox_type == G_SANDBOX_TYPE_SNAP) +@@ -164,15 +173,20 @@ glib_network_available_in_sandbox (void) + } + + return network_available; ++#endif + } + + gboolean + glib_has_dconf_access_in_sandbox (void) + { ++#ifdef G_PLATFORM_WASM ++ return FALSE; ++#else + sandbox_info_read (); + + if (sandbox_type == G_SANDBOX_TYPE_SNAP) + return snap_plug_is_connected ("gsettings"); + + return dconf_access; ++#endif + } +diff --git a/gio/gpowerprofilemonitordbus.c b/gio/gpowerprofilemonitordbus.c +index ac6f8a88c..ffd66d5ed 100644 +--- a/gio/gpowerprofilemonitordbus.c ++++ b/gio/gpowerprofilemonitordbus.c +@@ -34,8 +34,10 @@ + + #define G_POWER_PROFILE_MONITOR_DBUS_GET_INITABLE_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_INITABLE, GInitable)) + +-static void g_power_profile_monitor_dbus_iface_init (GPowerProfileMonitorInterface *iface); +-static void g_power_profile_monitor_dbus_initable_iface_init (GInitableIface *iface); ++static void g_power_profile_monitor_dbus_iface_init (GPowerProfileMonitorInterface *iface, ++ gpointer iface_data); ++static void g_power_profile_monitor_dbus_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + + struct _GPowerProfileMonitorDBus + { +@@ -233,12 +235,14 @@ g_power_profile_monitor_dbus_class_init (GPowerProfileMonitorDBusClass *nl_class + } + + static void +-g_power_profile_monitor_dbus_iface_init (GPowerProfileMonitorInterface *monitor_iface) ++g_power_profile_monitor_dbus_iface_init (GPowerProfileMonitorInterface *monitor_iface, ++ gpointer iface_data) + { + } + + static void +-g_power_profile_monitor_dbus_initable_iface_init (GInitableIface *iface) ++g_power_profile_monitor_dbus_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + iface->init = g_power_profile_monitor_dbus_initable_init; + } +diff --git a/gio/gpowerprofilemonitorportal.c b/gio/gpowerprofilemonitorportal.c +index 0c69ed9b5..3ba794aee 100644 +--- a/gio/gpowerprofilemonitorportal.c ++++ b/gio/gpowerprofilemonitorportal.c +@@ -31,8 +31,10 @@ + + #define G_POWER_PROFILE_MONITOR_PORTAL_GET_INITABLE_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_INITABLE, GInitable)) + +-static void g_power_profile_monitor_portal_iface_init (GPowerProfileMonitorInterface *iface); +-static void g_power_profile_monitor_portal_initable_iface_init (GInitableIface *iface); ++static void g_power_profile_monitor_portal_iface_init (GPowerProfileMonitorInterface *iface, ++ gpointer iface_data); ++static void g_power_profile_monitor_portal_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + + typedef enum + { +@@ -180,12 +182,14 @@ g_power_profile_monitor_portal_class_init (GPowerProfileMonitorPortalClass *nl_c + } + + static void +-g_power_profile_monitor_portal_iface_init (GPowerProfileMonitorInterface *monitor_iface) ++g_power_profile_monitor_portal_iface_init (GPowerProfileMonitorInterface *monitor_iface, ++ gpointer iface_data) + { + } + + static void +-g_power_profile_monitor_portal_initable_iface_init (GInitableIface *iface) ++g_power_profile_monitor_portal_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + iface->init = g_power_profile_monitor_portal_initable_init; + } +diff --git a/gio/gpropertyaction.c b/gio/gpropertyaction.c +index 8df765e98..285c24210 100644 +--- a/gio/gpropertyaction.c ++++ b/gio/gpropertyaction.c +@@ -108,7 +108,8 @@ struct _GPropertyAction + + typedef GObjectClass GPropertyActionClass; + +-static void g_property_action_iface_init (GActionInterface *iface); ++static void g_property_action_iface_init (GActionInterface *iface, ++ gpointer iface_data); + G_DEFINE_TYPE_WITH_CODE (GPropertyAction, g_property_action, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (G_TYPE_ACTION, g_property_action_iface_init)) + +@@ -426,7 +427,8 @@ g_property_action_init (GPropertyAction *property) + } + + void +-g_property_action_iface_init (GActionInterface *iface) ++g_property_action_iface_init (GActionInterface *iface, ++ gpointer iface_data) + { + iface->get_name = g_property_action_get_name; + iface->get_parameter_type = g_property_action_get_parameter_type; +diff --git a/gio/gproxyresolverportal.c b/gio/gproxyresolverportal.c +index ec803b9c4..a25e6e8cc 100644 +--- a/gio/gproxyresolverportal.c ++++ b/gio/gproxyresolverportal.c +@@ -33,7 +33,8 @@ struct _GProxyResolverPortal { + gboolean network_available; + }; + +-static void g_proxy_resolver_portal_iface_init (GProxyResolverInterface *iface); ++static void g_proxy_resolver_portal_iface_init (GProxyResolverInterface *iface, ++ gpointer iface_data); + + G_DEFINE_TYPE_WITH_CODE (GProxyResolverPortal, g_proxy_resolver_portal, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (G_TYPE_PROXY_RESOLVER, +@@ -201,7 +202,8 @@ g_proxy_resolver_portal_class_init (GProxyResolverPortalClass *resolver_class) + } + + static void +-g_proxy_resolver_portal_iface_init (GProxyResolverInterface *iface) ++g_proxy_resolver_portal_iface_init (GProxyResolverInterface *iface, ++ gpointer iface_data) + { + iface->is_supported = g_proxy_resolver_portal_is_supported; + iface->lookup = g_proxy_resolver_portal_lookup; +diff --git a/gio/gresourcefile.c b/gio/gresourcefile.c +index 488fa34e2..981cff82f 100644 +--- a/gio/gresourcefile.c ++++ b/gio/gresourcefile.c +@@ -68,7 +68,8 @@ struct _GResourceFileEnumeratorClass + typedef struct _GResourceFileEnumerator GResourceFileEnumerator; + typedef struct _GResourceFileEnumeratorClass GResourceFileEnumeratorClass; + +-static void g_resource_file_file_iface_init (GFileIface *iface); ++static void g_resource_file_file_iface_init (GFileIface *iface, ++ gpointer iface_data); + + static GFileAttributeInfoList *resource_writable_attributes = NULL; + static GFileAttributeInfoList *resource_writable_namespaces = NULL; +@@ -661,7 +662,8 @@ g_resource_file_set_display_name (GFile *file, + } + + static void +-g_resource_file_file_iface_init (GFileIface *iface) ++g_resource_file_file_iface_init (GFileIface *iface, ++ gpointer iface_data) + { + iface->dup = g_resource_file_dup; + iface->hash = g_resource_file_hash; +diff --git a/gio/gsettings.c b/gio/gsettings.c +index a2c3dd0e4..c770940bf 100644 +--- a/gio/gsettings.c ++++ b/gio/gsettings.c +@@ -3163,7 +3163,8 @@ typedef struct + typedef GObjectClass GSettingsActionClass; + + static GType g_settings_action_get_type (void); +-static void g_settings_action_iface_init (GActionInterface *iface); ++static void g_settings_action_iface_init (GActionInterface *iface, ++ gpointer iface_data); + G_DEFINE_TYPE_WITH_CODE (GSettingsAction, g_settings_action, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (G_TYPE_ACTION, g_settings_action_iface_init)) + +@@ -3320,7 +3321,8 @@ g_settings_action_init (GSettingsAction *gsa) + } + + static void +-g_settings_action_iface_init (GActionInterface *iface) ++g_settings_action_iface_init (GActionInterface *iface, ++ gpointer iface_data) + { + iface->get_name = g_settings_action_get_name; + iface->get_parameter_type = g_settings_action_get_parameter_type; +diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c +index fb3bb7012..d03be72c0 100644 +--- a/gio/gsettingsschema.c ++++ b/gio/gsettingsschema.c +@@ -553,62 +553,7 @@ start_element (GMarkupParseContext *context, + static gchar * + normalise_whitespace (const gchar *orig) + { +- /* We normalise by the same rules as in intltool: +- * +- * sub cleanup { +- * s/^\s+//; +- * s/\s+$//; +- * s/\s+/ /g; +- * return $_; +- * } +- * +- * $message = join "\n\n", map &cleanup, split/\n\s*\n+/, $message; +- * +- * Where \s is an ascii space character. +- * +- * We aim for ease of implementation over efficiency -- this code is +- * not run in normal applications. +- */ +- static GRegex *cleanup[3]; +- static GRegex *splitter; +- gchar **lines; +- gchar *result; +- gint i; +- +- if (g_once_init_enter (&splitter)) +- { +- GRegex *s; +- +- cleanup[0] = g_regex_new ("^\\s+", G_REGEX_DEFAULT, +- G_REGEX_MATCH_DEFAULT, NULL); +- cleanup[1] = g_regex_new ("\\s+$", G_REGEX_DEFAULT, +- G_REGEX_MATCH_DEFAULT, NULL); +- cleanup[2] = g_regex_new ("\\s+", G_REGEX_DEFAULT, +- G_REGEX_MATCH_DEFAULT, NULL); +- s = g_regex_new ("\\n\\s*\\n+", G_REGEX_DEFAULT, +- G_REGEX_MATCH_DEFAULT, NULL); +- +- g_once_init_leave (&splitter, s); +- } +- +- lines = g_regex_split (splitter, orig, 0); +- for (i = 0; lines[i]; i++) +- { +- gchar *a, *b, *c; +- +- a = g_regex_replace_literal (cleanup[0], lines[i], -1, 0, "", 0, 0); +- b = g_regex_replace_literal (cleanup[1], a, -1, 0, "", 0, 0); +- c = g_regex_replace_literal (cleanup[2], b, -1, 0, " ", 0, 0); +- g_free (lines[i]); +- g_free (a); +- g_free (b); +- lines[i] = c; +- } +- +- result = g_strjoinv ("\n\n", lines); +- g_strfreev (lines); +- +- return result; ++ return orig; + } + + static void +diff --git a/gio/gsimpleaction.c b/gio/gsimpleaction.c +index 4e7e5b5ee..7ec06dd51 100644 +--- a/gio/gsimpleaction.c ++++ b/gio/gsimpleaction.c +@@ -60,7 +60,8 @@ struct _GSimpleAction + + typedef GObjectClass GSimpleActionClass; + +-static void g_simple_action_iface_init (GActionInterface *iface); ++static void g_simple_action_iface_init (GActionInterface *iface, ++ gpointer iface_data); + G_DEFINE_TYPE_WITH_CODE (GSimpleAction, g_simple_action, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (G_TYPE_ACTION, g_simple_action_iface_init)) + +@@ -349,7 +350,8 @@ g_simple_action_init (GSimpleAction *simple) + } + + void +-g_simple_action_iface_init (GActionInterface *iface) ++g_simple_action_iface_init (GActionInterface *iface, ++ gpointer iface_data) + { + iface->get_name = g_simple_action_get_name; + iface->get_parameter_type = g_simple_action_get_parameter_type; +diff --git a/gio/gsimpleactiongroup.c b/gio/gsimpleactiongroup.c +index 28ca21ab5..92ccf0160 100644 +--- a/gio/gsimpleactiongroup.c ++++ b/gio/gsimpleactiongroup.c +@@ -42,8 +42,10 @@ struct _GSimpleActionGroupPrivate + GHashTable *table; /* string -> GAction */ + }; + +-static void g_simple_action_group_iface_init (GActionGroupInterface *); +-static void g_simple_action_group_map_iface_init (GActionMapInterface *); ++static void g_simple_action_group_iface_init (GActionGroupInterface *iface, ++ gpointer iface_data); ++static void g_simple_action_group_map_iface_init (GActionMapInterface *iface, ++ gpointer iface_data); + G_DEFINE_TYPE_WITH_CODE (GSimpleActionGroup, + g_simple_action_group, G_TYPE_OBJECT, + G_ADD_PRIVATE (GSimpleActionGroup) +@@ -274,7 +276,8 @@ g_simple_action_group_class_init (GSimpleActionGroupClass *class) + } + + static void +-g_simple_action_group_iface_init (GActionGroupInterface *iface) ++g_simple_action_group_iface_init (GActionGroupInterface *iface, ++ gpointer iface_data) + { + iface->list_actions = g_simple_action_group_list_actions; + iface->query_action = g_simple_action_group_query_action; +@@ -283,7 +286,8 @@ g_simple_action_group_iface_init (GActionGroupInterface *iface) + } + + static void +-g_simple_action_group_map_iface_init (GActionMapInterface *iface) ++g_simple_action_group_map_iface_init (GActionMapInterface *iface, ++ gpointer iface_data) + { + iface->add_action = g_simple_action_group_add_action; + iface->remove_action = g_simple_action_group_remove_action; +diff --git a/gio/gsimpleasyncresult.c b/gio/gsimpleasyncresult.c +index d0de30973..fa677e5db 100644 +--- a/gio/gsimpleasyncresult.c ++++ b/gio/gsimpleasyncresult.c +@@ -207,7 +207,8 @@ + + G_GNUC_BEGIN_IGNORE_DEPRECATIONS + +-static void g_simple_async_result_async_result_iface_init (GAsyncResultIface *iface); ++static void g_simple_async_result_async_result_iface_init (GAsyncResultIface *iface, ++ gpointer iface_data); + + struct _GSimpleAsyncResult + { +@@ -466,7 +467,8 @@ g_simple_async_result_is_tagged (GAsyncResult *res, + } + + static void +-g_simple_async_result_async_result_iface_init (GAsyncResultIface *iface) ++g_simple_async_result_async_result_iface_init (GAsyncResultIface *iface, ++ gpointer iface_data) + { + iface->get_user_data = g_simple_async_result_get_user_data; + iface->get_source_object = g_simple_async_result_get_source_object; +diff --git a/gio/gsimpleproxyresolver.c b/gio/gsimpleproxyresolver.c +index 8de26cb7b..1ca5cdaff 100644 +--- a/gio/gsimpleproxyresolver.c ++++ b/gio/gsimpleproxyresolver.c +@@ -64,7 +64,8 @@ struct _GSimpleProxyResolverPrivate { + GSimpleProxyResolverDomain *ignore_domains; + }; + +-static void g_simple_proxy_resolver_iface_init (GProxyResolverInterface *iface); ++static void g_simple_proxy_resolver_iface_init (GProxyResolverInterface *iface, ++ gpointer iface_data); + + G_DEFINE_TYPE_WITH_CODE (GSimpleProxyResolver, g_simple_proxy_resolver, G_TYPE_OBJECT, + G_ADD_PRIVATE (GSimpleProxyResolver) +@@ -484,7 +485,8 @@ g_simple_proxy_resolver_class_init (GSimpleProxyResolverClass *resolver_class) + } + + static void +-g_simple_proxy_resolver_iface_init (GProxyResolverInterface *iface) ++g_simple_proxy_resolver_iface_init (GProxyResolverInterface *iface, ++ gpointer iface_data) + { + iface->lookup = g_simple_proxy_resolver_lookup; + iface->lookup_async = g_simple_proxy_resolver_lookup_async; +diff --git a/gio/gsocket.c b/gio/gsocket.c +index 983c05a96..53ec40d35 100644 +--- a/gio/gsocket.c ++++ b/gio/gsocket.c +@@ -31,7 +31,7 @@ + + #include "gsocket.h" + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + #include "glib-unix.h" + #endif + +@@ -54,7 +54,7 @@ + # include + #endif + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + #include + #endif + +@@ -143,12 +143,14 @@ + * Since: 2.22 + */ + +-static void g_socket_initable_iface_init (GInitableIface *iface); ++static void g_socket_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + static gboolean g_socket_initable_init (GInitable *initable, + GCancellable *cancellable, + GError **error); + +-static void g_socket_datagram_based_iface_init (GDatagramBasedInterface *iface); ++static void g_socket_datagram_based_iface_init (GDatagramBasedInterface *iface, ++ gpointer iface_data); + static gint g_socket_datagram_based_receive_messages (GDatagramBased *self, + GInputMessage *messages, + guint num_messages, +@@ -708,9 +710,9 @@ g_socket_constructed (GObject *object) + + if (socket->priv->fd != -1) + { +-#ifndef G_OS_WIN32 ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + GError *error = NULL; +-#else ++#elif defined(G_OS_WIN32) + gulong arg; + #endif + +@@ -718,13 +720,13 @@ g_socket_constructed (GObject *object) + * nonblocking automatically in certain operations. This way we make + * things work the same on all platforms. + */ +-#ifndef G_OS_WIN32 ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + if (!g_unix_set_fd_nonblocking (socket->priv->fd, TRUE, &error)) + { + g_warning ("Error setting socket nonblocking: %s", error->message); + g_clear_error (&error); + } +-#else ++#elif defined(G_OS_WIN32) + arg = TRUE; + + if (ioctlsocket (socket->priv->fd, FIONBIO, &arg) == SOCKET_ERROR) +@@ -1103,13 +1105,15 @@ g_socket_class_init (GSocketClass *klass) + } + + static void +-g_socket_initable_iface_init (GInitableIface *iface) ++g_socket_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + iface->init = g_socket_initable_init; + } + + static void +-g_socket_datagram_based_iface_init (GDatagramBasedInterface *iface) ++g_socket_datagram_based_iface_init (GDatagramBasedInterface *iface, ++ gpointer iface_data) + { + iface->receive_messages = g_socket_datagram_based_receive_messages; + iface->send_messages = g_socket_datagram_based_send_messages; +@@ -4036,7 +4040,7 @@ socket_source_dispatch (GSource *source, + events = G_IO_NVAL; + else + events = update_condition (socket_source->socket); +-#else ++#elif defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + if (g_socket_is_closed (socket_source->socket)) + { + if (socket_source->fd_tag) +@@ -4174,7 +4178,7 @@ socket_source_new (GSocket *socket, + socket_source->pollfd.events = condition; + socket_source->pollfd.revents = 0; + g_source_add_poll (source, &socket_source->pollfd); +-#else ++#elif defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + socket_source->fd_tag = g_source_add_unix_fd (source, socket->priv->fd, condition); + #endif + +diff --git a/gio/gsocketaddress.c b/gio/gsocketaddress.c +index 994037c05..03afad81b 100644 +--- a/gio/gsocketaddress.c ++++ b/gio/gsocketaddress.c +@@ -68,7 +68,8 @@ enum + PROP_FAMILY + }; + +-static void g_socket_address_connectable_iface_init (GSocketConnectableIface *iface); ++static void g_socket_address_connectable_iface_init (GSocketConnectableIface *iface, ++ gpointer iface_data); + static GSocketAddressEnumerator *g_socket_address_connectable_enumerate (GSocketConnectable *connectable); + static GSocketAddressEnumerator *g_socket_address_connectable_proxy_enumerate (GSocketConnectable *connectable); + +@@ -129,7 +130,8 @@ g_socket_address_class_init (GSocketAddressClass *klass) + } + + static void +-g_socket_address_connectable_iface_init (GSocketConnectableIface *connectable_iface) ++g_socket_address_connectable_iface_init (GSocketConnectableIface *connectable_iface, ++ gpointer iface_data) + { + connectable_iface->enumerate = g_socket_address_connectable_enumerate; + connectable_iface->proxy_enumerate = g_socket_address_connectable_proxy_enumerate; +diff --git a/gio/gsocketinputstream.c b/gio/gsocketinputstream.c +index 5307fcdad..1c4a6421a 100644 +--- a/gio/gsocketinputstream.c ++++ b/gio/gsocketinputstream.c +@@ -41,14 +41,16 @@ struct _GSocketInputStreamPrivate + gsize count; + }; + +-static void g_socket_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface); +-#ifdef G_OS_UNIX +-static void g_socket_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface); ++static void g_socket_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface, ++ gpointer iface_data); ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) ++static void g_socket_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, ++ gpointer iface_data); + #endif + + #define g_socket_input_stream_get_type _g_socket_input_stream_get_type + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + G_DEFINE_TYPE_WITH_CODE (GSocketInputStream, g_socket_input_stream, G_TYPE_INPUT_STREAM, + G_ADD_PRIVATE (GSocketInputStream) + G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM, g_socket_input_stream_pollable_iface_init) +@@ -168,7 +170,7 @@ g_socket_input_stream_pollable_read_nonblocking (GPollableInputStream *pollable + NULL, error); + } + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + static int + g_socket_input_stream_get_fd (GFileDescriptorBased *fd_based) + { +@@ -198,16 +200,18 @@ g_socket_input_stream_class_init (GSocketInputStreamClass *klass) + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + } + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + static void +-g_socket_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface) ++g_socket_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, ++ gpointer iface_data) + { + iface->get_fd = g_socket_input_stream_get_fd; + } + #endif + + static void +-g_socket_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface) ++g_socket_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface, ++ gpointer iface_data) + { + iface->is_readable = g_socket_input_stream_pollable_is_readable; + iface->create_source = g_socket_input_stream_pollable_create_source; +diff --git a/gio/gsocketoutputstream.c b/gio/gsocketoutputstream.c +index d380c52cc..888c9d61e 100644 +--- a/gio/gsocketoutputstream.c ++++ b/gio/gsocketoutputstream.c +@@ -46,14 +46,16 @@ struct _GSocketOutputStreamPrivate + gsize count; + }; + +-static void g_socket_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface); +-#ifdef G_OS_UNIX +-static void g_socket_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface); ++static void g_socket_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface, ++ gpointer iface_data); ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) ++static void g_socket_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, ++ gpointer iface_data); + #endif + + #define g_socket_output_stream_get_type _g_socket_output_stream_get_type + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + G_DEFINE_TYPE_WITH_CODE (GSocketOutputStream, g_socket_output_stream, G_TYPE_OUTPUT_STREAM, + G_ADD_PRIVATE (GSocketOutputStream) + G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_OUTPUT_STREAM, g_socket_output_stream_pollable_iface_init) +@@ -223,7 +225,7 @@ g_socket_output_stream_pollable_create_source (GPollableOutputStream *pollable, + return pollable_source; + } + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + static int + g_socket_output_stream_get_fd (GFileDescriptorBased *fd_based) + { +@@ -254,16 +256,18 @@ g_socket_output_stream_class_init (GSocketOutputStreamClass *klass) + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + } + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + static void +-g_socket_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface) ++g_socket_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, ++ gpointer iface_data) + { + iface->get_fd = g_socket_output_stream_get_fd; + } + #endif + + static void +-g_socket_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface) ++g_socket_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface, ++ gpointer iface_data) + { + iface->is_writable = g_socket_output_stream_pollable_is_writable; + iface->create_source = g_socket_output_stream_pollable_create_source; +diff --git a/gio/gsocks4aproxy.c b/gio/gsocks4aproxy.c +index 3dad118eb..e4a1306e6 100644 +--- a/gio/gsocks4aproxy.c ++++ b/gio/gsocks4aproxy.c +@@ -50,7 +50,8 @@ + #define SOCKS4_REP_NO_IDENT 92 + #define SOCKS4_REP_BAD_IDENT 93 + +-static void g_socks4a_proxy_iface_init (GProxyInterface *proxy_iface); ++static void g_socks4a_proxy_iface_init (GProxyInterface *proxy_iface, ++ gpointer iface_data); + + #define g_socks4a_proxy_get_type _g_socks4a_proxy_get_type + G_DEFINE_TYPE_WITH_CODE (GSocks4aProxy, g_socks4a_proxy, G_TYPE_OBJECT, +@@ -451,7 +452,8 @@ g_socks4a_proxy_class_init (GSocks4aProxyClass *class) + } + + static void +-g_socks4a_proxy_iface_init (GProxyInterface *proxy_iface) ++g_socks4a_proxy_iface_init (GProxyInterface *proxy_iface, ++ gpointer iface_data) + { + proxy_iface->connect = g_socks4a_proxy_connect; + proxy_iface->connect_async = g_socks4a_proxy_connect_async; +diff --git a/gio/gsocks5proxy.c b/gio/gsocks5proxy.c +index 6f256727a..ce2e9cef5 100644 +--- a/gio/gsocks5proxy.c ++++ b/gio/gsocks5proxy.c +@@ -82,7 +82,8 @@ struct _GSocks5ProxyClass + GObjectClass parent_class; + }; + +-static void g_socks5_proxy_iface_init (GProxyInterface *proxy_iface); ++static void g_socks5_proxy_iface_init (GProxyInterface *proxy_iface, ++ gpointer iface_data); + + #define g_socks5_proxy_get_type _g_socks5_proxy_get_type + G_DEFINE_TYPE_WITH_CODE (GSocks5Proxy, g_socks5_proxy, G_TYPE_OBJECT, +@@ -1101,7 +1102,8 @@ g_socks5_proxy_class_init (GSocks5ProxyClass *class) + } + + static void +-g_socks5_proxy_iface_init (GProxyInterface *proxy_iface) ++g_socks5_proxy_iface_init (GProxyInterface *proxy_iface, ++ gpointer iface_data) + { + proxy_iface->connect = g_socks5_proxy_connect; + proxy_iface->connect_async = g_socks5_proxy_connect_async; +diff --git a/gio/gsubprocess.c b/gio/gsubprocess.c +index c4747a148..29eefad50 100644 +--- a/gio/gsubprocess.c ++++ b/gio/gsubprocess.c +@@ -95,7 +95,7 @@ + #include "glib-private.h" + + #include +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + #include + #include + #include +@@ -108,6 +108,14 @@ + #include + #include "giowin32-priv.h" + #endif ++#ifdef G_PLATFORM_WASM ++#include ++#include ++#include ++#include ++#include ++#include ++#endif + + #ifndef O_BINARY + #define O_BINARY 0 +@@ -145,7 +153,8 @@ + * via the worker thread so that we don't race with waitpid() and + * accidentally send a signal to an already-reaped child. + */ +-static void initable_iface_init (GInitableIface *initable_iface); ++static void initable_iface_init (GInitableIface *initable_iface, ++ gpointer iface_data); + + typedef GObjectClass GSubprocessClass; + +@@ -190,7 +199,9 @@ platform_input_stream_from_spawn_fd (gint fd) + if (fd < 0) + return NULL; + +-#ifdef G_OS_UNIX ++#ifdef G_PLATFORM_WASM ++ return NULL; ++#elif defined(G_OS_UNIX) + return g_unix_input_stream_new (fd, TRUE); + #else + return g_win32_input_stream_new_from_fd (fd, TRUE); +@@ -203,14 +214,16 @@ platform_output_stream_from_spawn_fd (gint fd) + if (fd < 0) + return NULL; + +-#ifdef G_OS_UNIX ++#ifdef G_PLATFORM_WASM ++ return NULL; ++#elif defined(G_OS_UNIX) + return g_unix_output_stream_new (fd, TRUE); + #else + return g_win32_output_stream_new_from_fd (fd, TRUE); + #endif + } + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + static gint + unix_open_file (const char *filename, + gint mode, +@@ -304,7 +317,7 @@ initable_init (GInitable *initable, + gint *pipe_ptrs[3] = { NULL, NULL, NULL }; + gint pipe_fds[3] = { -1, -1, -1 }; + gint close_fds[3] = { -1, -1, -1 }; +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + gint stdin_fd = -1, stdout_fd = -1, stderr_fd = -1; + #endif + GSpawnFlags spawn_flags = 0; +@@ -327,7 +340,7 @@ initable_init (GInitable *initable, + spawn_flags |= G_SPAWN_CHILD_INHERITS_STDIN; + else if (self->flags & G_SUBPROCESS_FLAGS_STDIN_PIPE) + pipe_ptrs[0] = &pipe_fds[0]; +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + else if (self->launcher) + { + if (self->launcher->stdin_fd != -1) +@@ -346,7 +359,7 @@ initable_init (GInitable *initable, + spawn_flags |= G_SPAWN_STDOUT_TO_DEV_NULL; + else if (self->flags & G_SUBPROCESS_FLAGS_STDOUT_PIPE) + pipe_ptrs[1] = &pipe_fds[1]; +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + else if (self->launcher) + { + if (self->launcher->stdout_fd != -1) +@@ -365,7 +378,7 @@ initable_init (GInitable *initable, + spawn_flags |= G_SPAWN_STDERR_TO_DEV_NULL; + else if (self->flags & G_SUBPROCESS_FLAGS_STDERR_PIPE) + pipe_ptrs[2] = &pipe_fds[2]; +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + else if (self->flags & G_SUBPROCESS_FLAGS_STDERR_MERGE) + /* This will work because stderr gets set up after stdout. */ + stderr_fd = 1; +@@ -401,7 +414,7 @@ initable_init (GInitable *initable, + (const gchar * const *) self->argv, + (const gchar * const *) (self->launcher ? self->launcher->envp : NULL), + spawn_flags, +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + self->launcher ? self->launcher->child_setup_func : NULL, + self->launcher ? self->launcher->child_setup_user_data : NULL, + stdin_fd, stdout_fd, stderr_fd, +@@ -445,7 +458,7 @@ initable_init (GInitable *initable, + g_source_unref (source); + } + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + out: + #endif + /* we don't need this past init... */ +@@ -487,7 +500,8 @@ g_subprocess_init (GSubprocess *self) + } + + static void +-initable_iface_init (GInitableIface *initable_iface) ++initable_iface_init (GInitableIface *initable_iface, ++ gpointer iface_data) + { + initable_iface->init = initable_init; + } +@@ -950,7 +964,7 @@ g_subprocess_wait_check_finish (GSubprocess *subprocess, + g_spawn_check_wait_status (subprocess->status, error); + } + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + typedef struct + { + GSubprocess *subprocess; +@@ -1045,9 +1059,9 @@ g_subprocess_force_exit (GSubprocess *subprocess) + { + g_return_if_fail (G_IS_SUBPROCESS (subprocess)); + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + g_subprocess_dispatch_signal (subprocess, SIGKILL); +-#else ++#elif defined(G_OS_WIN32) + TerminateProcess (subprocess->pid, 1); + #endif + } +@@ -1102,7 +1116,7 @@ g_subprocess_get_successful (GSubprocess *subprocess) + g_return_val_if_fail (G_IS_SUBPROCESS (subprocess), FALSE); + g_return_val_if_fail (subprocess->pid == 0, FALSE); + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + return WIFEXITED (subprocess->status) && WEXITSTATUS (subprocess->status) == 0; + #else + return subprocess->status == 0; +@@ -1131,7 +1145,7 @@ g_subprocess_get_if_exited (GSubprocess *subprocess) + g_return_val_if_fail (G_IS_SUBPROCESS (subprocess), FALSE); + g_return_val_if_fail (subprocess->pid == 0, FALSE); + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + return WIFEXITED (subprocess->status); + #else + return TRUE; +@@ -1161,7 +1175,7 @@ g_subprocess_get_exit_status (GSubprocess *subprocess) + g_return_val_if_fail (G_IS_SUBPROCESS (subprocess), 1); + g_return_val_if_fail (subprocess->pid == 0, 1); + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + g_return_val_if_fail (WIFEXITED (subprocess->status), 1); + + return WEXITSTATUS (subprocess->status); +@@ -1191,7 +1205,7 @@ g_subprocess_get_if_signaled (GSubprocess *subprocess) + g_return_val_if_fail (G_IS_SUBPROCESS (subprocess), FALSE); + g_return_val_if_fail (subprocess->pid == 0, FALSE); + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + return WIFSIGNALED (subprocess->status); + #else + return FALSE; +@@ -1220,12 +1234,12 @@ g_subprocess_get_term_sig (GSubprocess *subprocess) + g_return_val_if_fail (G_IS_SUBPROCESS (subprocess), 0); + g_return_val_if_fail (subprocess->pid == 0, 0); + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + g_return_val_if_fail (WIFSIGNALED (subprocess->status), 0); + + return WTERMSIG (subprocess->status); + #else +- g_critical ("g_subprocess_get_term_sig() called on Windows, where " ++ g_critical ("g_subprocess_get_term_sig() called on Windows or Wasm, where " + "g_subprocess_get_if_signaled() always returns FALSE..."); + return 0; + #endif +@@ -1440,7 +1454,7 @@ g_subprocess_communicate_internal (GSubprocess *subprocess, + { + g_assert (stdin_buf != NULL); + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + /* We're doing async writes to the pipe, and the async write mechanism assumes + * that streams polling as writable do SOME progress (possibly partial) and then + * stop, but never block. +diff --git a/gio/gtask.c b/gio/gtask.c +index 80df75286..124731498 100644 +--- a/gio/gtask.c ++++ b/gio/gtask.c +@@ -633,7 +633,8 @@ typedef enum + PROP_COMPLETED = 1, + } GTaskProperty; + +-static void g_task_async_result_iface_init (GAsyncResultIface *iface); ++static void g_task_async_result_iface_init (GAsyncResultIface *iface, ++ gpointer iface_data); + static void g_task_thread_pool_init (void); + + G_DEFINE_TYPE_WITH_CODE (GTask, g_task, G_TYPE_OBJECT, +@@ -2358,7 +2359,8 @@ g_task_is_tagged (GAsyncResult *res, + } + + static void +-g_task_async_result_iface_init (GAsyncResultIface *iface) ++g_task_async_result_iface_init (GAsyncResultIface *iface, ++ gpointer iface_data) + { + iface->get_user_data = g_task_get_user_data; + iface->get_source_object = g_task_ref_source_object; +diff --git a/gio/gtestdbus.c b/gio/gtestdbus.c +index 34cead176..dd0bdb337 100644 +--- a/gio/gtestdbus.c ++++ b/gio/gtestdbus.c +@@ -48,7 +48,7 @@ + + #include "glibintl.h" + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + #include "glib-unix.h" + #include "glib-unixprivate.h" + #endif +@@ -244,6 +244,7 @@ watcher_init (void) + static GIOChannel *channel = NULL; + int errsv; + ++#ifndef G_PLATFORM_WASM + if (g_once_init_enter (&started)) + { + gint pipe_fds[2]; +@@ -288,6 +289,7 @@ watcher_init (void) + + g_once_init_leave (&started, 1); + } ++#endif + + return channel; + } +@@ -604,7 +606,7 @@ static gboolean + make_pipe (gint pipe_fds[2], + GError **error) + { +-#if defined(G_OS_UNIX) ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + return g_unix_open_pipe (pipe_fds, FD_CLOEXEC, error); + #elif defined(G_OS_WIN32) + if (_pipe (pipe_fds, 4096, _O_BINARY) < 0) +diff --git a/gio/gthemedicon.c b/gio/gthemedicon.c +index 8551bd27d..63866e905 100644 +--- a/gio/gthemedicon.c ++++ b/gio/gthemedicon.c +@@ -45,7 +45,8 @@ + * themes that inherit other themes. + **/ + +-static void g_themed_icon_icon_iface_init (GIconIface *iface); ++static void g_themed_icon_icon_iface_init (GIconIface *iface, ++ gpointer iface_data); + + struct _GThemedIcon + { +@@ -620,7 +621,8 @@ g_themed_icon_serialize (GIcon *icon) + } + + static void +-g_themed_icon_icon_iface_init (GIconIface *iface) ++g_themed_icon_icon_iface_init (GIconIface *iface, ++ gpointer iface_data) + { + iface->hash = g_themed_icon_hash; + iface->equal = g_themed_icon_equal; +diff --git a/gio/gunixfdlist.c b/gio/gunixfdlist.c +index e06171414..d7ced32fe 100644 +--- a/gio/gunixfdlist.c ++++ b/gio/gunixfdlist.c +@@ -54,6 +54,10 @@ + #include "glib/glib-private.h" + #include "glib/gstdio.h" + ++#ifdef G_OS_UNIX ++#include /* dup() */ ++#endif ++ + #ifdef G_OS_WIN32 + #include + #endif +diff --git a/gio/gunixinputstream.c b/gio/gunixinputstream.c +index 2180ce8dc..8596bfe79 100644 +--- a/gio/gunixinputstream.c ++++ b/gio/gunixinputstream.c +@@ -67,8 +67,10 @@ struct _GUnixInputStreamPrivate { + guint can_poll : 1; + }; + +-static void g_unix_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface); +-static void g_unix_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface); ++static void g_unix_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface, ++ gpointer iface_data); ++static void g_unix_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, ++ gpointer iface_data); + + G_DEFINE_TYPE_WITH_CODE (GUnixInputStream, g_unix_input_stream, G_TYPE_INPUT_STREAM, + G_ADD_PRIVATE (GUnixInputStream) +@@ -159,7 +161,8 @@ g_unix_input_stream_class_init (GUnixInputStreamClass *klass) + } + + static void +-g_unix_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface) ++g_unix_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface, ++ gpointer iface_data) + { + iface->can_poll = g_unix_input_stream_pollable_can_poll; + iface->is_readable = g_unix_input_stream_pollable_is_readable; +@@ -167,7 +170,8 @@ g_unix_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface) + } + + static void +-g_unix_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface) ++g_unix_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, ++ gpointer iface_data) + { + iface->get_fd = (int (*) (GFileDescriptorBased *))g_unix_input_stream_get_fd; + } +diff --git a/gio/gunixmount.c b/gio/gunixmount.c +index 7055d8edd..a5d4127fe 100644 +--- a/gio/gunixmount.c ++++ b/gio/gunixmount.c +@@ -63,7 +63,8 @@ struct _GUnixMount { + gboolean can_eject; + }; + +-static void g_unix_mount_mount_iface_init (GMountIface *iface); ++static void g_unix_mount_mount_iface_init (GMountIface *iface, ++ gpointer iface_data); + + #define g_unix_mount_get_type _g_unix_mount_get_type + G_DEFINE_TYPE_WITH_CODE (GUnixMount, g_unix_mount, G_TYPE_OBJECT, +@@ -379,7 +380,8 @@ g_unix_mount_eject_finish (GMount *mount, + } + + static void +-g_unix_mount_mount_iface_init (GMountIface *iface) ++g_unix_mount_mount_iface_init (GMountIface *iface, ++ gpointer iface_data) + { + iface->get_root = g_unix_mount_get_root; + iface->get_name = g_unix_mount_get_name; +diff --git a/gio/gunixoutputstream.c b/gio/gunixoutputstream.c +index 8a71c315c..40012eb0a 100644 +--- a/gio/gunixoutputstream.c ++++ b/gio/gunixoutputstream.c +@@ -69,8 +69,10 @@ struct _GUnixOutputStreamPrivate { + guint can_poll : 1; + }; + +-static void g_unix_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface); +-static void g_unix_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface); ++static void g_unix_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface, ++ gpointer iface_data); ++static void g_unix_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, ++ gpointer iface_data); + + G_DEFINE_TYPE_WITH_CODE (GUnixOutputStream, g_unix_output_stream, G_TYPE_OUTPUT_STREAM, + G_ADD_PRIVATE (GUnixOutputStream) +@@ -158,7 +160,8 @@ g_unix_output_stream_class_init (GUnixOutputStreamClass *klass) + } + + static void +-g_unix_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface) ++g_unix_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface, ++ gpointer iface_data) + { + iface->can_poll = g_unix_output_stream_pollable_can_poll; + iface->is_writable = g_unix_output_stream_pollable_is_writable; +@@ -167,7 +170,8 @@ g_unix_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface) + } + + static void +-g_unix_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface) ++g_unix_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, ++ gpointer iface_data) + { + iface->get_fd = (int (*) (GFileDescriptorBased *))g_unix_output_stream_get_fd; + } +diff --git a/gio/gunixsocketaddress.c b/gio/gunixsocketaddress.c +index 3ccb2cbf1..9c6167f8a 100644 +--- a/gio/gunixsocketaddress.c ++++ b/gio/gunixsocketaddress.c +@@ -88,7 +88,8 @@ struct _GUnixSocketAddressPrivate + GUnixSocketAddressType address_type; + }; + +-static void g_unix_socket_address_connectable_iface_init (GSocketConnectableIface *iface); ++static void g_unix_socket_address_connectable_iface_init (GSocketConnectableIface *iface, ++ gpointer iface_data); + static gchar *g_unix_socket_address_connectable_to_string (GSocketConnectable *connectable); + + G_DEFINE_TYPE_WITH_CODE (GUnixSocketAddress, g_unix_socket_address, G_TYPE_SOCKET_ADDRESS, +@@ -321,7 +322,8 @@ g_unix_socket_address_class_init (GUnixSocketAddressClass *klass) + } + + static void +-g_unix_socket_address_connectable_iface_init (GSocketConnectableIface *iface) ++g_unix_socket_address_connectable_iface_init (GSocketConnectableIface *iface, ++ gpointer iface_data) + { + GSocketConnectableIface *parent_iface = g_type_interface_peek_parent (iface); + +diff --git a/gio/gunixvolume.c b/gio/gunixvolume.c +index a0f00ffbb..2257a287f 100644 +--- a/gio/gunixvolume.c ++++ b/gio/gunixvolume.c +@@ -61,7 +61,8 @@ struct _GUnixVolume { + GIcon *symbolic_icon; + }; + +-static void g_unix_volume_volume_iface_init (GVolumeIface *iface); ++static void g_unix_volume_volume_iface_init (GVolumeIface *iface, ++ gpointer iface_data); + + #define g_unix_volume_get_type _g_unix_volume_get_type + G_DEFINE_TYPE_WITH_CODE (GUnixVolume, g_unix_volume, G_TYPE_OBJECT, +@@ -421,7 +422,8 @@ g_unix_volume_enumerate_identifiers (GVolume *volume) + } + + static void +-g_unix_volume_volume_iface_init (GVolumeIface *iface) ++g_unix_volume_volume_iface_init (GVolumeIface *iface, ++ gpointer iface_data) + { + iface->get_name = g_unix_volume_get_name; + iface->get_icon = g_unix_volume_get_icon; +diff --git a/gio/gwin32appinfo.c b/gio/gwin32appinfo.c +index 49e76ca9a..c45d729dc 100644 +--- a/gio/gwin32appinfo.c ++++ b/gio/gwin32appinfo.c +@@ -4059,7 +4059,8 @@ gio_win32_appinfo_init (gboolean do_wait) + } + + +-static void g_win32_app_info_iface_init (GAppInfoIface *iface); ++static void g_win32_app_info_iface_init (GAppInfoIface *iface, ++ gpointer iface_data); + + struct _GWin32AppInfo + { +@@ -5724,7 +5725,8 @@ g_app_info_create_from_commandline (const char *commandline, + /* GAppInfo interface init */ + + static void +-g_win32_app_info_iface_init (GAppInfoIface *iface) ++g_win32_app_info_iface_init (GAppInfoIface *iface, ++ gpointer iface_data) + { + iface->dup = g_win32_app_info_dup; + iface->equal = g_win32_app_info_equal; +diff --git a/gio/gwin32mount.c b/gio/gwin32mount.c +index 98560259b..9a495d2c3 100644 +--- a/gio/gwin32mount.c ++++ b/gio/gwin32mount.c +@@ -97,7 +97,8 @@ struct _GWin32Mount { + gboolean can_eject; + }; + +-static void g_win32_mount_mount_iface_init (GMountIface *iface); ++static void g_win32_mount_mount_iface_init (GMountIface *iface, ++ gpointer iface_data) + + #define g_win32_mount_get_type _g_win32_mount_get_type + G_DEFINE_TYPE_WITH_CODE (GWin32Mount, g_win32_mount, G_TYPE_OBJECT, +@@ -525,7 +526,8 @@ g_win32_mount_eject_finish (GMount *mount, + } + + static void +-g_win32_mount_mount_iface_init (GMountIface *iface) ++g_win32_mount_mount_iface_init (GMountIface *iface, ++ gpointer iface_data) + { + iface->get_root = g_win32_mount_get_root; + iface->get_name = g_win32_mount_get_name; +diff --git a/gio/gwin32networkmonitor.c b/gio/gwin32networkmonitor.c +index e219225f0..836cfee06 100644 +--- a/gio/gwin32networkmonitor.c ++++ b/gio/gwin32networkmonitor.c +@@ -46,8 +46,10 @@ + #include "gioerror.h" + + static GInitableIface *initable_parent_iface; +-static void g_win32_network_monitor_iface_init (GNetworkMonitorInterface *iface); +-static void g_win32_network_monitor_initable_iface_init (GInitableIface *iface); ++static void g_win32_network_monitor_iface_init (GNetworkMonitorInterface *iface, ++ gpointer iface_data); ++static void g_win32_network_monitor_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + + struct _GWin32NetworkMonitorPrivate + { +@@ -328,12 +330,14 @@ g_win32_network_monitor_class_init (GWin32NetworkMonitorClass *win_class) + } + + static void +-g_win32_network_monitor_iface_init (GNetworkMonitorInterface *monitor_iface) ++g_win32_network_monitor_iface_init (GNetworkMonitorInterface *monitor_iface, ++ gpointer iface_data) + { + } + + static void +-g_win32_network_monitor_initable_iface_init (GInitableIface *iface) ++g_win32_network_monitor_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + initable_parent_iface = g_type_interface_peek_parent (iface); + +diff --git a/gio/gwin32registrykey.c b/gio/gwin32registrykey.c +index df20db102..e468cf578 100644 +--- a/gio/gwin32registrykey.c ++++ b/gio/gwin32registrykey.c +@@ -434,7 +434,8 @@ struct _GWin32RegistryKeyPrivate { + gpointer user_data; + }; + +-static void g_win32_registry_key_initable_iface_init (GInitableIface *iface); ++static void g_win32_registry_key_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data); + static gboolean g_win32_registry_key_initable_init (GInitable *initable, + GCancellable *cancellable, + GError **error); +@@ -541,7 +542,8 @@ g_win32_registry_key_new_w (const gunichar2 *path, + } + + static void +-g_win32_registry_key_initable_iface_init (GInitableIface *iface) ++g_win32_registry_key_initable_iface_init (GInitableIface *iface, ++ gpointer iface_data) + { + iface->init = g_win32_registry_key_initable_init; + } +diff --git a/gio/gzlibcompressor.c b/gio/gzlibcompressor.c +index a1c018a01..59d9a7822 100644 +--- a/gio/gzlibcompressor.c ++++ b/gio/gzlibcompressor.c +@@ -51,7 +51,8 @@ enum { + * compresses data using zlib. + */ + +-static void g_zlib_compressor_iface_init (GConverterIface *iface); ++static void g_zlib_compressor_iface_init (GConverterIface *iface, ++ gpointer iface_data); + + /** + * GZlibCompressor: +@@ -431,7 +432,8 @@ g_zlib_compressor_convert (GConverter *converter, + } + + static void +-g_zlib_compressor_iface_init (GConverterIface *iface) ++g_zlib_compressor_iface_init (GConverterIface *iface, ++ gpointer iface_data) + { + iface->convert = g_zlib_compressor_convert; + iface->reset = g_zlib_compressor_reset; +diff --git a/gio/gzlibdecompressor.c b/gio/gzlibdecompressor.c +index f7045093e..1133d5e5e 100644 +--- a/gio/gzlibdecompressor.c ++++ b/gio/gzlibdecompressor.c +@@ -50,7 +50,8 @@ enum { + * decompresses data compressed with zlib. + */ + +-static void g_zlib_decompressor_iface_init (GConverterIface *iface); ++static void g_zlib_decompressor_iface_init (GConverterIface *iface, ++ gpointer iface_data); + + typedef struct { + gz_header gzheader; +@@ -411,7 +412,8 @@ g_zlib_decompressor_convert (GConverter *converter, + } + + static void +-g_zlib_decompressor_iface_init (GConverterIface *iface) ++g_zlib_decompressor_iface_init (GConverterIface *iface, ++ gpointer iface_data) + { + iface->convert = g_zlib_decompressor_convert; + iface->reset = g_zlib_decompressor_reset; +diff --git a/gio/meson.build b/gio/meson.build +index 462606f3b..f1812424d 100644 +--- a/gio/meson.build ++++ b/gio/meson.build +@@ -39,7 +39,7 @@ endif + + network_libs = [ ] + network_args = [ ] +-if host_system != 'windows' ++if host_system not in ['windows', 'emscripten'] + # res_query() + res_query_test = '''#include + int main (int argc, char ** argv) { +@@ -354,7 +354,7 @@ gdbus_daemon_sources = [ + gdbus_daemon_generated, + ] + +-if host_system != 'windows' ++if host_system not in ['windows', 'emscripten'] + unix_sources = files( + 'gfiledescriptorbased.c', + 'giounix-private.c', +@@ -406,20 +406,6 @@ if host_system != 'windows' + contenttype_sources += files('gcontenttype.c') + appinfo_sources += files('gdesktopappinfo.c') + gio_unix_include_headers += files('gdesktopappinfo.h') +- launch_desktop_sources = files('gio-launch-desktop.c') +- +- if host_system == 'linux' +- launch_desktop_sources += files('../glib/gjournal-private.c') +- endif +- +- gio_launch_desktop = executable('gio-launch-desktop', launch_desktop_sources, +- include_directories : glibinc, +- install : true, +- install_dir : multiarch_libexecdir, +- install_tag : 'bin', +- c_args : gio_c_args, +- # intl.lib is not compatible with SAFESEH +- link_args : noseh_link_args) + endif + + subdir('xdgmime') +@@ -433,7 +419,7 @@ if host_system != 'windows' + 'gnetworkmonitornm.c', + ) + endif +-else ++elif host_system == 'windows' + appinfo_sources += files('gwin32appinfo.c') + contenttype_sources += files('gcontenttype-win32.c') + platform_deps += [cc.find_library('shlwapi'), +@@ -907,7 +893,7 @@ if host_system == 'windows' + description : 'Windows specific headers for glib I/O library', + ) + meson.override_dependency('gio-windows-2.0', libgio_dep) +-else ++elif host_system != 'emscripten' + pkg.generate(requires : ['gobject-2.0', 'gio-2.0'], + subdirs : ['gio-unix-2.0'], + version : glib_version, +@@ -956,115 +942,6 @@ gconstructor_as_data_h = custom_target('gconstructor_as_data.h', + output : ['gconstructor_as_data.h'], + command : [python, '@INPUT0@', '@INPUT1@', 'gconstructor_code', '@OUTPUT@']) + +-# Several installed executables +-gio_tool_sources = [ +- 'gio-tool.c', +- 'gio-tool.h', +- 'gio-tool-cat.c', +- 'gio-tool-copy.c', +- 'gio-tool-info.c', +- 'gio-tool-launch.c', +- 'gio-tool-list.c', +- 'gio-tool-mime.c', +- 'gio-tool-mkdir.c', +- 'gio-tool-monitor.c', +- 'gio-tool-mount.c', +- 'gio-tool-move.c', +- 'gio-tool-open.c', +- 'gio-tool-rename.c', +- 'gio-tool-remove.c', +- 'gio-tool-save.c', +- 'gio-tool-set.c', +- 'gio-tool-trash.c', +- 'gio-tool-tree.c', +-] +- +-executable('gio', gio_tool_sources, +- install : true, +- install_tag : 'bin', +- c_args : gio_c_args, +- # intl.lib is not compatible with SAFESEH +- link_args : noseh_link_args, +- dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) +- +-executable('gresource', 'gresource-tool.c', +- install : true, +- install_tag : 'bin', +- # intl.lib is not compatible with SAFESEH +- link_args : noseh_link_args, +- dependencies : [libelf, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) +- +-gio_querymodules = executable('gio-querymodules', 'gio-querymodules.c', 'giomodule-priv.c', +- install : true, +- install_dir : multiarch_bindir, +- install_tag : 'bin', +- c_args : gio_c_args, +- # intl.lib is not compatible with SAFESEH +- link_args : noseh_link_args, +- dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) +- +-glib_compile_schemas = executable('glib-compile-schemas', +- ['glib-compile-schemas.c'], +- install : true, +- install_dir : multiarch_bindir, +- install_tag : 'bin', +- # intl.lib is not compatible with SAFESEH +- link_args : noseh_link_args, +- dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep, gvdb_dep]) +- +-glib_compile_resources = executable('glib-compile-resources', +- [gconstructor_as_data_h, 'glib-compile-resources.c'], +- install : true, +- install_tag : 'bin-devel', +- c_args : gio_c_args, +- # intl.lib is not compatible with SAFESEH +- link_args : noseh_link_args, +- dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep, gvdb_dep]) +- +-# Cannot override those programs in cross compilation case because they are +-# native executables that cannot be run on the build machine. +-# See https://gitlab.gnome.org/GNOME/glib/issues/1859. +-if meson.can_run_host_binaries() +- meson.override_find_program('glib-compile-schemas', glib_compile_schemas) +- meson.override_find_program('glib-compile-resources', glib_compile_resources) +- meson.override_find_program('gio-querymodules', gio_querymodules) +-endif +- +-executable('gsettings', 'gsettings-tool.c', +- install : true, +- install_tag : 'bin', +- c_args : gio_c_args, +- # intl.lib is not compatible with SAFESEH +- link_args : noseh_link_args, +- dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) +-install_data('gschema.dtd', +- install_dir : get_option('datadir') / schemas_subdir, +- install_tag : 'devel', +-) +- +-install_data(['gschema.loc', 'gschema.its'], +- install_dir : get_option('datadir') / 'gettext' / 'its', +- install_tag : 'devel', +-) +- +-executable('gdbus', 'gdbus-tool.c', +- install : true, +- install_tag : 'bin', +- c_args : gio_c_args, +- # intl.lib is not compatible with SAFESEH +- link_args : noseh_link_args, +- dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) +- +-if host_system != 'windows' and not glib_have_cocoa +- executable('gapplication', 'gapplication-tool.c', +- install : true, +- install_tag : 'bin', +- c_args : gio_c_args, +- # intl.lib is not compatible with SAFESEH +- link_args : noseh_link_args, +- dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) +-endif +- + if enable_systemtap + gio_stp = configure_file(input : 'gio.stp.in', + output : '@0@.stp'.format(libgio.full_path().split('/').get(-1)), +@@ -1074,25 +951,6 @@ if enable_systemtap + ) + endif + +-if multiarch_bindir != get_option('bindir') +- foreach exe : ['gio-querymodules', 'glib-compile-schemas'] +- if meson.version().version_compare('>=0.61.0') +- install_symlink( +- exe, +- install_dir : get_option('bindir'), +- pointing_to : get_option('prefix') / multiarch_bindir / exe, +- ) +- else +- warning( +- 'Please use Meson >= 0.61.0 or create a symlink @1@ -> @2@ in packaging'.format( +- get_option('prefix') / get_option('bindir') / exe, +- get_option('prefix') / multiarch_bindir / exe, +- ) +- ) +- endif +- endforeach +-endif +- + if build_tests + subdir('tests') + endif +diff --git a/gio/win32/gwinhttpfile.c b/gio/win32/gwinhttpfile.c +index e73c87658..c9c2d0336 100644 +--- a/gio/win32/gwinhttpfile.c ++++ b/gio/win32/gwinhttpfile.c +@@ -37,7 +37,8 @@ + + #include "glibintl.h" + +-static void g_winhttp_file_file_iface_init (GFileIface *iface); ++static void g_winhttp_file_file_iface_init (GFileIface *iface, ++ gpointer iface_data); + + #define g_winhttp_file_get_type _g_winhttp_file_get_type + G_DEFINE_TYPE_WITH_CODE (GWinHttpFile, g_winhttp_file, G_TYPE_OBJECT, +@@ -757,7 +758,8 @@ g_winhttp_file_move (GFile *source, + #endif + + static void +-g_winhttp_file_file_iface_init (GFileIface *iface) ++g_winhttp_file_file_iface_init (GFileIface *iface, ++ gpointer iface_data) + { + iface->dup = g_winhttp_file_dup; + iface->hash = g_winhttp_file_hash; +diff --git a/glib/garray.c b/glib/garray.c +index 118360ca1..deef2ca8a 100644 +--- a/glib/garray.c ++++ b/glib/garray.c +@@ -945,6 +945,14 @@ g_array_remove_range (GArray *farray, + return farray; + } + ++static gint ++array_sort_to_data_trampoline (gconstpointer a, gconstpointer b, gpointer userdata) ++{ ++ // Store the actual compare func in userdata. ++ GCompareFunc compare_func = (GCompareFunc) userdata; ++ return compare_func (a, b); ++} ++ + /** + * g_array_sort: + * @array: a #GArray +@@ -970,8 +978,8 @@ g_array_sort (GArray *farray, + g_qsort_with_data (array->data, + array->len, + array->elt_size, +- (GCompareDataFunc)compare_func, +- NULL); ++ array_sort_to_data_trampoline, ++ (gpointer)compare_func); + } + + /** +diff --git a/glib/gbacktrace.c b/glib/gbacktrace.c +index b708b1636..74ea69220 100644 +--- a/glib/gbacktrace.c ++++ b/glib/gbacktrace.c +@@ -260,7 +260,7 @@ g_on_error_query (const gchar *prg_name) + void + g_on_error_stack_trace (const gchar *prg_name) + { +-#if defined(G_OS_UNIX) ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + pid_t pid; + gchar buf[16]; + const gchar *args[5] = { DEBUGGER, NULL, NULL, NULL, NULL }; +@@ -302,9 +302,11 @@ g_on_error_stack_trace (const gchar *prg_name) + break; + } + #else ++#ifdef G_OS_WIN32 + if (IsDebuggerPresent ()) + G_BREAKPOINT (); + else ++#endif + g_abort (); + #endif + } +diff --git a/glib/gi18n-lib.h b/glib/gi18n-lib.h +index fe9e79dbd..8597f90d1 100644 +--- a/glib/gi18n-lib.h ++++ b/glib/gi18n-lib.h +@@ -20,19 +20,10 @@ + #ifndef __G_I18N_LIB_H__ + #define __G_I18N_LIB_H__ + +-#include +- +-#include +-#include +- +-#ifndef GETTEXT_PACKAGE +-#error You must define GETTEXT_PACKAGE before including gi18n-lib.h. Did you forget to include config.h? +-#endif +- +-#define _(String) ((char *) g_dgettext (GETTEXT_PACKAGE, String)) +-#define Q_(String) g_dpgettext (GETTEXT_PACKAGE, String, 0) ++#define _(String) (String) ++#define Q_(String) (String) + #define N_(String) (String) +-#define C_(Context,String) g_dpgettext (GETTEXT_PACKAGE, Context "\004" String, strlen (Context) + 1) ++#define C_(Context,String) (String) + #define NC_(Context, String) (String) + + #endif /* __G_I18N_LIB_H__ */ +diff --git a/glib/glib-autocleanups.h b/glib/glib-autocleanups.h +index 6adf23282..1edbe2b13 100644 +--- a/glib/glib-autocleanups.h ++++ b/glib/glib-autocleanups.h +@@ -73,8 +73,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPatternSpec, g_pattern_spec_free) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GQueue, g_queue_free) + G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GQueue, g_queue_clear) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRand, g_rand_free) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRegex, g_regex_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMatchInfo, g_match_info_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GScanner, g_scanner_destroy) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSequence, g_sequence_free) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSList, g_slist_free) +diff --git a/glib/glib-unix.c b/glib/glib-unix.c +index 1c9f12599..d5bf896b4 100644 +--- a/glib/glib-unix.c ++++ b/glib/glib-unix.c +@@ -26,6 +26,7 @@ + #include "glib-unix.h" + #include "glib-unixprivate.h" + #include "gmain-internal.h" ++#include "gmessages.h" + + #include + #include +@@ -133,9 +134,13 @@ g_unix_set_fd_nonblocking (gint fd, + #else + fcntl_flags |= O_NDELAY; + #endif +- } ++ } + else + { ++#ifdef __EMSCRIPTEN__ ++ g_error("Cannot create blocking pipes in Emscripten.\n"); ++ abort(); ++#endif + #ifdef O_NONBLOCK + fcntl_flags &= ~O_NONBLOCK; + #else +diff --git a/glib/glib.h b/glib/glib.h +index 40e501997..d9b4e3414 100644 +--- a/glib/glib.h ++++ b/glib/glib.h +@@ -83,8 +83,8 @@ + #include + #include + #include +-#include + #include ++#include + #include + #include + #include +diff --git a/glib/gmain.c b/glib/gmain.c +index ec4d24cde..d28f89e0c 100644 +--- a/glib/gmain.c ++++ b/glib/gmain.c +@@ -48,7 +48,7 @@ + #define G_MAIN_POLL_DEBUG + #endif + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + #include "glib-unix.h" + #include + #ifdef HAVE_EVENTFD +@@ -379,7 +379,7 @@ struct _GChildWatchSource + gint child_status; + /* @poll is always used on Windows, and used on Unix iff @using_pidfd is set: */ + GPollFD poll; +-#ifndef G_OS_WIN32 ++#if !defined(G_OS_WIN32) && !defined(G_PLATFORM_WASM) + gboolean child_exited; /* (atomic); not used iff @using_pidfd is set */ + gboolean using_pidfd; + #endif /* G_OS_WIN32 */ +@@ -474,7 +474,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_PLATFORM_WASM) + static void g_unix_signal_handler (int signum); + static gboolean g_unix_signal_watch_prepare (GSource *source, + gint *timeout); +@@ -495,7 +495,7 @@ static void block_source (GSource *source); + + static GMainContext *glib_worker_context; + +-#ifndef G_OS_WIN32 ++#if !defined(G_OS_WIN32) && !defined(G_PLATFORM_WASM) + + + /* UNIX signals work by marking one of these variables then waking the +@@ -536,7 +536,7 @@ GSourceFuncs g_unix_signal_funcs = + g_unix_signal_watch_finalize, + NULL, NULL + }; +-#endif /* !G_OS_WIN32 */ ++#endif /* !G_OS_WIN32 && !G_PLATFORM_WASM */ + G_LOCK_DEFINE_STATIC (main_context_list); + static GSList *main_context_list = NULL; + +@@ -2711,7 +2711,7 @@ g_clear_handle_id (guint *tag_ptr, + } + } + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + /** + * g_source_add_unix_fd: + * @source: a #GSource +@@ -2893,7 +2893,7 @@ g_source_query_unix_fd (GSource *source, + + return poll_fd->revents; + } +-#endif /* G_OS_UNIX */ ++#endif /* G_OS_UNIX && !G_PLATFORM_WASM */ + + /** + * g_get_current_time: +@@ -5453,7 +5453,28 @@ g_child_watch_finalize (GSource *source) + { + } + +-#else /* G_OS_WIN32 */ ++#elif defined(G_PLATFORM_WASM) /* G_OS_WIN32 */ ++ ++static gboolean ++g_child_watch_prepare (GSource *source, ++ gint *timeout) ++{ ++ *timeout = -1; ++ return FALSE; ++} ++ ++static gboolean ++g_child_watch_check (GSource *source) ++{ ++ return FALSE; ++} ++ ++static void ++g_child_watch_finalize (GSource *source) ++{ ++} ++ ++#else /* G_PLATFORM_WASM */ + + static void + wake_source (GSource *source) +@@ -5880,7 +5901,7 @@ g_child_watch_dispatch (GSource *source, + return FALSE; + } + +-#ifndef G_OS_WIN32 ++#if !defined(G_OS_WIN32) && !defined(G_PLATFORM_WASM) + + static void + g_unix_signal_handler (int signum) +@@ -5901,7 +5922,7 @@ g_unix_signal_handler (int signum) + errno = saved_errno; + } + +-#endif /* !G_OS_WIN32 */ ++#endif /* !G_OS_WIN32 && !G_PLATFORM_WASM */ + + /** + * g_child_watch_source_new: +@@ -5971,7 +5992,7 @@ g_child_watch_source_new (GPid pid) + child_watch_source->poll.events = G_IO_IN; + + g_source_add_poll (source, &child_watch_source->poll); +-#else /* !G_OS_WIN32 */ ++#elif !defined(G_PLATFORM_WASM) /* !G_OS_WIN32 */ + + #ifdef HAVE_PIDFD + /* Use a pidfd, if possible, to avoid having to install a global SIGCHLD +@@ -6454,7 +6475,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_PLATFORM_WASM) + if (g_atomic_int_get (&any_unix_signal_pending)) + dispatch_unix_signals (); + #endif +@@ -6471,7 +6492,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_PLATFORM_WASM) + sigset_t prev_mask; + sigset_t all; + +@@ -6480,7 +6501,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_PLATFORM_WASM) + pthread_sigmask (SIG_SETMASK, &prev_mask, NULL); + #endif + g_once_init_leave (&initialised, TRUE); +diff --git a/glib/gmem.c b/glib/gmem.c +index 7e19aed65..91c1e8f87 100644 +--- a/glib/gmem.c ++++ b/glib/gmem.c +@@ -61,6 +61,24 @@ + #include "gthread.h" + #include "glib_trace.h" + ++#ifdef __EMSCRIPTEN__ ++// malloc returns 16-byte aligned addresses on 64-bit platforms. Most code ++// therefore assumes an 16-byte aligned malloc. To support 64-bit code, we will ++// manually force alignment to 16 bytes. ++// TODO: Maybe have this as a toggle for people that really don't want this. ++#include ++ ++#define system_malloc(size) ({ \ ++ void *ptr = NULL; \ ++ posix_memalign(&ptr, 16, size); \ ++ ptr; \ ++}) ++#define system_calloc(n, size) g_aligned_alloc0(n, size, 16) ++ ++#else ++#define FORCE_ALIGN_16 (0) ++#endif ++ + /* notes on macros: + * having G_DISABLE_CHECKS defined disables use of glib_mem_profiler_table and + * g_mem_profile(). +@@ -127,7 +145,7 @@ g_malloc (gsize n_bytes) + { + gpointer mem; + +- mem = malloc (n_bytes); ++ mem = system_malloc (n_bytes); + TRACE (GLIB_MEM_ALLOC((void*) mem, (unsigned int) n_bytes, 0, 0)); + if (mem) + return mem; +@@ -160,7 +178,7 @@ g_malloc0 (gsize n_bytes) + { + gpointer mem; + +- mem = calloc (1, n_bytes); ++ mem = system_calloc (1, n_bytes); + TRACE (GLIB_MEM_ALLOC((void*) mem, (unsigned int) n_bytes, 1, 0)); + if (mem) + return mem; +@@ -199,6 +217,17 @@ g_realloc (gpointer mem, + if (G_LIKELY (n_bytes)) + { + newmem = realloc (mem, n_bytes); ++ // It's unclear how often the Emscripten allocator will successfully re- ++ // use the same address. Let's be optimistic and only do a manual alloc if ++ // the pointer is no longer aligned. ++#ifdef __EMSCRIPTEN__ ++ if ((unsigned long)newmem & 15) { ++ gpointer aligned_mem = g_aligned_alloc(1, n_bytes, 16); ++ memcpy(aligned_mem, newmem, n_bytes); ++ free(newmem); ++ newmem = aligned_mem; ++ } ++#endif + TRACE (GLIB_MEM_REALLOC((void*) newmem, (void*)mem, (unsigned int) n_bytes, 0)); + if (newmem) + return newmem; +@@ -313,7 +342,7 @@ g_try_malloc (gsize n_bytes) + gpointer mem; + + if (G_LIKELY (n_bytes)) +- mem = malloc (n_bytes); ++ mem = system_malloc (n_bytes); + else + mem = NULL; + +@@ -338,7 +367,7 @@ g_try_malloc0 (gsize n_bytes) + gpointer mem; + + if (G_LIKELY (n_bytes)) +- mem = calloc (1, n_bytes); ++ mem = system_calloc (1, n_bytes); + else + mem = NULL; + +@@ -364,8 +393,15 @@ g_try_realloc (gpointer mem, + { + gpointer newmem; + +- if (G_LIKELY (n_bytes)) ++ if (G_LIKELY (n_bytes)) { + newmem = realloc (mem, n_bytes); ++#ifdef __EMSCRIPTEN__ ++ if ((unsigned long)newmem & 15) { ++ // TODO: Do the same thing as in realloc. ++ g_warning("Warning: g_try_realloc return unaligned pointer.\n"); ++ } ++#endif ++ } + else + { + newmem = NULL; +diff --git a/glib/gpoll.c b/glib/gpoll.c +index 5afc7596d..c10ce8828 100644 +--- a/glib/gpoll.c ++++ b/glib/gpoll.c +@@ -83,6 +83,11 @@ + #include "gprintf.h" + #endif + ++#ifdef __EMSCRIPTEN__ ++#include ++#include ++#endif ++ + #ifdef G_MAIN_POLL_DEBUG + extern gboolean _g_main_poll_debug; + #endif +@@ -124,6 +129,25 @@ g_poll (GPollFD *fds, + guint nfds, + gint timeout) + { ++#ifdef __EMSCRIPTEN__ ++ // Emscripten does not have synchronous polling capabilities. So we simulate ++ // it here. ++ if (timeout != 0) { ++ gint remaining_timeout = timeout; ++ do { ++ gint result = poll ((struct pollfd *)fds, nfds, 0); ++ // Either error-out immediately, or if we have results, return them now. ++ if (result != 0) return result; ++ // Otherwise, there is no data (yet). Sleep for a millisecond (smallest ++ // granularity). ++ // TODO: Check for pthreads, if so, can probably do a smaller granularity. ++ emscripten_thread_sleep(1); ++ remaining_timeout -= 1; ++ } while (remaining_timeout > 0 || timeout < 0); ++ // We've waited all we can. ++ return 0; ++ } ++#endif + return poll ((struct pollfd *)fds, nfds, timeout); + } + +diff --git a/glib/gslist.c b/glib/gslist.c +index 7d4051c24..4e22958d8 100644 +--- a/glib/gslist.c ++++ b/glib/gslist.c +@@ -943,6 +943,14 @@ g_slist_insert_sorted_real (GSList *list, + } + } + ++static gint ++compare_data_func_trampoline (gconstpointer a, gconstpointer b, gpointer user_data) ++{ ++ // Store the pointer to the real function in user_data. ++ GCompareFunc compare_func = (GCompareFunc) user_data; ++ return compare_func (a, b); ++} ++ + /** + * g_slist_insert_sorted: + * @list: a #GSList +@@ -956,12 +964,12 @@ g_slist_insert_sorted_real (GSList *list, + * + * Returns: the new start of the #GSList + */ +-GSList* +-g_slist_insert_sorted (GSList *list, +- gpointer data, +- GCompareFunc func) ++GSList * ++g_slist_insert_sorted (GSList *list, ++ gpointer data, ++ GCompareFunc func) + { +- return g_slist_insert_sorted_real (list, data, (GFunc) func, NULL); ++ return g_slist_insert_sorted_real (list, data, (GFunc) compare_data_func_trampoline, func); + } + + /** +@@ -1065,10 +1073,10 @@ g_slist_sort_real (GSList *list, + * Returns: the start of the sorted #GSList + */ + GSList * +-g_slist_sort (GSList *list, +- GCompareFunc compare_func) ++g_slist_sort (GSList *list, ++ GCompareFunc compare_func) + { +- return g_slist_sort_real (list, (GFunc) compare_func, NULL); ++ return g_slist_sort_real (list, (GFunc) compare_data_func_trampoline, compare_func); + } + + /** +diff --git a/glib/gspawn-wasm.c b/glib/gspawn-wasm.c +new file mode 100644 +index 000000000..6972250e3 +--- /dev/null ++++ b/glib/gspawn-wasm.c +@@ -0,0 +1,164 @@ ++/* gspawn-wasm.c - Process launching on WebAssembly, no-op implementation ++ * ++ * Copyright 2022 Kleis Auke Wolthuizen ++ * ++ * SPDX-License-Identifier: LGPL-2.1-or-later ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this library; if not, see . ++ */ ++ ++#include "config.h" ++ ++#include "glib.h" ++#include "glibintl.h" ++#include "gspawn.h" ++ ++G_DEFINE_QUARK (g-exec-error-quark, g_spawn_error) ++G_DEFINE_QUARK (g-spawn-exit-error-quark, g_spawn_exit_error) ++ ++gboolean ++g_spawn_async (const gchar *working_directory, ++ gchar **argv, ++ gchar **envp, ++ GSpawnFlags flags, ++ GSpawnChildSetupFunc child_setup, ++ gpointer user_data, ++ GPid *child_pid, ++ GError **error) ++{ ++ g_set_error_literal (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, ++ _("g_spawn_async is no-op on WebAssembly")); ++ return FALSE; ++} ++ ++gboolean ++g_spawn_async_with_pipes (const gchar *working_directory, ++ gchar **argv, ++ gchar **envp, ++ GSpawnFlags flags, ++ GSpawnChildSetupFunc child_setup, ++ gpointer user_data, ++ GPid *child_pid, ++ gint *standard_input, ++ gint *standard_output, ++ gint *standard_error, ++ GError **error) ++{ ++ g_set_error_literal (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, ++ _("g_spawn_async_with_pipes is no-op on WebAssembly")); ++ return FALSE; ++} ++ ++gboolean ++g_spawn_async_with_pipes_and_fds (const gchar *working_directory, ++ const gchar * const *argv, ++ const gchar * const *envp, ++ GSpawnFlags flags, ++ GSpawnChildSetupFunc child_setup, ++ gpointer user_data, ++ gint stdin_fd, ++ gint stdout_fd, ++ gint stderr_fd, ++ const gint *source_fds, ++ const gint *target_fds, ++ gsize n_fds, ++ GPid *child_pid_out, ++ gint *stdin_pipe_out, ++ gint *stdout_pipe_out, ++ gint *stderr_pipe_out, ++ GError **error) ++{ ++ g_set_error_literal (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, ++ _("g_spawn_async_with_pipes_and_fds is no-op on WebAssembly")); ++ return FALSE; ++} ++ ++gboolean ++g_spawn_async_with_fds (const gchar *working_directory, ++ gchar **argv, ++ gchar **envp, ++ GSpawnFlags flags, ++ GSpawnChildSetupFunc child_setup, ++ gpointer user_data, ++ GPid *child_pid, ++ gint stdin_fd, ++ gint stdout_fd, ++ gint stderr_fd, ++ GError **error) ++{ ++ g_set_error_literal (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, ++ _("g_spawn_async_with_fds is no-op on WebAssembly")); ++ return FALSE; ++} ++ ++gboolean ++g_spawn_sync (const gchar *working_directory, ++ gchar **argv, ++ gchar **envp, ++ GSpawnFlags flags, ++ GSpawnChildSetupFunc child_setup, ++ gpointer user_data, ++ gchar **standard_output, ++ gchar **standard_error, ++ gint *wait_status, ++ GError **error) ++{ ++ g_set_error_literal (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, ++ _("g_spawn_sync is no-op on WebAssembly")); ++ return FALSE; ++} ++ ++gboolean ++g_spawn_command_line_sync (const gchar *command_line, ++ gchar **standard_output, ++ gchar **standard_error, ++ gint *wait_status, ++ GError **error) ++{ ++ g_set_error_literal (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, ++ _("g_spawn_command_line_sync is no-op on WebAssembly")); ++ return FALSE; ++} ++ ++gboolean ++g_spawn_command_line_async (const gchar *command_line, ++ GError **error) ++{ ++ g_set_error_literal (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, ++ _("g_spawn_command_line_async is no-op on WebAssembly")); ++ return FALSE; ++} ++ ++gboolean ++g_spawn_check_wait_status (gint wait_status, ++ GError **error) ++{ ++ g_set_error_literal (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, ++ _("g_spawn_check_wait_status is no-op on WebAssembly")); ++ return FALSE; ++} ++ ++gboolean ++g_spawn_check_exit_status (gint wait_status, ++ GError **error) ++{ ++ g_set_error_literal (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, ++ _("g_spawn_check_exit_status is no-op on WebAssembly")); ++ return FALSE; ++} ++ ++void ++g_spawn_close_pid (GPid pid) ++{ ++} +diff --git a/glib/gtestutils.c b/glib/gtestutils.c +index e98294ed3..727cad614 100644 +--- a/glib/gtestutils.c ++++ b/glib/gtestutils.c +@@ -2807,6 +2807,14 @@ g_test_set_nonfatal_assertions (void) + * Since: 2.28 + */ + ++static void ++func_to_fixture_trampoline (gpointer fixture, ++ gconstpointer user_data) ++{ ++ GTestFunc actual_func = (GTestFunc) user_data; ++ actual_func (); ++} ++ + /** + * g_test_add_func: + * @testpath: /-separated test case path name for the test. +@@ -2834,7 +2842,7 @@ g_test_add_func (const char *testpath, + g_return_if_fail (testpath != NULL); + g_return_if_fail (testpath[0] == '/'); + g_return_if_fail (test_func != NULL); +- g_test_add_vtable (testpath, 0, NULL, NULL, (GTestFixtureFunc) test_func, NULL); ++ g_test_add_vtable (testpath, 0, test_func, NULL, func_to_fixture_trampoline, NULL); + } + + /** +@@ -2847,6 +2855,19 @@ g_test_add_func (const char *testpath, + * Since: 2.28 + */ + ++struct DataFuncTrampolineCtx { ++ GTestDataFunc actual_func; ++ gconstpointer user_data; ++}; ++ ++static void ++data_func_to_fixture_trampoline (gpointer fixture, ++ gconstpointer user_data) ++{ ++ const struct DataFuncTrampolineCtx *ctx = user_data; ++ ctx->actual_func (ctx->user_data); ++} ++ + /** + * g_test_add_data_func: + * @testpath: /-separated test case path name for the test. +@@ -2870,15 +2891,20 @@ g_test_add_func (const char *testpath, + * Since: 2.16 + */ + void +-g_test_add_data_func (const char *testpath, +- gconstpointer test_data, +- GTestDataFunc test_func) ++g_test_add_data_func (const char *testpath, ++ gconstpointer test_data, ++ GTestDataFunc test_func) + { + g_return_if_fail (testpath != NULL); + g_return_if_fail (testpath[0] == '/'); + g_return_if_fail (test_func != NULL); + +- g_test_add_vtable (testpath, 0, test_data, NULL, (GTestFixtureFunc) test_func, NULL); ++ // TODO: Ctx leaks. Free it when we destroy fixture. ++ struct DataFuncTrampolineCtx *ctx = g_malloc (sizeof (*ctx)); ++ ctx->actual_func = test_func; ++ ctx->user_data = test_data; ++ ++ g_test_add_vtable (testpath, 0, ctx, NULL, (GTestFixtureFunc) data_func_to_fixture_trampoline, NULL); + } + + /** +@@ -2903,8 +2929,13 @@ g_test_add_data_func_full (const char *testpath, + g_return_if_fail (testpath[0] == '/'); + g_return_if_fail (test_func != NULL); + +- g_test_add_vtable (testpath, 0, test_data, NULL, +- (GTestFixtureFunc) test_func, ++ // TODO: Ctx leaks. Free it when we destroy fixture. ++ struct DataFuncTrampolineCtx *ctx = g_malloc (sizeof (*ctx)); ++ ctx->actual_func = test_func; ++ ctx->user_data = test_data; ++ ++ g_test_add_vtable (testpath, 0, ctx, NULL, ++ (GTestFixtureFunc) data_func_to_fixture_trampoline, + (GTestFixtureFunc) data_free_func); + } + +@@ -3065,6 +3096,11 @@ test_has_prefix (gconstpointer a, + return g_strcmp0 (test_run_name_local, test_path_skipped_local); + } + ++static void test_case_free(gpointer ptr, gpointer user_data) { ++ (void)user_data; ++ g_free(ptr); ++} ++ + static gboolean + test_case_run (GTestCase *tc) + { +@@ -3139,7 +3175,7 @@ test_case_run (GTestCase *tc) + g_timer_destroy (test_run_timer); + } + +- g_slist_free_full (filename_free_list, g_free); ++ g_slist_free_full (filename_free_list, (GDestroyNotify)test_case_free); + test_filename_free_list = old_free_list; + g_free (test_uri_base); + test_uri_base = old_base; +@@ -3328,6 +3364,20 @@ g_test_case_free (GTestCase *test_case) + g_slice_free (GTestCase, test_case); + } + ++static void ++test_case_free_trampoline (gpointer data, gpointer userdata) ++{ ++ (void) userdata; ++ g_test_case_free (data); ++} ++ ++static void ++test_suite_free_trampoline (gpointer data, gpointer userdata) ++{ ++ (void)userdata; ++ g_test_suite_free (data); ++} ++ + /** + * g_test_suite_free: + * @suite: a #GTestSuite +@@ -3339,11 +3389,11 @@ g_test_case_free (GTestCase *test_case) + void + g_test_suite_free (GTestSuite *suite) + { +- g_slist_free_full (suite->cases, (GDestroyNotify)g_test_case_free); ++ g_slist_free_full (suite->cases, (GDestroyNotify)test_case_free_trampoline); + + g_free (suite->name); + +- g_slist_free_full (suite->suites, (GDestroyNotify)g_test_suite_free); ++ g_slist_free_full (suite->suites, (GDestroyNotify)test_suite_free_trampoline); + + g_slice_free (GTestSuite, suite); + } +diff --git a/glib/gthread.c b/glib/gthread.c +index eed759590..c4e75fd11 100644 +--- a/glib/gthread.c ++++ b/glib/gthread.c +@@ -56,6 +56,10 @@ + #include + #endif /* G_OS_WIN32 */ + ++#ifdef G_PLATFORM_WASM ++#include ++#endif /*G_PLATFORM_WASM*/ ++ + #include "gslice.h" + #include "gstrfuncs.h" + #include "gtestutils.h" +@@ -1060,7 +1064,9 @@ g_thread_self (void) + guint + g_get_num_processors (void) + { +-#ifdef G_OS_WIN32 ++#ifdef G_PLATFORM_WASM ++ return emscripten_num_logical_cores(); ++#elif defined(G_OS_WIN32) + unsigned int count; + SYSTEM_INFO sysinfo; + DWORD_PTR process_cpus; +diff --git a/glib/gtimezone.c b/glib/gtimezone.c +index 4a4a2d010..affa4b144 100644 +--- a/glib/gtimezone.c ++++ b/glib/gtimezone.c +@@ -211,7 +211,7 @@ static GTimeZone *tz_local = NULL; + there's no point in getting carried + away. */ + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + static GTimeZone *parse_footertz (const gchar *, size_t); + #endif + +@@ -445,7 +445,7 @@ zone_for_constant_offset (GTimeZone *gtz, const gchar *name) + gtz->transitions = NULL; + } + +-#if defined(G_OS_UNIX) && defined(__sun) && defined(__SVR4) ++#if defined(G_OS_UNIX) && defined(__sun) && defined(__SVR4) && !defined(G_PLATFORM_WASM) + /* + * only used by Illumos distros or Solaris < 11: parse the /etc/default/init + * text file looking for TZ= followed by the timezone, possibly quoted +@@ -511,7 +511,7 @@ zone_identifier_illumos (void) + } + #endif /* defined(__sun) && defined(__SRVR) */ + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + /* + * returns the path to the top of the Olson zoneinfo timezone hierarchy. + */ +@@ -1703,7 +1703,7 @@ rules_from_identifier (const gchar *identifier, + return create_ruleset_from_rule (rules, &tzr); + } + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + static GTimeZone * + parse_footertz (const gchar *footer, size_t footerlen) + { +@@ -1862,7 +1862,9 @@ g_time_zone_new_identifier (const gchar *identifier) + else + { + G_LOCK (tz_default); +-#ifdef G_OS_UNIX ++#ifdef G_PLATFORM_WASM ++ resolved_identifier = g_strdup ("UTC0"); ++#elif defined (G_OS_UNIX) + resolved_identifier = zone_identifier_unix (); + #elif defined (G_OS_WIN32) + resolved_identifier = windows_default_tzname (); +@@ -1902,7 +1904,7 @@ g_time_zone_new_identifier (const gchar *identifier) + + if (tz->t_info == NULL) + { +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + GBytes *zoneinfo = zone_info_unix (identifier, resolved_identifier); + if (zoneinfo != NULL) + { +diff --git a/glib/gutils.c b/glib/gutils.c +index dce7cbee5..ce5ecd984 100644 +--- a/glib/gutils.c ++++ b/glib/gutils.c +@@ -1523,7 +1523,7 @@ get_windows_version (gboolean with_windows) + } + #endif + +-#if defined (G_OS_UNIX) && !defined (__APPLE__) ++#if defined (G_OS_UNIX) && !defined (__APPLE__) && !defined (G_PLATFORM_WASM) + static gchar * + get_os_info_from_os_release (const gchar *key_name, + const gchar *buffer) +@@ -1680,6 +1680,11 @@ g_get_os_info (const gchar *key_name) + return g_strdup ("macOS"); + else + return NULL; ++#elif defined (G_PLATFORM_WASM) ++ if (g_strcmp0 (key_name, G_OS_INFO_KEY_NAME) == 0) ++ return g_strdup ("wasm"); ++ else ++ return NULL; + #elif defined (G_OS_UNIX) + const gchar * const os_release_files[] = { "/etc/os-release", "/usr/lib/os-release" }; + gsize i; +diff --git a/glib/gwakeup.c b/glib/gwakeup.c +index 24d85b669..35eb75f2d 100644 +--- a/glib/gwakeup.c ++++ b/glib/gwakeup.c +@@ -110,18 +110,70 @@ g_wakeup_free (GWakeup *wakeup) + CloseHandle ((HANDLE) wakeup); + } + ++#elif defined G_PLATFORM_WASM ++ ++#include "glib-unix.h" ++ ++#include ++ ++struct _GWakeup { ++ emscripten_semaphore_t sem; ++}; ++ ++GWakeup * ++g_wakeup_new (void) ++{ ++ GWakeup* wakeup = g_slice_new(GWakeup); ++ emscripten_semaphore_init(&wakeup->sem, 0); ++ return wakeup; ++} ++ ++void ++g_wakeup_get_pollfd (GWakeup *wakeup, ++ GPollFD *poll_fd) ++{ ++ poll_fd->fd = (gintptr) wakeup; ++ poll_fd->events = G_IO_IN; ++} ++ ++void ++g_wakeup_acknowledge (GWakeup *wakeup) ++{ ++ emscripten_semaphore_try_acquire(&wakeup->sem, INT32_MAX); ++} ++ ++void ++g_wakeup_signal (GWakeup *wakeup) ++{ ++ emscripten_semaphore_release(&wakeup->sem, INT32_MAX); ++} ++ ++void ++g_wakeup_free (GWakeup *wakeup) ++{ ++ g_slice_free(GWakeup, wakeup); ++} ++ + #else + ++#ifdef G_PLATFORM_WASM ++#ifdef GLIB_COMPILATION ++#include "gmessages.h" ++#endif ++#else /*!G_PLATFORM_WASM*/ + #include "glib-unix.h" + #include + + #if defined (HAVE_EVENTFD) + #include + #endif ++#endif /*G_PLATFORM_WASM*/ + + struct _GWakeup + { ++#ifndef G_PLATFORM_WASM + gint fds[2]; ++#endif + }; + + /** +@@ -138,6 +190,10 @@ struct _GWakeup + GWakeup * + g_wakeup_new (void) + { ++#ifdef G_PLATFORM_WASM ++ g_error ("g_wakeup_new is no-op on WebAssembly"); ++ return NULL; ++#else + GError *error = NULL; + GWakeup *wakeup; + +@@ -168,6 +224,7 @@ g_wakeup_new (void) + g_error ("Set pipes non-blocking for GWakeup: %s", error->message); + + return wakeup; ++#endif + } + + /** +@@ -186,8 +243,12 @@ void + g_wakeup_get_pollfd (GWakeup *wakeup, + GPollFD *poll_fd) + { ++#ifdef G_PLATFORM_WASM ++ g_error ("g_wakeup_get_pollfd is no-op on WebAssembly"); ++#else + poll_fd->fd = wakeup->fds[0]; + poll_fd->events = G_IO_IN; ++#endif + } + + /** +@@ -207,6 +268,11 @@ g_wakeup_get_pollfd (GWakeup *wakeup, + void + g_wakeup_acknowledge (GWakeup *wakeup) + { ++#ifdef G_PLATFORM_WASM ++ g_error ("g_wakeup_acknowledge is no-op on WebAssembly"); ++#else ++ char buffer[16]; ++ + /* read until it is empty */ + + if (wakeup->fds[1] == -1) +@@ -221,6 +287,7 @@ g_wakeup_acknowledge (GWakeup *wakeup) + + while (read (wakeup->fds[0], &value, sizeof (value)) == sizeof (value)); + } ++#endif + } + + /** +@@ -240,6 +307,9 @@ g_wakeup_acknowledge (GWakeup *wakeup) + void + g_wakeup_signal (GWakeup *wakeup) + { ++#ifdef G_PLATFORM_WASM ++ g_error ("g_wakeup_signal is no-op on WebAssembly"); ++#else + int res; + + if (wakeup->fds[1] == -1) +@@ -262,6 +332,7 @@ g_wakeup_signal (GWakeup *wakeup) + res = write (wakeup->fds[1], &one, sizeof one); + while (G_UNLIKELY (res == -1 && errno == EINTR)); + } ++#endif + } + + /** +@@ -276,12 +347,16 @@ g_wakeup_signal (GWakeup *wakeup) + void + g_wakeup_free (GWakeup *wakeup) + { ++#ifdef G_PLATFORM_WASM ++ g_error ("g_wakeup_free is no-op on WebAssembly"); ++#else + close (wakeup->fds[0]); + + if (wakeup->fds[1] != -1) + close (wakeup->fds[1]); + + g_slice_free (GWakeup, wakeup); ++#endif + } + + #endif /* !_WIN32 */ +diff --git a/glib/meson.build b/glib/meson.build +index da76fc005..7d2ec173f 100644 +--- a/glib/meson.build ++++ b/glib/meson.build +@@ -364,9 +364,10 @@ if host_system == 'windows' + if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl' + glib_sources += files('dirent/wdirent.c') + endif ++elif host_system == 'emscripten' ++ glib_sources += files('gspawn-wasm.c', 'giounix.c', 'glib-unix.c') + else + glib_sources += files('glib-unix.c', 'glib-unixprivate.h', 'gspawn.c', 'giounix.c') +- platform_deps = [] + endif + + if host_system == 'linux' +@@ -394,12 +395,7 @@ else + glib_dtrace_hdr = [] + endif + +-pcre2_static_args = [] +- +-if use_pcre2_static_flag +- pcre2_static_args = ['-DPCRE2_STATIC'] +-endif +- ++pcre2_static_args = ['-DPCRE2_STATIC'] + glib_c_args = ['-DG_LOG_DOMAIN="GLib"'] + glib_c_args_internal + pcre2_static_args + libglib = library('glib-2.0', + glib_dtrace_obj, glib_dtrace_hdr, +@@ -477,7 +473,7 @@ if host_system == 'windows' + include_directories : configinc, + dependencies : [libglib_dep]) + endif +-else ++elif host_system != 'emscripten' + gtester = executable('gtester', 'gtester.c', + install : true, + install_tag : 'bin-devel', +diff --git a/gobject/gboxed.c b/gobject/gboxed.c +index 242ba09a6..3868003db 100644 +--- a/gobject/gboxed.c ++++ b/gobject/gboxed.c +@@ -149,7 +149,6 @@ G_DEFINE_BOXED_TYPE (GPtrArray, g_ptr_array,g_ptr_array_ref, g_ptr_array_unref) + G_DEFINE_BOXED_TYPE (GByteArray, g_byte_array, g_byte_array_ref, g_byte_array_unref) + G_DEFINE_BOXED_TYPE (GBytes, g_bytes, g_bytes_ref, g_bytes_unref) + G_DEFINE_BOXED_TYPE (GTree, g_tree, g_tree_ref, g_tree_unref) +- + G_DEFINE_BOXED_TYPE (GRegex, g_regex, g_regex_ref, g_regex_unref) + G_DEFINE_BOXED_TYPE (GMatchInfo, g_match_info, g_match_info_ref, g_match_info_unref) + +diff --git a/gobject/gobject.c b/gobject/gobject.c +index a61754b9f..661ecf8c0 100644 +--- a/gobject/gobject.c ++++ b/gobject/gobject.c +@@ -203,7 +203,8 @@ G_STATIC_ASSERT(G_STRUCT_OFFSET(GObject, qdata) == G_STRUCT_OFFSET(GObjectReal, + /* --- prototypes --- */ + static void g_object_base_class_init (GObjectClass *class); + static void g_object_base_class_finalize (GObjectClass *class); +-static void g_object_do_class_init (GObjectClass *class); ++static void g_object_do_class_init (GObjectClass *class, ++ gpointer class_data); + static void g_object_init (GObject *object, + GObjectClass *class); + static GObject* g_object_constructor (GType type, +@@ -518,7 +519,8 @@ g_object_base_class_finalize (GObjectClass *class) + } + + static void +-g_object_do_class_init (GObjectClass *class) ++g_object_do_class_init (GObjectClass *class, ++ gpointer class_data) + { + /* read the comment about typedef struct CArray; on why not to change this quark */ + quark_closure_array = g_quark_from_static_string ("GObject-closure-array"); +diff --git a/gobject/gparam.h b/gobject/gparam.h +index 6454e69a9..f65e76ad5 100644 +--- a/gobject/gparam.h ++++ b/gobject/gparam.h +@@ -399,7 +399,8 @@ struct _GParamSpecTypeInfo + /* type system portion */ + guint16 instance_size; /* obligatory */ + guint16 n_preallocs; /* optional */ +- void (*instance_init) (GParamSpec *pspec); /* optional */ ++ void (*instance_init) (GParamSpec *pspec, /* optional */ ++ gpointer class_data); + + /* class portion */ + GType value_type; /* obligatory */ +diff --git a/gobject/gparamspecs.c b/gobject/gparamspecs.c +index 17b860657..7d3f77984 100644 +--- a/gobject/gparamspecs.c ++++ b/gobject/gparamspecs.c +@@ -66,7 +66,8 @@ + + /* --- param spec functions --- */ + static void +-param_char_init (GParamSpec *pspec) ++param_char_init (GParamSpec *pspec, ++ gpointer class_data) + { + GParamSpecChar *cspec = G_PARAM_SPEC_CHAR (pspec); + +@@ -105,7 +106,8 @@ param_char_validate (GParamSpec *pspec, + } + + static void +-param_uchar_init (GParamSpec *pspec) ++param_uchar_init (GParamSpec *pspec, ++ gpointer class_data) + { + GParamSpecUChar *uspec = G_PARAM_SPEC_UCHAR (pspec); + +@@ -171,7 +173,8 @@ param_boolean_validate (GParamSpec *pspec, + } + + static void +-param_int_init (GParamSpec *pspec) ++param_int_init (GParamSpec *pspec, ++ gpointer class_data) + { + GParamSpecInt *ispec = G_PARAM_SPEC_INT (pspec); + +@@ -221,7 +224,8 @@ param_int_values_cmp (GParamSpec *pspec, + } + + static void +-param_uint_init (GParamSpec *pspec) ++param_uint_init (GParamSpec *pspec, ++ gpointer class_data) + { + GParamSpecUInt *uspec = G_PARAM_SPEC_UINT (pspec); + +@@ -271,7 +275,8 @@ param_uint_values_cmp (GParamSpec *pspec, + } + + static void +-param_long_init (GParamSpec *pspec) ++param_long_init (GParamSpec *pspec, ++ gpointer class_data) + { + GParamSpecLong *lspec = G_PARAM_SPEC_LONG (pspec); + +@@ -326,7 +331,8 @@ param_long_values_cmp (GParamSpec *pspec, + } + + static void +-param_ulong_init (GParamSpec *pspec) ++param_ulong_init (GParamSpec *pspec, ++ gpointer class_data) + { + GParamSpecULong *uspec = G_PARAM_SPEC_ULONG (pspec); + +@@ -380,7 +386,8 @@ param_ulong_values_cmp (GParamSpec *pspec, + } + + static void +-param_int64_init (GParamSpec *pspec) ++param_int64_init (GParamSpec *pspec, ++ gpointer class_data) + { + GParamSpecInt64 *lspec = G_PARAM_SPEC_INT64 (pspec); + +@@ -430,7 +437,8 @@ param_int64_values_cmp (GParamSpec *pspec, + } + + static void +-param_uint64_init (GParamSpec *pspec) ++param_uint64_init (GParamSpec *pspec, ++ gpointer class_data) + { + GParamSpecUInt64 *uspec = G_PARAM_SPEC_UINT64 (pspec); + +@@ -480,7 +488,8 @@ param_uint64_values_cmp (GParamSpec *pspec, + } + + static void +-param_unichar_init (GParamSpec *pspec) ++param_unichar_init (GParamSpec *pspec, ++ gpointer class_data) + { + GParamSpecUnichar *uspec = G_PARAM_SPEC_UNICHAR (pspec); + +@@ -529,7 +538,8 @@ param_unichar_values_cmp (GParamSpec *pspec, + } + + static void +-param_enum_init (GParamSpec *pspec) ++param_enum_init (GParamSpec *pspec, ++ gpointer class_data) + { + GParamSpecEnum *espec = G_PARAM_SPEC_ENUM (pspec); + +@@ -584,7 +594,8 @@ param_enum_validate (GParamSpec *pspec, + } + + static void +-param_flags_init (GParamSpec *pspec) ++param_flags_init (GParamSpec *pspec, ++ gpointer class_data) + { + GParamSpecFlags *fspec = G_PARAM_SPEC_FLAGS (pspec); + +@@ -639,7 +650,8 @@ param_flags_validate (GParamSpec *pspec, + } + + static void +-param_float_init (GParamSpec *pspec) ++param_float_init (GParamSpec *pspec, ++ gpointer class_data) + { + GParamSpecFloat *fspec = G_PARAM_SPEC_FLOAT (pspec); + +@@ -692,7 +704,8 @@ param_float_values_cmp (GParamSpec *pspec, + } + + static void +-param_double_init (GParamSpec *pspec) ++param_double_init (GParamSpec *pspec, ++ gpointer class_data) + { + GParamSpecDouble *dspec = G_PARAM_SPEC_DOUBLE (pspec); + +@@ -745,7 +758,8 @@ param_double_values_cmp (GParamSpec *pspec, + } + + static void +-param_string_init (GParamSpec *pspec) ++param_string_init (GParamSpec *pspec, ++ gpointer class_data) + { + GParamSpecString *sspec = G_PARAM_SPEC_STRING (pspec); + +@@ -876,7 +890,8 @@ param_string_values_cmp (GParamSpec *pspec, + } + + static void +-param_param_init (GParamSpec *pspec) ++param_param_init (GParamSpec *pspec, ++ gpointer class_data) + { + /* GParamSpecParam *spec = G_PARAM_SPEC_PARAM (pspec); */ + } +@@ -919,7 +934,8 @@ param_param_validate (GParamSpec *pspec, + } + + static void +-param_boxed_init (GParamSpec *pspec) ++param_boxed_init (GParamSpec *pspec, ++ gpointer class_data) + { + /* GParamSpecBoxed *bspec = G_PARAM_SPEC_BOXED (pspec); */ + } +@@ -945,7 +961,8 @@ param_boxed_values_cmp (GParamSpec *pspec, + } + + static void +-param_pointer_init (GParamSpec *pspec) ++param_pointer_init (GParamSpec *pspec, ++ gpointer class_data) + { + /* GParamSpecPointer *spec = G_PARAM_SPEC_POINTER (pspec); */ + } +@@ -971,7 +988,8 @@ param_pointer_values_cmp (GParamSpec *pspec, + } + + static void +-param_value_array_init (GParamSpec *pspec) ++param_value_array_init (GParamSpec *pspec, ++ gpointer class_data) + { + GParamSpecValueArray *aspec = G_PARAM_SPEC_VALUE_ARRAY (pspec); + +@@ -1122,7 +1140,8 @@ param_value_array_values_cmp (GParamSpec *pspec, + } + + static void +-param_object_init (GParamSpec *pspec) ++param_object_init (GParamSpec *pspec, ++ gpointer class_data) + { + /* GParamSpecObject *ospec = G_PARAM_SPEC_OBJECT (pspec); */ + } +@@ -1177,7 +1196,8 @@ param_object_values_cmp (GParamSpec *pspec, + } + + static void +-param_override_init (GParamSpec *pspec) ++param_override_init (GParamSpec *pspec, ++ gpointer class_data) + { + /* GParamSpecOverride *ospec = G_PARAM_SPEC_OVERRIDE (pspec); */ + } +@@ -1235,7 +1255,8 @@ param_override_values_cmp (GParamSpec *pspec, + } + + static void +-param_gtype_init (GParamSpec *pspec) ++param_gtype_init (GParamSpec *pspec, ++ gpointer class_data) + { + } + +@@ -1290,7 +1311,8 @@ param_gtype_values_cmp (GParamSpec *pspec, + } + + static void +-param_variant_init (GParamSpec *pspec) ++param_variant_init (GParamSpec *pspec, ++ gpointer class_data) + { + GParamSpecVariant *vspec = G_PARAM_SPEC_VARIANT (pspec); + +diff --git a/gobject/gsourceclosure.c b/gobject/gsourceclosure.c +index 6a42f779c..4b79b13ac 100644 +--- a/gobject/gsourceclosure.c ++++ b/gobject/gsourceclosure.c +@@ -25,7 +25,7 @@ + #include "gmarshal.h" + #include "gvalue.h" + #include "gvaluetypes.h" +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + #include "glib-unix.h" + #endif + +@@ -119,7 +119,7 @@ g_child_watch_closure_callback (GPid pid, + + g_value_init (&result_value, G_TYPE_BOOLEAN); + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + g_value_init (¶ms[0], G_TYPE_ULONG); + g_value_set_ulong (¶ms[0], pid); + #endif +@@ -141,7 +141,7 @@ g_child_watch_closure_callback (GPid pid, + return result; + } + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + static gboolean + g_unix_fd_source_closure_callback (int fd, + GIOCondition condition, +@@ -203,12 +203,12 @@ closure_callback_get (gpointer cb_data, + closure_callback = (GSourceFunc)io_watch_closure_callback; + else if (source->source_funcs == &g_child_watch_funcs) + closure_callback = (GSourceFunc)g_child_watch_closure_callback; +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + else if (source->source_funcs == &g_unix_fd_source_funcs) + closure_callback = (GSourceFunc)g_unix_fd_source_closure_callback; + #endif + else if (source->source_funcs == &g_timeout_funcs || +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + source->source_funcs == &g_unix_signal_funcs || + #endif + source->source_funcs == &g_idle_funcs) +@@ -251,7 +251,7 @@ g_source_set_closure (GSource *source, + g_return_if_fail (closure != NULL); + + if (!source->source_funcs->closure_callback && +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + source->source_funcs != &g_unix_fd_source_funcs && + source->source_funcs != &g_unix_signal_funcs && + #endif +@@ -276,7 +276,7 @@ g_source_set_closure (GSource *source, + if (marshal) + g_closure_set_marshal (closure, marshal); + else if (source->source_funcs == &g_idle_funcs || +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + source->source_funcs == &g_unix_signal_funcs || + #endif + source->source_funcs == &g_timeout_funcs) +diff --git a/gobject/gtype.h b/gobject/gtype.h +index b68af22ca..3305a597e 100644 +--- a/gobject/gtype.h ++++ b/gobject/gtype.h +@@ -1994,7 +1994,7 @@ guint g_type_get_type_registration_serial (void); + */ + #define G_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init) { \ + const GInterfaceInfo g_implement_interface_info = { \ +- (GInterfaceInitFunc)(void (*)(void)) iface_init, NULL, NULL \ ++ (GInterfaceInitFunc) iface_init, NULL, NULL \ + }; \ + g_type_add_interface_static (g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \ + } +@@ -2136,7 +2136,8 @@ guint g_type_get_type_registration_serial (void); + */ + #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + #define _G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \ +-static void type_name##_class_intern_init (gpointer klass) \ ++static void type_name##_class_intern_init (gpointer klass, \ ++ gpointer class_data) \ + { \ + type_name##_parent_class = g_type_class_peek_parent (klass); \ + if (TypeName##_private_offset != 0) \ +@@ -2146,7 +2147,8 @@ static void type_name##_class_intern_init (gpointer klass) \ + + #else + #define _G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \ +-static void type_name##_class_intern_init (gpointer klass) \ ++static void type_name##_class_intern_init (gpointer klass, \ ++ gpointer class_data) \ + { \ + type_name##_parent_class = g_type_class_peek_parent (klass); \ + type_name##_class_init ((TypeName##Class*) klass); \ +@@ -2158,6 +2160,11 @@ static void type_name##_class_intern_init (gpointer klass) \ + \ + static void type_name##_init (TypeName *self); \ + static void type_name##_class_init (TypeName##Class *klass); \ ++static void type_name##_init_adapter (TypeName *self, \ ++ gpointer class_data) \ ++{ \ ++ type_name##_init (self); \ ++} \ + static GType type_name##_get_type_once (void); \ + static gpointer type_name##_parent_class = NULL; \ + static gint TypeName##_private_offset; \ +@@ -2195,9 +2202,9 @@ type_name##_get_type_once (void) \ + g_type_register_static_simple (TYPE_PARENT, \ + g_intern_static_string (#TypeName), \ + sizeof (TypeName##Class), \ +- (GClassInitFunc)(void (*)(void)) type_name##_class_intern_init, \ ++ (GClassInitFunc) type_name##_class_intern_init, \ + sizeof (TypeName), \ +- (GInstanceInitFunc)(void (*)(void)) type_name##_init, \ ++ (GInstanceInitFunc) type_name##_init_adapter, \ + (GTypeFlags) flags); \ + { /* custom code follows */ + #define _G_DEFINE_TYPE_EXTENDED_END() \ +@@ -2217,7 +2224,12 @@ type_name##_get_type_once (void) \ + * to avoid deprecation warnings with older GLIB_VERSION_MAX_ALLOWED */ + #define _G_DEFINE_INTERFACE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PREREQ) \ + \ +-static void type_name##_default_init (TypeName##Interface *klass); \ ++static void type_name##_default_init (TypeName##Interface *klass); \ ++static void type_name##_default_init_adapter (TypeName##Interface *klass, \ ++ gpointer class_data) \ ++{ \ ++ type_name##_default_init (klass); \ ++} \ + \ + GType \ + type_name##_get_type (void) \ +@@ -2229,7 +2241,7 @@ type_name##_get_type (void) \ + g_type_register_static_simple (G_TYPE_INTERFACE, \ + g_intern_static_string (#TypeName), \ + sizeof (TypeName##Interface), \ +- (GClassInitFunc)(void (*)(void)) type_name##_default_init, \ ++ (GClassInitFunc) type_name##_default_init_adapter, \ + 0, \ + (GInstanceInitFunc)NULL, \ + (GTypeFlags) 0); \ +diff --git a/gobject/gtypemodule.c b/gobject/gtypemodule.c +index ec9511090..ce6b02dae 100644 +--- a/gobject/gtypemodule.c ++++ b/gobject/gtypemodule.c +@@ -131,7 +131,8 @@ g_type_module_class_init (GTypeModuleClass *class) + } + + static void +-g_type_module_iface_init (GTypePluginClass *iface) ++g_type_module_iface_init (GTypePluginClass *iface, ++ gpointer iface_data) + { + iface->use_plugin = g_type_module_use_plugin; + iface->unuse_plugin = (void (*) (GTypePlugin *))g_type_module_unuse; +diff --git a/gobject/gtypemodule.h b/gobject/gtypemodule.h +index e386b50df..f3096a939 100644 +--- a/gobject/gtypemodule.h ++++ b/gobject/gtypemodule.h +@@ -209,12 +209,12 @@ type_name##_register_type (GTypeModule *type_module) \ + sizeof (TypeName##Class), \ + (GBaseInitFunc) NULL, \ + (GBaseFinalizeFunc) NULL, \ +- (GClassInitFunc)(void (*)(void)) type_name##_class_intern_init, \ +- (GClassFinalizeFunc)(void (*)(void)) type_name##_class_finalize, \ ++ (GClassInitFunc) type_name##_class_intern_init, \ ++ (GClassFinalizeFunc) type_name##_class_finalize, \ + NULL, /* class_data */ \ + sizeof (TypeName), \ + 0, /* n_preallocs */ \ +- (GInstanceInitFunc)(void (*)(void)) type_name##_init, \ ++ (GInstanceInitFunc) type_name##_init_adapter, \ + NULL /* value_table */ \ + }; \ + type_name##_type_id = g_type_module_register_type (type_module, \ +@@ -244,7 +244,7 @@ type_name##_register_type (GTypeModule *type_module) \ + */ + #define G_IMPLEMENT_INTERFACE_DYNAMIC(TYPE_IFACE, iface_init) { \ + const GInterfaceInfo g_implement_interface_info = { \ +- (GInterfaceInitFunc)(void (*)(void)) iface_init, NULL, NULL \ ++ (GInterfaceInitFunc) iface_init, NULL, NULL \ + }; \ + g_type_module_add_interface (type_module, g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \ + } +diff --git a/gobject/meson.build b/gobject/meson.build +index 2129aaf8a..0cf39253d 100644 +--- a/gobject/meson.build ++++ b/gobject/meson.build +@@ -170,11 +170,6 @@ libgobject_dep = declare_dependency(link_with : libgobject, + ) + meson.override_dependency('gobject-2.0', libgobject_dep) + +-gobject_query = executable('gobject-query', 'gobject-query.c', +- install : true, +- install_tag : 'bin-devel', +- dependencies : [libglib_dep, libgobject_dep]) +- + install_data('gobject_gdb.py', + install_dir : glib_pkgdatadir / 'gdb', + install_tag : 'devel', +diff --git a/meson.build b/meson.build +index 43e058078..5df61c223 100644 +--- a/meson.build ++++ b/meson.build +@@ -296,6 +296,9 @@ if host_system == 'windows' + elif host_system == 'cygwin' + glib_os = '''#define G_OS_UNIX + #define G_WITH_CYGWIN''' ++elif host_system == 'emscripten' ++ glib_os = '''#define G_OS_UNIX ++#define G_PLATFORM_WASM''' + else + glib_os = '#define G_OS_UNIX' + endif +@@ -492,7 +495,7 @@ foreach m : struct_members + endforeach + + # Compiler flags +-if cc.get_id() == 'gcc' or cc.get_id() == 'clang' ++if cc.get_id() == 'gcc' or cc.get_id() == 'clang' or cc.get_id() == 'emscripten' + warning_common_args = [ + '-Wduplicated-branches', + '-Wimplicit-fallthrough', +@@ -749,7 +752,7 @@ if host_system != 'windows' and cc.has_function('posix_memalign', prefix: '#incl + endif + + # Check that posix_spawn() is usable; must use header +-if cc.has_function('posix_spawn', prefix : '#include ') ++if host_system != 'emscripten' and cc.has_function('posix_spawn', prefix : '#include ') + glib_conf.set('HAVE_POSIX_SPAWN', 1) + endif + +@@ -1074,9 +1077,9 @@ if host_system == 'windows' and (cc.get_id() == 'msvc' or cc.get_id() == 'clang- + glib_conf.set('HAVE_C99_SNPRINTF', false) + glib_conf.set('HAVE_C99_VSNPRINTF', false) + glib_conf.set('HAVE_UNIX98_PRINTF', false) +-elif not cc_can_run and host_system in ['ios', 'darwin'] +- # All these are true when compiling natively on macOS, so we should use good +- # defaults when building for iOS and tvOS. ++elif not cc_can_run and host_system in ['ios', 'darwin', 'emscripten'] ++ # All these are true when compiling natively on macOS, or when compiling with ++ # Emscripten (which uses musl libc internally). + glib_conf.set('HAVE_C99_SNPRINTF', true) + glib_conf.set('HAVE_C99_VSNPRINTF', true) + glib_conf.set('HAVE_UNIX98_PRINTF', true) +@@ -1597,10 +1600,10 @@ g_sizet_compatibility = { + 'long long': sizet_size == long_long_size, + } + +-# Do separate checks for gcc/clang (and ignore other compilers for now), since +-# we need to explicitly pass -Werror to the compilers. ++# Do separate checks for gcc/clang/emscripten (and ignore other compilers for now), ++# since we need to explicitly pass -Werror to the compilers. + # FIXME: https://github.com/mesonbuild/meson/issues/5399 +-if cc.get_id() == 'gcc' or cc.get_id() == 'clang' ++if cc.get_id() == 'gcc' or cc.get_id() == 'clang' or cc.get_id() == 'emscripten' + foreach type_name, size_compatibility : g_sizet_compatibility + g_sizet_compatibility += { type_name: size_compatibility and + cc.compiles( +@@ -1685,6 +1688,8 @@ glibconfig_conf.set('gssizebits', ssizet_size * 8) + # XXX: https://gitlab.gnome.org/GNOME/glib/issues/1413 + if host_system == 'windows' + g_module_suffix = 'dll' ++elif host_system == 'emscripten' ++ g_module_suffix = 'wasm' + else + g_module_suffix = 'so' + endif +@@ -1891,8 +1896,8 @@ atomicdefine = ''' + # We know that we can always use real ("lock free") atomic operations with MSVC + if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl' or cc.links(atomictest, name : 'atomic ops') + have_atomic_lock_free = true +- if cc.get_id() == 'gcc' and not cc.compiles(atomicdefine, name : 'atomic ops define') +- # Old gcc release may provide ++ if (cc.get_id() == 'gcc' or host_system == 'emscripten') and not cc.compiles(atomicdefine, name : 'atomic ops define') ++ # gcc (some old releases) or Emscripten provides + # __sync_bool_compare_and_swap but doesn't define + # __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 + glib_conf.set('__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4', true) +@@ -2037,6 +2042,10 @@ else + libiconv = dependency('iconv') + endif + ++# pcre2 = dependency('libpcre2-8', required : true, fallback : ['pcre2', 'libpcre2_8']) ++pcre2 = dependency('libpcre2-8', required : true) ++use_pcre2_static_flag = true ++ + pcre2_req = '>=10.32' + pcre2 = dependency('libpcre2-8', version: pcre2_req, required: false, allow_fallback: false) + if not pcre2.found() +@@ -2391,7 +2400,6 @@ subdir('gobject') + subdir('gthread') + subdir('gmodule') + subdir('gio') +-subdir('fuzzing') + + # xgettext is optional (on Windows for instance) + if find_program('xgettext', required : get_option('nls')).found() diff --git a/ports/glib/fixes-for-sidemodule.patch b/ports/glib/fixes-for-sidemodule.patch new file mode 100644 index 00000000000000..c8ee48474a249e --- /dev/null +++ b/ports/glib/fixes-for-sidemodule.patch @@ -0,0 +1,312 @@ +diff --git a/glib/gbookmarkfile.c b/glib/gbookmarkfile.c +index f494cbc..a0bbeda 100644 +--- a/glib/gbookmarkfile.c ++++ b/glib/gbookmarkfile.c +@@ -3628,6 +3628,10 @@ g_bookmark_file_set_application_info (GBookmarkFile *bookmark, + GDateTime *stamp, + GError **error) + { ++#ifdef __EMSCRIPTEN__ ++ fprintf (stderr, "%s (%d): Not implemented\n", __FUNCTION__, __LINE__); ++ return TRUE; ++#else + BookmarkItem *item; + BookmarkAppInfo *ai; + +@@ -3707,6 +3711,7 @@ g_bookmark_file_set_application_info (GBookmarkFile *bookmark, + bookmark_item_touch_modified (item); + + return TRUE; ++#endif + } + + /* expands the application's command line */ +@@ -3851,6 +3856,10 @@ g_bookmark_file_get_application_info (GBookmarkFile *bookmark, + GDateTime **stamp, + GError **error) + { ++#ifdef __EMSCRIPTEN__ ++ fprintf (stderr, "%s (%d): Not implemented\n", __FUNCTION__, __LINE__); ++ return TRUE; ++#else + BookmarkItem *item; + BookmarkAppInfo *ai; + +@@ -3914,6 +3923,7 @@ g_bookmark_file_get_application_info (GBookmarkFile *bookmark, + *stamp = ai->stamp; + + return TRUE; ++#endif + } + + /** +diff --git a/glib/glib-autocleanups.h b/glib/glib-autocleanups.h +index 014e9bb..2502fcc 100644 +--- a/glib/glib-autocleanups.h ++++ b/glib/glib-autocleanups.h +@@ -95,6 +95,7 @@ G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantDict, g_variant_dict_clear) + G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GMutex, g_mutex_clear) + G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GQueue, g_queue_clear) + G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GCond, g_cond_clear) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRand, g_rand_free_adapter) + + #ifndef __EMSCRIPTEN__ + +@@ -107,7 +108,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNode, g_node_destroy) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionContext, g_option_context_free) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionGroup, g_option_group_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSequence, g_sequence_free) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRand, g_rand_free) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUri, g_uri_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC (GPathBuf, g_path_buf_free) + G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (GPathBuf, g_path_buf_clear) +diff --git a/glib/glib-unix.c b/glib/glib-unix.c +index c1c6bce..243f82f 100644 +--- a/glib/glib-unix.c ++++ b/glib/glib-unix.c +@@ -189,6 +189,7 @@ g_unix_set_fd_nonblocking (gint fd, + * + * Since: 2.30 + */ ++#ifndef __EMSCRIPTEN__ + GSource * + g_unix_signal_source_new (int signum) + { +@@ -198,6 +199,7 @@ g_unix_signal_source_new (int signum) + + return _g_main_create_unix_signal_watch (signum); + } ++#endif + + /** + * g_unix_signal_add_full: (rename-to g_unix_signal_add) +@@ -223,6 +225,10 @@ g_unix_signal_add_full (int priority, + gpointer user_data, + GDestroyNotify notify) + { ++#ifdef __EMSCRIPTEN__ ++ fprintf (stderr, "%s (%d): Not Implemented - ARL\n", __FUNCTION__, __LINE__); ++ return 0; ++#else + guint id; + GSource *source; + +@@ -236,6 +242,7 @@ g_unix_signal_add_full (int priority, + g_source_unref (source); + + return id; ++#endif + } + + /** +@@ -313,6 +320,10 @@ GSource * + g_unix_fd_source_new (gint fd, + GIOCondition condition) + { ++#ifdef __EMSCRIPTEN__ ++ fprintf(stderr, "%s (%d): I commented this out - ARL\n", __FUNCTION__, __LINE__); ++ return NULL; ++#else + GUnixFDSource *fd_source; + GSource *source; + +@@ -323,6 +334,7 @@ g_unix_fd_source_new (gint fd, + fd_source->tag = g_source_add_unix_fd (source, fd, condition); + + return source; ++#endif + } + + /** +diff --git a/glib/glib-unix.h b/glib/glib-unix.h +index 7cf4f0d..4c30315 100644 +--- a/glib/glib-unix.h ++++ b/glib/glib-unix.h +@@ -69,7 +69,9 @@ gboolean g_unix_set_fd_nonblocking (gint fd, + GError **error); + + GLIB_AVAILABLE_IN_2_30 ++#ifndef __EMSCRIPTEN__ + GSource *g_unix_signal_source_new (gint signum); ++#endif + + GLIB_AVAILABLE_IN_2_30 + guint g_unix_signal_add_full (gint priority, +diff --git a/glib/glib.h b/glib/glib.h +index 25443a5..392cbda 100644 +--- a/glib/glib.h ++++ b/glib/glib.h +@@ -39,7 +39,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -87,6 +86,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff --git a/glib/gmain.c b/glib/gmain.c +index 656a2d5..5a27ffb 100644 +--- a/glib/gmain.c ++++ b/glib/gmain.c +@@ -2771,6 +2771,7 @@ g_clear_handle_id (guint *tag_ptr, + * + * Since: 2.36 + **/ ++#ifndef __EMSCRIPTEN__ + gpointer + g_source_add_unix_fd (GSource *source, + gint fd, +@@ -2804,6 +2805,7 @@ g_source_add_unix_fd (GSource *source, + + return poll_fd; + } ++#endif /* NOT __EMSCRIPTEN__ */ + + /** + * g_source_modify_unix_fd: +diff --git a/glib/gmain.h b/glib/gmain.h +index a8dc66c..9ae2986 100644 +--- a/glib/gmain.h ++++ b/glib/gmain.h +@@ -672,9 +672,11 @@ gint64 g_source_get_ready_time (GSource *source); + + #ifdef G_OS_UNIX + GLIB_AVAILABLE_IN_2_36 ++#ifndef __EMSCRIPTEN__ + gpointer g_source_add_unix_fd (GSource *source, + gint fd, + GIOCondition events); ++#endif + GLIB_AVAILABLE_IN_2_36 + void g_source_modify_unix_fd (GSource *source, + gpointer tag, +diff --git a/glib/grand.c b/glib/grand.c +index 5fb4457..d9f0be3 100644 +--- a/glib/grand.c ++++ b/glib/grand.c +@@ -301,6 +301,11 @@ g_rand_free (GRand *rand) + + g_free (rand); + } ++void ++g_rand_free_adapter (gpointer rand) ++{ ++ g_rand_free ((GRand*) rand); ++} + + /** + * g_rand_copy: +diff --git a/glib/grand.h b/glib/grand.h +index c4ae956..5079341 100644 +--- a/glib/grand.h ++++ b/glib/grand.h +@@ -55,6 +55,7 @@ GLIB_AVAILABLE_IN_ALL + GRand* g_rand_new (void); + GLIB_AVAILABLE_IN_ALL + void g_rand_free (GRand *rand_); ++void g_rand_free_adapter (gpointer rand_); + GLIB_AVAILABLE_IN_ALL + GRand* g_rand_copy (GRand *rand_); + GLIB_AVAILABLE_IN_ALL +diff --git a/glib/gstring.c b/glib/gstring.c +index ad6b922..dee82f8 100644 +--- a/glib/gstring.c ++++ b/glib/gstring.c +@@ -545,9 +545,13 @@ g_string_append_uri_escaped (GString *string, + const gchar *reserved_chars_allowed, + gboolean allow_utf8) + { ++#ifdef __EMSCRIPTEN__ ++ fprintf (stderr, "%s (%d): Not implemented - ARL\n", __FUNCTION__, __LINE__); ++#else + _uri_encoder (string, (const guchar *) unescaped, strlen (unescaped), + reserved_chars_allowed, allow_utf8); + return string; ++#endif + } + + /** +diff --git a/glib/meson.build b/glib/meson.build +index 65d5f63..e88dbb0 100644 +--- a/glib/meson.build ++++ b/glib/meson.build +@@ -212,7 +212,7 @@ glib_sub_headers = files( + 'gqsort.h', + 'gquark.h', + 'gqueue.h', +- # 'grand.h', ++ 'grand.h', + 'grcbox.h', + 'grefcount.h', + # 'grefstring.h', +@@ -301,7 +301,7 @@ glib_sources += files( + 'gqsort.c', + 'gquark.c', + 'gqueue.c', +- # 'grand.c', ++ 'grand.c', + 'grcbox.c', + 'grefcount.c', + # 'grefstring.c', +@@ -323,7 +323,7 @@ glib_sources += files( + 'gtimezone.c', + # 'gtrace.c', + # 'gtrace-private.h', +- # 'gtranslit.c', ++ 'gtranslit.c', + # 'gtrashstack.c', + 'gtree.c', + 'guniprop.c', +diff --git a/glib/tests/unix.c b/glib/tests/unix.c +index 0c1ec21..c554bb8 100644 +--- a/glib/tests/unix.c ++++ b/glib/tests/unix.c +@@ -248,6 +248,10 @@ test_sighup_add_remove (void) + static gboolean + nested_idle (gpointer data) + { ++#ifdef __EMSCRIPTEN__ ++ fprintf ( stderr, "%s (%d) - Not Implemented - ARL", __FUNCTION__, __LINE__); ++ return G_SOURCE_REMOVE; ++#else + GMainLoop *nested; + GMainContext *context; + GSource *source; +@@ -268,6 +272,7 @@ nested_idle (gpointer data) + g_main_context_unref (context); + + return G_SOURCE_REMOVE; ++#endif + } + + static void +diff --git a/gobject/tests/closure.c b/gobject/tests/closure.c +index b761825..e340a35 100644 +--- a/gobject/tests/closure.c ++++ b/gobject/tests/closure.c +@@ -182,6 +182,9 @@ closure_quit_callback (gpointer user_data) + static void + test_closure_signal (void) + { ++#ifdef __EMSCRIPTEN__ ++ fprintf (stderr, "test_closure_signal NOT Implemented - ARL\n"); ++#else + GSource *source; + + g_idle_add_full (G_PRIORITY_LOW, send_usr1, NULL, NULL); +@@ -189,6 +192,7 @@ test_closure_signal (void) + source = g_unix_signal_source_new (SIGUSR1); + test_source (source, G_CALLBACK (closure_quit_callback)); + g_source_unref (source); ++#endif + } + #endif + diff --git a/ports/glib/glib-without-func-ptr-casts-for-pango-wasm.patch b/ports/glib/glib-without-func-ptr-casts-for-pango-wasm.patch new file mode 100644 index 00000000000000..c2909ce8bd2279 --- /dev/null +++ b/ports/glib/glib-without-func-ptr-casts-for-pango-wasm.patch @@ -0,0 +1,5524 @@ +diff --git a/gio/gio.h b/gio/gio.h +index c17657db0..2fd1d73c1 100644 +--- a/gio/gio.h ++++ b/gio/gio.h +@@ -25,6 +25,11 @@ + + #define __GIO_GIO_H_INSIDE__ + ++#ifdef __EMSCRIPTEN__ ++#include ++#include ++#else ++ + #include + + #include +@@ -183,4 +188,5 @@ + + #undef __GIO_GIO_H_INSIDE__ + ++#endif // __EMSCRIPTEN__ + #endif /* __G_IO_H__ */ +diff --git a/gio/gioenumtypes.h.template b/gio/gioenumtypes.h.template +index c75a3b459..4f734f626 100644 +--- a/gio/gioenumtypes.h.template ++++ b/gio/gioenumtypes.h.template +@@ -24,7 +24,10 @@ + #define __GIO_ENUM_TYPES_H__ + + #include ++ ++#ifndef __EMSCRIPTEN__ + #include ++#endif + + G_BEGIN_DECLS + /*** END file-header ***/ +diff --git a/gio/glistmodel.c b/gio/glistmodel.c +index 3f9b85e91..2a9f32123 100644 +--- a/gio/glistmodel.c ++++ b/gio/glistmodel.c +@@ -24,6 +24,8 @@ + + #include "config.h" + ++#include "gio.h" ++// #include "../glib.h" + #include "glistmodel.h" + #include "glibintl.h" + #include "gmarshal-internal.h" +@@ -136,8 +138,8 @@ G_DEFINE_INTERFACE (GListModel, g_list_model, G_TYPE_OBJECT) + * using the following functions. + **/ + +-static guint g_list_model_changed_signal; +- ++// static guint g_list_model_changed_signal; ++// + static void + g_list_model_default_init (GListModelInterface *iface) + { +@@ -157,19 +159,20 @@ g_list_model_default_init (GListModelInterface *iface) + * + * Since: 2.44 + */ +- g_list_model_changed_signal = g_signal_new (I_("items-changed"), +- G_TYPE_LIST_MODEL, +- G_SIGNAL_RUN_LAST, +- 0, +- NULL, NULL, +- _g_cclosure_marshal_VOID__UINT_UINT_UINT, +- G_TYPE_NONE, +- 3, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT); +- g_signal_set_va_marshaller (g_list_model_changed_signal, +- G_TYPE_FROM_INTERFACE (iface), +- _g_cclosure_marshal_VOID__UINT_UINT_UINTv); ++ // g_list_model_changed_signal = g_signal_new (I_("items-changed"), ++ // G_TYPE_LIST_MODEL, ++ // G_SIGNAL_RUN_LAST, ++ // 0, ++ // NULL, NULL, ++ // _g_cclosure_marshal_VOID__UINT_UINT_UINT, ++ // G_TYPE_NONE, ++ // 3, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT); ++ // g_signal_set_va_marshaller (g_list_model_changed_signal, ++ // G_TYPE_FROM_INTERFACE (iface), ++ // _g_cclosure_marshal_VOID__UINT_UINT_UINTv); + } + ++ + /** + * g_list_model_get_item_type: + * @list: a #GListModel +@@ -318,5 +321,6 @@ g_list_model_items_changed (GListModel *list, + { + g_return_if_fail (G_IS_LIST_MODEL (list)); + +- g_signal_emit (list, g_list_model_changed_signal, 0, position, removed, added); ++ //printf("__FUNCTION__ called. Unfortunately, this is not implemented in this Emscripten build.\n"); ++ //g_signal_emit (list, g_list_model_changed_signal, 0, position, removed, added); + } +diff --git a/gio/glistmodel.h b/gio/glistmodel.h +index a96e3cea0..4ae0e47b6 100644 +--- a/gio/glistmodel.h ++++ b/gio/glistmodel.h +@@ -29,12 +29,12 @@ + #error "Only can be included directly." + #endif + +-#include ++//#include + + G_BEGIN_DECLS + + #define G_TYPE_LIST_MODEL g_list_model_get_type () +-GIO_AVAILABLE_IN_2_44 ++//GIO_AVAILABLE_IN_2_44 + G_DECLARE_INTERFACE(GListModel, g_list_model, G, LIST_MODEL, GObject) + + struct _GListModelInterface +@@ -49,21 +49,21 @@ struct _GListModelInterface + guint position); + }; + +-GIO_AVAILABLE_IN_2_44 ++//GIO_AVAILABLE_IN_2_44 + GType g_list_model_get_item_type (GListModel *list); + +-GIO_AVAILABLE_IN_2_44 ++//GIO_AVAILABLE_IN_2_44 + guint g_list_model_get_n_items (GListModel *list); + +-GIO_AVAILABLE_IN_2_44 ++//GIO_AVAILABLE_IN_2_44 + gpointer g_list_model_get_item (GListModel *list, + guint position); + +-GIO_AVAILABLE_IN_2_44 ++//GIO_AVAILABLE_IN_2_44 + GObject * g_list_model_get_object (GListModel *list, + guint position); + +-GIO_AVAILABLE_IN_2_44 ++//GIO_AVAILABLE_IN_2_44 + void g_list_model_items_changed (GListModel *list, + guint position, + guint removed, +diff --git a/gio/meson.build b/gio/meson.build +index f1812424d..9acdd661a 100644 +--- a/gio/meson.build ++++ b/gio/meson.build +@@ -1,7 +1,6 @@ + gio_c_args = [ + '-DG_LOG_DOMAIN="GLib-GIO"', + '-DGIO_LAUNCH_DESKTOP="@0@"'.format(glib_prefix / multiarch_libexecdir / 'gio-launch-desktop'), +- '-DGIO_MODULE_DIR="@0@"'.format(glib_giomodulesdir), + '-DLOCALSTATEDIR="@0@"'.format(glib_localstatedir), + ] + +@@ -9,14 +8,23 @@ gio_c_args_internal = [ + '-DGIO_COMPILATION', + ] + +-# Install empty glib_giomodulesdir +-install_emptydir(glib_giomodulesdir) ++if host_system != 'emscripten' ++ gio_c_args += [ ++ '-DGIO_MODULE_DIR="@0@"'.format(glib_giomodulesdir), ++ ] ++ ++ # Install empty glib_giomodulesdir ++ install_emptydir(glib_giomodulesdir) ++endif + + gio_includedir = glib_includedir / 'gio' + +-gnetworking_h_conf = configuration_data() + +-gnetworking_h_nameser_compat_include = '' ++if host_system != 'emscripten' ++ gnetworking_h_conf = configuration_data() ++ ++ gnetworking_h_nameser_compat_include = '' ++endif + + if host_system not in ['windows', 'android'] + # Don't check for C_IN on Android since it does not define it in public +@@ -30,7 +38,7 @@ if host_system not in ['windows', 'android'] + #include + int qclass = C_IN;''', + name : 'arpa/nameser_compat.h needed for C_IN') +- gnetworking_h_nameser_compat_include = '#include ' ++ # gnetworking_h_nameser_compat_include = '#include ' + else + error('Could not find required includes for ARPA C_IN') + endif +@@ -168,177 +176,180 @@ if host_system == 'android' + endif + endif + +-gnetworking_h_conf.set('NAMESER_COMPAT_INCLUDE', gnetworking_h_nameser_compat_include) +- +-gnetworking_h = configure_file(input : 'gnetworking.h.in', +- output : 'gnetworking.h', +- install_dir : gio_includedir, +- configuration : gnetworking_h_conf) +- +-gdbus_headers = files( +- 'gdbusauthobserver.h', +- 'gcredentials.h', +- 'gdbusutils.h', +- 'gdbuserror.h', +- 'gdbusaddress.h', +- 'gdbusconnection.h', +- 'gdbusmessage.h', +- 'gdbusnameowning.h', +- 'gdbusnamewatching.h', +- 'gdbusproxy.h', +- 'gdbusintrospection.h', +- 'gdbusmethodinvocation.h', +- 'gdbusserver.h', +- 'gdbusinterface.h', +- 'gdbusinterfaceskeleton.h', +- 'gdbusobject.h', +- 'gdbusobjectskeleton.h', +- 'gdbusobjectproxy.h', +- 'gdbusobjectmanager.h', +- 'gdbusobjectmanagerclient.h', +- 'gdbusobjectmanagerserver.h', +- 'gtestdbus.h', +-) +- +-gdbus_sources = files( +- 'gdbusutils.c', +- 'gdbusaddress.c', +- 'gdbusauthobserver.c', +- 'gdbusauth.c', +- 'gdbusauthmechanism.c', +- 'gdbusauthmechanismanon.c', +- 'gdbusauthmechanismexternal.c', +- 'gdbusauthmechanismsha1.c', +- 'gdbuserror.c', +- 'gdbusconnection.c', +- 'gdbusmessage.c', +- 'gdbusnameowning.c', +- 'gdbusnamewatching.c', +- 'gdbusproxy.c', +- 'gdbusprivate.c', +- 'gdbusintrospection.c', +- 'gdbusmethodinvocation.c', +- 'gdbusserver.c', +- 'gdbusinterface.c', +- 'gdbusinterfaceskeleton.c', +- 'gdbusobject.c', +- 'gdbusobjectskeleton.c', +- 'gdbusobjectproxy.c', +- 'gdbusobjectmanager.c', +- 'gdbusobjectmanagerclient.c', +- 'gdbusobjectmanagerserver.c', +- 'gtestdbus.c', +-) +- +-# Generate gdbus-codegen +-subdir('gdbus-2.0/codegen') +- +-# Generate xdp-dbus.{c,h} +-xdp_dbus_generated = custom_target('xdp-dbus', +- input : ['org.freedesktop.portal.Documents.xml', +- 'org.freedesktop.portal.OpenURI.xml', +- 'org.freedesktop.portal.ProxyResolver.xml', +- 'org.freedesktop.portal.Trash.xml'], +- output : ['xdp-dbus.h', 'xdp-dbus.c'], +- depend_files : gdbus_codegen_built_files, +- command : [python, gdbus_codegen, +- '--interface-prefix', 'org.freedesktop.portal.', +- '--output-directory', '@OUTDIR@', +- '--generate-c-code', 'xdp-dbus', +- '--c-namespace', 'GXdp', +- '@INPUT@']) +- +-# Generate gdbus-generated.{c,h} +-gdbus_daemon_generated = custom_target('gdbus-daemon-generated', +- input : ['dbus-daemon.xml'], +- output : ['gdbus-daemon-generated.h', 'gdbus-daemon-generated.c'], +- depend_files : gdbus_codegen_built_files, +- command : [python, gdbus_codegen, +- '--interface-prefix', 'org.', +- '--output-directory', '@OUTDIR@', +- '--generate-c-code', 'gdbus-daemon-generated', +- '--c-namespace', '_G', '@INPUT@']) +- +-settings_headers = files( +- 'gsettingsbackend.h', +- 'gsettingsschema.h', +- 'gsettings.h', +-) +- +-settings_sources = files( +- 'gdelayedsettingsbackend.c', +- 'gkeyfilesettingsbackend.c', +- 'gmemorysettingsbackend.c', +- 'gnullsettingsbackend.c', +- 'gsettingsbackend.c', +- 'gsettingsschema.c', +- 'gsettings-mapping.c', +- 'gsettings.c', +-) + +-if host_system == 'windows' +- settings_sources += files('gregistrysettingsbackend.c') +-endif +- +-application_headers = files( +- 'gapplication.h', +- 'gapplicationcommandline.h', +- +- 'gactiongroup.h', +- 'gactionmap.h', +- 'gsimpleactiongroup.h', +- 'gremoteactiongroup.h', +- 'gactiongroupexporter.h', +- 'gdbusactiongroup.h', +- 'gaction.h', +- 'gpropertyaction.h', +- 'gsimpleaction.h', +- +- 'gmenumodel.h', +- 'gmenu.h', +- 'gmenuexporter.h', +- 'gdbusmenumodel.h', +- 'gnotification.h', +-) +- +-application_sources = files( +- 'gapplication.c', +- 'gapplicationcommandline.c', +- 'gapplicationimpl-dbus.c', +- +- 'gactiongroup.c', +- 'gactionmap.c', +- 'gsimpleactiongroup.c', +- 'gremoteactiongroup.c', +- 'gactiongroupexporter.c', +- 'gdbusactiongroup.c', +- 'gaction.c', +- 'gpropertyaction.c', +- 'gsimpleaction.c', +- +- 'gmenumodel.c', +- 'gmenu.c', +- 'gmenuexporter.c', +- 'gdbusmenumodel.c', +- 'gnotification.c', +- 'gnotificationbackend.c', +-) +- +-local_sources = files( +- 'ghttpproxy.c', +- 'glocalfile.c', +- 'glocalfileenumerator.c', +- 'glocalfileinfo.c', +- 'glocalfileinputstream.c', +- 'glocalfilemonitor.c', +- 'glocalfileoutputstream.c', +- 'glocalfileiostream.c', +- 'glocalvfs.c', +- 'gsocks4proxy.c', +- 'gsocks4aproxy.c', +- 'gsocks5proxy.c', +- 'thumbnail-verify.c', +-) ++if host_system != 'emscripten' ++ gnetworking_h_conf.set('NAMESER_COMPAT_INCLUDE', gnetworking_h_nameser_compat_include) ++ ++ gnetworking_h = configure_file(input : 'gnetworking.h.in', ++ output : 'gnetworking.h', ++ install_dir : gio_includedir, ++ configuration : gnetworking_h_conf) ++ ++ gdbus_headers = files( ++ 'gdbusauthobserver.h', ++ 'gcredentials.h', ++ 'gdbusutils.h', ++ 'gdbuserror.h', ++ 'gdbusaddress.h', ++ 'gdbusconnection.h', ++ 'gdbusmessage.h', ++ 'gdbusnameowning.h', ++ 'gdbusnamewatching.h', ++ 'gdbusproxy.h', ++ 'gdbusintrospection.h', ++ 'gdbusmethodinvocation.h', ++ 'gdbusserver.h', ++ 'gdbusinterface.h', ++ 'gdbusinterfaceskeleton.h', ++ 'gdbusobject.h', ++ 'gdbusobjectskeleton.h', ++ 'gdbusobjectproxy.h', ++ 'gdbusobjectmanager.h', ++ 'gdbusobjectmanagerclient.h', ++ 'gdbusobjectmanagerserver.h', ++ 'gtestdbus.h', ++ ) ++ ++ gdbus_sources = files( ++ 'gdbusutils.c', ++ 'gdbusaddress.c', ++ 'gdbusauthobserver.c', ++ 'gdbusauth.c', ++ 'gdbusauthmechanism.c', ++ 'gdbusauthmechanismanon.c', ++ 'gdbusauthmechanismexternal.c', ++ 'gdbusauthmechanismsha1.c', ++ 'gdbuserror.c', ++ 'gdbusconnection.c', ++ 'gdbusmessage.c', ++ 'gdbusnameowning.c', ++ 'gdbusnamewatching.c', ++ 'gdbusproxy.c', ++ 'gdbusprivate.c', ++ 'gdbusintrospection.c', ++ 'gdbusmethodinvocation.c', ++ 'gdbusserver.c', ++ 'gdbusinterface.c', ++ 'gdbusinterfaceskeleton.c', ++ 'gdbusobject.c', ++ 'gdbusobjectskeleton.c', ++ 'gdbusobjectproxy.c', ++ 'gdbusobjectmanager.c', ++ 'gdbusobjectmanagerclient.c', ++ 'gdbusobjectmanagerserver.c', ++ 'gtestdbus.c', ++ ) ++ ++ # Generate gdbus-codegen ++ subdir('gdbus-2.0/codegen') ++ ++ # Generate xdp-dbus.{c,h} ++ xdp_dbus_generated = custom_target('xdp-dbus', ++ input : ['org.freedesktop.portal.Documents.xml', ++ 'org.freedesktop.portal.OpenURI.xml', ++ 'org.freedesktop.portal.ProxyResolver.xml', ++ 'org.freedesktop.portal.Trash.xml'], ++ output : ['xdp-dbus.h', 'xdp-dbus.c'], ++ depend_files : gdbus_codegen_built_files, ++ command : [python, gdbus_codegen, ++ '--interface-prefix', 'org.freedesktop.portal.', ++ '--output-directory', '@OUTDIR@', ++ '--generate-c-code', 'xdp-dbus', ++ '--c-namespace', 'GXdp', ++ '@INPUT@']) ++ ++ # Generate gdbus-generated.{c,h} ++ gdbus_daemon_generated = custom_target('gdbus-daemon-generated', ++ input : ['dbus-daemon.xml'], ++ output : ['gdbus-daemon-generated.h', 'gdbus-daemon-generated.c'], ++ depend_files : gdbus_codegen_built_files, ++ command : [python, gdbus_codegen, ++ '--interface-prefix', 'org.', ++ '--output-directory', '@OUTDIR@', ++ '--generate-c-code', 'gdbus-daemon-generated', ++ '--c-namespace', '_G', '@INPUT@']) ++ ++ settings_headers = files( ++ 'gsettingsbackend.h', ++ 'gsettingsschema.h', ++ 'gsettings.h', ++ ) ++ ++ settings_sources = files( ++ 'gdelayedsettingsbackend.c', ++ 'gkeyfilesettingsbackend.c', ++ 'gmemorysettingsbackend.c', ++ 'gnullsettingsbackend.c', ++ 'gsettingsbackend.c', ++ 'gsettingsschema.c', ++ 'gsettings-mapping.c', ++ 'gsettings.c', ++ ) ++ ++ if host_system == 'windows' ++ settings_sources += files('gregistrysettingsbackend.c') ++ endif ++ ++ application_headers = files( ++ 'gapplication.h', ++ 'gapplicationcommandline.h', ++ ++ 'gactiongroup.h', ++ 'gactionmap.h', ++ 'gsimpleactiongroup.h', ++ 'gremoteactiongroup.h', ++ 'gactiongroupexporter.h', ++ 'gdbusactiongroup.h', ++ 'gaction.h', ++ 'gpropertyaction.h', ++ 'gsimpleaction.h', ++ ++ 'gmenumodel.h', ++ 'gmenu.h', ++ 'gmenuexporter.h', ++ 'gdbusmenumodel.h', ++ 'gnotification.h', ++ ) ++ ++ application_sources = files( ++ 'gapplication.c', ++ 'gapplicationcommandline.c', ++ 'gapplicationimpl-dbus.c', ++ ++ 'gactiongroup.c', ++ 'gactionmap.c', ++ 'gsimpleactiongroup.c', ++ 'gremoteactiongroup.c', ++ 'gactiongroupexporter.c', ++ 'gdbusactiongroup.c', ++ 'gaction.c', ++ 'gpropertyaction.c', ++ 'gsimpleaction.c', ++ ++ 'gmenumodel.c', ++ 'gmenu.c', ++ 'gmenuexporter.c', ++ 'gdbusmenumodel.c', ++ 'gnotification.c', ++ 'gnotificationbackend.c', ++ ) ++ ++ local_sources = files( ++ 'ghttpproxy.c', ++ 'glocalfile.c', ++ 'glocalfileenumerator.c', ++ 'glocalfileinfo.c', ++ 'glocalfileinputstream.c', ++ 'glocalfilemonitor.c', ++ 'glocalfileoutputstream.c', ++ 'glocalfileiostream.c', ++ 'glocalvfs.c', ++ 'gsocks4proxy.c', ++ 'gsocks4aproxy.c', ++ 'gsocks5proxy.c', ++ 'thumbnail-verify.c', ++ ) ++endif # host system not emscripten + + platform_deps = [] + internal_deps = [] +@@ -348,11 +359,13 @@ portal_sources = [] + unix_sources = [] + win32_sources = [] + +-# This is also used by tests/gdbus-daemon, so use files() to include the path +-gdbus_daemon_sources = [ +- files('gdbusdaemon.c'), +- gdbus_daemon_generated, +-] ++if host_system != 'emscripten' ++ # This is also used by tests/gdbus-daemon, so use files() to include the path ++ gdbus_daemon_sources = [ ++ files('gdbusdaemon.c'), ++ gdbus_daemon_generated, ++ ] ++endif + + if host_system not in ['windows', 'emscripten'] + unix_sources = files( +@@ -460,150 +473,153 @@ elif host_system == 'windows' + endif + + gio_sources = files( +- 'gappinfo.c', +- 'gasynchelper.c', +- 'gasyncinitable.c', +- 'gasyncresult.c', +- 'gbufferedinputstream.c', +- 'gbufferedoutputstream.c', +- 'gbytesicon.c', +- 'gcancellable.c', +- 'gcharsetconverter.c', +- 'gcontextspecificgroup.c', +- 'gconverter.c', +- 'gconverterinputstream.c', +- 'gconverteroutputstream.c', +- 'gcredentials.c', +- 'gdatagrambased.c', +- 'gdatainputstream.c', +- 'gdataoutputstream.c', +- 'gdebugcontroller.c', +- 'gdebugcontrollerdbus.c', +- 'gdrive.c', +- 'gdummyfile.c', +- 'gdummyproxyresolver.c', +- 'gdummytlsbackend.c', +- 'gemblem.c', +- 'gemblemedicon.c', +- 'gfile.c', +- 'gfileattribute.c', +- 'gfileenumerator.c', +- 'gfileicon.c', +- 'gfileinfo.c', +- 'gfileinputstream.c', +- 'gfilemonitor.c', +- 'gfilenamecompleter.c', +- 'gfileoutputstream.c', +- 'gfileiostream.c', +- 'gfilterinputstream.c', +- 'gfilteroutputstream.c', +- 'gicon.c', +- 'ginetaddress.c', +- 'ginetaddressmask.c', +- 'ginetsocketaddress.c', +- 'ginitable.c', +- 'ginputstream.c', +- 'gioerror.c', +- 'giomodule.c', +- 'giomodule-priv.c', +- 'gioscheduler.c', +- 'giostream.c', +- 'gloadableicon.c', +- 'gmarshal-internal.c', +- 'gmount.c', +- 'gmemorymonitor.c', +- 'gmemorymonitordbus.c', +- 'gmemoryinputstream.c', +- 'gmemoryoutputstream.c', +- 'gmountoperation.c', +- 'gnativesocketaddress.c', +- 'gnativevolumemonitor.c', +- 'gnetworkaddress.c', +- 'gnetworking.c', +- 'gnetworkmonitor.c', +- 'gnetworkmonitorbase.c', +- 'gnetworkservice.c', +- 'goutputstream.c', +- 'gpermission.c', +- 'gpollableinputstream.c', +- 'gpollableoutputstream.c', +- 'gpollableutils.c', +- 'gpollfilemonitor.c', +- 'gpowerprofilemonitor.c', +- 'gpowerprofilemonitordbus.c', +- 'gproxy.c', +- 'gproxyaddress.c', +- 'gproxyaddressenumerator.c', +- 'gproxyresolver.c', +- 'gresolver.c', +- 'gresource.c', +- 'gresourcefile.c', +- 'gseekable.c', +- 'gsimpleasyncresult.c', +- 'gsimpleiostream.c', +- 'gsimplepermission.c', +- 'gsimpleproxyresolver.c', +- 'gsocket.c', +- 'gsocketaddress.c', +- 'gsocketaddressenumerator.c', +- 'gsocketclient.c', +- 'gsocketconnectable.c', +- 'gsocketconnection.c', +- 'gsocketcontrolmessage.c', +- 'gsocketinputstream.c', +- 'gsocketlistener.c', +- 'gsocketoutputstream.c', +- 'gsocketservice.c', +- 'gsrvtarget.c', +- 'gsubprocesslauncher.c', +- 'gsubprocess.c', +- 'gtask.c', +- 'gtcpconnection.c', +- 'gtcpwrapperconnection.c', +- 'gthemedicon.c', +- 'gthreadedsocketservice.c', +- 'gthreadedresolver.c', +- 'gthreadedresolver.h', +- 'gtlsbackend.c', +- 'gtlscertificate.c', +- 'gtlsclientconnection.c', +- 'gtlsconnection.c', +- 'gtlsdatabase.c', +- 'gtlsfiledatabase.c', +- 'gtlsinteraction.c', +- 'gtlspassword.c', +- 'gtlsserverconnection.c', +- 'gdtlsconnection.c', +- 'gdtlsclientconnection.c', +- 'gdtlsserverconnection.c', +- 'gunionvolumemonitor.c', +- 'gunixconnection.c', +- 'gunixfdlist.c', +- 'gunixcredentialsmessage.c', +- 'gunixsocketaddress.c', +- 'gvfs.c', +- 'gvolume.c', +- 'gvolumemonitor.c', +- 'gzlibcompressor.c', +- 'gzlibdecompressor.c', ++ # 'gappinfo.c', ++ # 'gasynchelper.c', ++ # 'gasyncinitable.c', ++ # 'gasyncresult.c', ++ # 'gbufferedinputstream.c', ++ # 'gbufferedoutputstream.c', ++ # 'gbytesicon.c', ++ # 'gcancellable.c', ++ # 'gcharsetconverter.c', ++ # 'gcontextspecificgroup.c', ++ # 'gconverter.c', ++ # 'gconverterinputstream.c', ++ # 'gconverteroutputstream.c', ++ # 'gcredentials.c', ++ # 'gdatagrambased.c', ++ # 'gdatainputstream.c', ++ # 'gdataoutputstream.c', ++ # 'gdebugcontroller.c', ++ # 'gdebugcontrollerdbus.c', ++ # 'gdrive.c', ++ # 'gdummyfile.c', ++ # 'gdummyproxyresolver.c', ++ # 'gdummytlsbackend.c', ++ # 'gemblem.c', ++ # 'gemblemedicon.c', ++ # 'gfile.c', ++ # 'gfileattribute.c', ++ # 'gfileenumerator.c', ++ # 'gfileicon.c', ++ # 'gfileinfo.c', ++ # 'gfileinputstream.c', ++ # 'gfilemonitor.c', ++ # 'gfilenamecompleter.c', ++ # 'gfileoutputstream.c', ++ # 'gfileiostream.c', ++ # 'gfilterinputstream.c', ++ # 'gfilteroutputstream.c', ++ # 'gicon.c', ++ # 'ginetaddress.c', ++ # 'ginetaddressmask.c', ++ # 'ginetsocketaddress.c', ++ # 'ginitable.c', ++ # 'ginputstream.c', ++ # 'gioerror.c', ++ # 'giomodule.c', ++ # 'giomodule-priv.c', ++ # 'gioscheduler.c', ++ # 'giostream.c', ++ # 'gloadableicon.c', ++ # 'gmarshal-internal.c', ++ # 'gmount.c', ++ # 'gmemorymonitor.c', ++ # 'gmemorymonitordbus.c', ++ # 'gmemoryinputstream.c', ++ # 'gmemoryoutputstream.c', ++ # 'gmountoperation.c', ++ # 'gnativesocketaddress.c', ++ # 'gnativevolumemonitor.c', ++ # 'gnetworkaddress.c', ++ # 'gnetworking.c', ++ # 'gnetworkmonitor.c', ++ # 'gnetworkmonitorbase.c', ++ # 'gnetworkservice.c', ++ # 'goutputstream.c', ++ # 'gpermission.c', ++ # 'gpollableinputstream.c', ++ # 'gpollableoutputstream.c', ++ # 'gpollableutils.c', ++ # 'gpollfilemonitor.c', ++ # 'gpowerprofilemonitor.c', ++ # 'gpowerprofilemonitordbus.c', ++ # 'gproxy.c', ++ # 'gproxyaddress.c', ++ # 'gproxyaddressenumerator.c', ++ # 'gproxyresolver.c', ++ # 'gresolver.c', ++ # 'gresource.c', ++ # 'gresourcefile.c', ++ # 'gseekable.c', ++ # 'gsimpleasyncresult.c', ++ # 'gsimpleiostream.c', ++ # 'gsimplepermission.c', ++ # 'gsimpleproxyresolver.c', ++ # 'gsocket.c', ++ # 'gsocketaddress.c', ++ # 'gsocketaddressenumerator.c', ++ # 'gsocketclient.c', ++ # 'gsocketconnectable.c', ++ # 'gsocketconnection.c', ++ # 'gsocketcontrolmessage.c', ++ # 'gsocketinputstream.c', ++ # 'gsocketlistener.c', ++ # 'gsocketoutputstream.c', ++ # 'gsocketservice.c', ++ # 'gsrvtarget.c', ++ # 'gsubprocesslauncher.c', ++ # 'gsubprocess.c', ++ # 'gtask.c', ++ # 'gtcpconnection.c', ++ # 'gtcpwrapperconnection.c', ++ # 'gthemedicon.c', ++ # 'gthreadedsocketservice.c', ++ # 'gthreadedresolver.c', ++ # 'gthreadedresolver.h', ++ # 'gtlsbackend.c', ++ # 'gtlscertificate.c', ++ # 'gtlsclientconnection.c', ++ # 'gtlsconnection.c', ++ # 'gtlsdatabase.c', ++ # 'gtlsfiledatabase.c', ++ # 'gtlsinteraction.c', ++ # 'gtlspassword.c', ++ # 'gtlsserverconnection.c', ++ # 'gdtlsconnection.c', ++ # 'gdtlsclientconnection.c', ++ # 'gdtlsserverconnection.c', ++ # 'gunionvolumemonitor.c', ++ # 'gunixconnection.c', ++ # 'gunixfdlist.c', ++ # 'gunixcredentialsmessage.c', ++ # 'gunixsocketaddress.c', ++ # 'gvfs.c', ++ # 'gvolume.c', ++ # 'gvolumemonitor.c', ++ # 'gzlibcompressor.c', ++ # 'gzlibdecompressor.c', + 'glistmodel.c', +- 'gliststore.c', ++ # 'gliststore.c', + ) + + if glib_build_shared + gio_sources += files ('../glib/gtrace.c') + endif + +-gio_sources += appinfo_sources +-gio_sources += contenttype_sources +-gio_sources += gdbus_daemon_sources +-gio_sources += unix_sources +-gio_sources += win32_sources +-gio_sources += application_sources +-gio_sources += settings_sources +-gio_sources += gdbus_sources + gio_sources += portal_sources +-gio_sources += local_sources ++ ++if host_system != 'emscripten' ++ gio_sources += appinfo_sources ++ gio_sources += contenttype_sources ++ gio_sources += gdbus_daemon_sources ++ gio_sources += unix_sources ++ gio_sources += win32_sources ++ gio_sources += application_sources ++ gio_sources += settings_sources ++ gio_sources += gdbus_sources ++ gio_sources += local_sources ++endif + + MISSING_STUFF = ''' + # This is read by gobject-introspection/misc/ and gtk-doc +@@ -618,137 +634,142 @@ gio-2.0.lib: libgio-2.0.la gio.def + ''' + + gio_headers = files( +- 'gappinfo.h', +- 'gasyncinitable.h', +- 'gasyncresult.h', +- 'gbufferedinputstream.h', +- 'gbufferedoutputstream.h', +- 'gbytesicon.h', +- 'gcancellable.h', +- 'gcontenttype.h', +- 'gcharsetconverter.h', +- 'gconverter.h', +- 'gconverterinputstream.h', +- 'gconverteroutputstream.h', +- 'gdatagrambased.h', +- 'gdatainputstream.h', +- 'gdataoutputstream.h', +- 'gdebugcontroller.h', +- 'gdebugcontrollerdbus.h', +- 'gdrive.h', +- 'gemblem.h', +- 'gemblemedicon.h', +- 'gfile.h', +- 'gfileattribute.h', +- 'gfileenumerator.h', +- 'gfileicon.h', +- 'gfileinfo.h', +- 'gfileinputstream.h', +- 'gfilemonitor.h', +- 'gfilenamecompleter.h', +- 'gfileoutputstream.h', +- 'gfileiostream.h', +- 'gfilterinputstream.h', +- 'gfilteroutputstream.h', +- 'gicon.h', +- 'ginetaddress.h', +- 'ginetaddressmask.h', +- 'ginetsocketaddress.h', +- 'ginitable.h', +- 'ginputstream.h', ++ # 'gappinfo.h', ++ # 'gasyncinitable.h', ++ # 'gasyncresult.h', ++ # 'gbufferedinputstream.h', ++ # 'gbufferedoutputstream.h', ++ # 'gbytesicon.h', ++ # 'gcancellable.h', ++ # 'gcontenttype.h', ++ # 'gcharsetconverter.h', ++ # 'gconverter.h', ++ # 'gconverterinputstream.h', ++ # 'gconverteroutputstream.h', ++ # 'gdatagrambased.h', ++ # 'gdatainputstream.h', ++ # 'gdataoutputstream.h', ++ # 'gdebugcontroller.h', ++ # 'gdebugcontrollerdbus.h', ++ # 'gdrive.h', ++ # 'gemblem.h', ++ # 'gemblemedicon.h', ++ # 'gfile.h', ++ # 'gfileattribute.h', ++ # 'gfileenumerator.h', ++ # 'gfileicon.h', ++ # 'gfileinfo.h', ++ # 'gfileinputstream.h', ++ # 'gfilemonitor.h', ++ # 'gfilenamecompleter.h', ++ # 'gfileoutputstream.h', ++ # 'gfileiostream.h', ++ # 'gfilterinputstream.h', ++ # 'gfilteroutputstream.h', ++ # 'gicon.h', ++ # 'ginetaddress.h', ++ # 'ginetaddressmask.h', ++ # 'ginetsocketaddress.h', ++ # 'ginitable.h', ++ # 'ginputstream.h', + 'gio.h', +- 'gio-autocleanups.h', +- 'gioenums.h', +- 'gioerror.h', +- 'giomodule.h', +- 'gioscheduler.h', +- 'giostream.h', +- 'giotypes.h', +- 'gloadableicon.h', +- 'gmount.h', +- 'gmemoryinputstream.h', +- 'gmemorymonitor.h', +- 'gmemoryoutputstream.h', +- 'gmountoperation.h', +- 'gnativesocketaddress.h', +- 'gnativevolumemonitor.h', +- 'gnetworkaddress.h', +- 'gnetworkmonitor.h', +- 'gnetworkservice.h', +- 'goutputstream.h', +- 'gpermission.h', +- 'gpollableinputstream.h', +- 'gpollableoutputstream.h', +- 'gpollableutils.h', +- 'gpowerprofilemonitor.h', +- 'gproxy.h', +- 'gproxyaddress.h', +- 'gproxyaddressenumerator.h', +- 'gproxyresolver.h', +- 'gresolver.h', +- 'gresource.h', +- 'gseekable.h', +- 'gsimpleasyncresult.h', +- 'gsimpleiostream.h', +- 'gsimplepermission.h', +- 'gsimpleproxyresolver.h', +- 'gsocket.h', +- 'gsocketaddress.h', +- 'gsocketaddressenumerator.h', +- 'gsocketclient.h', +- 'gsocketconnectable.h', +- 'gsocketconnection.h', +- 'gsocketcontrolmessage.h', +- 'gsocketlistener.h', +- 'gsocketservice.h', +- 'gsrvtarget.h', +- 'gsubprocess.h', +- 'gsubprocesslauncher.h', +- 'gtask.h', +- 'gtcpconnection.h', +- 'gtcpwrapperconnection.h', +- 'gthemedicon.h', +- 'gthreadedsocketservice.h', +- 'gtlsbackend.h', +- 'gtlscertificate.h', +- 'gtlsclientconnection.h', +- 'gtlsconnection.h', +- 'gtlsdatabase.h', +- 'gtlsfiledatabase.h', +- 'gtlsinteraction.h', +- 'gtlspassword.h', +- 'gtlsserverconnection.h', +- 'gdtlsconnection.h', +- 'gdtlsclientconnection.h', +- 'gdtlsserverconnection.h', +- 'gunixconnection.h', +- 'gunixcredentialsmessage.h', +- 'gunixfdlist.h', +- 'gunixsocketaddress.h', +- 'gvfs.h', +- 'gvolume.h', +- 'gvolumemonitor.h', +- 'gzlibcompressor.h', +- 'gzlibdecompressor.h', ++ # 'gio-autocleanups.h', ++ # 'gioenums.h', ++ # 'gioerror.h', ++ # 'giomodule.h', ++ # 'gioscheduler.h', ++ # 'giostream.h', ++ # 'giotypes.h', ++ # 'gloadableicon.h', ++ # 'gmount.h', ++ # 'gmemoryinputstream.h', ++ # 'gmemorymonitor.h', ++ # 'gmemoryoutputstream.h', ++ # 'gmountoperation.h', ++ # 'gnativesocketaddress.h', ++ # 'gnativevolumemonitor.h', ++ # 'gnetworkaddress.h', ++ # 'gnetworkmonitor.h', ++ # 'gnetworkservice.h', ++ # 'goutputstream.h', ++ # 'gpermission.h', ++ # 'gpollableinputstream.h', ++ # 'gpollableoutputstream.h', ++ # 'gpollableutils.h', ++ # 'gpowerprofilemonitor.h', ++ # 'gproxy.h', ++ # 'gproxyaddress.h', ++ # 'gproxyaddressenumerator.h', ++ # 'gproxyresolver.h', ++ # 'gresolver.h', ++ # 'gresource.h', ++ # 'gseekable.h', ++ # 'gsimpleasyncresult.h', ++ # 'gsimpleiostream.h', ++ # 'gsimplepermission.h', ++ # 'gsimpleproxyresolver.h', ++ # 'gsocket.h', ++ # 'gsocketaddress.h', ++ # 'gsocketaddressenumerator.h', ++ # 'gsocketclient.h', ++ # 'gsocketconnectable.h', ++ # 'gsocketconnection.h', ++ # 'gsocketcontrolmessage.h', ++ # 'gsocketlistener.h', ++ # 'gsocketservice.h', ++ # 'gsrvtarget.h', ++ # 'gsubprocess.h', ++ # 'gsubprocesslauncher.h', ++ # 'gtask.h', ++ # 'gtcpconnection.h', ++ # 'gtcpwrapperconnection.h', ++ # 'gthemedicon.h', ++ # 'gthreadedsocketservice.h', ++ # 'gtlsbackend.h', ++ # 'gtlscertificate.h', ++ # 'gtlsclientconnection.h', ++ # 'gtlsconnection.h', ++ # 'gtlsdatabase.h', ++ # 'gtlsfiledatabase.h', ++ # 'gtlsinteraction.h', ++ # 'gtlspassword.h', ++ # 'gtlsserverconnection.h', ++ # 'gdtlsconnection.h', ++ # 'gdtlsclientconnection.h', ++ # 'gdtlsserverconnection.h', ++ # 'gunixconnection.h', ++ # 'gunixcredentialsmessage.h', ++ # 'gunixfdlist.h', ++ # 'gunixsocketaddress.h', ++ # 'gvfs.h', ++ # 'gvolume.h', ++ # 'gvolumemonitor.h', ++ # 'gzlibcompressor.h', ++ # 'gzlibdecompressor.h', + 'glistmodel.h', +- 'gliststore.h', ++ # 'gliststore.h', + ) + +-gio_visibility_h = custom_target( +- output: 'gio-visibility.h', +- command: [gen_visibility_macros, meson.project_version(), 'visibility-macros', 'GIO', '@OUTPUT@'], +- install: true, +- install_dir: gio_includedir, +- # FIXME: Not needed with Meson >= 0.64.0 +- install_tag: 'devel', +-) +-gio_sources += gio_visibility_h ++if host_system != 'emscripten' ++ gio_visibility_h = custom_target( ++ output: 'gio-visibility.h', ++ command: [gen_visibility_macros, meson.project_version(), 'visibility-macros', 'GIO', '@OUTPUT@'], ++ install: true, ++ install_dir: gio_includedir, ++ # FIXME: Not needed with Meson >= 0.64.0 ++ install_tag: 'devel', ++ ) ++ gio_sources += gio_visibility_h ++ ++ gio_headers += application_headers ++ gio_headers += settings_headers ++ gio_headers += gdbus_headers ++endif + +-gio_headers += application_headers +-gio_headers += settings_headers +-gio_headers += gdbus_headers + install_headers(gio_headers, install_dir : gio_includedir) + ++# TODO Handle gnetworking and visibility in the sections below. ++# + # We can't use gnome.mkenums() because the GNOME module looks for glib-mkenums + # in PATH, which means you can't bootstrap glib with its own glib-mkenums. + gioenumtypes_h = custom_target('gioenumtypes_h', +@@ -761,7 +782,7 @@ gioenumtypes_h = custom_target('gioenumtypes_h', + install_tag: 'devel', + command : [python, glib_mkenums, + '--template', files('gioenumtypes.h.template'), +- '@INPUT@', gnetworking_h]) ++ '@INPUT@'])#, gnetworking_h]) + + gioenumtypes_c = custom_target('gioenumtypes_c', + output : 'gioenumtypes.c', +@@ -770,9 +791,9 @@ gioenumtypes_c = custom_target('gioenumtypes_c', + depends : [gioenumtypes_h], + command : [python, glib_mkenums, + '--template', files('gioenumtypes.c.template'), +- '@INPUT@', gnetworking_h]) ++ '@INPUT@'])#, gnetworking_h]) + +-gioenumtypes_dep = declare_dependency(sources : [gioenumtypes_h, glib_enumtypes_h, gio_visibility_h]) ++gioenumtypes_dep = declare_dependency(sources : [gioenumtypes_h, glib_enumtypes_h])#, gio_visibility_h]) + + # inotify + if glib_conf.has('HAVE_SYS_INOTIFY_H') and have_func_inotify_init1 +@@ -823,8 +844,12 @@ else + gio_dtrace_hdr = [] + endif + ++# TODO Handle gnetworking and gvdb_dep + libgio = library('gio-2.0', +- gioenumtypes_h, gioenumtypes_c, gnetworking_h, gio_sources, ++ gioenumtypes_h, ++ gioenumtypes_c, ++ # gnetworking_h, ++ gio_sources, + gio_dtrace_hdr, gio_dtrace_obj, + version : library_version, + soversion : soversion, +@@ -836,7 +861,7 @@ libgio = library('gio-2.0', + dependencies : [libz_dep, libdl_dep, libmount_dep, libglib_dep, + libgobject_dep, libgmodule_dep, selinux_dep, xattr_dep, + platform_deps, network_libs, libsysprof_capture_dep, +- gioenumtypes_dep, gvdb_dep], ++ gioenumtypes_dep], #, gvdb_dep], + c_args : [gio_c_args, gio_c_args_internal], + objc_args : [gio_c_args, gio_c_args_internal], + gnu_symbol_visibility : 'hidden', +@@ -844,11 +869,11 @@ libgio = library('gio-2.0', + link_args : [noseh_link_args, glib_link_flags], + ) + +-if get_option('gio_module_dir') != '' +- pkgconfig_giomodulesdir = join_paths('${prefix}', get_option('gio_module_dir')) +-else +- pkgconfig_giomodulesdir = join_paths('${libdir}', 'gio', 'modules') +-endif ++# if get_option('gio_module_dir') != '' ++# pkgconfig_giomodulesdir = join_paths('${prefix}', get_option('gio_module_dir')) ++# else ++# pkgconfig_giomodulesdir = join_paths('${libdir}', 'gio', 'modules') ++# endif + + schemas_subdir = join_paths('glib-2.0', 'schemas') + +@@ -857,7 +882,6 @@ libgio_dep = declare_dependency(link_with : libgio, + include_directories : [gioinc], + variables : [ + 'schemasdir=' + join_paths(glib_datadir, schemas_subdir), +- 'giomoduledir=' + glib_giomodulesdir, + ], + ) + +@@ -866,15 +890,15 @@ pkg.generate(libgio, + variables : ['datadir=' + join_paths('${prefix}', get_option('datadir')), + 'schemasdir=' + join_paths('${datadir}', schemas_subdir), + 'bindir=' + join_paths('${prefix}', get_option('bindir')), +- 'giomoduledir=' + pkgconfig_giomodulesdir, ++ #'giomoduledir=' + pkgconfig_giomodulesdir, + 'gio=' + join_paths('${bindir}', 'gio'), +- 'gio_querymodules=@0@'.format(pkgconfig_multiarch_bindir / 'gio-querymodules'), ++ #'gio_querymodules=@0@'.format(pkgconfig_multiarch_bindir / 'gio-querymodules'), + 'glib_compile_schemas=@0@'.format(pkgconfig_multiarch_bindir / 'glib-compile-schemas'), + 'glib_compile_resources=' + join_paths('${bindir}', 'glib-compile-resources'), + 'gdbus=' + join_paths('${bindir}', 'gdbus'), +- 'gdbus_codegen=' + join_paths('${bindir}', 'gdbus-codegen'), +- 'gresource=' + join_paths('${bindir}', 'gresource'), +- 'gsettings=' + join_paths('${bindir}', 'gsettings')], ++ # 'gdbus_codegen=' + join_paths('${bindir}', 'gdbus-codegen'), ++ 'gresource=' + join_paths('${bindir}', 'gresource')], ++ # 'gsettings=' + join_paths('${bindir}', 'gsettings')], + version : glib_version, + install_dir : glib_pkgconfigreldir, + filebase : 'gio-2.0', +@@ -951,9 +975,9 @@ if enable_systemtap + ) + endif + +-if build_tests +- subdir('tests') +-endif ++# if host_system not in ['emscripten'] ++# subdir('tests') ++# endif + + # The following is an example for building internal marshallers that are used + # by GIO. We cannot guarantee glib-genmarshal availability while building GLib +diff --git a/glib/garray.c b/glib/garray.c +index deef2ca8a..7375fcc93 100644 +--- a/glib/garray.c ++++ b/glib/garray.c +@@ -506,6 +506,11 @@ g_array_unref (GArray *array) + if (g_atomic_ref_count_dec (&rarray->ref_count)) + array_free (rarray, FREE_SEGMENT); + } ++void ++g_array_unref_adapter (gpointer array) ++{ ++ g_array_unref ((GArray*) array); ++} + + /** + * g_array_get_element_size: +@@ -1865,6 +1870,11 @@ g_ptr_array_unref (GPtrArray *array) + if (g_atomic_ref_count_dec (&rarray->ref_count)) + ptr_array_free (array, FREE_SEGMENT); + } ++void ++g_ptr_array_unref_adapter (gpointer array) ++{ ++ g_ptr_array_unref ((GPtrArray*) array); ++} + + /** + * g_ptr_array_free: +@@ -2499,7 +2509,7 @@ g_ptr_array_insert (GPtrArray *array, + */ + void + g_ptr_array_sort (GPtrArray *array, +- GCompareFunc compare_func) ++ GCompareDataFunc compare_func) + { + g_return_if_fail (array != NULL); + +@@ -2508,7 +2518,7 @@ g_ptr_array_sort (GPtrArray *array, + g_qsort_with_data (array->pdata, + array->len, + sizeof (gpointer), +- (GCompareDataFunc)compare_func, ++ compare_func, + NULL); + } + +@@ -2983,6 +2993,11 @@ g_byte_array_unref (GByteArray *array) + { + g_array_unref ((GArray *)array); + } ++void ++g_byte_array_unref_adapter (gpointer array) ++{ ++ g_byte_array_unref ((GByteArray*) array); ++} + + /** + * g_byte_array_append: +diff --git a/glib/garray.h b/glib/garray.h +index 5dc32b2a7..ace6139bc 100644 +--- a/glib/garray.h ++++ b/glib/garray.h +@@ -98,6 +98,7 @@ GLIB_AVAILABLE_IN_ALL + GArray *g_array_ref (GArray *array); + GLIB_AVAILABLE_IN_ALL + void g_array_unref (GArray *array); ++void g_array_unref_adapter (gpointer array); + GLIB_AVAILABLE_IN_ALL + guint g_array_get_element_size (GArray *array); + GLIB_AVAILABLE_IN_ALL +@@ -192,6 +193,7 @@ GLIB_AVAILABLE_IN_ALL + GPtrArray* g_ptr_array_ref (GPtrArray *array); + GLIB_AVAILABLE_IN_ALL + void g_ptr_array_unref (GPtrArray *array); ++void g_ptr_array_unref_adapter (gpointer array); + GLIB_AVAILABLE_IN_ALL + void g_ptr_array_set_free_func (GPtrArray *array, + GDestroyNotify element_free_func); +@@ -237,7 +239,7 @@ void g_ptr_array_insert (GPtrArray *array, + gpointer data); + GLIB_AVAILABLE_IN_ALL + void g_ptr_array_sort (GPtrArray *array, +- GCompareFunc compare_func); ++ GCompareDataFunc compare_func); + GLIB_AVAILABLE_IN_ALL + void g_ptr_array_sort_with_data (GPtrArray *array, + GCompareDataFunc compare_func, +@@ -289,6 +291,7 @@ GLIB_AVAILABLE_IN_ALL + GByteArray *g_byte_array_ref (GByteArray *array); + GLIB_AVAILABLE_IN_ALL + void g_byte_array_unref (GByteArray *array); ++void g_byte_array_unref_adapter (gpointer array); + GLIB_AVAILABLE_IN_ALL + GByteArray* g_byte_array_append (GByteArray *array, + const guint8 *data, +diff --git a/glib/gbookmarkfile.c b/glib/gbookmarkfile.c +index 3988e3653..f494cbc88 100644 +--- a/glib/gbookmarkfile.c ++++ b/glib/gbookmarkfile.c +@@ -51,6 +51,11 @@ + #include "gtimer.h" + #include "gutils.h" + ++static gpointer g_strdup_adapter(gconstpointer data, gpointer dummy G_GNUC_UNUSED) ++{ ++ gchar* result = g_strdup((gchar*) data); ++ return (gpointer) result; ++} + + /** + * SECTION:bookmarkfile +@@ -286,6 +291,11 @@ bookmark_app_info_free (BookmarkAppInfo *app_info) + + g_slice_free (BookmarkAppInfo, app_info); + } ++static void ++bookmark_app_info_free_adapter (gpointer app_info) ++{ ++ bookmark_app_info_free ((BookmarkAppInfo*) app_info); ++} + + static BookmarkAppInfo * + bookmark_app_info_copy (BookmarkAppInfo *app_info) +@@ -304,6 +314,12 @@ bookmark_app_info_copy (BookmarkAppInfo *app_info) + + return copy; + } ++static gpointer ++bookmark_app_info_copy_adapter (gconstpointer app_info, gpointer dummy G_GNUC_UNUSED) ++{ ++ BookmarkAppInfo* result = bookmark_app_info_copy ((BookmarkAppInfo*) app_info); ++ return (gpointer) result; ++} + + static gchar * + bookmark_app_info_dump (BookmarkAppInfo *app_info) +@@ -390,7 +406,7 @@ bookmark_metadata_free (BookmarkMetadata *metadata) + g_free (metadata->mime_type); + + g_list_free_full (metadata->groups, g_free); +- g_list_free_full (metadata->applications, (GDestroyNotify) bookmark_app_info_free); ++ g_list_free_full (metadata->applications, bookmark_app_info_free_adapter); + + g_hash_table_destroy (metadata->apps_by_name); + +@@ -415,9 +431,9 @@ bookmark_metadata_copy (BookmarkMetadata *metadata) + copy->icon_href = g_strdup (metadata->icon_href); + copy->icon_mime = g_strdup (metadata->icon_mime); + +- copy->groups = g_list_copy_deep (metadata->groups, (GCopyFunc) g_strdup, NULL); ++ copy->groups = g_list_copy_deep (metadata->groups, g_strdup_adapter, NULL); + copy->applications = +- g_list_copy_deep (metadata->applications, (GCopyFunc) bookmark_app_info_copy, NULL); ++ g_list_copy_deep (metadata->applications, bookmark_app_info_copy_adapter, NULL); + + for (l = copy->applications; l; l = l->next) + { +@@ -604,6 +620,11 @@ bookmark_item_free (BookmarkItem *item) + + g_slice_free (BookmarkItem, item); + } ++static void ++bookmark_item_free_adapter (gpointer item) ++{ ++ bookmark_item_free ((BookmarkItem*) item); ++} + + static BookmarkItem * + bookmark_item_copy (BookmarkItem *item) +@@ -629,6 +650,12 @@ bookmark_item_copy (BookmarkItem *item) + + return copy; + } ++static gpointer ++bookmark_item_copy_adapter (gconstpointer item, gpointer dummy G_GNUC_UNUSED) ++{ ++ BookmarkItem* result = bookmark_item_copy ((BookmarkItem*) item); ++ return (gpointer) result; ++} + + static void + bookmark_item_touch_modified (BookmarkItem *item) +@@ -780,7 +807,7 @@ g_bookmark_file_clear (GBookmarkFile *bookmark) + g_free (bookmark->title); + g_free (bookmark->description); + +- g_list_free_full (bookmark->items, (GDestroyNotify) bookmark_item_free); ++ g_list_free_full (bookmark->items, bookmark_item_free_adapter); + bookmark->items = NULL; + + g_clear_pointer (&bookmark->items_by_uri, g_hash_table_unref); +@@ -820,6 +847,11 @@ parse_data_free (ParseData *parse_data) + + g_free (parse_data); + } ++static void ++parse_data_free_adapter (gpointer parse_data) ++{ ++ parse_data_free ((ParseData*) parse_data); ++} + + #define IS_ATTRIBUTE(s,a) ((0 == strcmp ((s), (a)))) + +@@ -1594,7 +1626,7 @@ g_bookmark_file_parse (GBookmarkFile *bookmark, + context = g_markup_parse_context_new (&markup_parser, + G_MARKUP_DEFAULT_FLAGS, + parse_data, +- (GDestroyNotify) parse_data_free); ++ parse_data_free_adapter); + + retval = g_markup_parse_context_parse (context, + buffer, +@@ -1775,7 +1807,7 @@ g_bookmark_file_copy (GBookmarkFile *bookmark) + copy = g_bookmark_file_new (); + copy->title = g_strdup (bookmark->title); + copy->description = g_strdup (bookmark->description); +- copy->items = g_list_copy_deep (bookmark->items, (GCopyFunc) bookmark_item_copy, NULL); ++ copy->items = g_list_copy_deep (bookmark->items, bookmark_item_copy_adapter, NULL); + + for (l = copy->items; l; l = l->next) + { +@@ -1807,6 +1839,11 @@ g_bookmark_file_free (GBookmarkFile *bookmark) + + g_free (bookmark); + } ++void ++g_bookmark_file_free_adapter (gpointer bookmark) ++{ ++ g_bookmark_file_free ((GBookmarkFile*) bookmark); ++} + + /** + * g_bookmark_file_load_from_data: +diff --git a/glib/gbookmarkfile.h b/glib/gbookmarkfile.h +index f753420ed..d47e692ed 100644 +--- a/glib/gbookmarkfile.h ++++ b/glib/gbookmarkfile.h +@@ -83,6 +83,7 @@ GLIB_AVAILABLE_IN_ALL + GBookmarkFile *g_bookmark_file_new (void); + GLIB_AVAILABLE_IN_ALL + void g_bookmark_file_free (GBookmarkFile *bookmark); ++void g_bookmark_file_free_adapter (gpointer bookmark); + + GLIB_AVAILABLE_IN_2_76 + GBookmarkFile *g_bookmark_file_copy (GBookmarkFile *bookmark); +diff --git a/glib/gbytes.c b/glib/gbytes.c +index e4d269710..1698b98c6 100644 +--- a/glib/gbytes.c ++++ b/glib/gbytes.c +@@ -247,7 +247,7 @@ g_bytes_new_from_bytes (GBytes *bytes, + g_return_val_if_fail (base + length <= (gchar *)bytes->data + bytes->size, NULL); + + return g_bytes_new_with_free_func (base, length, +- (GDestroyNotify)g_bytes_unref, g_bytes_ref (bytes)); ++ g_bytes_unref_adapter, g_bytes_ref (bytes)); + } + + /** +@@ -328,6 +328,11 @@ g_bytes_ref (GBytes *bytes) + * Since: 2.32 + */ + void ++g_bytes_unref_adapter (gpointer bytes) ++{ ++ g_bytes_unref ((GBytes*) bytes); ++} ++void + g_bytes_unref (GBytes *bytes) + { + if (bytes == NULL) +@@ -611,4 +616,4 @@ g_bytes_get_region (GBytes *bytes, + */ + + return ((guchar *) bytes->data) + offset; +-} +\ No newline at end of file ++} +diff --git a/glib/gbytes.h b/glib/gbytes.h +index d93498943..70f48259c 100644 +--- a/glib/gbytes.h ++++ b/glib/gbytes.h +@@ -67,6 +67,7 @@ GLIB_AVAILABLE_IN_ALL + GBytes * g_bytes_ref (GBytes *bytes); + + GLIB_AVAILABLE_IN_ALL ++void g_bytes_unref_adapter (gpointer bytes); + void g_bytes_unref (GBytes *bytes); + + GLIB_AVAILABLE_IN_ALL +diff --git a/glib/gcharset.c b/glib/gcharset.c +index 82cd0a7b8..cd263eaab 100644 +--- a/glib/gcharset.c ++++ b/glib/gcharset.c +@@ -795,7 +795,7 @@ g_get_language_names (void) + const gchar * const * + g_get_language_names_with_category (const gchar *category_name) + { +- static GPrivate cache_private = G_PRIVATE_INIT ((void (*)(gpointer)) g_hash_table_unref); ++ static GPrivate cache_private = G_PRIVATE_INIT (g_hash_table_unref_adapter); + GHashTable *cache = g_private_get (&cache_private); + const gchar *languages; + GLanguageNamesCache *name_cache; +diff --git a/glib/gchecksum.c b/glib/gchecksum.c +index fea7803cd..f5aa14a09 100644 +--- a/glib/gchecksum.c ++++ b/glib/gchecksum.c +@@ -1569,6 +1569,11 @@ g_checksum_free (GChecksum *checksum) + g_slice_free (GChecksum, checksum); + } + } ++void ++g_checksum_free_adapter (gpointer checksum) ++{ ++ g_checksum_free ((GChecksum*) checksum); ++} + + /** + * g_checksum_update: +diff --git a/glib/gchecksum.h b/glib/gchecksum.h +index e5c54e7c7..e035ed17b 100644 +--- a/glib/gchecksum.h ++++ b/glib/gchecksum.h +@@ -77,6 +77,7 @@ GLIB_AVAILABLE_IN_ALL + GChecksum * g_checksum_copy (const GChecksum *checksum); + GLIB_AVAILABLE_IN_ALL + void g_checksum_free (GChecksum *checksum); ++void g_checksum_free_adapter (gpointer checksum); + GLIB_AVAILABLE_IN_ALL + void g_checksum_update (GChecksum *checksum, + const guchar *data, +diff --git a/glib/gconstructor.h b/glib/gconstructor.h +index 29509e4a4..f8575b143 100644 +--- a/glib/gconstructor.h ++++ b/glib/gconstructor.h +@@ -51,7 +51,7 @@ + + #define G_HAS_CONSTRUCTORS 1 + +-#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void); ++#define G_DEFINE_CONSTRUCTOR(_func, priority) static void __attribute__((constructor(priority))) _func (void); + #define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void); + + #elif defined (_MSC_VER) && (_MSC_VER >= 1500) +diff --git a/glib/gdate.c b/glib/gdate.c +index 85892ec9b..e91ef6f18 100644 +--- a/glib/gdate.c ++++ b/glib/gdate.c +@@ -365,6 +365,11 @@ g_date_free (GDate *date) + + g_free (date); + } ++void ++g_date_free_adapter (gpointer date) ++{ ++ g_date_free((GDate*) date); ++} + + /** + * g_date_copy: +diff --git a/glib/gdate.h b/glib/gdate.h +index 5ef21cbf9..c8c9d30ae 100644 +--- a/glib/gdate.h ++++ b/glib/gdate.h +@@ -129,6 +129,7 @@ GLIB_AVAILABLE_IN_ALL + GDate* g_date_new_julian (guint32 julian_day); + GLIB_AVAILABLE_IN_ALL + void g_date_free (GDate *date); ++void g_date_free_adapter (gpointer date); + GLIB_AVAILABLE_IN_2_56 + GDate* g_date_copy (const GDate *date); + +diff --git a/glib/gdatetime.c b/glib/gdatetime.c +index 2640e3b24..1b310c93d 100644 +--- a/glib/gdatetime.c ++++ b/glib/gdatetime.c +@@ -726,6 +726,11 @@ g_date_time_unref (GDateTime *datetime) + g_slice_free (GDateTime, datetime); + } + } ++void ++g_date_time_unref_adapter (gpointer datetime) ++{ ++ g_date_time_unref((GDateTime*) datetime); ++} + + /* Internal state transformers {{{1 */ + /*< internal > +diff --git a/glib/gdatetime.h b/glib/gdatetime.h +index 4312433bd..24c958a47 100644 +--- a/glib/gdatetime.h ++++ b/glib/gdatetime.h +@@ -99,6 +99,7 @@ typedef struct _GDateTime GDateTime; + + GLIB_AVAILABLE_IN_ALL + void g_date_time_unref (GDateTime *datetime); ++void g_date_time_unref_adapter (gpointer datetime); + GLIB_AVAILABLE_IN_ALL + GDateTime * g_date_time_ref (GDateTime *datetime); + +diff --git a/glib/gdir.c b/glib/gdir.c +index c9283dea4..bbabf6941 100644 +--- a/glib/gdir.c ++++ b/glib/gdir.c +@@ -305,6 +305,11 @@ g_dir_close (GDir *dir) + #endif + g_free (dir); + } ++void ++g_dir_close_adapter (gpointer dir) ++{ ++ g_dir_close ((GDir*) dir); ++} + + #ifdef G_OS_WIN32 + +diff --git a/glib/gdir.h b/glib/gdir.h +index 0d3ee82b3..b8da6de96 100644 +--- a/glib/gdir.h ++++ b/glib/gdir.h +@@ -48,6 +48,7 @@ GLIB_AVAILABLE_IN_ALL + void g_dir_rewind (GDir *dir); + GLIB_AVAILABLE_IN_ALL + void g_dir_close (GDir *dir); ++void g_dir_close_adapter (gpointer dir); + + G_END_DECLS + +diff --git a/glib/gerror.c b/glib/gerror.c +index 7ac85fc66..d577d9d05 100644 +--- a/glib/gerror.c ++++ b/glib/gerror.c +@@ -872,6 +872,11 @@ g_error_free (GError *error) + #endif + g_slice_free1 (private_size + sizeof (GError), allocated); + } ++void ++g_error_free_adapter (gpointer error) ++{ ++ g_error_free ((GError*) error); ++} + + /** + * g_error_copy: +diff --git a/glib/gerror.h b/glib/gerror.h +index 1aebfbeb9..22b597bda 100644 +--- a/glib/gerror.h ++++ b/glib/gerror.h +@@ -206,6 +206,7 @@ GError* g_error_new_valist (GQuark domain, + + GLIB_AVAILABLE_IN_ALL + void g_error_free (GError *error); ++void g_error_free_adapter (gpointer error); + GLIB_AVAILABLE_IN_ALL + GError* g_error_copy (const GError *error); + +diff --git a/glib/ghash.c b/glib/ghash.c +index 132e3ac5e..518458272 100644 +--- a/glib/ghash.c ++++ b/glib/ghash.c +@@ -1496,6 +1496,11 @@ g_hash_table_unref (GHashTable *hash_table) + g_slice_free (GHashTable, hash_table); + } + } ++void ++g_hash_table_unref_adapter (gpointer hash_table) ++{ ++ g_hash_table_unref ((GHashTable*) hash_table); ++} + + /** + * g_hash_table_destroy: +diff --git a/glib/ghash.h b/glib/ghash.h +index 3eb8f3be0..f9a5dc6a3 100644 +--- a/glib/ghash.h ++++ b/glib/ghash.h +@@ -160,6 +160,7 @@ void g_hash_table_iter_steal (GHashTableIter *iter); + GLIB_AVAILABLE_IN_ALL + GHashTable* g_hash_table_ref (GHashTable *hash_table); + GLIB_AVAILABLE_IN_ALL ++void g_hash_table_unref_adapter (gpointer hash_table); + void g_hash_table_unref (GHashTable *hash_table); + + #define g_hash_table_freeze(hash_table) ((void)0) GLIB_DEPRECATED_MACRO_IN_2_26 +diff --git a/glib/giochannel.c b/glib/giochannel.c +index 7572c47a2..3eb879a50 100644 +--- a/glib/giochannel.c ++++ b/glib/giochannel.c +@@ -257,6 +257,11 @@ g_io_channel_unref (GIOChannel *channel) + channel->funcs->io_free (channel); + } + } ++void ++g_io_channel_unref_adapter (gpointer channel) ++{ ++ g_io_channel_unref ((GIOChannel*) channel); ++} + + static GIOError + g_io_error_get_from_g_error (GIOStatus status, +@@ -642,7 +647,7 @@ guint + g_io_add_watch_full (GIOChannel *channel, + gint priority, + GIOCondition condition, +- GIOFunc func, ++ GSourceFunc func, + gpointer user_data, + GDestroyNotify notify) + { +@@ -655,7 +660,7 @@ g_io_add_watch_full (GIOChannel *channel, + + if (priority != G_PRIORITY_DEFAULT) + g_source_set_priority (source, priority); +- g_source_set_callback (source, (GSourceFunc)func, user_data, notify); ++ g_source_set_callback (source, func, user_data, notify); + + id = g_source_attach (source, NULL); + g_source_unref (source); +@@ -663,6 +668,7 @@ g_io_add_watch_full (GIOChannel *channel, + return id; + } + ++#ifndef __EMSCRIPTEN__ + /** + * g_io_add_watch: + * @channel: a #GIOChannel +@@ -709,6 +715,7 @@ g_io_add_watch (GIOChannel *channel, + { + return g_io_add_watch_full (channel, G_PRIORITY_DEFAULT, condition, func, user_data, NULL); + } ++#endif /* !__EMSCRIPTEN__ */ + + /** + * g_io_channel_get_buffer_condition: +diff --git a/glib/giochannel.h b/glib/giochannel.h +index 913019cd4..9593f2ec2 100644 +--- a/glib/giochannel.h ++++ b/glib/giochannel.h +@@ -164,6 +164,7 @@ GLIB_AVAILABLE_IN_ALL + GIOChannel *g_io_channel_ref (GIOChannel *channel); + GLIB_AVAILABLE_IN_ALL + void g_io_channel_unref (GIOChannel *channel); ++void g_io_channel_unref_adapter (gpointer channel); + + GLIB_DEPRECATED_FOR(g_io_channel_read_chars) + GIOError g_io_channel_read (GIOChannel *channel, +@@ -193,7 +194,7 @@ GLIB_AVAILABLE_IN_ALL + guint g_io_add_watch_full (GIOChannel *channel, + gint priority, + GIOCondition condition, +- GIOFunc func, ++ GSourceFunc func, + gpointer user_data, + GDestroyNotify notify); + GLIB_AVAILABLE_IN_ALL +diff --git a/glib/giounix.c b/glib/giounix.c +index 9d9492b28..e7e6deaf7 100644 +--- a/glib/giounix.c ++++ b/glib/giounix.c +@@ -158,6 +158,10 @@ g_io_unix_dispatch (GSource *source, + gpointer user_data) + + { ++#ifdef __EMSCRIPTEN__ ++ fprintf(stderr, "%s (%d): I commented this out - ARL\n", __FUNCTION__, __LINE__); ++ return FALSE; ++#else + GIOFunc func = (GIOFunc)callback; + GIOUnixWatch *watch = (GIOUnixWatch *)source; + GIOCondition buffer_condition = g_io_channel_get_buffer_condition (watch->channel); +@@ -168,10 +172,11 @@ g_io_unix_dispatch (GSource *source, + "You must call g_source_connect()."); + return FALSE; + } +- ++ + return (*func) (watch->channel, + (watch->pollfd.revents | buffer_condition) & watch->condition, + user_data); ++#endif + } + + static void +diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c +index 9a4821bc5..613d09f28 100644 +--- a/glib/gkeyfile.c ++++ b/glib/gkeyfile.c +@@ -584,6 +584,7 @@ static gboolean g_key_file_is_group_name (const gchar *nam + static gboolean g_key_file_is_key_name (const gchar *name, + gsize len); + static void g_key_file_key_value_pair_free (GKeyFileKeyValuePair *pair); ++static void g_key_file_key_value_pair_free_adapter (gpointer pair); + static gboolean g_key_file_line_is_comment (const gchar *line); + static gboolean g_key_file_line_is_group (const gchar *line); + static gboolean g_key_file_line_is_key_value_pair (const gchar *line); +@@ -1230,6 +1231,11 @@ g_key_file_unref (GKeyFile *key_file) + g_slice_free (GKeyFile, key_file); + } + } ++void ++g_key_file_unref_adapter (gpointer key_file) ++{ ++ g_key_file_unref ((GKeyFile*) key_file); ++} + + /* If G_KEY_FILE_KEEP_TRANSLATIONS is not set, only returns + * true for locales that match those in g_get_language_names(). +@@ -3410,7 +3416,7 @@ g_key_file_set_top_comment (GKeyFile *key_file, + /* Note all keys must be comments at the top of + * the file, so we can just free it all. + */ +- g_list_free_full (group->key_value_pairs, (GDestroyNotify) g_key_file_key_value_pair_free); ++ g_list_free_full (group->key_value_pairs, g_key_file_key_value_pair_free_adapter); + group->key_value_pairs = NULL; + + if (comment == NULL) +@@ -3855,17 +3861,6 @@ g_key_file_add_group (GKeyFile *key_file, + g_hash_table_insert (key_file->group_hash, (gpointer)group->name, group); + } + +-static void +-g_key_file_key_value_pair_free (GKeyFileKeyValuePair *pair) +-{ +- if (pair != NULL) +- { +- g_free (pair->key); +- g_free (pair->value); +- g_slice_free (GKeyFileKeyValuePair, pair); +- } +-} +- + /* Be careful not to call this function on a node with data in the + * lookup map without removing it from the lookup map, first. + * +@@ -4231,6 +4226,22 @@ g_key_file_is_key_name (const gchar *name, + return TRUE; + } + ++static void ++g_key_file_key_value_pair_free (GKeyFileKeyValuePair *pair) ++{ ++ if (pair != NULL) ++ { ++ g_free (pair->key); ++ g_free (pair->value); ++ g_slice_free (GKeyFileKeyValuePair, pair); ++ } ++} ++static void ++g_key_file_key_value_pair_free_adapter (gpointer pair) ++{ ++ g_key_file_key_value_pair_free ((GKeyFileKeyValuePair*) pair); ++} ++ + /* A group in a key file is made up of a starting '[' followed by one + * or more letters making up the group name followed by ']'. + */ +diff --git a/glib/gkeyfile.h b/glib/gkeyfile.h +index 9d026d681..0e380729d 100644 +--- a/glib/gkeyfile.h ++++ b/glib/gkeyfile.h +@@ -62,6 +62,7 @@ GLIB_AVAILABLE_IN_ALL + GKeyFile *g_key_file_ref (GKeyFile *key_file); + GLIB_AVAILABLE_IN_ALL + void g_key_file_unref (GKeyFile *key_file); ++void g_key_file_unref_adapter (gpointer key_file); + GLIB_AVAILABLE_IN_ALL + void g_key_file_free (GKeyFile *key_file); + GLIB_AVAILABLE_IN_ALL +diff --git a/glib/glib-autocleanups.h b/glib/glib-autocleanups.h +index 1edbe2b13..014e9bb94 100644 +--- a/glib/glib-autocleanups.h ++++ b/glib/glib-autocleanups.h +@@ -36,6 +36,11 @@ g_autoptr_cleanup_gstring_free (GString *string) + if (string) + g_string_free (string, TRUE); + } ++static inline void ++g_autoptr_cleanup_gstring_free_adapter (gpointer string) ++{ ++ g_autoptr_cleanup_gstring_free ((GString*) string); ++} + + /* Ignore deprecations in case we refer to a type which was added in a more + * recent GLib version than the user’s #GLIB_VERSION_MAX_ALLOWED definition. */ +@@ -44,62 +49,69 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS + /* If adding a cleanup here, please also add a test case to + * glib/tests/autoptr.c + */ ++ ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GList, g_list_free_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GThread, g_thread_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBytes, g_bytes_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHashTable, g_hash_table_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSList, g_slist_free_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GArray, g_array_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPtrArray, g_ptr_array_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GByteArray, g_byte_array_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContext, g_main_context_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContextPusher, g_main_context_pusher_free_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainLoop, g_main_loop_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSource, g_source_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GString, g_autoptr_cleanup_gstring_free_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GQueue, g_queue_free_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDateTime, g_date_time_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDate, g_date_free_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GIOChannel, g_io_channel_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDir, g_dir_close_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBookmarkFile, g_bookmark_file_free_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GChecksum, g_checksum_free_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GError, g_error_free_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GKeyFile, g_key_file_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMappedFile, g_mapped_file_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMarkupParseContext, g_markup_parse_context_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimer, g_timer_destroy_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimeZone, g_time_zone_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTree, g_tree_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariant, g_variant_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantBuilder, g_variant_builder_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantIter, g_variant_iter_free_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantDict, g_variant_dict_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantType, g_variant_type_free_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMutexLocker, g_mutex_locker_free_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRecMutexLocker, g_rec_mutex_locker_free_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRWLockWriterLocker, g_rw_lock_writer_locker_free_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRWLockReaderLocker, g_rw_lock_reader_locker_free_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPatternSpec, g_pattern_spec_free_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GScanner, g_scanner_destroy_adapter) ++G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GStrv, g_strfreev, NULL) ++ ++G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantBuilder, g_variant_builder_clear) ++G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantDict, g_variant_dict_clear) ++G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GMutex, g_mutex_clear) ++G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GQueue, g_queue_clear) ++G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GCond, g_cond_clear) ++ ++#ifndef __EMSCRIPTEN__ ++ ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRefString, g_ref_string_release_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GStrvBuilder, g_strv_builder_unref) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GStringChunk, g_string_chunk_free) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncQueue, g_async_queue_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBookmarkFile, g_bookmark_file_free) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBytes, g_bytes_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GChecksum, g_checksum_free) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDateTime, g_date_time_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDate, g_date_free) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDir, g_dir_close) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GError, g_error_free) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHashTable, g_hash_table_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHmac, g_hmac_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GIOChannel, g_io_channel_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GKeyFile, g_key_file_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GList, g_list_free) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GArray, g_array_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPtrArray, g_ptr_array_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GByteArray, g_byte_array_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContext, g_main_context_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContextPusher, g_main_context_pusher_free) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainLoop, g_main_loop_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSource, g_source_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMappedFile, g_mapped_file_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMarkupParseContext, g_markup_parse_context_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNode, g_node_destroy) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionContext, g_option_context_free) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionGroup, g_option_group_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPatternSpec, g_pattern_spec_free) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GQueue, g_queue_free) +-G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GQueue, g_queue_clear) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRand, g_rand_free) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GScanner, g_scanner_destroy) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSequence, g_sequence_free) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSList, g_slist_free) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GString, g_autoptr_cleanup_gstring_free) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GStringChunk, g_string_chunk_free) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GStrvBuilder, g_strv_builder_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GThread, g_thread_unref) +-G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GMutex, g_mutex_clear) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMutexLocker, g_mutex_locker_free) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRecMutexLocker, g_rec_mutex_locker_free) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRWLockWriterLocker, g_rw_lock_writer_locker_free) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRWLockReaderLocker, g_rw_lock_reader_locker_free) +-G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GCond, g_cond_clear) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimer, g_timer_destroy) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimeZone, g_time_zone_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTree, g_tree_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariant, g_variant_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantBuilder, g_variant_builder_unref) +-G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantBuilder, g_variant_builder_clear) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantIter, g_variant_iter_free) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantDict, g_variant_dict_unref) +-G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantDict, g_variant_dict_clear) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantType, g_variant_type_free) +-G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GStrv, g_strfreev, NULL) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRefString, g_ref_string_release) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRand, g_rand_free) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUri, g_uri_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC (GPathBuf, g_path_buf_free) + G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (GPathBuf, g_path_buf_clear) + ++#endif /* !__EMSCRIPTEN__ */ ++ + G_GNUC_END_IGNORE_DEPRECATIONS +diff --git a/glib/glib-init.c b/glib/glib-init.c +index c513f5190..345670eee 100644 +--- a/glib/glib-init.c ++++ b/glib/glib-init.c +@@ -481,7 +481,7 @@ glib_init_dtor (void) + #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA + #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(glib_init_ctor) + #endif +-G_DEFINE_CONSTRUCTOR(glib_init_ctor) ++G_DEFINE_CONSTRUCTOR(glib_init_ctor, 100) + + static void + glib_init_ctor (void) +diff --git a/glib/glib-private.c b/glib/glib-private.c +index 6b2205f86..4d4c9a644 100644 +--- a/glib/glib-private.c ++++ b/glib/glib-private.c +@@ -39,11 +39,13 @@ GLibPrivateVTable * + glib__private__ (void) + { + static GLibPrivateVTable table = { ++#ifndef __EMSCRIPTEN__ + g_wakeup_new, + g_wakeup_free, + g_wakeup_get_pollfd, + g_wakeup_signal, + g_wakeup_acknowledge, ++#endif + + g_get_worker_context, + +diff --git a/glib/glib-private.h b/glib/glib-private.h +index 85bea5ffe..1cdd59996 100644 +--- a/glib/glib-private.h ++++ b/glib/glib-private.h +@@ -21,7 +21,11 @@ + #define __GLIB_PRIVATE_H__ + + #include ++ ++#ifndef __EMSCRIPTEN__ + #include "gwakeup.h" ++#endif ++ + #include "gstdioprivate.h" + + /* gcc defines __SANITIZE_ADDRESS__, clang sets the address_sanitizer +@@ -162,6 +166,7 @@ char *g_find_program_for_path (const char *program, + + + typedef struct { ++#ifndef __EMSCRIPTEN__ + /* See gwakeup.c */ + GWakeup * (* g_wakeup_new) (void); + void (* g_wakeup_free) (GWakeup *wakeup); +@@ -169,6 +174,7 @@ typedef struct { + GPollFD *poll_fd); + void (* g_wakeup_signal) (GWakeup *wakeup); + void (* g_wakeup_acknowledge) (GWakeup *wakeup); ++#endif + + /* See gmain.c */ + GMainContext * (* g_get_worker_context) (void); +diff --git a/glib/glib-unix.c b/glib/glib-unix.c +index d5bf896b4..c1c6bce5e 100644 +--- a/glib/glib-unix.c ++++ b/glib/glib-unix.c +@@ -29,6 +29,7 @@ + #include "gmessages.h" + + #include ++#include + #include + #include + +@@ -272,6 +273,10 @@ g_unix_fd_source_dispatch (GSource *source, + GSourceFunc callback, + gpointer user_data) + { ++#ifdef __EMSCRIPTEN__ ++ fprintf(stderr, "%s (%d): I commented this out - ARL\n", __FUNCTION__, __LINE__); ++ return FALSE; ++#else + GUnixFDSource *fd_source = (GUnixFDSource *) source; + GUnixFDSourceFunc func = (GUnixFDSourceFunc) callback; + +@@ -283,6 +288,7 @@ g_unix_fd_source_dispatch (GSource *source, + } + + return (* func) (fd_source->fd, g_source_query_unix_fd (source, fd_source->tag), user_data); ++#endif + } + + GSourceFuncs g_unix_fd_source_funcs = { +@@ -347,6 +353,10 @@ g_unix_fd_add_full (gint priority, + gpointer user_data, + GDestroyNotify notify) + { ++#ifdef __EMSCRIPTEN__ ++ fprintf(stderr, "%s (%d): I commented this out - ARL\n", __FUNCTION__, __LINE__); ++ return 0; ++#else + GSource *source; + guint id; + +@@ -362,6 +372,7 @@ g_unix_fd_add_full (gint priority, + g_source_unref (source); + + return id; ++#endif + } + + /** +diff --git a/glib/glib.h b/glib/glib.h +index d9b4e3414..25443a5a9 100644 +--- a/glib/glib.h ++++ b/glib/glib.h +@@ -29,79 +29,27 @@ + + #define __GLIB_H_INSIDE__ + +-#include +-#include ++#ifndef __EMSCRIPTEN__ ++ + #include +-#include + #include + #include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include + #include +-#include + #include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include + #include + #include +-#include +-#include + #include +-#include +-#include +-#include + #include +-#include +-#include + #include +-#include +-#include + #include + #include +-#include +-#include + #include +-#include +-#include + #include + #include +-#include +-#include + #include +-#include +-#include + #include +-#include +-#include +-#include + #include +-#include + #include +-#include +-#include +-#include +-#include + + #ifdef G_PLATFORM_WIN32 + #include +@@ -112,10 +60,68 @@ + #include + #include + #include ++ ++ ++#endif /* NOT __EMSCRIPTEN__ */ ++ + #include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include + +-#include + #include ++#include + + #undef __GLIB_H_INSIDE__ + +diff --git a/glib/glist.c b/glib/glist.c +index 754a3ec52..8b9d0460d 100644 +--- a/glib/glist.c ++++ b/glib/glist.c +@@ -195,6 +195,11 @@ g_list_free (GList *list) + { + g_slice_free_chain (GList, list, next); + } ++void ++g_list_free_adapter (gpointer list) ++{ ++ g_list_free ((GList*) list); ++} + + /** + * g_list_free_1: +@@ -243,7 +248,12 @@ void + g_list_free_full (GList *list, + GDestroyNotify free_func) + { +- g_list_foreach (list, (GFunc) free_func, NULL); ++ while (list) ++ { ++ GList *next = list->next; ++ (*free_func) (list->data); ++ list = next; ++ } + g_list_free (list); + } + +@@ -1097,7 +1107,7 @@ g_list_foreach (GList *list, + static GList* + g_list_insert_sorted_real (GList *list, + gpointer data, +- GFunc func, ++ GCompareDataFunc func, + gpointer user_data) + { + GList *tmp_list = list; +@@ -1113,13 +1123,13 @@ g_list_insert_sorted_real (GList *list, + return new_list; + } + +- cmp = ((GCompareDataFunc) func) (data, tmp_list->data, user_data); ++ cmp = (func) (data, tmp_list->data, user_data); + + while ((tmp_list->next) && (cmp > 0)) + { + tmp_list = tmp_list->next; + +- cmp = ((GCompareDataFunc) func) (data, tmp_list->data, user_data); ++ cmp = (func) (data, tmp_list->data, user_data); + } + + new_list = _g_list_alloc0 (); +@@ -1168,9 +1178,9 @@ g_list_insert_sorted_real (GList *list, + GList * + g_list_insert_sorted (GList *list, + gpointer data, +- GCompareFunc func) ++ GCompareDataFunc func) + { +- return g_list_insert_sorted_real (list, data, (GFunc) func, NULL); ++ return g_list_insert_sorted_real (list, data, func, NULL); + } + + /** +@@ -1201,13 +1211,13 @@ g_list_insert_sorted_with_data (GList *list, + GCompareDataFunc func, + gpointer user_data) + { +- return g_list_insert_sorted_real (list, data, (GFunc) func, user_data); ++ return g_list_insert_sorted_real (list, data, func, user_data); + } + + static GList * + g_list_sort_merge (GList *l1, + GList *l2, +- GFunc compare_func, ++ GCompareDataFunc compare_func, + gpointer user_data) + { + GList list, *l, *lprev; +@@ -1218,7 +1228,7 @@ g_list_sort_merge (GList *l1, + + while (l1 && l2) + { +- cmp = ((GCompareDataFunc) compare_func) (l1->data, l2->data, user_data); ++ cmp = (compare_func) (l1->data, l2->data, user_data); + + if (cmp <= 0) + { +@@ -1242,7 +1252,7 @@ g_list_sort_merge (GList *l1, + + static GList * + g_list_sort_real (GList *list, +- GFunc compare_func, ++ GCompareDataFunc compare_func, + gpointer user_data) + { + GList *l1, *l2; +@@ -1299,9 +1309,9 @@ g_list_sort_real (GList *list, + */ + GList * + g_list_sort (GList *list, +- GCompareFunc compare_func) ++ GCompareDataFunc compare_func) + { +- return g_list_sort_real (list, (GFunc) compare_func, NULL); ++ return g_list_sort_real (list, compare_func, NULL); + } + + /** +@@ -1334,7 +1344,7 @@ g_list_sort_with_data (GList *list, + GCompareDataFunc compare_func, + gpointer user_data) + { +- return g_list_sort_real (list, (GFunc) compare_func, user_data); ++ return g_list_sort_real (list, compare_func, user_data); + } + + /** +diff --git a/glib/glist.h b/glib/glist.h +index 2a453b79f..f6f9bd79f 100644 +--- a/glib/glist.h ++++ b/glib/glist.h +@@ -51,6 +51,7 @@ GLIB_AVAILABLE_IN_ALL + GList* g_list_alloc (void) G_GNUC_WARN_UNUSED_RESULT; + GLIB_AVAILABLE_IN_ALL + void g_list_free (GList *list); ++void g_list_free_adapter (gpointer list); + GLIB_AVAILABLE_IN_ALL + void g_list_free_1 (GList *list); + #define g_list_free1 g_list_free_1 +@@ -70,7 +71,7 @@ GList* g_list_insert (GList *list, + GLIB_AVAILABLE_IN_ALL + GList* g_list_insert_sorted (GList *list, + gpointer data, +- GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT; ++ GCompareDataFunc func) G_GNUC_WARN_UNUSED_RESULT; + GLIB_AVAILABLE_IN_ALL + GList* g_list_insert_sorted_with_data (GList *list, + gpointer data, +@@ -140,7 +141,7 @@ void g_list_foreach (GList *list, + gpointer user_data); + GLIB_AVAILABLE_IN_ALL + GList* g_list_sort (GList *list, +- GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT; ++ GCompareDataFunc compare_func) G_GNUC_WARN_UNUSED_RESULT; + GLIB_AVAILABLE_IN_ALL + GList* g_list_sort_with_data (GList *list, + GCompareDataFunc compare_func, +diff --git a/glib/gmacros.h b/glib/gmacros.h +index a7ed77541..90597227e 100644 +--- a/glib/gmacros.h ++++ b/glib/gmacros.h +@@ -1351,16 +1351,16 @@ + typedef GSList *_GLIB_AUTOPTR_SLIST_TYPENAME(TypeName); \ + typedef GQueue *_GLIB_AUTOPTR_QUEUE_TYPENAME(TypeName); \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ +- static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) (TypeName *_ptr) \ +- { if (_ptr) (cleanup) ((ParentName *) _ptr); } \ ++ static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) (gpointer _ptr) \ ++ { if (_ptr) (cleanup) ((TypeName*) _ptr); } \ + static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_FUNC_NAME(TypeName) (TypeName **_ptr) \ +- { _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) (*_ptr); } \ ++ { _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) ((TypeName *) *_ptr); } \ + static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName) (GList **_l) \ +- { g_list_free_full (*_l, (GDestroyNotify) (void(*)(void)) cleanup); } \ ++ { g_list_free_full (*_l, cleanup); } \ + static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName) (GSList **_l) \ +- { g_slist_free_full (*_l, (GDestroyNotify) (void(*)(void)) cleanup); } \ ++ { g_slist_free_full (*_l, cleanup); } \ + static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_QUEUE_FUNC_NAME(TypeName) (GQueue **_q) \ +- { if (*_q) g_queue_free_full (*_q, (GDestroyNotify) (void(*)(void)) cleanup); } \ ++ { if (*_q) g_queue_free_full (*_q, cleanup); } \ + G_GNUC_END_IGNORE_DEPRECATIONS + #define _GLIB_DEFINE_AUTOPTR_CHAINUP(ModuleObjName, ParentName) \ + _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(ModuleObjName, ParentName, _GLIB_AUTOPTR_CLEAR_FUNC_NAME(ParentName)) +diff --git a/glib/gmain.c b/glib/gmain.c +index d28f89e0c..656a2d5ec 100644 +--- a/glib/gmain.c ++++ b/glib/gmain.c +@@ -34,6 +34,7 @@ + #include "config.h" + #include "glibconfig.h" + #include "glib_trace.h" ++#include + + /* Uncomment the next line (and the corresponding line in gpoll.c) to + * enable debugging printouts if the environment variable +@@ -68,6 +69,7 @@ + #endif /* G_OS_UNIX */ + #include + #include ++#include + + #ifdef HAVE_PIDFD + #include +@@ -122,7 +124,10 @@ + #include "gtimer.h" + #endif + ++#ifndef __EMSCRIPTEN__ + #include "gwakeup.h" ++#endif ++ + #include "gmain-internal.h" + #include "glib-init.h" + #include "glib-private.h" +@@ -327,7 +332,9 @@ struct _GMainContext + GPollFD *cached_poll_array; + guint cached_poll_array_size; + ++#ifndef __EMSCRIPTEN__ + GWakeup *wakeup; ++#endif + + GPollFD wake_up_rec; + +@@ -471,8 +478,8 @@ static gboolean g_child_watch_prepare (GSource *source, + gint *timeout); + static gboolean g_child_watch_check (GSource *source); + static gboolean g_child_watch_dispatch (GSource *source, +- GSourceFunc callback, +- gpointer user_data); ++ GSourceFunc callback, ++ gpointer user_data); + static void g_child_watch_finalize (GSource *source); + #if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + static void g_unix_signal_handler (int signum); +@@ -603,6 +610,9 @@ poll_rec_list_free (GMainContext *context, + void + g_main_context_unref (GMainContext *context) + { ++#ifdef __EMSCRIPTEN__ ++ printf ("%s (%d): ARL Debugging.\n", __FUNCTION__, __LINE__); ++#else + GSourceIter iter; + GSource *source; + GList *sl_iter; +@@ -686,6 +696,12 @@ g_main_context_unref (GMainContext *context) + g_source_unref_internal (source, NULL, FALSE); + } + g_slist_free (remaining_sources); ++#endif ++} ++void ++g_main_context_unref_adapter (gpointer context) ++{ ++ g_main_context_unref ((GMainContext*) context); + } + + /* Helper function used by mainloop/overflow test. +@@ -727,6 +743,10 @@ g_main_context_new (void) + GMainContext * + g_main_context_new_with_flags (GMainContextFlags flags) + { ++#ifdef __EMSCRIPTEN__ ++ printf ("%s (%d): ARL - Not implmented.\n", __FUNCTION__, __LINE__); ++ return NULL; ++#else + static gsize initialised; + GMainContext *context; + +@@ -782,6 +802,7 @@ g_main_context_new_with_flags (GMainContextFlags flags) + G_UNLOCK (main_context_list); + + return context; ++#endif + } + + /** +@@ -1278,6 +1299,10 @@ g_source_attach_unlocked (GSource *source, + GMainContext *context, + gboolean do_wakeup) + { ++#ifdef __EMSCRIPTEN__ ++ printf ("%s (%d): ARL - Not implemented.\n", __FUNCTION__, __LINE__); ++ return -1; ++#else + GSList *tmp_list; + guint id; + +@@ -1333,6 +1358,7 @@ g_source_attach_unlocked (GSource *source, + context); + + return source->source_id; ++#endif + } + + /** +@@ -2034,6 +2060,9 @@ void + g_source_set_ready_time (GSource *source, + gint64 ready_time) + { ++#ifdef __EMSCRIPTEN__ ++ printf ("%s (%d): ARL - Not implemented.\n", __FUNCTION__, __LINE__); ++#else + GMainContext *context; + + g_return_if_fail (source != NULL); +@@ -2063,6 +2092,7 @@ g_source_set_ready_time (GSource *source, + g_wakeup_signal (context->wakeup); + UNLOCK_CONTEXT (context); + } ++#endif + } + + /** +@@ -2442,6 +2472,11 @@ g_source_unref (GSource *source) + + g_source_unref_internal (source, source->context, FALSE); + } ++void ++g_source_unref_adapter (gpointer source) ++{ ++ g_source_unref ((GSource*) source); ++} + + /** + * g_main_context_find_source_by_id: +@@ -3990,6 +4025,10 @@ g_main_context_check (GMainContext *context, + GPollFD *fds, + gint n_fds) + { ++#ifdef __EMSCRIPTEN__ ++ printf ("%s (%d): ARL - Not implemented\n", __FUNCTION__, __LINE__); ++ return TRUE; ++#else + GSource *source; + GSourceIter iter; + GPollRec *pollrec; +@@ -4170,6 +4209,7 @@ g_main_context_check (GMainContext *context, + UNLOCK_CONTEXT (context); + + return n_ready > 0; ++#endif + } + + /** +@@ -4417,6 +4457,11 @@ g_main_loop_unref (GMainLoop *loop) + g_main_context_unref (loop->context); + g_free (loop); + } ++void ++g_main_loop_unref_adapter (gpointer loop) ++{ ++ g_main_loop_unref ((GMainLoop*) loop); ++} + + /** + * g_main_loop_run: +@@ -4498,6 +4543,9 @@ g_main_loop_run (GMainLoop *loop) + void + g_main_loop_quit (GMainLoop *loop) + { ++#ifdef __EMSCRIPTEN__ ++ printf ("%s (%d): ARL - Not implemented\n", __FUNCTION__, __LINE__); ++#else + g_return_if_fail (loop != NULL); + g_return_if_fail (g_atomic_int_get (&loop->ref_count) > 0); + +@@ -4510,6 +4558,7 @@ g_main_loop_quit (GMainLoop *loop) + UNLOCK_CONTEXT (loop->context); + + TRACE (GLIB_MAIN_LOOP_QUIT (loop)); ++#endif + } + + /** +@@ -4677,6 +4726,9 @@ g_main_context_add_poll_unlocked (GMainContext *context, + gint priority, + GPollFD *fd) + { ++#ifdef __EMSCRIPTEN__ ++ printf ("%s (%d): ARL - Not implemented\n", __FUNCTION__, __LINE__); ++#else + GPollRec *prevrec, *nextrec; + GPollRec *newrec = g_slice_new (GPollRec); + +@@ -4714,6 +4766,7 @@ g_main_context_add_poll_unlocked (GMainContext *context, + /* Now wake up the main loop if it is waiting in the poll() */ + if (fd != &context->wake_up_rec) + g_wakeup_signal (context->wakeup); ++#endif + } + + /** +@@ -4744,6 +4797,9 @@ static void + g_main_context_remove_poll_unlocked (GMainContext *context, + GPollFD *fd) + { ++#ifdef __EMSCRIPTEN__ ++ printf ("%s (%d): ARL - Not implemented\n", __FUNCTION__, __LINE__); ++#else + GPollRec *pollrec, *prevrec, *nextrec; + + prevrec = NULL; +@@ -4775,6 +4831,7 @@ g_main_context_remove_poll_unlocked (GMainContext *context, + + /* Now wake up the main loop if it is waiting in the poll() */ + g_wakeup_signal (context->wakeup); ++#endif + } + + /** +@@ -4935,6 +4992,9 @@ g_main_context_get_poll_func (GMainContext *context) + void + g_main_context_wakeup (GMainContext *context) + { ++#ifdef __EMSCRIPTEN__ ++ printf ("%s (%d): ARL - Not implemented\n", __FUNCTION__, __LINE__); ++#else + if (!context) + context = g_main_context_default (); + +@@ -4943,6 +5003,7 @@ g_main_context_wakeup (GMainContext *context) + TRACE (GLIB_MAIN_CONTEXT_WAKEUP (context)); + + g_wakeup_signal (context->wakeup); ++#endif + } + + /** +@@ -5033,6 +5094,10 @@ g_timeout_dispatch (GSource *source, + GSourceFunc callback, + gpointer user_data) + { ++#ifdef __EMSCRIPTEN__ ++ fprintf(stderr, "%s (%d): I commented this out - ARL\n", __FUNCTION__, __LINE__); ++ return FALSE; ++#else + GTimeoutSource *timeout_source = (GTimeoutSource *)source; + gboolean again; + +@@ -5045,7 +5110,7 @@ g_timeout_dispatch (GSource *source, + + if (timeout_source->one_shot) + { +- GSourceOnceFunc once_callback = (GSourceOnceFunc) callback; ++ GSourceOnceFunc once_callback = callback; + once_callback (user_data); + again = G_SOURCE_REMOVE; + } +@@ -5060,6 +5125,7 @@ g_timeout_dispatch (GSource *source, + g_timeout_set_expiration (timeout_source, g_source_get_time (source)); + + return again; ++#endif + } + + static GSource * +@@ -5135,6 +5201,10 @@ timeout_add_full (gint priority, + gpointer data, + GDestroyNotify notify) + { ++#ifdef __EMSCRIPTEN__ ++ fprintf(stderr, "%s (%d): I commented this out - ARL\n", __FUNCTION__, __LINE__); ++ return 0; ++#else + GSource *source; + guint id; + +@@ -5153,6 +5223,7 @@ timeout_add_full (gint priority, + g_source_unref (source); + + return id; ++#endif + } + + /** +@@ -5277,7 +5348,12 @@ g_timeout_add_once (guint32 interval, + GSourceOnceFunc function, + gpointer data) + { +- return timeout_add_full (G_PRIORITY_DEFAULT, interval, FALSE, TRUE, (GSourceFunc) function, data, NULL); ++#ifdef __EMSCRIPTEN__ ++ fprintf(stderr, "%s (%d): I commented this out - ARL\n", __FUNCTION__, __LINE__); ++ return 0; ++#else ++ return timeout_add_full (G_PRIORITY_DEFAULT, interval, FALSE, TRUE, function, data, NULL); ++#endif + } + + /** +@@ -5479,6 +5555,9 @@ g_child_watch_finalize (GSource *source) + static void + wake_source (GSource *source) + { ++#ifdef __EMSCRIPTEN__ ++ printf ("%s (%d): ARL - Not implemented\n", __FUNCTION__, __LINE__); ++#else + GMainContext *context; + + /* This should be thread-safe: +@@ -5511,11 +5590,15 @@ wake_source (GSource *source) + if (context) + g_wakeup_signal (context->wakeup); + G_UNLOCK(main_context_list); ++#endif + } + + static void + dispatch_unix_signals_unlocked (void) + { ++#ifdef __EMSCRIPTEN__ ++ printf ("%s (%d): ARL - Not implemented\n", __FUNCTION__, __LINE__); ++#else + gboolean pending[NSIG]; + GSList *node; + gint i; +@@ -5597,6 +5680,7 @@ dispatch_unix_signals_unlocked (void) + } + } + ++#endif + } + + static void +@@ -5883,6 +5967,9 @@ g_child_watch_dispatch (GSource *source, + GSourceFunc callback, + gpointer user_data) + { ++#ifdef __EMSCRIPTEN__ ++ fprintf(stderr, "%s (%d): I commented this out - ARL\n", __FUNCTION__, __LINE__); ++#else + GChildWatchSource *child_watch_source; + GChildWatchFunc child_watch_callback = (GChildWatchFunc) callback; + +@@ -5896,6 +5983,7 @@ g_child_watch_dispatch (GSource *source, + } + + (child_watch_callback) (child_watch_source->pid, child_watch_source->child_status, user_data); ++#endif + + /* We never keep a child watch source around as the child is gone */ + return FALSE; +@@ -6079,6 +6167,10 @@ g_child_watch_add_full (gint priority, + gpointer data, + GDestroyNotify notify) + { ++#ifdef __EMSCRIPTEN__ ++ fprintf(stderr, "%s (%d): I commented this out - ARL\n", __FUNCTION__, __LINE__); ++ return 0; ++#else + GSource *source; + guint id; + +@@ -6092,11 +6184,12 @@ g_child_watch_add_full (gint priority, + if (priority != G_PRIORITY_DEFAULT) + g_source_set_priority (source, priority); + +- g_source_set_callback (source, (GSourceFunc) function, data, notify); ++ g_source_set_callback (source, function, data, notify); + id = g_source_attach (source, NULL); + g_source_unref (source); + + return id; ++#endif + } + + /** +@@ -6163,6 +6256,10 @@ g_idle_dispatch (GSource *source, + GSourceFunc callback, + gpointer user_data) + { ++#ifdef __EMSCRIPTEN__ ++ fprintf(stderr, "%s (%d): I commented this out - ARL\n", __FUNCTION__, __LINE__); ++ return FALSE; ++#else + GIdleSource *idle_source = (GIdleSource *)source; + gboolean again; + +@@ -6175,7 +6272,7 @@ g_idle_dispatch (GSource *source, + + if (idle_source->one_shot) + { +- GSourceOnceFunc once_callback = (GSourceOnceFunc) callback; ++ GSourceOnceFunc once_callback = callback; + once_callback (user_data); + again = G_SOURCE_REMOVE; + } +@@ -6187,6 +6284,7 @@ g_idle_dispatch (GSource *source, + TRACE (GLIB_IDLE_DISPATCH (source, source->context, callback, user_data, again)); + + return again; ++#endif + } + + static GSource * +@@ -6339,7 +6437,12 @@ guint + g_idle_add_once (GSourceOnceFunc function, + gpointer data) + { +- return idle_add_full (G_PRIORITY_DEFAULT_IDLE, TRUE, (GSourceFunc) function, data, NULL); ++#ifdef __EMSCRIPTEN__ ++ fprintf(stderr, "%s (%d): I commented this out - ARL\n", __FUNCTION__, __LINE__); ++ return 0; ++#else ++ return idle_add_full (G_PRIORITY_DEFAULT_IDLE, TRUE, function, data, NULL); ++#endif + } + + /** +@@ -6499,6 +6602,7 @@ g_get_worker_context (void) + sigfillset (&all); + pthread_sigmask (SIG_SETMASK, &all, &prev_mask); + #endif ++ fprintf(stderr, "%s (%d): Kicking off the main thread - ARL\n", __FUNCTION__, __LINE__); + glib_worker_context = g_main_context_new (); + g_thread_new ("gmain", glib_worker_main, NULL); + #if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) +diff --git a/glib/gmain.h b/glib/gmain.h +index ae3cc3ec5..a8dc66c6c 100644 +--- a/glib/gmain.h ++++ b/glib/gmain.h +@@ -402,6 +402,7 @@ GLIB_AVAILABLE_IN_ALL + GMainContext *g_main_context_ref (GMainContext *context); + GLIB_AVAILABLE_IN_ALL + void g_main_context_unref (GMainContext *context); ++void g_main_context_unref_adapter (gpointer context); + GLIB_AVAILABLE_IN_ALL + GMainContext *g_main_context_default (void); + +@@ -427,7 +428,9 @@ GSource *g_main_context_find_source_by_funcs_user_data (GMainContext *conte + /* Low level functions for implementing custom main loops. + */ + GLIB_AVAILABLE_IN_ALL ++#ifdef __EMSCRIPTEN__ + void g_main_context_wakeup (GMainContext *context); ++#endif + GLIB_AVAILABLE_IN_ALL + gboolean g_main_context_acquire (GMainContext *context); + GLIB_AVAILABLE_IN_ALL +@@ -571,6 +574,11 @@ g_main_context_pusher_free (GMainContextPusher *pusher) + { + g_main_context_pop_thread_default ((GMainContext *) pusher); + } ++static inline void ++g_main_context_pusher_free_adapter (gpointer pusher) ++{ ++ g_main_context_pusher_free ((GMainContextPusher*) pusher); ++} + G_GNUC_END_IGNORE_DEPRECATIONS + + /* GMainLoop: */ +@@ -586,6 +594,7 @@ GLIB_AVAILABLE_IN_ALL + GMainLoop *g_main_loop_ref (GMainLoop *loop); + GLIB_AVAILABLE_IN_ALL + void g_main_loop_unref (GMainLoop *loop); ++void g_main_loop_unref_adapter (gpointer loop); + GLIB_AVAILABLE_IN_ALL + gboolean g_main_loop_is_running (GMainLoop *loop); + GLIB_AVAILABLE_IN_ALL +@@ -607,6 +616,7 @@ GLIB_AVAILABLE_IN_ALL + GSource *g_source_ref (GSource *source); + GLIB_AVAILABLE_IN_ALL + void g_source_unref (GSource *source); ++void g_source_unref_adapter (gpointer source); + + GLIB_AVAILABLE_IN_ALL + guint g_source_attach (GSource *source, +diff --git a/glib/gmappedfile.c b/glib/gmappedfile.c +index 4d7a89eb2..37dfdf484 100644 +--- a/glib/gmappedfile.c ++++ b/glib/gmappedfile.c +@@ -408,6 +408,11 @@ g_mapped_file_unref (GMappedFile *file) + if (g_atomic_int_dec_and_test (&file->ref_count)) + g_mapped_file_destroy (file); + } ++void ++g_mapped_file_unref_adapter (gpointer file) ++{ ++ g_mapped_file_unref ((GMappedFile*) file); ++} + + /** + * g_mapped_file_get_bytes: +@@ -429,6 +434,6 @@ g_mapped_file_get_bytes (GMappedFile *file) + + return g_bytes_new_with_free_func (file->contents, + file->length, +- (GDestroyNotify) g_mapped_file_unref, ++ g_mapped_file_unref_adapter, + g_mapped_file_ref (file)); + } +diff --git a/glib/gmappedfile.h b/glib/gmappedfile.h +index 4f5f6981b..e76ceb2f5 100644 +--- a/glib/gmappedfile.h ++++ b/glib/gmappedfile.h +@@ -51,6 +51,7 @@ GLIB_AVAILABLE_IN_ALL + GMappedFile *g_mapped_file_ref (GMappedFile *file); + GLIB_AVAILABLE_IN_ALL + void g_mapped_file_unref (GMappedFile *file); ++void g_mapped_file_unref_adapter(gpointer file); + + GLIB_DEPRECATED_FOR(g_mapped_file_unref) + void g_mapped_file_free (GMappedFile *file); +diff --git a/glib/gmarkup.c b/glib/gmarkup.c +index 9422abde4..b05826460 100644 +--- a/glib/gmarkup.c ++++ b/glib/gmarkup.c +@@ -310,6 +310,11 @@ g_markup_parse_context_unref (GMarkupParseContext *context) + if (g_atomic_int_dec_and_test (&context->ref_count)) + g_markup_parse_context_free (context); + } ++void ++g_markup_parse_context_unref_adapter (gpointer context) ++{ ++ g_markup_parse_context_unref ((GMarkupParseContext*) context); ++} + + static void + string_full_free (gpointer ptr) +diff --git a/glib/gmarkup.h b/glib/gmarkup.h +index 5b5781350..671b7e34d 100644 +--- a/glib/gmarkup.h ++++ b/glib/gmarkup.h +@@ -196,6 +196,7 @@ GLIB_AVAILABLE_IN_2_36 + GMarkupParseContext *g_markup_parse_context_ref (GMarkupParseContext *context); + GLIB_AVAILABLE_IN_2_36 + void g_markup_parse_context_unref (GMarkupParseContext *context); ++void g_markup_parse_context_unref_adapter (gpointer context); + GLIB_AVAILABLE_IN_ALL + void g_markup_parse_context_free (GMarkupParseContext *context); + GLIB_AVAILABLE_IN_ALL +diff --git a/glib/gmessages.c b/glib/gmessages.c +index 541b08130..83855bd4a 100644 +--- a/glib/gmessages.c ++++ b/glib/gmessages.c +@@ -1920,7 +1920,7 @@ g_log_variant (const gchar *log_domain, + g_log_structured_array (log_level, (GLogField *) fields_array->data, fields_array->len); + + g_array_free (fields_array, TRUE); +- g_slist_free_full (values_list, (GDestroyNotify) g_variant_unref); ++ g_slist_free_full (values_list, g_variant_unref_adapter); + g_slist_free_full (print_list, g_free); + } + +diff --git a/glib/gpattern.c b/glib/gpattern.c +index 09bdd5ad9..b7d106d9c 100644 +--- a/glib/gpattern.c ++++ b/glib/gpattern.c +@@ -434,6 +434,11 @@ g_pattern_spec_free (GPatternSpec *pspec) + g_free (pspec->pattern); + g_free (pspec); + } ++void ++g_pattern_spec_free_adapter (gpointer pspec) ++{ ++ g_pattern_spec_free ((GPatternSpec*) pspec); ++} + + /** + * g_pattern_spec_equal: +diff --git a/glib/gpattern.h b/glib/gpattern.h +index c8ceb84d2..179f87405 100644 +--- a/glib/gpattern.h ++++ b/glib/gpattern.h +@@ -35,6 +35,7 @@ GLIB_AVAILABLE_IN_ALL + GPatternSpec* g_pattern_spec_new (const gchar *pattern); + GLIB_AVAILABLE_IN_ALL + void g_pattern_spec_free (GPatternSpec *pspec); ++void g_pattern_spec_free_adapter (gpointer pspec); + GLIB_AVAILABLE_IN_2_70 + GPatternSpec *g_pattern_spec_copy (GPatternSpec *pspec); + GLIB_AVAILABLE_IN_ALL +diff --git a/glib/gqueue.c b/glib/gqueue.c +index a5c4f183b..5c72f6856 100644 +--- a/glib/gqueue.c ++++ b/glib/gqueue.c +@@ -92,6 +92,11 @@ g_queue_free (GQueue *queue) + g_list_free (queue->head); + g_slice_free (GQueue, queue); + } ++void ++g_queue_free_adapter (gpointer queue) ++{ ++ g_queue_free ((GQueue*) queue); ++} + + /** + * g_queue_free_full: +@@ -110,7 +115,21 @@ void + g_queue_free_full (GQueue *queue, + GDestroyNotify free_func) + { +- g_queue_foreach (queue, (GFunc) free_func, NULL); ++ // Expanded the implentation of g_queue_foreach to avoid func ptr cast. ++ //g_queue_foreach (queue, (GFunc) free_func, NULL); ++ GList *list; ++ ++ g_return_if_fail (queue != NULL); ++ g_return_if_fail (free_func != NULL); ++ ++ list = queue->head; ++ while (list) ++ { ++ GList *next = list->next; ++ free_func (list->data); ++ list = next; ++ } ++ + g_queue_free (queue); + } + +@@ -169,7 +188,17 @@ g_queue_clear_full (GQueue *queue, + g_return_if_fail (queue != NULL); + + if (free_func != NULL) +- g_queue_foreach (queue, (GFunc) free_func, NULL); ++ { ++ GList *list; ++ ++ list = queue->head; ++ while (list) ++ { ++ GList *next = list->next; ++ free_func (list->data); ++ list = next; ++ } ++ } + + g_queue_clear (queue); + } +diff --git a/glib/gqueue.h b/glib/gqueue.h +index c3a28c843..4ae077e85 100644 +--- a/glib/gqueue.h ++++ b/glib/gqueue.h +@@ -75,6 +75,7 @@ GLIB_AVAILABLE_IN_ALL + GQueue* g_queue_new (void); + GLIB_AVAILABLE_IN_ALL + void g_queue_free (GQueue *queue); ++void g_queue_free_adapter (gpointer queue); + GLIB_AVAILABLE_IN_ALL + void g_queue_free_full (GQueue *queue, + GDestroyNotify free_func); +diff --git a/glib/grefstring.c b/glib/grefstring.c +index f20189786..91f4e5c4c 100644 +--- a/glib/grefstring.c ++++ b/glib/grefstring.c +@@ -284,6 +284,11 @@ g_ref_string_release (char *str) + + g_atomic_rc_box_release_full (str, remove_if_interned); + } ++void ++g_ref_string_release_adapter (gpointer str) ++{ ++ g_ref_string_release ((char *) str); ++} + + /** + * g_ref_string_length: +diff --git a/glib/grefstring.h b/glib/grefstring.h +index ae7d173fc..5de2e720c 100644 +--- a/glib/grefstring.h ++++ b/glib/grefstring.h +@@ -37,6 +37,7 @@ GLIB_AVAILABLE_IN_2_58 + char * g_ref_string_acquire (char *str); + GLIB_AVAILABLE_IN_2_58 + void g_ref_string_release (char *str); ++void g_ref_string_release_adapter (gpointer str); + + GLIB_AVAILABLE_IN_2_58 + gsize g_ref_string_length (char *str); +diff --git a/glib/gregex.c b/glib/gregex.c +index 39b9edeec..c61414195 100644 +--- a/glib/gregex.c ++++ b/glib/gregex.c +@@ -265,6 +265,7 @@ static gboolean interpolate_replacement (const GMatchInfo *match_info, + static GList *split_replacement (const gchar *replacement, + GError **error); + static void free_interpolation_data (InterpolationData *data); ++static void free_interpolation_data_adapter(gpointer data); + + static uint32_t + get_pcre2_compile_options (GRegexCompileFlags compile_flags) +@@ -1352,7 +1353,7 @@ g_match_info_expand_references (const GMatchInfo *match_info, + result = g_string_sized_new (strlen (string_to_expand)); + interpolate_replacement (match_info, result, list); + +- g_list_free_full (list, (GDestroyNotify) free_interpolation_data); ++ g_list_free_full (list, free_interpolation_data_adapter); + + return g_string_free (result, FALSE); + } +@@ -2817,6 +2818,11 @@ free_interpolation_data (InterpolationData *data) + g_free (data->text); + g_free (data); + } ++static void ++free_interpolation_data_adapter (gpointer data) ++{ ++ free_interpolation_data ((InterpolationData*) data); ++} + + static const gchar * + expand_escape (const gchar *replacement, +@@ -3089,7 +3095,7 @@ split_replacement (const gchar *replacement, + start = p = expand_escape (replacement, p, data, error); + if (p == NULL) + { +- g_list_free_full (list, (GDestroyNotify) free_interpolation_data); ++ g_list_free_full (list, free_interpolation_data_adapter); + free_interpolation_data (data); + + return NULL; +@@ -3300,7 +3306,7 @@ g_regex_replace (const GRegex *regex, + if (tmp_error != NULL) + g_propagate_error (error, tmp_error); + +- g_list_free_full (list, (GDestroyNotify) free_interpolation_data); ++ g_list_free_full (list, free_interpolation_data_adapter); + + return result; + } +@@ -3509,7 +3515,7 @@ g_regex_check_replacement (const gchar *replacement, + if (has_references) + *has_references = interpolation_list_needs_match (list); + +- g_list_free_full (list, (GDestroyNotify) free_interpolation_data); ++ g_list_free_full (list, free_interpolation_data_adapter); + + return TRUE; + } +diff --git a/glib/gscanner.c b/glib/gscanner.c +index 451feb67b..7c2c304e2 100644 +--- a/glib/gscanner.c ++++ b/glib/gscanner.c +@@ -530,6 +530,11 @@ g_scanner_destroy (GScanner *scanner) + g_free (scanner->buffer); + g_free (scanner); + } ++void ++g_scanner_destroy_adapter (gpointer scanner) ++{ ++ g_scanner_destroy ((GScanner*) scanner); ++} + + static void + g_scanner_msg_handler (GScanner *scanner, +diff --git a/glib/gscanner.h b/glib/gscanner.h +index bbad353e2..c98f66c4b 100644 +--- a/glib/gscanner.h ++++ b/glib/gscanner.h +@@ -216,6 +216,7 @@ GLIB_AVAILABLE_IN_ALL + GScanner* g_scanner_new (const GScannerConfig *config_templ); + GLIB_AVAILABLE_IN_ALL + void g_scanner_destroy (GScanner *scanner); ++void g_scanner_destroy_adapter (gpointer scanner); + GLIB_AVAILABLE_IN_ALL + void g_scanner_input_file (GScanner *scanner, + gint input_fd); +diff --git a/glib/gslist.c b/glib/gslist.c +index 4e22958d8..e3ce80bbb 100644 +--- a/glib/gslist.c ++++ b/glib/gslist.c +@@ -150,6 +150,11 @@ g_slist_free (GSList *list) + { + g_slice_free_chain (GSList, list, next); + } ++void ++g_slist_free_adapter (gpointer list) ++{ ++ g_slist_free((GSList*) list); ++} + + /** + * g_slist_free_1: +@@ -197,7 +202,12 @@ void + g_slist_free_full (GSList *list, + GDestroyNotify free_func) + { +- g_slist_foreach (list, (GFunc) free_func, NULL); ++ while (list) ++ { ++ GSList *next = list->next; ++ (*free_func) (list->data); ++ list = next; ++ } + g_slist_free (list); + } + +@@ -892,7 +902,7 @@ g_slist_foreach (GSList *list, + static GSList* + g_slist_insert_sorted_real (GSList *list, + gpointer data, +- GFunc func, ++ GCompareDataFunc func, + gpointer user_data) + { + GSList *tmp_list = list; +@@ -910,14 +920,14 @@ g_slist_insert_sorted_real (GSList *list, + return new_list; + } + +- cmp = ((GCompareDataFunc) func) (data, tmp_list->data, user_data); ++ cmp = (func) (data, tmp_list->data, user_data); + + while ((tmp_list->next) && (cmp > 0)) + { + prev_list = tmp_list; + tmp_list = tmp_list->next; + +- cmp = ((GCompareDataFunc) func) (data, tmp_list->data, user_data); ++ cmp = (func) (data, tmp_list->data, user_data); + } + + new_list = _g_slist_alloc (); +@@ -967,9 +977,9 @@ compare_data_func_trampoline (gconstpointer a, gconstpointer b, gpointer user_da + GSList * + g_slist_insert_sorted (GSList *list, + gpointer data, +- GCompareFunc func) ++ GCompareDataFunc func) + { +- return g_slist_insert_sorted_real (list, data, (GFunc) compare_data_func_trampoline, func); ++ return g_slist_insert_sorted_real (list, data, compare_data_func_trampoline, func); + } + + /** +@@ -994,13 +1004,13 @@ g_slist_insert_sorted_with_data (GSList *list, + GCompareDataFunc func, + gpointer user_data) + { +- return g_slist_insert_sorted_real (list, data, (GFunc) func, user_data); ++ return g_slist_insert_sorted_real (list, data, func, user_data); + } + + static GSList * + g_slist_sort_merge (GSList *l1, + GSList *l2, +- GFunc compare_func, ++ GCompareDataFunc compare_func, + gpointer user_data) + { + GSList list, *l; +@@ -1010,7 +1020,7 @@ g_slist_sort_merge (GSList *l1, + + while (l1 && l2) + { +- cmp = ((GCompareDataFunc) compare_func) (l1->data, l2->data, user_data); ++ cmp = (compare_func) (l1->data, l2->data, user_data); + + if (cmp <= 0) + { +@@ -1030,7 +1040,7 @@ g_slist_sort_merge (GSList *l1, + + static GSList * + g_slist_sort_real (GSList *list, +- GFunc compare_func, ++ GCompareDataFunc compare_func, + gpointer user_data) + { + GSList *l1, *l2; +@@ -1074,9 +1084,9 @@ g_slist_sort_real (GSList *list, + */ + GSList * + g_slist_sort (GSList *list, +- GCompareFunc compare_func) ++ GCompareDataFunc compare_func) + { +- return g_slist_sort_real (list, (GFunc) compare_data_func_trampoline, compare_func); ++ return g_slist_sort_real (list, compare_data_func_trampoline, compare_func); + } + + /** +@@ -1094,7 +1104,7 @@ g_slist_sort_with_data (GSList *list, + GCompareDataFunc compare_func, + gpointer user_data) + { +- return g_slist_sort_real (list, (GFunc) compare_func, user_data); ++ return g_slist_sort_real (list, compare_func, user_data); + } + + /** +diff --git a/glib/gslist.h b/glib/gslist.h +index c8e0cf228..eb77b40e0 100644 +--- a/glib/gslist.h ++++ b/glib/gslist.h +@@ -50,6 +50,7 @@ GLIB_AVAILABLE_IN_ALL + GSList* g_slist_alloc (void) G_GNUC_WARN_UNUSED_RESULT; + GLIB_AVAILABLE_IN_ALL + void g_slist_free (GSList *list); ++void g_slist_free_adapter (gpointer list); + GLIB_AVAILABLE_IN_ALL + void g_slist_free_1 (GSList *list); + #define g_slist_free1 g_slist_free_1 +@@ -69,7 +70,7 @@ GSList* g_slist_insert (GSList *list, + GLIB_AVAILABLE_IN_ALL + GSList* g_slist_insert_sorted (GSList *list, + gpointer data, +- GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT; ++ GCompareDataFunc func) G_GNUC_WARN_UNUSED_RESULT; + GLIB_AVAILABLE_IN_ALL + GSList* g_slist_insert_sorted_with_data (GSList *list, + gpointer data, +@@ -129,7 +130,7 @@ void g_slist_foreach (GSList *list, + gpointer user_data); + GLIB_AVAILABLE_IN_ALL + GSList* g_slist_sort (GSList *list, +- GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT; ++ GCompareDataFunc compare_func) G_GNUC_WARN_UNUSED_RESULT; + GLIB_AVAILABLE_IN_ALL + GSList* g_slist_sort_with_data (GSList *list, + GCompareDataFunc compare_func, +diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c +index 391cf569b..54c6c6af6 100644 +--- a/glib/gstrfuncs.c ++++ b/glib/gstrfuncs.c +@@ -2592,6 +2592,11 @@ g_strfreev (gchar **str_array) + g_free (str_array); + } + } ++void ++g_strfreev_adapter (gpointer str_array) ++{ ++ g_strfreev ((gchar**) str_array); ++} + + /** + * g_strdupv: +@@ -2631,6 +2636,10 @@ g_strdupv (gchar **str_array) + else + return NULL; + } ++gpointer g_strdupv_adapter (gpointer str_array) ++{ ++ return (gpointer) g_strdupv ((gchar**) str_array); ++} + + /** + * g_strjoinv: +diff --git a/glib/gstrfuncs.h b/glib/gstrfuncs.h +index cb021b658..1527c3796 100644 +--- a/glib/gstrfuncs.h ++++ b/glib/gstrfuncs.h +@@ -377,8 +377,10 @@ gchar* g_strjoinv (const gchar *separator, + gchar **str_array) G_GNUC_MALLOC; + GLIB_AVAILABLE_IN_ALL + void g_strfreev (gchar **str_array); ++void g_strfreev_adapter (gpointer str_array); + GLIB_AVAILABLE_IN_ALL + gchar** g_strdupv (gchar **str_array); ++gpointer g_strdupv_adapter (gpointer str_array); + GLIB_AVAILABLE_IN_ALL + guint g_strv_length (gchar **str_array); + +diff --git a/glib/gtestutils.c b/glib/gtestutils.c +index 727cad614..a0b224bcf 100644 +--- a/glib/gtestutils.c ++++ b/glib/gtestutils.c +@@ -2907,6 +2907,7 @@ g_test_add_data_func (const char *testpath, + g_test_add_vtable (testpath, 0, ctx, NULL, (GTestFixtureFunc) data_func_to_fixture_trampoline, NULL); + } + ++#ifndef __EMSCRIPTEN__ + /** + * g_test_add_data_func_full: + * @testpath: /-separated test case path name for the test. +@@ -2973,6 +2974,7 @@ g_test_suite_case_exists (GTestSuite *suite, + + return FALSE; + } ++#endif /* !__EMSCRIPTEN__ */ + + /** + * g_test_create_suite: +@@ -3096,11 +3098,6 @@ test_has_prefix (gconstpointer a, + return g_strcmp0 (test_run_name_local, test_path_skipped_local); + } + +-static void test_case_free(gpointer ptr, gpointer user_data) { +- (void)user_data; +- g_free(ptr); +-} +- + static gboolean + test_case_run (GTestCase *tc) + { +@@ -3175,7 +3172,7 @@ test_case_run (GTestCase *tc) + g_timer_destroy (test_run_timer); + } + +- g_slist_free_full (filename_free_list, (GDestroyNotify)test_case_free); ++ g_slist_free_full (filename_free_list, g_test_case_free_adapter); + test_filename_free_list = old_free_list; + g_free (test_uri_base); + test_uri_base = old_base; +@@ -3363,19 +3360,10 @@ g_test_case_free (GTestCase *test_case) + g_free (test_case->name); + g_slice_free (GTestCase, test_case); + } +- +-static void +-test_case_free_trampoline (gpointer data, gpointer userdata) +-{ +- (void) userdata; +- g_test_case_free (data); +-} +- +-static void +-test_suite_free_trampoline (gpointer data, gpointer userdata) ++void ++g_test_case_free_adapter (gpointer test_case) + { +- (void)userdata; +- g_test_suite_free (data); ++ g_test_case_free ((GTestCase*) test_case); + } + + /** +@@ -3389,14 +3377,19 @@ test_suite_free_trampoline (gpointer data, gpointer userdata) + void + g_test_suite_free (GTestSuite *suite) + { +- g_slist_free_full (suite->cases, (GDestroyNotify)test_case_free_trampoline); ++ g_slist_free_full (suite->cases, g_test_case_free_adapter); + + g_free (suite->name); + +- g_slist_free_full (suite->suites, (GDestroyNotify)test_suite_free_trampoline); ++ g_slist_free_full (suite->suites, g_test_suite_free_adapter); + + g_slice_free (GTestSuite, suite); + } ++void ++g_test_suite_free_adapter (gpointer suite) ++{ ++ g_test_suite_free ((GTestSuite*) suite); ++} + + static void + gtest_default_log_handler (const gchar *log_domain, +@@ -3675,7 +3668,7 @@ test_trap_clear (void) + g_clear_pointer (&test_trap_last_stderr, g_free); + } + +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && ! defined(__EMSCRIPTEN__) + + static int + safe_dup2 (int fd1, +@@ -3704,6 +3697,7 @@ typedef struct { + GString *stderr_str; + } WaitForChildData; + ++#ifndef __EMSCRIPTEN__ + static void + check_complete (WaitForChildData *data) + { +@@ -3874,6 +3868,7 @@ wait_for_child (GPid pid, + g_clear_pointer (&data.stdout_io, g_io_channel_unref); + g_clear_pointer (&data.stderr_io, g_io_channel_unref); + } ++#endif /* !__EMSCRIPTEN__ */ + + /** + * g_test_trap_fork: +@@ -3923,7 +3918,7 @@ gboolean + g_test_trap_fork (guint64 usec_timeout, + GTestTrapFlags test_trap_flags) + { +-#ifdef G_OS_UNIX ++#if defined(G_OS_UNIX) && ! defined(__EMSCRIPTEN__) + int stdout_pipe[2] = { -1, -1 }; + int stderr_pipe[2] = { -1, -1 }; + int errsv; +@@ -3995,6 +3990,7 @@ g_test_trap_fork (guint64 usec_timeout, + } + G_GNUC_END_IGNORE_DEPRECATIONS + ++#ifndef __EMSCRIPTEN__ + /** + * g_test_trap_subprocess: + * @test_path: (nullable): Test to run in a subprocess +@@ -4142,6 +4138,7 @@ g_test_trap_subprocess (const char *test_path, + stderr_fd, !!(test_flags & G_TEST_SUBPROCESS_INHERIT_STDERR), + usec_timeout); + } ++#endif /* !__EMSCRIPTEN__ */ + + /** + * g_test_subprocess: +diff --git a/glib/gtestutils.h b/glib/gtestutils.h +index 86ee4e521..2c7fda89c 100644 +--- a/glib/gtestutils.h ++++ b/glib/gtestutils.h +@@ -524,9 +524,11 @@ int g_test_run_suite (GTestSuite *suite); + + GLIB_AVAILABLE_IN_2_70 + void g_test_case_free (GTestCase *test_case); ++void g_test_case_free_adapter (gpointer test_case); + + GLIB_AVAILABLE_IN_2_70 + void g_test_suite_free (GTestSuite *suite); ++void g_test_suite_free_adapter (gpointer suite); + + GLIB_AVAILABLE_IN_ALL + void g_test_trap_assertions (const char *domain, +diff --git a/glib/gthread.c b/glib/gthread.c +index c4e75fd11..8fb864b60 100644 +--- a/glib/gthread.c ++++ b/glib/gthread.c +@@ -807,6 +807,11 @@ g_thread_unref (GThread *thread) + g_slice_free (GRealThread, real); + } + } ++void ++g_thread_unref_adapter (gpointer thread) ++{ ++ g_thread_unref ((GThread *) thread); ++} + + static void + g_thread_cleanup (gpointer data) +diff --git a/glib/gthread.h b/glib/gthread.h +index e96632b91..3a2db258b 100644 +--- a/glib/gthread.h ++++ b/glib/gthread.h +@@ -143,6 +143,7 @@ GLIB_AVAILABLE_IN_2_32 + GThread * g_thread_ref (GThread *thread); + GLIB_AVAILABLE_IN_2_32 + void g_thread_unref (GThread *thread); ++void g_thread_unref_adapter (gpointer thread); + GLIB_AVAILABLE_IN_2_32 + GThread * g_thread_new (const gchar *name, + GThreadFunc func, +@@ -352,6 +353,11 @@ g_mutex_locker_free (GMutexLocker *locker) + { + g_mutex_unlock ((GMutex *) locker); + } ++static inline void ++g_mutex_locker_free_adapter (gpointer locker) ++{ ++ g_mutex_unlock ((GMutex*) locker); ++} + + /** + * GRecMutexLocker: +@@ -430,6 +436,11 @@ g_rec_mutex_locker_free (GRecMutexLocker *locker) + { + g_rec_mutex_unlock ((GRecMutex *) locker); + } ++static inline void ++g_rec_mutex_locker_free_adapter (gpointer locker) ++{ ++ g_rec_mutex_locker_free ((GRecMutex*) locker); ++} + G_GNUC_END_IGNORE_DEPRECATIONS + + /** +@@ -541,6 +552,11 @@ g_rw_lock_writer_locker_free (GRWLockWriterLocker *locker) + { + g_rw_lock_writer_unlock ((GRWLock *) locker); + } ++static inline void ++g_rw_lock_writer_locker_free_adapter (gpointer locker) ++{ ++ g_rw_lock_writer_locker_free ((GRWLockWriterLocker*) locker); ++} + G_GNUC_END_IGNORE_DEPRECATIONS + + /** +@@ -596,6 +612,11 @@ g_rw_lock_reader_locker_free (GRWLockReaderLocker *locker) + { + g_rw_lock_reader_unlock ((GRWLock *) locker); + } ++static inline void ++g_rw_lock_reader_locker_free_adapter (gpointer locker) ++{ ++ g_rw_lock_reader_locker_free ((GRWLockReaderLocker*) locker); ++} + G_GNUC_END_IGNORE_DEPRECATIONS + + G_END_DECLS +diff --git a/glib/gtimer.c b/glib/gtimer.c +index d2d259918..97ce2fe3a 100644 +--- a/glib/gtimer.c ++++ b/glib/gtimer.c +@@ -114,6 +114,11 @@ g_timer_destroy (GTimer *timer) + + g_free (timer); + } ++void ++g_timer_destroy_adapter (gpointer timer) ++{ ++ g_timer_destroy ((GTimer*) timer); ++} + + /** + * g_timer_start: +diff --git a/glib/gtimer.h b/glib/gtimer.h +index 439ffad98..c4dff5a49 100644 +--- a/glib/gtimer.h ++++ b/glib/gtimer.h +@@ -47,6 +47,7 @@ GLIB_AVAILABLE_IN_ALL + GTimer* g_timer_new (void); + GLIB_AVAILABLE_IN_ALL + void g_timer_destroy (GTimer *timer); ++void g_timer_destroy_adapter (gpointer timer); + GLIB_AVAILABLE_IN_ALL + void g_timer_start (GTimer *timer); + GLIB_AVAILABLE_IN_ALL +diff --git a/glib/gtimezone.c b/glib/gtimezone.c +index affa4b144..9dbed2c24 100644 +--- a/glib/gtimezone.c ++++ b/glib/gtimezone.c +@@ -103,6 +103,7 @@ typedef struct { gchar bytes[8]; } gint64_be; + typedef struct { gchar bytes[4]; } gint32_be; + typedef struct { gchar bytes[4]; } guint32_be; + ++#ifndef __EMSCRIPTEN__ + static inline gint64 gint64_from_be (const gint64_be be) { + gint64 tmp; memcpy (&tmp, &be, sizeof tmp); return GINT64_FROM_BE (tmp); + } +@@ -114,6 +115,7 @@ static inline gint32 gint32_from_be (const gint32_be be) { + static inline guint32 guint32_from_be (const guint32_be be) { + guint32 tmp; memcpy (&tmp, &be, sizeof tmp); return GUINT32_FROM_BE (tmp); + } ++#endif + + /* The layout of an IANA timezone file header */ + struct tzhead +@@ -273,6 +275,11 @@ again: + ref_count - 1)) + goto again; + } ++void ++g_time_zone_unref_adapter (gpointer tz) ++{ ++ g_time_zone_unref ((GTimeZone*) tz); ++} + + /** + * g_time_zone_ref: +@@ -1153,8 +1160,8 @@ find_relative_date (TimeZoneDate *buffer) + g_date_add_days (&date, wday); + else + g_date_add_days (&date, wday - 1); +- buffer->mon = (int) g_date_get_month (&date); +- buffer->mday = (int) g_date_get_day (&date); ++ buffer->mon = g_date_get_month (&date); ++ buffer->mday = g_date_get_day (&date); + buffer->wday = 0; + } + else /* M.W.D */ +@@ -1481,8 +1488,8 @@ parse_julian_boundary (gchar** pos, TimeZoneDate *boundary, + g_date_clear (&date, 1); + g_date_set_julian (&date, day); + boundary->year = 0; +- boundary->mon = (int) g_date_get_month (&date); +- boundary->mday = (int) g_date_get_day (&date); ++ boundary->mon = g_date_get_month (&date); ++ boundary->mday = g_date_get_day (&date); + boundary->wday = 0; + + return TRUE; +diff --git a/glib/gtimezone.h b/glib/gtimezone.h +index 679ed4e95..2aa90376d 100644 +--- a/glib/gtimezone.h ++++ b/glib/gtimezone.h +@@ -70,6 +70,7 @@ GLIB_AVAILABLE_IN_ALL + GTimeZone * g_time_zone_ref (GTimeZone *tz); + GLIB_AVAILABLE_IN_ALL + void g_time_zone_unref (GTimeZone *tz); ++void g_time_zone_unref_adapter (gpointer tz); + + GLIB_AVAILABLE_IN_ALL + gint g_time_zone_find_interval (GTimeZone *tz, +diff --git a/glib/gtree.c b/glib/gtree.c +index bbd609e5b..e7bf7419b 100644 +--- a/glib/gtree.c ++++ b/glib/gtree.c +@@ -161,11 +161,11 @@ g_tree_node_new (gpointer key, + * Returns: a newly allocated #GTree + */ + GTree * +-g_tree_new (GCompareFunc key_compare_func) ++g_tree_new (GCompareDataFunc key_compare_func) + { + g_return_val_if_fail (key_compare_func != NULL, NULL); + +- return g_tree_new_full ((GCompareDataFunc) key_compare_func, NULL, ++ return g_tree_new_full (key_compare_func, NULL, + NULL, NULL); + } + +@@ -433,6 +433,11 @@ g_tree_unref (GTree *tree) + g_slice_free (GTree, tree); + } + } ++void ++g_tree_unref_adapter (gpointer tree) ++{ ++ g_tree_unref ((GTree*) tree); ++} + + /** + * g_tree_destroy: +diff --git a/glib/gtree.h b/glib/gtree.h +index 74ab9ce95..195f8eb91 100644 +--- a/glib/gtree.h ++++ b/glib/gtree.h +@@ -71,7 +71,7 @@ typedef gboolean (*GTraverseNodeFunc) (GTreeNode *node, + /* Balanced binary trees + */ + GLIB_AVAILABLE_IN_ALL +-GTree* g_tree_new (GCompareFunc key_compare_func); ++GTree* g_tree_new (GCompareDataFunc key_compare_func); + GLIB_AVAILABLE_IN_ALL + GTree* g_tree_new_with_data (GCompareDataFunc key_compare_func, + gpointer key_compare_data); +@@ -92,6 +92,7 @@ GLIB_AVAILABLE_IN_ALL + GTree* g_tree_ref (GTree *tree); + GLIB_AVAILABLE_IN_ALL + void g_tree_unref (GTree *tree); ++void g_tree_unref_adapter (gpointer tree); + GLIB_AVAILABLE_IN_ALL + void g_tree_destroy (GTree *tree); + GLIB_AVAILABLE_IN_2_68 +diff --git a/glib/gvariant-core.c b/glib/gvariant-core.c +index f5e9dddfe..013f8d720 100644 +--- a/glib/gvariant-core.c ++++ b/glib/gvariant-core.c +@@ -800,6 +800,11 @@ g_variant_unref (GVariant *value) + g_slice_free (GVariant, value); + } + } ++void ++g_variant_unref_adapter (gpointer value) ++{ ++ g_variant_unref ((GVariant*) value); ++} + + /** + * g_variant_ref: +diff --git a/glib/gvariant.c b/glib/gvariant.c +index be2ffb860..687d0e6e0 100644 +--- a/glib/gvariant.c ++++ b/glib/gvariant.c +@@ -3094,6 +3094,11 @@ g_variant_iter_free (GVariantIter *iter) + + g_slice_free (struct heap_iter, GVHI(iter)); + } ++void ++g_variant_iter_free_adapter (gpointer iter) ++{ ++ g_variant_iter_free ((GVariantIter*) iter); ++} + + /** + * g_variant_iter_next_value: +@@ -3320,6 +3325,11 @@ g_variant_builder_unref (GVariantBuilder *builder) + + g_slice_free (struct heap_builder, GVHB(builder)); + } ++void ++g_variant_builder_unref_adapter (gpointer builder) ++{ ++ g_variant_builder_unref((GVariantBuilder*) builder); ++} + + /** + * g_variant_builder_ref: +@@ -4014,7 +4024,7 @@ g_variant_dict_init (GVariantDict *dict, + gchar *key; + GVariant *value; + +- GVSD(dict)->values = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_variant_unref); ++ GVSD(dict)->values = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_variant_unref_adapter); + GVSD(dict)->magic = GVSD_MAGIC; + + if (from_asv) +@@ -4330,6 +4340,11 @@ g_variant_dict_unref (GVariantDict *dict) + g_slice_free (struct heap_dict, (struct heap_dict *) dict); + } + } ++void ++g_variant_dict_unref_adapter (gpointer dict) ++{ ++ g_variant_dict_unref ((GVariantDict*) dict); ++} + + + /* Format strings {{{1 */ +diff --git a/glib/gvariant.h b/glib/gvariant.h +index e7087a1f6..ce85e9fd2 100644 +--- a/glib/gvariant.h ++++ b/glib/gvariant.h +@@ -59,6 +59,7 @@ typedef enum + + GLIB_AVAILABLE_IN_ALL + void g_variant_unref (GVariant *value); ++void g_variant_unref_adapter (gpointer value); + GLIB_AVAILABLE_IN_ALL + GVariant * g_variant_ref (GVariant *value); + GLIB_AVAILABLE_IN_ALL +@@ -284,6 +285,7 @@ GLIB_AVAILABLE_IN_ALL + gsize g_variant_iter_n_children (GVariantIter *iter); + GLIB_AVAILABLE_IN_ALL + void g_variant_iter_free (GVariantIter *iter); ++void g_variant_iter_free_adapter (gpointer iter); + GLIB_AVAILABLE_IN_ALL + GVariant * g_variant_iter_next_value (GVariantIter *iter); + GLIB_AVAILABLE_IN_ALL +@@ -377,6 +379,7 @@ GLIB_AVAILABLE_IN_ALL + GVariantBuilder * g_variant_builder_new (const GVariantType *type); + GLIB_AVAILABLE_IN_ALL + void g_variant_builder_unref (GVariantBuilder *builder); ++void g_variant_builder_unref_adapter (gpointer builder); + GLIB_AVAILABLE_IN_ALL + GVariantBuilder * g_variant_builder_ref (GVariantBuilder *builder); + GLIB_AVAILABLE_IN_ALL +@@ -535,6 +538,7 @@ GLIB_AVAILABLE_IN_2_40 + GVariantDict * g_variant_dict_ref (GVariantDict *dict); + GLIB_AVAILABLE_IN_2_40 + void g_variant_dict_unref (GVariantDict *dict); ++void g_variant_dict_unref_adapter (gpointer dict); + + G_END_DECLS + +diff --git a/glib/gvarianttype.c b/glib/gvarianttype.c +index 58a4a59c9..9df7ab907 100644 +--- a/glib/gvarianttype.c ++++ b/glib/gvarianttype.c +@@ -376,6 +376,11 @@ g_variant_type_free (GVariantType *type) + + g_free (type); + } ++void ++g_variant_type_free_adapter (gpointer type) ++{ ++ g_variant_type_free ((GVariantType*) type); ++} + + /** + * g_variant_type_copy: +diff --git a/glib/gvarianttype.h b/glib/gvarianttype.h +index 6374957f5..d60de16f2 100644 +--- a/glib/gvarianttype.h ++++ b/glib/gvarianttype.h +@@ -304,6 +304,7 @@ gboolean g_variant_type_string_scan (const g + /* create/destroy */ + GLIB_AVAILABLE_IN_ALL + void g_variant_type_free (GVariantType *type); ++void g_variant_type_free_adapter (gpointer type); + GLIB_AVAILABLE_IN_ALL + GVariantType * g_variant_type_copy (const GVariantType *type); + GLIB_AVAILABLE_IN_ALL +diff --git a/glib/gwakeup.c b/glib/gwakeup.c +index 35eb75f2d..63cb1948f 100644 +--- a/glib/gwakeup.c ++++ b/glib/gwakeup.c +@@ -19,6 +19,8 @@ + * Author: Ryan Lortie + */ + ++#ifndef __EMSCRIPTEN__ ++ + #include "config.h" + + #include +@@ -360,3 +362,5 @@ g_wakeup_free (GWakeup *wakeup) + } + + #endif /* !_WIN32 */ ++ ++#endif /* !__EMSCRIPTEN__ */ +diff --git a/glib/gwakeup.h b/glib/gwakeup.h +index 0905fde2f..186e58527 100644 +--- a/glib/gwakeup.h ++++ b/glib/gwakeup.h +@@ -22,6 +22,8 @@ + #ifndef __G_WAKEUP_H__ + #define __G_WAKEUP_H__ + ++#ifndef __EMSCRIPTEN__ ++ + #include + + typedef struct _GWakeup GWakeup; +@@ -34,4 +36,6 @@ void g_wakeup_get_pollfd (GWakeup *wakeup, + void g_wakeup_signal (GWakeup *wakeup); + void g_wakeup_acknowledge (GWakeup *wakeup); + ++#endif /* !__EMSCRIPTEN__ */ ++ + #endif +diff --git a/glib/meson.build b/glib/meson.build +index 7d2ec173f..65d5f6396 100644 +--- a/glib/meson.build ++++ b/glib/meson.build +@@ -155,11 +155,11 @@ install_headers(glib_headers, install_dir : glib_includedir) + glib_unix_h = files('glib-unix.h') + + glib_deprecated_headers = files( +- 'deprecated/gallocator.h', +- 'deprecated/gcache.h', +- 'deprecated/gcompletion.h', +- 'deprecated/gmain.h', +- 'deprecated/grel.h', ++# 'deprecated/gallocator.h', ++# 'deprecated/gcache.h', ++# 'deprecated/gcompletion.h', ++# 'deprecated/gmain.h', ++# 'deprecated/grel.h', + 'deprecated/gthread.h', + ) + install_headers(glib_deprecated_headers, +@@ -170,10 +170,10 @@ glib_sub_headers = files( + 'glib-typeof.h', + 'galloca.h', + 'garray.h', +- 'gasyncqueue.h', ++ # 'gasyncqueue.h', + 'gatomic.h', +- 'gbacktrace.h', +- 'gbase64.h', ++ # 'gbacktrace.h', ++ # 'gbase64.h', + 'gbitlock.h', + 'gbookmarkfile.h', + 'gbytes.h', +@@ -189,11 +189,11 @@ glib_sub_headers = files( + 'gfileutils.h', + 'ggettext.h', + 'ghash.h', +- 'ghmac.h', ++ # 'ghmac.h', + 'ghook.h', +- 'ghostutils.h', +- 'gi18n.h', +- 'gi18n-lib.h', ++ # 'ghostutils.h', ++ # 'gi18n.h', ++ # 'gi18n-lib.h', + 'giochannel.h', + 'gkeyfile.h', + 'glist.h', +@@ -204,66 +204,66 @@ glib_sub_headers = files( + 'gmem.h', + 'gmessages.h', + 'gnode.h', +- 'goption.h', +- 'gpathbuf.h', ++ # 'goption.h', ++ # 'gpathbuf.h', + 'gpattern.h', + 'gpoll.h', +- 'gprimes.h', ++ # 'gprimes.h', + 'gqsort.h', + 'gquark.h', + 'gqueue.h', +- 'grand.h', ++ # 'grand.h', + 'grcbox.h', + 'grefcount.h', +- 'grefstring.h', ++ # 'grefstring.h', + 'gregex.h', + 'gscanner.h', +- 'gsequence.h', +- 'gshell.h', ++ # 'gsequence.h', ++ # 'gshell.h', + 'gslice.h', + 'gslist.h', +- 'gspawn.h', ++ # 'gspawn.h', + 'gstdio.h', + 'gstrfuncs.h', +- 'gstrvbuilder.h', ++ # 'gstrvbuilder.h', + 'gtestutils.h', + 'gstring.h', +- 'gstringchunk.h', ++ # 'gstringchunk.h', + 'gthread.h', +- 'gthreadpool.h', ++ # 'gthreadpool.h', + 'gtimer.h', + 'gtimezone.h', +- 'gtrashstack.h', ++ # 'gtrashstack.h', + 'gtree.h', + 'gtypes.h', +- 'guuid.h', ++ # 'guuid.h', + 'gunicode.h', +- 'guri.h', ++ # 'guri.h', + 'gutils.h', + 'gvarianttype.h', + 'gvariant.h', + 'gversion.h', +- 'gwin32.h', ++ # 'gwin32.h', + 'gprintf.h', + ) + + install_headers(glib_sub_headers, install_dir : glib_sub_includedir) + + deprecated_sources = files( +- 'deprecated/gallocator.c', +- 'deprecated/gcache.c', +- 'deprecated/gcompletion.c', +- 'deprecated/grel.c', +- 'deprecated/gthread-deprecated.c' ++ # 'deprecated/gallocator.c', ++ # 'deprecated/gcache.c', ++ # 'deprecated/gcompletion.c', ++ # 'deprecated/grel.c', ++ # 'deprecated/gthread-deprecated.c' + ) + + glib_sources += files( + 'garcbox.c', + 'garray.c', +- 'gasyncqueue.c', ++ # 'gasyncqueue.c', + 'gatomic.c', +- 'gbacktrace.c', +- 'gbase64.c', ++ # 'gbacktrace.c', ++ # 'gbase64.c', + 'gbitlock.c', + 'gbookmarkfile.c', + 'gbytes.c', +@@ -279,9 +279,9 @@ glib_sources += files( + 'gfileutils.c', + 'ggettext.c', + 'ghash.c', +- 'ghmac.c', ++ # 'ghmac.c', + 'ghook.c', +- 'ghostutils.c', ++ # 'ghostutils.c', + 'giochannel.c', + 'gkeyfile.c', + 'glib-init.c', +@@ -293,57 +293,57 @@ glib_sources += files( + 'gmem.c', + 'gmessages.c', + 'gnode.c', +- 'goption.c', +- 'gpathbuf.c', ++ # 'goption.c', ++ # 'gpathbuf.c', + 'gpattern.c', + 'gpoll.c', +- 'gprimes.c', ++ # 'gprimes.c', + 'gqsort.c', + 'gquark.c', + 'gqueue.c', +- 'grand.c', ++ # 'grand.c', + 'grcbox.c', + 'grefcount.c', +- 'grefstring.c', ++ # 'grefstring.c', + 'gregex.c', + 'gscanner.c', +- 'gsequence.c', +- 'gshell.c', ++ # 'gsequence.c', ++ # 'gshell.c', + 'gslice.c', + 'gslist.c', + 'gstdio.c', + 'gstrfuncs.c', + 'gstring.c', +- 'gstringchunk.c', +- 'gstrvbuilder.c', ++ # 'gstringchunk.c', ++ # 'gstrvbuilder.c', + 'gtestutils.c', + 'gthread.c', +- 'gthreadpool.c', ++ # 'gthreadpool.c', + 'gtimer.c', + 'gtimezone.c', +- 'gtrace.c', +- 'gtrace-private.h', +- 'gtranslit.c', +- 'gtrashstack.c', ++ # 'gtrace.c', ++ # 'gtrace-private.h', ++ # 'gtranslit.c', ++ # 'gtrashstack.c', + 'gtree.c', + 'guniprop.c', + 'gutf8.c', + 'gunibreak.c', + 'gunicollate.c', + 'gunidecomp.c', +- 'guri.c', +- 'guriprivate.h', ++ # 'guri.c', ++ # 'guriprivate.h', + 'gutils.c', +- 'gutilsprivate.h', +- 'guuid.c', ++ # 'gutilsprivate.h', ++ # 'guuid.c', + 'gvariant.c', + 'gvariant-core.c', +- 'gvariant-parser.c', ++ # 'gvariant-parser.c', + 'gvariant-serialiser.c', + 'gvarianttypeinfo.c', + 'gvarianttype.c', + 'gversion.c', +- 'gwakeup.c', ++ # 'gwakeup.c', + 'gprintf.c', + ) + +diff --git a/gobject/gbinding.c b/gobject/gbinding.c +index 204dc44db..f6d7ae307 100644 +--- a/gobject/gbinding.c ++++ b/gobject/gbinding.c +@@ -108,6 +108,7 @@ + #include "config.h" + + #include ++#include + + #include "gbinding.h" + #include "genums.h" +@@ -166,6 +167,11 @@ binding_context_ref (BindingContext *context) + { + return g_atomic_rc_box_acquire (context); + } ++static gpointer ++binding_context_ref_adapter (gpointer context) ++{ ++ return binding_context_ref ((BindingContext*) context); ++} + + static void + binding_context_clear (BindingContext *context) +@@ -174,11 +180,21 @@ binding_context_clear (BindingContext *context) + g_weak_ref_clear (&context->source); + g_weak_ref_clear (&context->target); + } ++static void ++binding_context_clear_adapter (gpointer context) ++{ ++ binding_context_clear ((BindingContext *) context); ++} + + static void + binding_context_unref (BindingContext *context) + { +- g_atomic_rc_box_release_full (context, (GDestroyNotify) binding_context_clear); ++ g_atomic_rc_box_release_full (context, binding_context_clear_adapter); ++} ++static void ++binding_context_unref_gclosurenotify_adapter (gpointer context, GClosure* closure) ++{ ++ binding_context_unref ((BindingContext *) context); + } + + /* Reference counting for the transform functions to ensure that they're always +@@ -223,11 +239,16 @@ transform_func_clear (TransformFunc *func) + if (func->destroy_notify) + func->destroy_notify (func->transform_data); + } ++static void ++transform_func_clear_adapter (gpointer func) ++{ ++ transform_func_clear((TransformFunc*) func); ++} + + static void + transform_func_unref (TransformFunc *func) + { +- g_atomic_rc_box_release_full (func, (GDestroyNotify) transform_func_clear); ++ g_atomic_rc_box_release_full (func, transform_func_clear_adapter); + } + + #define G_BINDING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_BINDING, GBindingClass)) +@@ -796,6 +817,12 @@ g_binding_get_property (GObject *gobject, + static void + g_binding_constructed (GObject *gobject) + { ++#ifdef __EMSCRIPTEN__ ++ // print to stderr to help debugging which funcion and line we are on ++ fprintf(stderr, "%s (%d) Commented this out - ARL\n", __FUNCTION__, __LINE__); ++ return; ++#else ++ + GBinding *binding = G_BINDING (gobject); + GBindingTransformFunc transform_func = default_transform; + GObject *source, *target; +@@ -828,15 +855,15 @@ g_binding_constructed (GObject *gobject) + + source_property_detail = g_quark_from_string (binding->source_property); + source_notify_closure = g_cclosure_new (G_CALLBACK (on_source_notify), +- binding_context_ref (binding->context), +- (GClosureNotify) binding_context_unref); ++ binding_context_ref_adapter (binding->context), ++ binding_context_unref_gclosurenotify_adapter); + binding->source_notify = g_signal_connect_closure_by_id (source, + gobject_notify_signal_id, + source_property_detail, + source_notify_closure, + FALSE); + +- g_object_weak_ref (source, weak_unbind, binding_context_ref (binding->context)); ++ g_object_weak_ref (source, weak_unbind, binding_context_ref_adapter (binding->context)); + + if (binding->flags & G_BINDING_BIDIRECTIONAL) + { +@@ -845,8 +872,8 @@ g_binding_constructed (GObject *gobject) + + target_property_detail = g_quark_from_string (binding->target_property); + target_notify_closure = g_cclosure_new (G_CALLBACK (on_target_notify), +- binding_context_ref (binding->context), +- (GClosureNotify) binding_context_unref); ++ binding_context_ref_adapter(binding->context), ++ binding_context_unref_gclosurenotify_adapter); + binding->target_notify = g_signal_connect_closure_by_id (target, + gobject_notify_signal_id, + target_property_detail, +@@ -856,7 +883,7 @@ g_binding_constructed (GObject *gobject) + + if (target != source) + { +- g_object_weak_ref (target, weak_unbind, binding_context_ref (binding->context)); ++ g_object_weak_ref (target, weak_unbind, binding_context_ref_adapter (binding->context)); + + /* Need to remember separately if a target weak notify was installed as + * unlike for the source it can exist independently of the property +@@ -866,6 +893,7 @@ g_binding_constructed (GObject *gobject) + + g_object_unref (source); + g_object_unref (target); ++#endif + } + + static void +diff --git a/gobject/gboxed.c b/gobject/gboxed.c +index 3868003db..4f6c96b85 100644 +--- a/gobject/gboxed.c ++++ b/gobject/gboxed.c +@@ -175,10 +175,10 @@ G_DEFINE_BOXED_TYPE (GMarkupParseContext, g_markup_parse_context, g_markup_parse + + G_DEFINE_BOXED_TYPE (GThread, g_thread, g_thread_ref, g_thread_unref) + G_DEFINE_BOXED_TYPE (GChecksum, g_checksum, g_checksum_copy, g_checksum_free) +-G_DEFINE_BOXED_TYPE (GUri, g_uri, g_uri_ref, g_uri_unref) ++// G_DEFINE_BOXED_TYPE (GUri, g_uri, g_uri_ref, g_uri_unref) + +-G_DEFINE_BOXED_TYPE (GOptionGroup, g_option_group, g_option_group_ref, g_option_group_unref) +-G_DEFINE_BOXED_TYPE (GPatternSpec, g_pattern_spec, g_pattern_spec_copy, g_pattern_spec_free); ++// G_DEFINE_BOXED_TYPE (GOptionGroup, g_option_group, g_option_group_ref, g_option_group_unref) ++// G_DEFINE_BOXED_TYPE (GPatternSpec, g_pattern_spec, g_pattern_spec_copy, g_pattern_spec_free); + + /* This one can't use G_DEFINE_BOXED_TYPE (GStrv, g_strv, g_strdupv, g_strfreev) */ + GType +@@ -190,8 +190,8 @@ g_strv_get_type (void) + { + GType g_define_type_id = + g_boxed_type_register_static (g_intern_static_string ("GStrv"), +- (GBoxedCopyFunc) g_strdupv, +- (GBoxedFreeFunc) g_strfreev); ++ g_strdupv_adapter, ++ g_strfreev_adapter); + + g_once_init_leave (&static_g_define_type_id, g_define_type_id); + } +diff --git a/gobject/gclosure.c b/gobject/gclosure.c +index 8d5d88d94..00608f423 100644 +--- a/gobject/gclosure.c ++++ b/gobject/gclosure.c +@@ -26,6 +26,7 @@ + + #include "../glib/gvalgrind.h" + #include ++#include + + #include + +@@ -234,76 +235,78 @@ static inline void + closure_invoke_notifiers (GClosure *closure, + guint notify_type) + { +- /* notifier layout: +- * n_guards n_guards n_fnotif. n_inotifiers +- * ->[[pre_guards][post_guards][fnotifiers][inotifiers]] +- * +- * CLOSURE_N_MFUNCS(cl) = n_guards + n_guards; +- * CLOSURE_N_NOTIFIERS(cl) = CLOSURE_N_MFUNCS(cl) + n_fnotifiers + n_inotifiers +- * +- * constrains/catches: +- * - closure->notifiers may be reloacted during callback +- * - closure->n_fnotifiers and closure->n_inotifiers may change during callback +- * - i.e. callbacks can be removed/added during invocation +- * - must prepare for callback removal during FNOTIFY and INOTIFY (done via ->marshal= & ->data=) +- * - must distinguish (->marshal= & ->data=) for INOTIFY vs. FNOTIFY (via ->in_inotify) +- * + closure->n_guards is const during PRE_NOTIFY & POST_NOTIFY +- * + none of the callbacks can cause recursion +- * + closure->n_inotifiers is const 0 during FNOTIFY +- */ +- switch (notify_type) +- { +- GClosureNotifyData *ndata; +- guint i, offs; +- case FNOTIFY: +- while (closure->n_fnotifiers) +- { +- guint n; +- DEC_ASSIGN (closure, n_fnotifiers, &n); +- +- ndata = closure->notifiers + CLOSURE_N_MFUNCS (closure) + n; +- closure->marshal = (GClosureMarshal) ndata->notify; +- closure->data = ndata->data; +- ndata->notify (ndata->data, closure); +- } +- closure->marshal = NULL; +- closure->data = NULL; +- break; +- case INOTIFY: +- SET (closure, in_inotify, TRUE); +- while (closure->n_inotifiers) +- { +- guint n; +- DEC_ASSIGN (closure, n_inotifiers, &n); +- +- ndata = closure->notifiers + CLOSURE_N_MFUNCS (closure) + closure->n_fnotifiers + n; +- closure->marshal = (GClosureMarshal) ndata->notify; +- closure->data = ndata->data; +- ndata->notify (ndata->data, closure); +- } +- closure->marshal = NULL; +- closure->data = NULL; +- SET (closure, in_inotify, FALSE); +- break; +- case PRE_NOTIFY: +- i = closure->n_guards; +- offs = 0; +- while (i--) +- { +- ndata = closure->notifiers + offs + i; +- ndata->notify (ndata->data, closure); +- } +- break; +- case POST_NOTIFY: +- i = closure->n_guards; +- offs = i; +- while (i--) +- { +- ndata = closure->notifiers + offs + i; +- ndata->notify (ndata->data, closure); +- } +- break; +- } ++ fprintf(stderr, "%s (%d): I commented this out - ARL\n", __FUNCTION__, __LINE__); ++ return; ++ // /* notifier layout: ++ // * n_guards n_guards n_fnotif. n_inotifiers ++ // * ->[[pre_guards][post_guards][fnotifiers][inotifiers]] ++ // * ++ // * CLOSURE_N_MFUNCS(cl) = n_guards + n_guards; ++ // * CLOSURE_N_NOTIFIERS(cl) = CLOSURE_N_MFUNCS(cl) + n_fnotifiers + n_inotifiers ++ // * ++ // * constrains/catches: ++ // * - closure->notifiers may be reloacted during callback ++ // * - closure->n_fnotifiers and closure->n_inotifiers may change during callback ++ // * - i.e. callbacks can be removed/added during invocation ++ // * - must prepare for callback removal during FNOTIFY and INOTIFY (done via ->marshal= & ->data=) ++ // * - must distinguish (->marshal= & ->data=) for INOTIFY vs. FNOTIFY (via ->in_inotify) ++ // * + closure->n_guards is const during PRE_NOTIFY & POST_NOTIFY ++ // * + none of the callbacks can cause recursion ++ // * + closure->n_inotifiers is const 0 during FNOTIFY ++ // */ ++ // switch (notify_type) ++ // { ++ // GClosureNotifyData *ndata; ++ // guint i, offs; ++ // case FNOTIFY: ++ // while (closure->n_fnotifiers) ++ // { ++ // guint n; ++ // DEC_ASSIGN (closure, n_fnotifiers, &n); ++ // ++ // ndata = closure->notifiers + CLOSURE_N_MFUNCS (closure) + n; ++ // closure->marshal = (GClosureMarshal) ndata->notify; ++ // closure->data = ndata->data; ++ // ndata->notify (ndata->data, closure); ++ // } ++ // closure->marshal = NULL; ++ // closure->data = NULL; ++ // break; ++ // case INOTIFY: ++ // SET (closure, in_inotify, TRUE); ++ // while (closure->n_inotifiers) ++ // { ++ // guint n; ++ // DEC_ASSIGN (closure, n_inotifiers, &n); ++ // ++ // ndata = closure->notifiers + CLOSURE_N_MFUNCS (closure) + closure->n_fnotifiers + n; ++ // closure->marshal = (GClosureMarshal) ndata->notify; ++ // closure->data = ndata->data; ++ // ndata->notify (ndata->data, closure); ++ // } ++ // closure->marshal = NULL; ++ // closure->data = NULL; ++ // SET (closure, in_inotify, FALSE); ++ // break; ++ // case PRE_NOTIFY: ++ // i = closure->n_guards; ++ // offs = 0; ++ // while (i--) ++ // { ++ // ndata = closure->notifiers + offs + i; ++ // ndata->notify (ndata->data, closure); ++ // } ++ // break; ++ // case POST_NOTIFY: ++ // i = closure->n_guards; ++ // offs = i; ++ // while (i--) ++ // { ++ // ndata = closure->notifiers + offs + i; ++ // ndata->notify (ndata->data, closure); ++ // } ++ // break; ++ // } + } + + static void +@@ -564,6 +567,11 @@ g_closure_ref (GClosure *closure) + + return closure; + } ++gpointer g_closure_ref_adapter (gpointer closure) ++{ ++ GClosure* result = g_closure_ref ((GClosure*) closure); ++ return (gpointer) result; ++} + + /** + * g_closure_invalidate: +@@ -649,6 +657,11 @@ g_closure_unref (GClosure *closure) + g_free (G_REAL_CLOSURE (closure)); + } + } ++void ++g_closure_unref_adapter (gpointer closure) ++{ ++ g_closure_unref ((GClosure*) closure); ++} + + /** + * g_closure_sink: +diff --git a/gobject/gclosure.h b/gobject/gclosure.h +index 3b139b062..34027925a 100644 +--- a/gobject/gclosure.h ++++ b/gobject/gclosure.h +@@ -243,10 +243,12 @@ GClosure* g_signal_type_cclosure_new (GType itype, + /* --- prototypes --- */ + GOBJECT_AVAILABLE_IN_ALL + GClosure* g_closure_ref (GClosure *closure); ++gpointer g_closure_ref_adapter (gpointer closure); + GOBJECT_AVAILABLE_IN_ALL + void g_closure_sink (GClosure *closure); + GOBJECT_AVAILABLE_IN_ALL + void g_closure_unref (GClosure *closure); ++void g_closure_unref_adapter (gpointer closure); + /* intimidating */ + GOBJECT_AVAILABLE_IN_ALL + GClosure* g_closure_new_simple (guint sizeof_closure, +diff --git a/gobject/genums.c b/gobject/genums.c +index 1fe7f7211..ee42bf4e2 100644 +--- a/gobject/genums.c ++++ b/gobject/genums.c +@@ -71,8 +71,12 @@ + /* --- prototypes --- */ + static void g_enum_class_init (GEnumClass *class, + gpointer class_data); ++static void g_enum_class_init_adapter (gpointer class, ++ gpointer class_data); + static void g_flags_class_init (GFlagsClass *class, + gpointer class_data); ++static void g_flags_class_init_adapter (gpointer class, ++ gpointer class_data); + static void value_flags_enum_init (GValue *value); + static void value_flags_enum_copy_value (const GValue *src_value, + GValue *dest_value); +@@ -201,7 +205,7 @@ g_enum_register_static (const gchar *name, + sizeof (GEnumClass), /* class_size */ + NULL, /* base_init */ + NULL, /* base_finalize */ +- (GClassInitFunc) g_enum_class_init, ++ g_enum_class_init_adapter, + NULL, /* class_finalize */ + NULL, /* class_data */ + 0, /* instance_size */ +@@ -244,7 +248,7 @@ g_flags_register_static (const gchar *name, + sizeof (GFlagsClass), /* class_size */ + NULL, /* base_init */ + NULL, /* base_finalize */ +- (GClassInitFunc) g_flags_class_init, ++ g_flags_class_init_adapter, + NULL, /* class_finalize */ + NULL, /* class_data */ + 0, /* instance_size */ +@@ -305,7 +309,7 @@ g_enum_complete_type_info (GType g_enum_type, + info->class_size = sizeof (GEnumClass); + info->base_init = NULL; + info->base_finalize = NULL; +- info->class_init = (GClassInitFunc) g_enum_class_init; ++ info->class_init = g_enum_class_init_adapter; + info->class_finalize = NULL; + info->class_data = const_values; + } +@@ -334,7 +338,7 @@ g_flags_complete_type_info (GType g_flags_type, + info->class_size = sizeof (GFlagsClass); + info->base_init = NULL; + info->base_finalize = NULL; +- info->class_init = (GClassInitFunc) g_flags_class_init; ++ info->class_init = g_flags_class_init_adapter; + info->class_finalize = NULL; + info->class_data = const_values; + } +@@ -364,6 +368,12 @@ g_enum_class_init (GEnumClass *class, + } + } + } ++void ++g_enum_class_init_adapter (gpointer class, ++ gpointer class_data) ++{ ++ g_enum_class_init ((GEnumClass*) class, class_data ); ++} + + static void + g_flags_class_init (GFlagsClass *class, +@@ -386,6 +396,12 @@ g_flags_class_init (GFlagsClass *class, + } + } + } ++void ++g_flags_class_init_adapter (gpointer class, ++ gpointer class_data) ++{ ++ g_flags_class_init ((GFlagsClass*) class, class_data ); ++} + + /** + * g_enum_get_value_by_name: +diff --git a/gobject/gobject-autocleanups.h b/gobject/gobject-autocleanups.h +index bddb3f290..c36302907 100644 +--- a/gobject/gobject-autocleanups.h ++++ b/gobject/gobject-autocleanups.h +@@ -23,11 +23,11 @@ + #error "Only can be included directly." + #endif + +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GClosure, g_closure_unref) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GClosure, g_closure_unref_adapter) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GEnumClass, g_type_class_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFlagsClass, g_type_class_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GObject, g_object_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInitiallyUnowned, g_object_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GParamSpec, g_param_spec_unref) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(GParamSpec, g_param_spec_unref_adapter) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTypeClass, g_type_class_unref) +-G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GValue, g_value_unset) ++G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GValue, g_value_unset_adapter) +diff --git a/gobject/gobject.c b/gobject/gobject.c +index 661ecf8c0..07cb6bd7a 100644 +--- a/gobject/gobject.c ++++ b/gobject/gobject.c +@@ -202,11 +202,17 @@ G_STATIC_ASSERT(G_STRUCT_OFFSET(GObject, qdata) == G_STRUCT_OFFSET(GObjectReal, + + /* --- prototypes --- */ + static void g_object_base_class_init (GObjectClass *class); ++static void g_object_base_class_init_adapter (gpointer class); + static void g_object_base_class_finalize (GObjectClass *class); ++static void g_object_base_class_finalize_adapter (gpointer class); + static void g_object_do_class_init (GObjectClass *class, + gpointer class_data); ++static void g_object_do_class_init_adapter (gpointer class, ++ gpointer class_data); + static void g_object_init (GObject *object, + GObjectClass *class); ++static void g_object_init_adapter (GTypeInstance *object, ++ gpointer class); + static GObject* g_object_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_params); +@@ -426,14 +432,14 @@ _g_object_type_init (void) + }; + GTypeInfo info = { + sizeof (GObjectClass), +- (GBaseInitFunc) g_object_base_class_init, +- (GBaseFinalizeFunc) g_object_base_class_finalize, +- (GClassInitFunc) g_object_do_class_init, ++ g_object_base_class_init_adapter, ++ g_object_base_class_finalize_adapter, ++ g_object_do_class_init_adapter, + NULL /* class_destroy */, + NULL /* class_data */, + sizeof (GObject), + 0 /* n_preallocs */, +- (GInstanceInitFunc) g_object_init, ++ g_object_init_adapter, + NULL, /* value_table */ + }; + static const GTypeValueTable value_table = { +@@ -495,6 +501,11 @@ g_object_base_class_init (GObjectClass *class) + class->pspecs = NULL; + class->n_pspecs = 0; + } ++static void ++g_object_base_class_init_adapter (gpointer class) ++{ ++ g_object_base_class_init ((GObjectClass *) class); ++} + + static void + g_object_base_class_finalize (GObjectClass *class) +@@ -517,6 +528,11 @@ g_object_base_class_finalize (GObjectClass *class) + } + g_list_free (list); + } ++static void ++g_object_base_class_finalize_adapter (gpointer class) ++{ ++ g_object_base_class_finalize ((GObjectClass*) class); ++} + + static void + g_object_do_class_init (GObjectClass *class, +@@ -589,6 +605,12 @@ g_object_do_class_init (GObjectClass *class, + */ + g_type_add_interface_check (NULL, object_interface_check_properties); + } ++static void ++g_object_do_class_init_adapter (gpointer class, ++ gpointer class_data) ++{ ++ g_object_do_class_init ((GObjectClass*) class, class_data); ++} + + /* Sinks @pspec if it’s a floating ref. */ + static inline gboolean +@@ -1173,6 +1195,7 @@ g_object_interface_list_properties (gpointer g_iface, + return pspecs; + } + ++#ifndef __EMSCRIPTEN__ + static inline guint + object_get_optional_flags (GObject *object) + { +@@ -1198,6 +1221,7 @@ object_get_optional_flags_X (GObject *object) + return 0; + #endif + } ++#endif + + #ifdef HAVE_OPTIONAL_FLAGS + static inline void +@@ -1329,6 +1353,12 @@ g_object_init (GObject *object, + G_UNLOCK (debug_objects); + }); + } ++static void ++g_object_init_adapter (GTypeInstance *object, ++ gpointer class) ++{ ++ g_object_init ((GObject*)object, (GObjectClass*) class); ++} + + static void + g_object_do_set_property (GObject *object, +@@ -3396,6 +3426,11 @@ g_object_weak_unref (GObject *object, + * thread if the object's last g_object_unref() might happen in another + * thread. Use #GWeakRef if thread-safety is required. + */ ++static void ++g_nullify_pointer_adapter (gpointer data, GObject *where_the_object_was) ++{ ++ g_nullify_pointer ((gpointer*)data); ++} + void + g_object_add_weak_pointer (GObject *object, + gpointer *weak_pointer_location) +@@ -3404,7 +3439,7 @@ g_object_add_weak_pointer (GObject *object, + g_return_if_fail (weak_pointer_location != NULL); + + g_object_weak_ref (object, +- (GWeakNotify) g_nullify_pointer, ++ g_nullify_pointer_adapter, + weak_pointer_location); + } + +@@ -3426,7 +3461,7 @@ g_object_remove_weak_pointer (GObject *object, + g_return_if_fail (weak_pointer_location != NULL); + + g_object_weak_unref (object, +- (GWeakNotify) g_nullify_pointer, ++ g_nullify_pointer_adapter, + weak_pointer_location); + } + +@@ -3787,6 +3822,11 @@ gpointer + + return object; + } ++void ++(g_object_ref_adapter) (gpointer _object, GClosure *dummy) ++{ ++ g_object_ref (_object); ++} + + /** + * g_object_unref: +@@ -3964,6 +4004,11 @@ g_object_unref (gpointer _object) + } + } + } ++void ++g_object_unref_adapter (gpointer _object, GClosure *dummy) ++{ ++ g_object_unref (_object); ++} + + /** + * g_clear_object: (skip) +@@ -4742,8 +4787,8 @@ g_object_watch_closure (GObject *object, + + g_closure_add_invalidate_notifier (closure, object, object_remove_closure); + g_closure_add_marshal_guards (closure, +- object, (GClosureNotify) g_object_ref, +- object, (GClosureNotify) g_object_unref); ++ object, g_object_ref_adapter, ++ object, g_object_unref_adapter); + G_LOCK (closure_array_mutex); + carray = g_datalist_id_remove_no_notify (&object->qdata, quark_closure_array); + if (!carray) +diff --git a/gobject/gobject.h b/gobject/gobject.h +index ea0157c35..8dd278c7e 100644 +--- a/gobject/gobject.h ++++ b/gobject/gobject.h +@@ -526,8 +526,12 @@ GOBJECT_AVAILABLE_IN_2_70 + gpointer g_object_take_ref (gpointer object); + GOBJECT_AVAILABLE_IN_ALL + gpointer g_object_ref (gpointer object); ++void g_object_ref_adapter (gpointer object, ++ GClosure *dummy ); + GOBJECT_AVAILABLE_IN_ALL + void g_object_unref (gpointer object); ++void g_object_unref_adapter (gpointer object, ++ GClosure *dummy ); + GOBJECT_AVAILABLE_IN_ALL + void g_object_weak_ref (GObject *object, + GWeakNotify notify, +diff --git a/gobject/gparam.c b/gobject/gparam.c +index 00d8b7742..209366696 100644 +--- a/gobject/gparam.c ++++ b/gobject/gparam.c +@@ -60,12 +60,16 @@ + #define PSPEC_APPLIES_TO_VALUE(pspec, value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_PARAM_SPEC_VALUE_TYPE (pspec))) + + /* --- prototypes --- */ +-static void g_param_spec_class_base_init (GParamSpecClass *class); +-static void g_param_spec_class_base_finalize (GParamSpecClass *class); ++static void g_param_spec_class_base_init (gpointer class); ++static void g_param_spec_class_base_finalize (gpointer class); + static void g_param_spec_class_init (GParamSpecClass *class, + gpointer class_data); +-static void g_param_spec_init (GParamSpec *pspec, ++static void g_param_spec_class_init_adapter (gpointer class, ++ gpointer class_data); ++static void g_param_spec_init (GParamSpec *pspec, + GParamSpecClass *class); ++static void g_param_spec_init_adapter (GTypeInstance *pspec, ++ gpointer class); + static void g_param_spec_finalize (GParamSpec *pspec); + static void value_param_init (GValue *value); + static void value_param_free_value (GValue *value); +@@ -120,15 +124,15 @@ _g_param_type_init (void) + const GTypeInfo param_spec_info = { + sizeof (GParamSpecClass), + +- (GBaseInitFunc) g_param_spec_class_base_init, +- (GBaseFinalizeFunc) g_param_spec_class_base_finalize, +- (GClassInitFunc) g_param_spec_class_init, +- (GClassFinalizeFunc) NULL, ++ g_param_spec_class_base_init, ++ g_param_spec_class_base_finalize, ++ g_param_spec_class_init_adapter, ++ NULL, + NULL, /* class_data */ + + sizeof (GParamSpec), + 0, /* n_preallocs */ +- (GInstanceInitFunc) g_param_spec_init, ++ g_param_spec_init_adapter, + + ¶m_value_table, + }; +@@ -146,12 +150,12 @@ _g_param_type_init (void) + } + + static void +-g_param_spec_class_base_init (GParamSpecClass *class) ++g_param_spec_class_base_init (gpointer class) + { + } + + static void +-g_param_spec_class_base_finalize (GParamSpecClass *class) ++g_param_spec_class_base_finalize (gpointer class) + { + } + +@@ -167,6 +171,12 @@ g_param_spec_class_init (GParamSpecClass *class, + + g_type_class_adjust_private_offset (class, &g_param_private_offset); + } ++static void ++g_param_spec_class_init_adapter (gpointer class, ++ gpointer class_data) ++{ ++ g_param_spec_class_init ((GParamSpecClass*) class, class_data); ++} + + static void + g_param_spec_init (GParamSpec *pspec, +@@ -183,6 +193,12 @@ g_param_spec_init (GParamSpec *pspec, + pspec->ref_count = 1; + pspec->param_id = 0; + } ++static void ++g_param_spec_init_adapter (GTypeInstance *pspec, ++ gpointer class) ++{ ++ g_param_spec_init ((GParamSpec*) pspec, (GParamSpecClass*) class); ++} + + static void + g_param_spec_finalize (GParamSpec *pspec) +@@ -241,6 +257,10 @@ g_param_spec_unref (GParamSpec *pspec) + G_PARAM_SPEC_GET_CLASS (pspec)->finalize (pspec); + } + } ++void g_param_spec_unref_adapter (gpointer pspec) ++{ ++ g_param_spec_unref ((GParamSpec*) pspec); ++} + + /** + * g_param_spec_sink: +@@ -1245,7 +1265,8 @@ g_param_spec_pool_list_owned (GParamSpecPool *pool, + + static gint + pspec_compare_id (gconstpointer a, +- gconstpointer b) ++ gconstpointer b, ++ gpointer dummy) + { + const GParamSpec *pspec1 = a, *pspec2 = b; + +diff --git a/gobject/gparam.h b/gobject/gparam.h +index f65e76ad5..991d99a08 100644 +--- a/gobject/gparam.h ++++ b/gobject/gparam.h +@@ -297,6 +297,7 @@ GOBJECT_AVAILABLE_IN_ALL + GParamSpec* g_param_spec_ref (GParamSpec *pspec); + GOBJECT_AVAILABLE_IN_ALL + void g_param_spec_unref (GParamSpec *pspec); ++void g_param_spec_unref_adapter (gpointer pspec); + GOBJECT_AVAILABLE_IN_ALL + void g_param_spec_sink (GParamSpec *pspec); + GOBJECT_AVAILABLE_IN_ALL +@@ -399,7 +400,7 @@ struct _GParamSpecTypeInfo + /* type system portion */ + guint16 instance_size; /* obligatory */ + guint16 n_preallocs; /* optional */ +- void (*instance_init) (GParamSpec *pspec, /* optional */ ++ void (*instance_init) (GTypeInstance *pspec, /* optional */ + gpointer class_data); + + /* class portion */ +diff --git a/gobject/gparamspecs.c b/gobject/gparamspecs.c +index 7d3f77984..3c5a4d449 100644 +--- a/gobject/gparamspecs.c ++++ b/gobject/gparamspecs.c +@@ -66,7 +66,7 @@ + + /* --- param spec functions --- */ + static void +-param_char_init (GParamSpec *pspec, ++param_char_init (GTypeInstance *pspec, + gpointer class_data) + { + GParamSpecChar *cspec = G_PARAM_SPEC_CHAR (pspec); +@@ -106,7 +106,7 @@ param_char_validate (GParamSpec *pspec, + } + + static void +-param_uchar_init (GParamSpec *pspec, ++param_uchar_init (GTypeInstance *pspec, + gpointer class_data) + { + GParamSpecUChar *uspec = G_PARAM_SPEC_UCHAR (pspec); +@@ -173,7 +173,7 @@ param_boolean_validate (GParamSpec *pspec, + } + + static void +-param_int_init (GParamSpec *pspec, ++param_int_init (GTypeInstance *pspec, + gpointer class_data) + { + GParamSpecInt *ispec = G_PARAM_SPEC_INT (pspec); +@@ -224,7 +224,7 @@ param_int_values_cmp (GParamSpec *pspec, + } + + static void +-param_uint_init (GParamSpec *pspec, ++param_uint_init (GTypeInstance *pspec, + gpointer class_data) + { + GParamSpecUInt *uspec = G_PARAM_SPEC_UINT (pspec); +@@ -275,7 +275,7 @@ param_uint_values_cmp (GParamSpec *pspec, + } + + static void +-param_long_init (GParamSpec *pspec, ++param_long_init (GTypeInstance *pspec, + gpointer class_data) + { + GParamSpecLong *lspec = G_PARAM_SPEC_LONG (pspec); +@@ -331,7 +331,7 @@ param_long_values_cmp (GParamSpec *pspec, + } + + static void +-param_ulong_init (GParamSpec *pspec, ++param_ulong_init (GTypeInstance *pspec, + gpointer class_data) + { + GParamSpecULong *uspec = G_PARAM_SPEC_ULONG (pspec); +@@ -386,7 +386,7 @@ param_ulong_values_cmp (GParamSpec *pspec, + } + + static void +-param_int64_init (GParamSpec *pspec, ++param_int64_init (GTypeInstance *pspec, + gpointer class_data) + { + GParamSpecInt64 *lspec = G_PARAM_SPEC_INT64 (pspec); +@@ -437,7 +437,7 @@ param_int64_values_cmp (GParamSpec *pspec, + } + + static void +-param_uint64_init (GParamSpec *pspec, ++param_uint64_init (GTypeInstance *pspec, + gpointer class_data) + { + GParamSpecUInt64 *uspec = G_PARAM_SPEC_UINT64 (pspec); +@@ -488,7 +488,7 @@ param_uint64_values_cmp (GParamSpec *pspec, + } + + static void +-param_unichar_init (GParamSpec *pspec, ++param_unichar_init (GTypeInstance *pspec, + gpointer class_data) + { + GParamSpecUnichar *uspec = G_PARAM_SPEC_UNICHAR (pspec); +@@ -538,7 +538,7 @@ param_unichar_values_cmp (GParamSpec *pspec, + } + + static void +-param_enum_init (GParamSpec *pspec, ++param_enum_init (GTypeInstance *pspec, + gpointer class_data) + { + GParamSpecEnum *espec = G_PARAM_SPEC_ENUM (pspec); +@@ -594,7 +594,7 @@ param_enum_validate (GParamSpec *pspec, + } + + static void +-param_flags_init (GParamSpec *pspec, ++param_flags_init (GTypeInstance *pspec, + gpointer class_data) + { + GParamSpecFlags *fspec = G_PARAM_SPEC_FLAGS (pspec); +@@ -650,7 +650,7 @@ param_flags_validate (GParamSpec *pspec, + } + + static void +-param_float_init (GParamSpec *pspec, ++param_float_init (GTypeInstance *pspec, + gpointer class_data) + { + GParamSpecFloat *fspec = G_PARAM_SPEC_FLOAT (pspec); +@@ -704,7 +704,7 @@ param_float_values_cmp (GParamSpec *pspec, + } + + static void +-param_double_init (GParamSpec *pspec, ++param_double_init (GTypeInstance *pspec, + gpointer class_data) + { + GParamSpecDouble *dspec = G_PARAM_SPEC_DOUBLE (pspec); +@@ -758,7 +758,7 @@ param_double_values_cmp (GParamSpec *pspec, + } + + static void +-param_string_init (GParamSpec *pspec, ++param_string_init (GTypeInstance *pspec, + gpointer class_data) + { + GParamSpecString *sspec = G_PARAM_SPEC_STRING (pspec); +@@ -890,7 +890,7 @@ param_string_values_cmp (GParamSpec *pspec, + } + + static void +-param_param_init (GParamSpec *pspec, ++param_param_init (GTypeInstance *pspec, + gpointer class_data) + { + /* GParamSpecParam *spec = G_PARAM_SPEC_PARAM (pspec); */ +@@ -934,7 +934,7 @@ param_param_validate (GParamSpec *pspec, + } + + static void +-param_boxed_init (GParamSpec *pspec, ++param_boxed_init (GTypeInstance *pspec, + gpointer class_data) + { + /* GParamSpecBoxed *bspec = G_PARAM_SPEC_BOXED (pspec); */ +@@ -961,7 +961,7 @@ param_boxed_values_cmp (GParamSpec *pspec, + } + + static void +-param_pointer_init (GParamSpec *pspec, ++param_pointer_init (GTypeInstance *pspec, + gpointer class_data) + { + /* GParamSpecPointer *spec = G_PARAM_SPEC_POINTER (pspec); */ +@@ -988,7 +988,7 @@ param_pointer_values_cmp (GParamSpec *pspec, + } + + static void +-param_value_array_init (GParamSpec *pspec, ++param_value_array_init (GTypeInstance *pspec, + gpointer class_data) + { + GParamSpecValueArray *aspec = G_PARAM_SPEC_VALUE_ARRAY (pspec); +@@ -1140,7 +1140,7 @@ param_value_array_values_cmp (GParamSpec *pspec, + } + + static void +-param_object_init (GParamSpec *pspec, ++param_object_init (GTypeInstance *pspec, + gpointer class_data) + { + /* GParamSpecObject *ospec = G_PARAM_SPEC_OBJECT (pspec); */ +@@ -1196,7 +1196,7 @@ param_object_values_cmp (GParamSpec *pspec, + } + + static void +-param_override_init (GParamSpec *pspec, ++param_override_init (GTypeInstance *pspec, + gpointer class_data) + { + /* GParamSpecOverride *ospec = G_PARAM_SPEC_OVERRIDE (pspec); */ +@@ -1255,7 +1255,7 @@ param_override_values_cmp (GParamSpec *pspec, + } + + static void +-param_gtype_init (GParamSpec *pspec, ++param_gtype_init (GTypeInstance *pspec, + gpointer class_data) + { + } +@@ -1311,7 +1311,7 @@ param_gtype_values_cmp (GParamSpec *pspec, + } + + static void +-param_variant_init (GParamSpec *pspec, ++param_variant_init (GTypeInstance *pspec, + gpointer class_data) + { + GParamSpecVariant *vspec = G_PARAM_SPEC_VARIANT (pspec); +diff --git a/gobject/gsourceclosure.c b/gobject/gsourceclosure.c +index 4b79b13ac..7af433c9c 100644 +--- a/gobject/gsourceclosure.c ++++ b/gobject/gsourceclosure.c +@@ -25,6 +25,9 @@ + #include "gmarshal.h" + #include "gvalue.h" + #include "gvaluetypes.h" ++#include ++#include ++ + #if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + #include "glib-unix.h" + #endif +@@ -78,6 +81,7 @@ source_closure_marshal_BOOLEAN__VOID (GClosure *closure, + g_value_set_boolean (return_value, v_return); + } + ++#ifndef __EMSCRIPTEN__ + static gboolean + io_watch_closure_callback (GIOChannel *channel, + GIOCondition condition, +@@ -140,6 +144,7 @@ g_child_watch_closure_callback (GPid pid, + + return result; + } ++#endif + + #if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) + static gboolean +@@ -170,7 +175,6 @@ g_unix_fd_source_closure_callback (int fd, + + return result; + } +-#endif + + static gboolean + source_closure_callback (gpointer data) +@@ -188,6 +192,7 @@ source_closure_callback (gpointer data) + + return result; + } ++#endif + + static void + closure_callback_get (gpointer cb_data, +@@ -195,6 +200,9 @@ closure_callback_get (gpointer cb_data, + GSourceFunc *func, + gpointer *data) + { ++#ifdef __EMSCRIPTEN__ ++ fprintf(stderr, "%s (%d): not implemented -ARL \n", __FUNCTION__, __LINE__); ++#else + GSourceFunc closure_callback = source->source_funcs->closure_callback; + + if (!closure_callback) +@@ -217,11 +225,12 @@ closure_callback_get (gpointer cb_data, + + *func = closure_callback; + *data = cb_data; ++#endif + } + + static GSourceCallbackFuncs closure_callback_funcs = { +- (void (*) (gpointer)) g_closure_ref, +- (void (*) (gpointer)) g_closure_unref, ++ (void(*)) g_closure_ref_adapter, ++ g_closure_unref_adapter, + closure_callback_get + }; + +@@ -272,7 +281,13 @@ g_source_set_closure (GSource *source, + + if (G_CLOSURE_NEEDS_MARSHAL (closure)) + { ++ ++#ifdef __EMSCRIPTEN__ ++ fprintf(stderr, "%s (%d): not implemented -ARL \n", __FUNCTION__, __LINE__); ++ GClosureMarshal marshal = NULL; ++#else + GClosureMarshal marshal = (GClosureMarshal)source->source_funcs->closure_marshal; ++#endif + if (marshal) + g_closure_set_marshal (closure, marshal); + else if (source->source_funcs == &g_idle_funcs || +diff --git a/gobject/gtype.c b/gobject/gtype.c +index dfb01eed1..617777025 100644 +--- a/gobject/gtype.c ++++ b/gobject/gtype.c +@@ -3476,7 +3476,8 @@ g_type_from_name (const gchar *name) + g_return_val_if_fail (name != NULL, 0); + + G_READ_LOCK (&type_rw_lock); +- type = (GType) g_hash_table_lookup (static_type_nodes_ht, name); ++ gpointer result = g_hash_table_lookup (static_type_nodes_ht, name); ++ type = (GType) result; + G_READ_UNLOCK (&type_rw_lock); + + return type; +@@ -4673,7 +4674,7 @@ gobject_init_ctor (void) + #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(gobject_init_ctor) + #endif + +-G_DEFINE_CONSTRUCTOR (gobject_init_ctor) ++G_DEFINE_CONSTRUCTOR (gobject_init_ctor, 105) + + static void + gobject_init_ctor (void) +diff --git a/gobject/gtype.h b/gobject/gtype.h +index 3305a597e..ac9adf23b 100644 +--- a/gobject/gtype.h ++++ b/gobject/gtype.h +@@ -2160,10 +2160,10 @@ static void type_name##_class_intern_init (gpointer klass, \ + \ + static void type_name##_init (TypeName *self); \ + static void type_name##_class_init (TypeName##Class *klass); \ +-static void type_name##_init_adapter (TypeName *self, \ ++static void type_name##_init_adapter (GTypeInstance *self, \ + gpointer class_data) \ + { \ +- type_name##_init (self); \ ++ type_name##_init ((TypeName *) self); \ + } \ + static GType type_name##_get_type_once (void); \ + static gpointer type_name##_parent_class = NULL; \ +@@ -2202,9 +2202,9 @@ type_name##_get_type_once (void) \ + g_type_register_static_simple (TYPE_PARENT, \ + g_intern_static_string (#TypeName), \ + sizeof (TypeName##Class), \ +- (GClassInitFunc) type_name##_class_intern_init, \ ++ type_name##_class_intern_init, \ + sizeof (TypeName), \ +- (GInstanceInitFunc) type_name##_init_adapter, \ ++ type_name##_init_adapter, \ + (GTypeFlags) flags); \ + { /* custom code follows */ + #define _G_DEFINE_TYPE_EXTENDED_END() \ +@@ -2225,10 +2225,10 @@ type_name##_get_type_once (void) \ + #define _G_DEFINE_INTERFACE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PREREQ) \ + \ + static void type_name##_default_init (TypeName##Interface *klass); \ +-static void type_name##_default_init_adapter (TypeName##Interface *klass, \ ++static void type_name##_default_init_adapter (gpointer klass, \ + gpointer class_data) \ + { \ +- type_name##_default_init (klass); \ ++ type_name##_default_init ((TypeName##Interface *) klass); \ + } \ + \ + GType \ +@@ -2241,7 +2241,7 @@ type_name##_get_type (void) \ + g_type_register_static_simple (G_TYPE_INTERFACE, \ + g_intern_static_string (#TypeName), \ + sizeof (TypeName##Interface), \ +- (GClassInitFunc) type_name##_default_init_adapter, \ ++ type_name##_default_init_adapter, \ + 0, \ + (GInstanceInitFunc)NULL, \ + (GTypeFlags) 0); \ +diff --git a/gobject/gtypemodule.c b/gobject/gtypemodule.c +index ce6b02dae..36c1ef61a 100644 +--- a/gobject/gtypemodule.c ++++ b/gobject/gtypemodule.c +@@ -129,16 +129,27 @@ g_type_module_class_init (GTypeModuleClass *class) + gobject_class->dispose = g_type_module_dispose; + gobject_class->finalize = g_type_module_finalize; + } ++static void ++g_type_module_class_init_adapter (gpointer class, gpointer dummy) ++{ ++ g_type_module_class_init ((GTypeModuleClass*) class); ++} + + static void + g_type_module_iface_init (GTypePluginClass *iface, + gpointer iface_data) + { + iface->use_plugin = g_type_module_use_plugin; +- iface->unuse_plugin = (void (*) (GTypePlugin *))g_type_module_unuse; ++ iface->unuse_plugin = g_type_module_unuse_adapter; + iface->complete_type_info = g_type_module_complete_type_info; + iface->complete_interface_info = g_type_module_complete_interface_info; + } ++static void ++g_type_module_iface_init_adapter (gpointer iface, ++ gpointer iface_data) ++{ ++ g_type_module_iface_init ((GTypePluginClass*) iface, iface_data); ++} + + GType + g_type_module_get_type (void) +@@ -151,7 +162,7 @@ g_type_module_get_type (void) + sizeof (GTypeModuleClass), + NULL, /* base_init */ + NULL, /* base_finalize */ +- (GClassInitFunc) g_type_module_class_init, ++ g_type_module_class_init_adapter, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GTypeModule), +@@ -160,7 +171,7 @@ g_type_module_get_type (void) + NULL, /* value_table */ + }; + const GInterfaceInfo iface_info = { +- (GInterfaceInitFunc) g_type_module_iface_init, ++ g_type_module_iface_init_adapter, + NULL, /* interface_finalize */ + NULL, /* interface_data */ + }; +@@ -308,6 +319,11 @@ g_type_module_unuse (GTypeModule *module) + } + } + } ++void ++g_type_module_unuse_adapter (GTypePlugin *module) ++{ ++ g_type_module_unuse ((GTypeModule*) module); ++} + + static void + g_type_module_use_plugin (GTypePlugin *plugin) +diff --git a/gobject/gtypemodule.h b/gobject/gtypemodule.h +index f3096a939..0bbe02418 100644 +--- a/gobject/gtypemodule.h ++++ b/gobject/gtypemodule.h +@@ -274,6 +274,7 @@ GOBJECT_AVAILABLE_IN_ALL + gboolean g_type_module_use (GTypeModule *module); + GOBJECT_AVAILABLE_IN_ALL + void g_type_module_unuse (GTypeModule *module); ++void g_type_module_unuse_adapter (GTypePlugin *module); + GOBJECT_AVAILABLE_IN_ALL + void g_type_module_set_name (GTypeModule *module, + const gchar *name); +diff --git a/gobject/gvalue.c b/gobject/gvalue.c +index 10885dad8..1afc143ab 100644 +--- a/gobject/gvalue.c ++++ b/gobject/gvalue.c +@@ -313,6 +313,11 @@ g_value_unset (GValue *value) + value_table->value_free (value); + memset (value, 0, sizeof (*value)); + } ++void ++g_value_unset_adapter (gpointer value) ++{ ++ g_value_unset ((GValue*) value); ++} + + /** + * g_value_fits_pointer: +diff --git a/gobject/gvalue.h b/gobject/gvalue.h +index 2ac5ca189..b5b9e36f4 100644 +--- a/gobject/gvalue.h ++++ b/gobject/gvalue.h +@@ -141,6 +141,7 @@ GOBJECT_AVAILABLE_IN_ALL + GValue* g_value_reset (GValue *value); + GOBJECT_AVAILABLE_IN_ALL + void g_value_unset (GValue *value); ++void g_value_unset_adapter (gpointer value); + GOBJECT_AVAILABLE_IN_ALL + void g_value_set_instance (GValue *value, + gpointer instance); +diff --git a/gthread/gthread-impl.c b/gthread/gthread-impl.c +index f85da8f82..dc444c790 100644 +--- a/gthread/gthread-impl.c ++++ b/gthread/gthread-impl.c +@@ -48,3 +48,4 @@ g_thread_init_with_errorcheck_mutexes (gpointer vtable) + g_assert (vtable == NULL); + g_warning ("GThread system no longer supports errorcheck mutexes."); + } ++ +diff --git a/meson.build b/meson.build +index 5df61c223..774cdfd0f 100644 +--- a/meson.build ++++ b/meson.build +@@ -93,11 +93,11 @@ glib_libexecdir = join_paths(glib_prefix, get_option('libexecdir')) + glib_datadir = join_paths(glib_prefix, get_option('datadir')) + glib_pkgdatadir = join_paths(glib_datadir, 'glib-2.0') + glib_includedir = join_paths(glib_prefix, get_option('includedir'), 'glib-2.0') +-if get_option('gio_module_dir') != '' +- glib_giomodulesdir = join_paths(glib_prefix, get_option('gio_module_dir')) +-else +- glib_giomodulesdir = join_paths(glib_libdir, 'gio', 'modules') +-endif ++# if get_option('gio_module_dir') != '' ++# glib_giomodulesdir = join_paths(glib_prefix, get_option('gio_module_dir')) ++# else ++# glib_giomodulesdir = join_paths(glib_libdir, 'gio', 'modules') ++# endif + + if get_option('multiarch') + # For multiarch/multilib distributions, install each architecture's +@@ -507,7 +507,9 @@ if cc.get_id() == 'gcc' or cc.get_id() == 'clang' or cc.get_id() == 'emscripten' + '-Wno-unused-parameter', + # Due to pervasive use of things like GPOINTER_TO_UINT(), we do not support + # building with -Wbad-function-cast. +- '-Wno-cast-function-type', ++ #'-Wno-cast-function-type', ++ '-Wbad-function-cast', ++ '-Wcast-function-type', + # Due to function casts through (void*) we cannot support -Wpedantic: + # https://wiki.gnome.org/Projects/GLib/CompilerRequirements#Function_pointer_conversions. + '-Wno-pedantic', +@@ -526,7 +528,8 @@ if cc.get_id() == 'gcc' or cc.get_id() == 'clang' or cc.get_id() == 'emscripten' + '-Wstrict-prototypes', + # Due to pervasive use of things like GPOINTER_TO_UINT(), we do not support + # building with -Wbad-function-cast. +- '-Wno-bad-function-cast', ++ '-Wbad-function-cast', ++ '-Wcast-function-type', + '-Werror=implicit-function-declaration', + '-Werror=missing-prototypes', + '-Werror=pointer-sign', +@@ -2085,8 +2088,8 @@ else + endif + + # Import the gvdb sources as a subproject to avoid having the copylib in-tree +-subproject('gvdb') +-gvdb_dep = dependency('gvdb') ++# subproject('gvdb') ++# gvdb_dep = dependency('gvdb') + + libm = cc.find_library('m', required : false) + libffi_dep = dependency('libffi', version : '>= 3.0.0') +@@ -2477,7 +2480,7 @@ summary({ + 'pkgdatadir' : glib_pkgdatadir, + 'datadir' : glib_datadir, + 'includedir' : glib_includedir, +- 'giomodulesdir' : glib_giomodulesdir, ++ #'giomodulesdir' : glib_giomodulesdir, + 'localstatedir' : glib_localstatedir, + 'runstatedir' : glib_runstatedir, + }, section: 'Directories') diff --git a/ports/glib/portfile.cmake b/ports/glib/portfile.cmake index e1ff813421d97c..03af091f719698 100644 --- a/ports/glib/portfile.cmake +++ b/ports/glib/portfile.cmake @@ -5,14 +5,28 @@ vcpkg_download_distfile(GLIB_ARCHIVE SHA512 291b8913918d411b679442b888f56893a857a77decfe428086c8bd1da1949498938ddb0bf254ed99d192e4a09b5e8cee1905fd6932ee642463fb229cac7c226e ) -vcpkg_extract_source_archive(SOURCE_PATH - ARCHIVE "${GLIB_ARCHIVE}" - PATCHES - use-libiconv-on-windows.patch - libintl.patch - fix-build-race-on-gio.patch # https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3512 - tsc-allow-threadpriority-to-fail-windows.patch -) +if(VCPKG_TARGET_IS_EMSCRIPTEN) + vcpkg_extract_source_archive(SOURCE_PATH + ARCHIVE "${GLIB_ARCHIVE}" + PATCHES + use-libiconv-on-windows.patch + libintl.patch + fix-build-race-on-gio.patch # https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3512 + tsc-allow-threadpriority-to-fail-windows.patch + emscripten.patch + glib-without-func-ptr-casts-for-pango-wasm.patch + fixes-for-sidemodule.patch + ) +else() + vcpkg_extract_source_archive(SOURCE_PATH + ARCHIVE "${GLIB_ARCHIVE}" + PATCHES + use-libiconv-on-windows.patch + libintl.patch + fix-build-race-on-gio.patch # https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3512 + tsc-allow-threadpriority-to-fail-windows.patch + ) +endif() vcpkg_list(SET OPTIONS) if (selinux IN_LIST FEATURES) @@ -51,45 +65,60 @@ vcpkg_configure_meson( -Dtests=false -Dxattr=false ) + vcpkg_install_meson(ADD_BIN_TO_PATH) vcpkg_copy_pdbs() file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}") -set(GLIB_SCRIPTS - gdbus-codegen - glib-genmarshal - glib-gettextize - glib-mkenums - gtester-report -) + +if ( VCPKG_TARGET_IS_EMSCRIPTEN ) + set(GLIB_SCRIPTS + glib-mkenums + ) +else() + set(GLIB_SCRIPTS + gdbus-codegen + glib-genmarshal + glib-gettextize + glib-mkenums + gtester-report + ) +endif() foreach(script IN LISTS GLIB_SCRIPTS) file(RENAME "${CURRENT_PACKAGES_DIR}/bin/${script}" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/${script}") file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/${script}") endforeach() -set(GLIB_TOOLS - gapplication - gdbus - gio - gio-querymodules - glib-compile-resources - glib-compile-schemas - gobject-query - gresource - gsettings - gtester -) -if(VCPKG_TARGET_IS_WINDOWS) - list(REMOVE_ITEM GLIB_TOOLS gapplication gtester) - if(VCPKG_TARGET_ARCHITECTURE MATCHES "x64|arm64") - list(APPEND GLIB_TOOLS gspawn-win64-helper gspawn-win64-helper-console) - elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") - list(APPEND GLIB_TOOLS gspawn-win32-helper gspawn-win32-helper-console) +if(NOT VCPKG_TARGET_IS_EMSCRIPTEN) + set(GLIB_TOOLS + gapplication + gdbus + gio + gio-querymodules + glib-compile-resources + glib-compile-schemas + gobject-query + gresource + gsettings + gtester + ) + if(VCPKG_TARGET_IS_WINDOWS) + list(REMOVE_ITEM GLIB_TOOLS gapplication gtester) + if(VCPKG_TARGET_ARCHITECTURE MATCHES "x64|arm64") + list(APPEND GLIB_TOOLS gspawn-win64-helper gspawn-win64-helper-console) + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") + list(APPEND GLIB_TOOLS gspawn-win32-helper gspawn-win32-helper-console) + endif() + elseif(VCPKG_TARGET_IS_OSX) + list(REMOVE_ITEM GLIB_TOOLS gapplication) endif() -elseif(VCPKG_TARGET_IS_OSX) - list(REMOVE_ITEM GLIB_TOOLS gapplication) + + vcpkg_copy_tools(TOOL_NAMES ${GLIB_TOOLS} AUTO_CLEAN) +else() + # Since Emscripten doesn't build any of the tools (at least not yet), delete + # the bin directory to get rid of vcpkg complaints. + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") endif() -vcpkg_copy_tools(TOOL_NAMES ${GLIB_TOOLS} AUTO_CLEAN) vcpkg_fixup_pkgconfig() @@ -115,21 +144,24 @@ foreach(pc_prefix IN LISTS pc_replace_intl_path) endif() endforeach() -vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/gio-2.0.pc" "\${bindir}" "\${prefix}/tools/${PORT}") -vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/glib-2.0.pc" "\${bindir}" "\${prefix}/tools/${PORT}") -if(NOT VCPKG_BUILD_TYPE) - vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/gio-2.0.pc" "\${bindir}" "\${prefix}/../tools/${PORT}") - vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/glib-2.0.pc" "\${bindir}" "\${prefix}/../tools/${PORT}") -endif() +if(NOT VCPKG_TARGET_IS_EMSCRIPTEN) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/gio-2.0.pc" "\${bindir}" "\${prefix}/tools/${PORT}") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/glib-2.0.pc" "\${bindir}" "\${prefix}/tools/${PORT}") + if(NOT VCPKG_BUILD_TYPE) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/gio-2.0.pc" "\${bindir}" "\${prefix}/../tools/${PORT}") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/glib-2.0.pc" "\${bindir}" "\${prefix}/../tools/${PORT}") + endif() + + # Fix python scripts + set(_file "${CURRENT_PACKAGES_DIR}/tools/${PORT}/gdbus-codegen") -# Fix python scripts -set(_file "${CURRENT_PACKAGES_DIR}/tools/${PORT}/gdbus-codegen") -file(READ "${_file}" _contents) -string(REPLACE "elif os.path.basename(filedir) == 'bin':" "elif os.path.basename(filedir) == 'tools':" _contents "${_contents}") -string(REPLACE "path = os.path.join(filedir, '..', 'share', 'glib-2.0')" "path = os.path.join(filedir, '../..', 'share', 'glib-2.0')" _contents "${_contents}") -string(REPLACE "path = os.path.join(filedir, '..')" "path = os.path.join(filedir, '../../share/glib-2.0')" _contents "${_contents}") -string(REPLACE "path = os.path.join('${CURRENT_PACKAGES_DIR}/share', 'glib-2.0')" "path = os.path.join('unuseable/share', 'glib-2.0')" _contents "${_contents}") -file(WRITE "${_file}" "${_contents}") + file(READ "${_file}" _contents) + string(REPLACE "elif os.path.basename(filedir) == 'bin':" "elif os.path.basename(filedir) == 'tools':" _contents "${_contents}") + string(REPLACE "path = os.path.join(filedir, '..', 'share', 'glib-2.0')" "path = os.path.join(filedir, '../..', 'share', 'glib-2.0')" _contents "${_contents}") + string(REPLACE "path = os.path.join(filedir, '..')" "path = os.path.join(filedir, '../../share/glib-2.0')" _contents "${_contents}") + string(REPLACE "path = os.path.join('${CURRENT_PACKAGES_DIR}/share', 'glib-2.0')" "path = os.path.join('unuseable/share', 'glib-2.0')" _contents "${_contents}") + file(WRITE "${_file}" "${_contents}") +endif() if(EXISTS "${CURRENT_PACKAGES_DIR}/tools/${PORT}/glib-gettextize") vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/glib-gettextize" "${CURRENT_PACKAGES_DIR}" "`dirname $0`/../..") diff --git a/ports/libffi/CMakeLists.txt b/ports/libffi/CMakeLists.txt index 146b0329148e89..3287269f2883b6 100644 --- a/ports/libffi/CMakeLists.txt +++ b/ports/libffi/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.9) project(libffi C ASM) -set(KNOWN_PROCESSORS x86 x86_64 amd64 arm arm64 i386 i686 armv7l armv7-a aarch64 mips64el riscv32 riscv64) +set(KNOWN_PROCESSORS x86 x86_64 amd64 arm arm64 i386 i686 armv7l armv7-a aarch64 mips64el riscv32 riscv64 wasm32) string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" lower_system_processor) @@ -9,7 +9,9 @@ if(NOT lower_system_processor IN_LIST KNOWN_PROCESSORS) message(FATAL_ERROR "Unknown processor: ${CMAKE_SYSTEM_PROCESSOR}") endif() -if(CMAKE_SYSTEM_NAME MATCHES "Windows" AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") +if(CMAKE_SYSTEM_NAME MATCHES "Emscripten") + set(TARGET WASM32) +elseif(CMAKE_SYSTEM_NAME MATCHES "Windows" AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") set(TARGET ARM_WIN32) elseif(CMAKE_SYSTEM_NAME MATCHES "Windows" AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") set(TARGET ARM_WIN64) @@ -48,7 +50,9 @@ set(FFI_EXEC_TRAMPOLINE_TABLE 0) configure_file(include/ffi.h.in ${CMAKE_BINARY_DIR}/include/ffi.h) file(COPY ${FFI_CONFIG_FILE} DESTINATION ${CMAKE_BINARY_DIR}) -if ("${TARGET}" STREQUAL "ARM_WIN64" OR "${TARGET}" STREQUAL "ARM64") +if ("${TARGET}" STREQUAL "WASM32") + file(COPY src/wasm32/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include) +elseif ("${TARGET}" STREQUAL "ARM_WIN64" OR "${TARGET}" STREQUAL "ARM64") file(COPY src/aarch64/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include) elseif ("${TARGET}" STREQUAL "ARM_WIN32" OR "${TARGET}" STREQUAL "ARM") file(COPY src/arm/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include) @@ -75,7 +79,11 @@ set(FFI_SOURCES src/types.c src/tramp.c) -if ("${TARGET}" STREQUAL "ARM_WIN64" OR "${TARGET}" STREQUAL "ARM64") +if("${TARGET}" STREQUAL "WASM32") + set(FFI_SOURCES + ${FFI_SOURCES} + src/wasm32/ffi.c) +elseif ("${TARGET}" STREQUAL "ARM_WIN64" OR "${TARGET}" STREQUAL "ARM64") set(FFI_SOURCES ${FFI_SOURCES} src/aarch64/ffi.c) @@ -162,7 +170,9 @@ if("${TARGET}" STREQUAL "X86") set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -m32") endif() -if("${TARGET}" STREQUAL "X86" OR "${TARGET}" STREQUAL "X86_DARWIN") +if("${TARGET}" MATCHES "WASM32") + +elseif("${TARGET}" STREQUAL "X86" OR "${TARGET}" STREQUAL "X86_DARWIN") add_assembly(src/x86/sysv.S) elseif("${TARGET}" STREQUAL "X86_64") add_assembly(src/x86/unix64.S) diff --git a/ports/libffi/portfile.cmake b/ports/libffi/portfile.cmake index 0b118c3c1ad033..d499dd3f36c251 100644 --- a/ports/libffi/portfile.cmake +++ b/ports/libffi/portfile.cmake @@ -1,8 +1,10 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO libffi/libffi - REF "v${VERSION}" - SHA512 e3b261a7900cec61225c768ebd443884465669e0904db3f523aaaeeed74b4c03dbe23d74ff8bb69554791a798e25894a5fcbe2b13b883d3ee38aeff4c1e16a49 + # REF "v${VERSION}" + REF "ac598b7" + # SHA512 e3b261a7900cec61225c768ebd443884465669e0904db3f523aaaeeed74b4c03dbe23d74ff8bb69554791a798e25894a5fcbe2b13b883d3ee38aeff4c1e16a49 + SHA512 5f0800da9fa56318bf7bdf8a6dab97efd621026eda61de33d96ca5e7d2289ea58bc16120e0e7edb9ba1ab1f84d96902b4181052dff1e5e974256a0cd61028d0f HEAD_REF master ) diff --git a/ports/pango/add-in-func-for-sidemodule.patch b/ports/pango/add-in-func-for-sidemodule.patch new file mode 100644 index 00000000000000..f20f51c175b9cc --- /dev/null +++ b/ports/pango/add-in-func-for-sidemodule.patch @@ -0,0 +1,16 @@ +diff --git a/pango/pango-item.c b/pango/pango-item.c +index 5a88573..dfbc775 100644 +--- a/pango/pango-item.c ++++ b/pango/pango-item.c +@@ -116,6 +116,11 @@ pango_item_free (PangoItem *item) + else + g_slice_free (PangoItem, item); + } ++void ++pango_item_free_adapter (gpointer item, gpointer dummy) ++{ ++ pango_item_free ((PangoItem*) item); ++} + + G_DEFINE_BOXED_TYPE (PangoItem, pango_item, + pango_item_copy, diff --git a/ports/pango/emscripten.patch b/ports/pango/emscripten.patch new file mode 100644 index 00000000000000..938ecadd2b114b --- /dev/null +++ b/ports/pango/emscripten.patch @@ -0,0 +1,19 @@ +diff --git a/meson.build b/meson.build +index 7e4e0c10..cc178ad2 100644 +--- a/meson.build ++++ b/meson.build +@@ -597,10 +597,10 @@ root_inc = include_directories('.') + pango_inc = include_directories('pango') + + subdir('pango') +-subdir('utils') +-subdir('examples') +-subdir('tests') +-subdir('tools') ++# subdir('utils') ++# subdir('examples') ++# subdir('tests') ++# subdir('tools') + + if get_option('gtk_doc') + subdir('docs') diff --git a/ports/pango/portfile.cmake b/ports/pango/portfile.cmake index 7f30291e61509b..3e0d4be2ef96b3 100644 --- a/ports/pango/portfile.cmake +++ b/ports/pango/portfile.cmake @@ -6,6 +6,10 @@ vcpkg_from_gitlab( REF "${VERSION}" SHA512 5de67e711a1f25bd2c741162bb8306ae380d134f95b9103db6e96864d3a1100321ce106d8238dca54e746cd8f1cfdbe50cc407878611d3d09694404f3f128c73 HEAD_REF master + PATCHES + emscripten.patch + remove-func-ptr-casts.patch + add-in-func-for-sidemodule.patch ) # Fix for https://github.com/microsoft/vcpkg/issues/31573 @@ -24,38 +28,73 @@ else() list(APPEND OPTIONS -Dintrospection=disabled) endif() -if(CMAKE_HOST_WIN32 AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") - set(GIR_TOOL_DIR ${CURRENT_INSTALLED_DIR}) +if(NOT VCPKG_TARGET_IS_EMSCRIPTEN) + if(CMAKE_HOST_WIN32 AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") + set(GIR_TOOL_DIR ${CURRENT_INSTALLED_DIR}) + else() + set(GIR_TOOL_DIR ${CURRENT_HOST_INSTALLED_DIR}) + endif() +endif() + +if(NOT VCPKG_TARGET_IS_EMSCRIPTEN) + vcpkg_configure_meson( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -Dfontconfig=enabled # Build with FontConfig support. + -Dsysprof=disabled # include tracing support for sysprof + -Dlibthai=disabled # Build with libthai support + -Dcairo=enabled # Build with cairo support + -Dxft=disabled # Build with xft support + -Dfreetype=enabled # Build with freetype support + -Dgtk_doc=false #Build API reference for Pango using GTK-Doc + ${OPTIONS} + OPTIONS_DEBUG + ${OPTIONS_DEBUG} + OPTIONS_RELEASE + ${OPTIONS_RELEASE} + ADDITIONAL_BINARIES + "glib-genmarshal='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-genmarshal'" + "glib-mkenums='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-mkenums'" + "g-ir-compiler='${CURRENT_HOST_INSTALLED_DIR}/tools/gobject-introspection/g-ir-compiler${VCPKG_HOST_EXECUTABLE_SUFFIX}'" + "g-ir-scanner='${GIR_TOOL_DIR}/tools/gobject-introspection/g-ir-scanner'" + ) +else() + vcpkg_configure_meson( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -Dfontconfig=enabled # Build with FontConfig support. + -Dsysprof=disabled # include tracing support for sysprof + -Dlibthai=disabled # Build with libthai support + -Dcairo=enabled # Build with cairo support + -Dxft=disabled # Build with xft support + -Dfreetype=enabled # Build with freetype support + -Dgtk_doc=false #Build API reference for Pango using GTK-Doc + ${OPTIONS} + OPTIONS_DEBUG + ${OPTIONS_DEBUG} + OPTIONS_RELEASE + ${OPTIONS_RELEASE} + ADDITIONAL_BINARIES + "glib-genmarshal='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-genmarshal'" + "glib-mkenums='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-mkenums'" + # "g-ir-compiler='${CURRENT_HOST_INSTALLED_DIR}/tools/gobject-introspection/g-ir-compiler${VCPKG_HOST_EXECUTABLE_SUFFIX}'" + # "g-ir-scanner='${GIR_TOOL_DIR}/tools/gobject-introspection/g-ir-scanner'" + ) +endif() + +if(NOT VCPKG_TARGET_IS_EMSCRIPTEN) + vcpkg_install_meson(ADD_BIN_TO_PATH) else() - set(GIR_TOOL_DIR ${CURRENT_HOST_INSTALLED_DIR}) + vcpkg_install_meson(LD_LIBRARY_PATH) endif() -vcpkg_configure_meson( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS - -Dfontconfig=enabled # Build with FontConfig support. - -Dsysprof=disabled # include tracing support for sysprof - -Dlibthai=disabled # Build with libthai support - -Dcairo=enabled # Build with cairo support - -Dxft=disabled # Build with xft support - -Dfreetype=enabled # Build with freetype support - -Dgtk_doc=false #Build API reference for Pango using GTK-Doc - ${OPTIONS} - OPTIONS_DEBUG - ${OPTIONS_DEBUG} - OPTIONS_RELEASE - ${OPTIONS_RELEASE} - ADDITIONAL_BINARIES - "glib-genmarshal='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-genmarshal'" - "glib-mkenums='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-mkenums'" - "g-ir-compiler='${CURRENT_HOST_INSTALLED_DIR}/tools/gobject-introspection/g-ir-compiler${VCPKG_HOST_EXECUTABLE_SUFFIX}'" - "g-ir-scanner='${GIR_TOOL_DIR}/tools/gobject-introspection/g-ir-scanner'" -) - -vcpkg_install_meson(ADD_BIN_TO_PATH) vcpkg_fixup_pkgconfig() -vcpkg_copy_pdbs() -vcpkg_copy_tools(TOOL_NAMES pango-view pango-list pango-segmentation AUTO_CLEAN) +if(NOT VCPKG_TARGET_IS_EMSCRIPTEN) + vcpkg_copy_pdbs() + + vcpkg_copy_tools(TOOL_NAMES pango-view pango-list pango-segmentation AUTO_CLEAN) +endif() vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING") + diff --git a/ports/pango/remove-func-ptr-casts.patch b/ports/pango/remove-func-ptr-casts.patch new file mode 100644 index 00000000000000..d988baf60f462d --- /dev/null +++ b/ports/pango/remove-func-ptr-casts.patch @@ -0,0 +1,903 @@ +diff --git a/meson.build b/meson.build +index ba293fe..5578553 100644 +--- a/meson.build ++++ b/meson.build +@@ -61,7 +61,8 @@ if cc.get_id() == 'msvc' + test_cflags = ['-FImsvc_recommended_pragmas.h', '-utf-8'] + add_project_arguments(cc.get_supported_arguments(test_cflags), language: 'c') + test_c_only_flags = [] +-elif cc.get_id() == 'gcc' or cc.get_id() == 'clang' ++elif cc.get_id() == 'gcc' or cc.get_id() == 'clang' or cc.get_id() == 'emscripten' ++ + test_c_only_flags = [ + '-Wno-c++11-extensions', + '-Wno-missing-include-dirs', +@@ -107,9 +108,15 @@ elif cc.get_id() == 'gcc' or cc.get_id() == 'clang' + '-Werror=trigraphs', + '-Werror=vla', + '-Werror=write-strings', ++ '-Wbad-function-cast', ++ '-Wcast-function-type', + ] + ++ message('IN THE CFlAGS AREA') ++ + test_cflags = test_c_only_flags + [ ++ '-Wbad-function-cast', ++ '-Wcast-function-type', + '-fno-strict-aliasing', + '-Wpointer-arith', + '-Wmissing-declarations', +diff --git a/pango/break.c b/pango/break.c +index 0b636af..aa1e5d4 100644 +--- a/pango/break.c ++++ b/pango/break.c +@@ -2317,7 +2317,7 @@ pango_attr_break (const char *text, + start->is_cursor_position |= attr_before.is_cursor_position; + } + +- g_slist_free_full (attributes, (GDestroyNotify)pango_attribute_destroy); ++ g_slist_free_full (attributes, pango_attribute_destroy_adapter); + } + + /** +diff --git a/pango/fonts.c b/pango/fonts.c +index e259f8c..261ec9d 100644 +--- a/pango/fonts.c ++++ b/pango/fonts.c +@@ -2354,9 +2354,14 @@ pango_font_family_list_model_init (GListModelInterface *iface) + iface->get_n_items = pango_font_family_get_n_items; + iface->get_item = pango_font_family_get_item; + } ++static void ++pango_font_family_list_model_init_adapter (gpointer iface, gpointer dummy) ++{ ++ pango_font_family_list_model_init ((GListModelInterface *) iface); ++} + + G_DEFINE_ABSTRACT_TYPE_WITH_CODE (PangoFontFamily, pango_font_family, G_TYPE_OBJECT, +- G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, pango_font_family_list_model_init)) ++ G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, pango_font_family_list_model_init_adapter)) + + static PangoFontFace *pango_font_family_real_get_face (PangoFontFamily *family, + const char *name); +diff --git a/pango/itemize.c b/pango/itemize.c +index 5500d56..8583c02 100644 +--- a/pango/itemize.c ++++ b/pango/itemize.c +@@ -58,6 +58,11 @@ font_cache_destroy (FontCache *cache) + g_hash_table_destroy (cache->hash); + g_slice_free (FontCache, cache); + } ++static void ++font_cache_destroy_adapter (gpointer cache) ++{ ++ font_cache_destroy ((FontCache *) cache); ++} + + static void + font_element_destroy (FontElement *element) +@@ -66,6 +71,11 @@ font_element_destroy (FontElement *element) + g_object_unref (element->font); + g_slice_free (FontElement, element); + } ++static void ++font_element_destroy_adapter (gpointer element) ++{ ++ font_element_destroy ((FontElement *) element); ++} + + static FontCache * + get_font_cache (PangoFontset *fontset) +@@ -82,9 +92,9 @@ retry: + { + cache = g_slice_new (FontCache); + cache->hash = g_hash_table_new_full (g_direct_hash, NULL, +- NULL, (GDestroyNotify)font_element_destroy); ++ NULL, font_element_destroy_adapter); + if (!g_object_replace_qdata (G_OBJECT (fontset), cache_quark, NULL, +- cache, (GDestroyNotify)font_cache_destroy, ++ cache, font_cache_destroy_adapter, + NULL)) + { + font_cache_destroy (cache); +diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c +index 47aa0aa..3c3d0a8 100644 +--- a/pango/pango-attributes.c ++++ b/pango/pango-attributes.c +@@ -148,6 +148,11 @@ pango_attribute_copy (const PangoAttribute *attr) + + return result; + } ++gpointer ++pango_attribute_copy_adapter (gconstpointer attr, gpointer dummy) ++{ ++ return pango_attribute_copy ((PangoAttribute*) attr); ++} + + /** + * pango_attribute_destroy: +@@ -162,6 +167,16 @@ pango_attribute_destroy (PangoAttribute *attr) + + attr->klass->destroy (attr); + } ++void ++pango_attribute_destroy_adapter (gpointer attr) ++{ ++ pango_attribute_destroy ((PangoAttribute*) attr); ++} ++void ++pango_attribute_destroy_gfunc_adapter (gpointer attr, gpointer dummy) ++{ ++ pango_attribute_destroy ((PangoAttribute*) attr); ++} + + G_DEFINE_BOXED_TYPE (PangoAttribute, pango_attribute, + pango_attribute_copy, +@@ -1919,6 +1934,11 @@ pango_attr_list_unref (PangoAttrList *list) + g_slice_free (PangoAttrList, list); + } + } ++void ++pango_attr_list_unref_adapter (gpointer list) ++{ ++ pango_attr_list_unref((PangoAttrList*) list); ++} + + /** + * pango_attr_list_copy: +@@ -1943,7 +1963,7 @@ pango_attr_list_copy (PangoAttrList *list) + if (!list->attributes || list->attributes->len == 0) + return new; + +- new->attributes = g_ptr_array_copy (list->attributes, (GCopyFunc)pango_attribute_copy, NULL); ++ new->attributes = g_ptr_array_copy (list->attributes, pango_attribute_copy_adapter, NULL); + + return new; + } +@@ -3334,6 +3354,11 @@ pango_attr_iterator_destroy (PangoAttrIterator *iterator) + _pango_attr_iterator_destroy (iterator); + g_slice_free (PangoAttrIterator, iterator); + } ++void ++pango_attr_iterator_destroy_adapter (gpointer iterator) ++{ ++ pango_attr_iterator_destroy ((PangoAttrIterator*) iterator); ++} + + /** + * pango_attr_iterator_get: +diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h +index 69ff9e5..d2b11e2 100644 +--- a/pango/pango-attributes.h ++++ b/pango/pango-attributes.h +@@ -509,8 +509,13 @@ void pango_attribute_init (PangoAttribute + const PangoAttrClass *klass); + PANGO_AVAILABLE_IN_ALL + PangoAttribute * pango_attribute_copy (const PangoAttribute *attr); ++gpointer pango_attribute_copy_adapter (gconstpointer attr, ++ gpointer dummy); + PANGO_AVAILABLE_IN_ALL + void pango_attribute_destroy (PangoAttribute *attr); ++void pango_attribute_destroy_adapter (gpointer attr); ++void pango_attribute_destroy_gfunc_adapter (gpointer attr, ++ gpointer dummy); + PANGO_AVAILABLE_IN_ALL + gboolean pango_attribute_equal (const PangoAttribute *attr1, + const PangoAttribute *attr2) G_GNUC_PURE; +@@ -673,6 +678,7 @@ PANGO_AVAILABLE_IN_1_10 + PangoAttrList * pango_attr_list_ref (PangoAttrList *list); + PANGO_AVAILABLE_IN_ALL + void pango_attr_list_unref (PangoAttrList *list); ++void pango_attr_list_unref_adapter (gpointer list); + PANGO_AVAILABLE_IN_ALL + PangoAttrList * pango_attr_list_copy (PangoAttrList *list); + PANGO_AVAILABLE_IN_ALL +@@ -728,6 +734,7 @@ PANGO_AVAILABLE_IN_ALL + PangoAttrIterator * pango_attr_iterator_copy (PangoAttrIterator *iterator); + PANGO_AVAILABLE_IN_ALL + void pango_attr_iterator_destroy (PangoAttrIterator *iterator); ++void pango_attr_iterator_destroy_adapter (gpointer iterator); + PANGO_AVAILABLE_IN_ALL + PangoAttribute * pango_attr_iterator_get (PangoAttrIterator *iterator, + PangoAttrType type); +@@ -739,9 +746,9 @@ void pango_attr_iterator_get_font (PangoAttrIterator * + PANGO_AVAILABLE_IN_1_2 + GSList * pango_attr_iterator_get_attrs (PangoAttrIterator *iterator); + +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoAttribute, pango_attribute_destroy) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoAttrList, pango_attr_list_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoAttrIterator, pango_attr_iterator_destroy) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoAttribute, pango_attribute_destroy_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoAttrList, pango_attr_list_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoAttrIterator, pango_attr_iterator_destroy_adapter) + + G_END_DECLS + +diff --git a/pango/pango-context.c b/pango/pango-context.c +index cbc4f17..6c1d6b1 100644 +--- a/pango/pango-context.c ++++ b/pango/pango-context.c +@@ -722,7 +722,7 @@ pango_context_get_metrics (PangoContext *context, + + update_metrics_from_items (metrics, language, sample_str, text_len, items); + +- g_list_foreach (items, (GFunc)pango_item_free, NULL); ++ g_list_foreach (items, pango_item_free_adapter, NULL); + g_list_free (items); + + g_object_unref (current_fonts); +diff --git a/pango/pango-font.h b/pango/pango-font.h +index 9fc63b3..209f472 100644 +--- a/pango/pango-font.h ++++ b/pango/pango-font.h +@@ -259,6 +259,7 @@ gboolean pango_font_description_equal (const PangoFontDescrip + const PangoFontDescription *desc2) G_GNUC_PURE; + PANGO_AVAILABLE_IN_ALL + void pango_font_description_free (PangoFontDescription *desc); ++void pango_font_description_free_adapter(gpointer desc); + PANGO_AVAILABLE_IN_ALL + void pango_font_descriptions_free (PangoFontDescription **descs, + int n_descs); +@@ -692,7 +693,7 @@ PangoFont * pango_font_deserialize (PangoContext *context, + G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoFontFamily, g_object_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoFontFace, g_object_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoFont, g_object_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoFontDescription, pango_font_description_free) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoFontDescription, pango_font_description_free_adapter) + + G_END_DECLS + +diff --git a/pango/pango-fontmap.c b/pango/pango-fontmap.c +index 20ecb93..d647f7a 100644 +--- a/pango/pango-fontmap.c ++++ b/pango/pango-fontmap.c +@@ -42,6 +42,7 @@ static void pango_font_map_real_changed (PangoFontMap *fontmap); + static guint pango_font_map_get_n_items (GListModel *list); + + static void pango_font_map_list_model_init (GListModelInterface *iface); ++static void pango_font_map_list_model_init_adapter (gpointer iface, gpointer dummy); + + typedef struct { + guint n_families; +@@ -59,7 +60,7 @@ static GParamSpec *properties[N_PROPERTIES] = { NULL, }; + + G_DEFINE_ABSTRACT_TYPE_WITH_CODE (PangoFontMap, pango_font_map, G_TYPE_OBJECT, + G_ADD_PRIVATE (PangoFontMap) +- G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, pango_font_map_list_model_init)) ++ G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, pango_font_map_list_model_init_adapter)) + + static void + pango_font_map_get_property (GObject *object, +@@ -531,3 +532,8 @@ pango_font_map_list_model_init (GListModelInterface *iface) + iface->get_n_items = pango_font_map_get_n_items; + iface->get_item = pango_font_map_get_item; + } ++static void ++pango_font_map_list_model_init_adapter (gpointer iface, gpointer dummy) ++{ ++ pango_font_map_list_model_init ((GListModelInterface *) iface); ++} +diff --git a/pango/pango-item.c b/pango/pango-item.c +index 944bfe2..5a88573 100644 +--- a/pango/pango-item.c ++++ b/pango/pango-item.c +@@ -101,7 +101,7 @@ pango_item_free (PangoItem *item) + + if (item->analysis.extra_attrs) + { +- g_slist_foreach (item->analysis.extra_attrs, (GFunc)pango_attribute_destroy, NULL); ++ g_slist_foreach (item->analysis.extra_attrs, pango_attribute_destroy_gfunc_adapter, NULL); + g_slist_free (item->analysis.extra_attrs); + } + +@@ -252,7 +252,7 @@ pango_item_apply_attrs (PangoItem *item, + + attrs = g_slist_prepend (attrs, pango_attribute_copy (l->data)); + } +- g_slist_free_full (list, (GDestroyNotify)pango_attribute_destroy); ++ g_slist_free_full (list, pango_attribute_destroy_adapter); + } + + if (end >= item->offset + item->length) +diff --git a/pango/pango-item.h b/pango/pango-item.h +index f0eebc0..aa67138 100644 +--- a/pango/pango-item.h ++++ b/pango/pango-item.h +@@ -127,6 +127,8 @@ PANGO_AVAILABLE_IN_ALL + PangoItem * pango_item_copy (PangoItem *item); + PANGO_AVAILABLE_IN_ALL + void pango_item_free (PangoItem *item); ++void pango_item_free_adapter (gpointer item, ++ gpointer dummy); + + PANGO_AVAILABLE_IN_ALL + PangoItem * pango_item_split (PangoItem *orig, +diff --git a/pango/pango-layout.c b/pango/pango-layout.c +index 59e0645..e51b0aa 100644 +--- a/pango/pango-layout.c ++++ b/pango/pango-layout.c +@@ -3288,6 +3288,11 @@ free_run (PangoLayoutRun *run, gpointer data) + pango_glyph_string_free (run->glyphs); + g_slice_free (PangoLayoutRun, run); + } ++static void ++free_run_adapter (gpointer run, gpointer data) ++{ ++ free_run ((PangoLayoutRun*) run, data); ++} + + static PangoItem * + uninsert_run (PangoLayoutLine *line) +@@ -5024,7 +5029,7 @@ pango_layout_line_unref (PangoLayoutLine *line) + + if (g_atomic_int_dec_and_test ((int *) &private->ref_count)) + { +- g_slist_foreach (line->runs, (GFunc)free_run, GINT_TO_POINTER (1)); ++ g_slist_foreach (line->runs, free_run_adapter, GINT_TO_POINTER (1)); + g_slist_free (line->runs); + g_slice_free (PangoLayoutLinePrivate, private); + } +@@ -7278,6 +7283,11 @@ pango_layout_iter_free (PangoLayoutIter *iter) + _pango_layout_iter_destroy (iter); + g_slice_free (PangoLayoutIter, iter); + } ++void ++pango_layout_iter_free_adapter (gpointer iter) ++{ ++ pango_layout_iter_free ((PangoLayoutIter*) iter); ++} + + /** + * pango_layout_iter_get_index: +diff --git a/pango/pango-layout.h b/pango/pango-layout.h +index 12fc76c..afffc11 100644 +--- a/pango/pango-layout.h ++++ b/pango/pango-layout.h +@@ -488,6 +488,7 @@ PANGO_AVAILABLE_IN_1_20 + PangoLayoutIter *pango_layout_iter_copy (PangoLayoutIter *iter); + PANGO_AVAILABLE_IN_ALL + void pango_layout_iter_free (PangoLayoutIter *iter); ++void pango_layout_iter_free_adapter (gpointer iter); + + PANGO_AVAILABLE_IN_ALL + int pango_layout_iter_get_index (PangoLayoutIter *iter); +@@ -546,7 +547,7 @@ int pango_layout_iter_get_run_baseline (PangoLayoutIter *iter); + + + G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoLayout, g_object_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoLayoutIter, pango_layout_iter_free) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoLayoutIter, pango_layout_iter_free_adapter) + + G_END_DECLS + +diff --git a/pango/pango-markup.c b/pango/pango-markup.c +index 9a3bde5..041933f 100644 +--- a/pango/pango-markup.c ++++ b/pango/pango-markup.c +@@ -193,10 +193,15 @@ scale_factor (int scale_level, double base) + static void + open_tag_free (OpenTag *ot) + { +- g_slist_foreach (ot->attrs, (GFunc) pango_attribute_destroy, NULL); ++ g_slist_foreach (ot->attrs, pango_attribute_destroy_gfunc_adapter, NULL); + g_slist_free (ot->attrs); + g_slice_free (OpenTag, ot); + } ++static void ++open_tag_free_adapter (gpointer ot) ++{ ++ open_tag_free ((OpenTag *) ot); ++} + + static void + open_tag_set_absolute_font_size (OpenTag *ot, +@@ -550,8 +555,8 @@ static const GMarkupParser pango_markup_parser = { + static void + destroy_markup_data (MarkupData *md) + { +- g_slist_free_full (md->tag_stack, (GDestroyNotify) open_tag_free); +- g_slist_free_full (md->to_apply, (GDestroyNotify) pango_attribute_destroy); ++ g_slist_free_full (md->tag_stack, open_tag_free_adapter); ++ g_slist_free_full (md->to_apply, pango_attribute_destroy_adapter); + if (md->text) + g_string_free (md->text, TRUE); + +@@ -560,6 +565,11 @@ destroy_markup_data (MarkupData *md) + + g_slice_free (MarkupData, md); + } ++static void ++destroy_markup_data_adapter (gpointer md) ++{ ++ destroy_markup_data ((MarkupData*) md); ++} + + static GMarkupParseContext * + pango_markup_parser_new_internal (char accel_marker, +@@ -591,7 +601,7 @@ pango_markup_parser_new_internal (char accel_marker, + + context = g_markup_parse_context_new (&pango_markup_parser, + 0, md, +- (GDestroyNotify)destroy_markup_data); ++ destroy_markup_data_adapter); + + if (!g_markup_parse_context_parse (context, "", -1, error)) + g_clear_pointer (&context, g_markup_parse_context_free); +diff --git a/pango/pango-tabs.c b/pango/pango-tabs.c +index bc8a7cb..8963424 100644 +--- a/pango/pango-tabs.c ++++ b/pango/pango-tabs.c +@@ -209,6 +209,11 @@ pango_tab_array_free (PangoTabArray *tab_array) + + g_slice_free (PangoTabArray, tab_array); + } ++void ++pango_tab_array_free_adapter (gpointer tab_array) ++{ ++ pango_tab_array_free ((PangoTabArray*) tab_array); ++} + + /** + * pango_tab_array_get_size: +diff --git a/pango/pango-tabs.h b/pango/pango-tabs.h +index 07b3353..9ac80ea 100644 +--- a/pango/pango-tabs.h ++++ b/pango/pango-tabs.h +@@ -67,6 +67,7 @@ PANGO_AVAILABLE_IN_ALL + PangoTabArray *pango_tab_array_copy (PangoTabArray *src); + PANGO_AVAILABLE_IN_ALL + void pango_tab_array_free (PangoTabArray *tab_array); ++void pango_tab_array_free_adapter (gpointer tab_array); + PANGO_AVAILABLE_IN_ALL + gint pango_tab_array_get_size (PangoTabArray *tab_array); + PANGO_AVAILABLE_IN_ALL +@@ -110,7 +111,7 @@ gunichar pango_tab_array_get_decimal_point (PangoTabArray *tab_array, + PANGO_AVAILABLE_IN_1_50 + void pango_tab_array_sort (PangoTabArray *tab_array); + +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoTabArray, pango_tab_array_free) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoTabArray, pango_tab_array_free_adapter) + + G_END_DECLS + +diff --git a/pango/pangocairo-context.c b/pango/pangocairo-context.c +index 08a9067..268c538 100644 +--- a/pango/pangocairo-context.c ++++ b/pango/pangocairo-context.c +@@ -58,6 +58,11 @@ free_context_info (PangoCairoContextInfo *info) + + g_slice_free (PangoCairoContextInfo, info); + } ++static void ++free_context_info_adapter (gpointer info) ++{ ++ free_context_info ((PangoCairoContextInfo*) info); ++} + + static PangoCairoContextInfo * + get_context_info (PangoContext *context, +@@ -78,7 +83,7 @@ retry: + info->dpi = -1.0; + + if (!g_object_replace_qdata (G_OBJECT (context), context_info_quark, NULL, +- info, (GDestroyNotify)free_context_info, ++ info, free_context_info_adapter, + NULL)) + { + free_context_info (info); +diff --git a/pango/pangocairo-fcfont.c b/pango/pangocairo-fcfont.c +index 02eefb6..f68866c 100644 +--- a/pango/pangocairo-fcfont.c ++++ b/pango/pangocairo-fcfont.c +@@ -103,8 +103,14 @@ cairo_font_iface_init (PangoCairoFontIface *iface) + iface->cf_priv_offset = G_STRUCT_OFFSET (PangoCairoFcFont, cf_priv); + } + ++static void ++cairo_font_iface_init_adapter (gpointer iface, gpointer dummy) ++{ ++ cairo_font_iface_init ((PangoCairoFontIface*) iface); ++} ++ + G_DEFINE_TYPE_WITH_CODE (PangoCairoFcFont, pango_cairo_fc_font, PANGO_TYPE_FC_FONT, +- { G_IMPLEMENT_INTERFACE (PANGO_TYPE_CAIRO_FONT, cairo_font_iface_init) }) ++ { G_IMPLEMENT_INTERFACE (PANGO_TYPE_CAIRO_FONT, cairo_font_iface_init_adapter) }) + + static void + pango_cairo_fc_font_finalize (GObject *object) +diff --git a/pango/pangocairo-fcfontmap.c b/pango/pangocairo-fcfontmap.c +index dec59c8..f0f41db 100644 +--- a/pango/pangocairo-fcfontmap.c ++++ b/pango/pangocairo-fcfontmap.c +@@ -94,9 +94,14 @@ cairo_font_map_iface_init (PangoCairoFontMapIface *iface) + iface->get_resolution = pango_cairo_fc_font_map_get_resolution_cairo; + iface->get_font_type = pango_cairo_fc_font_map_get_font_type; + } ++static void ++cairo_font_map_iface_init_adapter (gpointer iface, gpointer dummy) ++{ ++ cairo_font_map_iface_init ((PangoCairoFontMapIface*) iface); ++} + + G_DEFINE_TYPE_WITH_CODE (PangoCairoFcFontMap, pango_cairo_fc_font_map, PANGO_TYPE_FC_FONT_MAP, +- { G_IMPLEMENT_INTERFACE (PANGO_TYPE_CAIRO_FONT_MAP, cairo_font_map_iface_init) }) ++ { G_IMPLEMENT_INTERFACE (PANGO_TYPE_CAIRO_FONT_MAP, cairo_font_map_iface_init_adapter) }) + + static void + pango_cairo_fc_font_map_fontset_key_substitute (PangoFcFontMap *fcfontmap G_GNUC_UNUSED, +diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c +index 24bb325..76ac896 100644 +--- a/pango/pangocairo-font.c ++++ b/pango/pangocairo-font.c +@@ -614,6 +614,11 @@ free_metrics_info (PangoCairoFontMetricsInfo *info) + pango_font_metrics_unref (info->metrics); + g_slice_free (PangoCairoFontMetricsInfo, info); + } ++static void ++free_metrics_info_gfunc_adapter (gpointer info, gpointer dummy) ++{ ++ free_metrics_info ((PangoCairoFontMetricsInfo*) info); ++} + + void + _pango_cairo_font_private_finalize (PangoCairoFontPrivate *cf_priv) +@@ -631,7 +636,7 @@ _pango_cairo_font_private_finalize (PangoCairoFontPrivate *cf_priv) + g_free (cf_priv->glyph_extents_cache); + cf_priv->glyph_extents_cache = NULL; + +- g_slist_foreach (cf_priv->metrics_by_lang, (GFunc)free_metrics_info, NULL); ++ g_slist_foreach (cf_priv->metrics_by_lang, free_metrics_info_gfunc_adapter, NULL); + g_slist_free (cf_priv->metrics_by_lang); + cf_priv->metrics_by_lang = NULL; + } +diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c +index d0077b3..a691504 100644 +--- a/pango/pangofc-font.c ++++ b/pango/pangofc-font.c +@@ -156,6 +156,11 @@ free_metrics_info (PangoFcMetricsInfo *info) + pango_font_metrics_unref (info->metrics); + g_slice_free (PangoFcMetricsInfo, info); + } ++static void ++free_metrics_info_gfunc_adapter (gpointer info, gpointer dummy) ++{ ++ free_metrics_info ((PangoFcMetricsInfo*) info); ++} + + static void + pango_fc_font_finalize (GObject *object) +@@ -164,7 +169,7 @@ pango_fc_font_finalize (GObject *object) + PangoFcFontPrivate *priv = fcfont->priv; + PangoFcFontMap *fontmap; + +- g_slist_foreach (fcfont->metrics_by_lang, (GFunc)free_metrics_info, NULL); ++ g_slist_foreach (fcfont->metrics_by_lang, free_metrics_info_gfunc_adapter, NULL); + g_slist_free (fcfont->metrics_by_lang); + + fontmap = g_weak_ref_get ((GWeakRef *) &fcfont->fontmap); +diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c +index 51f71cb..43e006a 100644 +--- a/pango/pangofc-fontmap.c ++++ b/pango/pangofc-fontmap.c +@@ -30,6 +30,7 @@ + * deriving from this base class will take advantage of the wide + * range of shapers implemented using FreeType that come with Pango. + */ ++#include "pango-glyph-item.h" + #define FONTSET_CACHE_SIZE 256 + + #include "config.h" +@@ -248,9 +249,12 @@ static PangoFontFace *pango_fc_font_map_get_face (PangoFontMap *fontmap, + + static void pango_fc_font_map_changed (PangoFontMap *fontmap); + +-static guint pango_fc_font_face_data_hash (PangoFcFontFaceData *key); +-static gboolean pango_fc_font_face_data_equal (PangoFcFontFaceData *key1, +- PangoFcFontFaceData *key2); ++static guint pango_fc_font_face_data_hash (const PangoFcFontFaceData *key); ++static guint pango_fc_font_face_data_hash_adapter (gconstpointer key); ++static gboolean pango_fc_font_face_data_equal (const PangoFcFontFaceData *key1, ++ const PangoFcFontFaceData *key2); ++static gboolean pango_fc_font_face_data_equal_adapter (gconstpointer key1, ++ gconstpointer key2); + + static void pango_fc_fontset_key_init (PangoFcFontsetKey *key, + PangoFcFontMap *fcfontmap, +@@ -260,8 +264,11 @@ static void pango_fc_fontset_key_init (PangoFcFontsetKey + static PangoFcFontsetKey *pango_fc_fontset_key_copy (const PangoFcFontsetKey *key); + static void pango_fc_fontset_key_free (PangoFcFontsetKey *key); + static guint pango_fc_fontset_key_hash (const PangoFcFontsetKey *key); ++static guint pango_fc_fontset_key_hash_adapter (gconstpointer key); + static gboolean pango_fc_fontset_key_equal (const PangoFcFontsetKey *key_a, + const PangoFcFontsetKey *key_b); ++static gboolean pango_fc_fontset_key_equal_adapter (gconstpointer key_a, ++ gconstpointer key_b); + + static void pango_fc_font_key_init (PangoFcFontKey *key, + PangoFcFontMap *fcfontmap, +@@ -270,8 +277,11 @@ static void pango_fc_font_key_init (PangoFcFontKey *key, + static PangoFcFontKey *pango_fc_font_key_copy (const PangoFcFontKey *key); + static void pango_fc_font_key_free (PangoFcFontKey *key); + static guint pango_fc_font_key_hash (const PangoFcFontKey *key); ++static guint pango_fc_font_key_hash_adapter (gconstpointer key); + static gboolean pango_fc_font_key_equal (const PangoFcFontKey *key_a, + const PangoFcFontKey *key_b); ++static gboolean pango_fc_font_key_equal_adapter (gconstpointer key_a, ++ gconstpointer key_b); + + static PangoFcPatterns *pango_fc_patterns_new (FcPattern *pat, + PangoFcFontMap *fontmap); +@@ -299,18 +309,29 @@ get_gravity_class (void) + } + + static guint +-pango_fc_font_face_data_hash (PangoFcFontFaceData *key) ++pango_fc_font_face_data_hash (const PangoFcFontFaceData *key) + { + return g_str_hash (key->filename) ^ key->id; + } ++static guint ++pango_fc_font_face_data_hash_adapter (gconstpointer key) ++{ ++ return pango_fc_font_face_data_hash ((PangoFcFontFaceData*) key); ++} + + static gboolean +-pango_fc_font_face_data_equal (PangoFcFontFaceData *key1, +- PangoFcFontFaceData *key2) ++pango_fc_font_face_data_equal (const PangoFcFontFaceData *key1, ++ const PangoFcFontFaceData *key2) + { + return key1->id == key2->id && + (key1 == key2 || 0 == strcmp (key1->filename, key2->filename)); + } ++static gboolean ++pango_fc_font_face_data_equal_adapter (gconstpointer key1, ++ gconstpointer key2) ++{ ++ return pango_fc_font_face_data_equal ((const PangoFcFontFaceData*) key1, (const PangoFcFontFaceData*) key2); ++} + + static void + pango_fc_font_face_data_free (PangoFcFontFaceData *data) +@@ -326,6 +347,11 @@ pango_fc_font_face_data_free (PangoFcFontFaceData *data) + + g_slice_free (PangoFcFontFaceData, data); + } ++static void ++pango_fc_font_face_data_free_adapter (gpointer data) ++{ ++ pango_fc_font_face_data_free ((PangoFcFontFaceData*) data); ++} + + /* Fowler / Noll / Vo (FNV) Hash (http://www.isthe.com/chongo/tech/comp/fnv/) + * +@@ -447,6 +473,12 @@ pango_fc_fontset_key_equal (const PangoFcFontsetKey *key_a, + else + return FALSE; + } ++static gboolean ++pango_fc_fontset_key_equal_adapter (gconstpointer key_a, ++ gconstpointer key_b) ++{ ++ return pango_fc_fontset_key_equal ((const PangoFcFontsetKey*) key_a, (const PangoFcFontsetKey*) key_b); ++} + + static guint + pango_fc_fontset_key_hash (const PangoFcFontsetKey *key) +@@ -470,6 +502,11 @@ pango_fc_fontset_key_hash (const PangoFcFontsetKey *key) + GPOINTER_TO_UINT (key->language) ^ + pango_font_description_hash (key->desc)); + } ++static guint ++pango_fc_fontset_key_hash_adapter (gconstpointer key) ++{ ++ return pango_fc_fontset_key_hash ((const PangoFcFontsetKey*) key); ++} + + static void + pango_fc_fontset_key_free (PangoFcFontsetKey *key) +@@ -627,6 +664,12 @@ pango_fc_font_key_equal (const PangoFcFontKey *key_a, + else + return FALSE; + } ++static gboolean ++pango_fc_font_key_equal_adapter (gconstpointer key_a, ++ gconstpointer key_b) ++{ ++ return pango_fc_font_key_equal ((const PangoFcFontKey*) key_a, (const PangoFcFontKey*) key_b); ++} + + static guint + pango_fc_font_key_hash (const PangoFcFontKey *key) +@@ -645,6 +688,11 @@ pango_fc_font_key_hash (const PangoFcFontKey *key) + + return (hash ^ GPOINTER_TO_UINT (key->pattern)); + } ++static guint ++pango_fc_font_key_hash_adapter (gconstpointer key) ++{ ++ return pango_fc_font_key_hash ((PangoFcFontKey*) key); ++} + + static void + pango_fc_font_key_free (PangoFcFontKey *key) +@@ -1354,10 +1402,15 @@ pango_fc_font_map_list_model_init (GListModelInterface *iface) + iface->get_n_items = pango_fc_font_map_get_n_items; + iface->get_item = pango_fc_font_map_get_item; + } ++static void ++pango_fc_font_map_list_model_init_adapter (gpointer iface, gpointer dummy) ++{ ++ pango_fc_font_map_list_model_init ((GListModelInterface *) iface); ++} + + G_DEFINE_ABSTRACT_TYPE_WITH_CODE (PangoFcFontMap, pango_fc_font_map, PANGO_TYPE_FONT_MAP, + G_ADD_PRIVATE (PangoFcFontMap) +- G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, pango_fc_font_map_list_model_init)) ++ G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, pango_fc_font_map_list_model_init_adapter)) + + static gpointer + init_in_thread (gpointer task_data) +@@ -1415,6 +1468,32 @@ wait_for_fc_init (void) + pango_trace_mark (before, "wait for FcInit", NULL); + } + ++static guint32 ++FcPatternHashAdapter(gconstpointer fcpattern ) ++{ ++ FcChar32 result = FcPatternHash((const FcPattern*) fcpattern); ++ return (guint32) result; ++} ++ ++static gboolean ++FcPatternEqualAdapter(gconstpointer a, gconstpointer b) ++{ ++ FcBool result = FcPatternEqual((const FcPattern*) a, (const FcPattern*) b); ++ return (gboolean) result; ++} ++ ++static void ++FcPatternDestroyAdapter (gpointer fcpattern) ++{ ++ FcPatternDestroy((FcPattern*) fcpattern); ++} ++ ++static void ++my_g_object_unref_adapter (gpointer obj) ++{ ++ g_object_unref (obj); ++} ++ + static void + pango_fc_font_map_init (PangoFcFontMap *fcfontmap) + { +@@ -1424,25 +1503,25 @@ pango_fc_font_map_init (PangoFcFontMap *fcfontmap) + + priv->n_families = -1; + +- priv->font_hash = g_hash_table_new ((GHashFunc)pango_fc_font_key_hash, +- (GEqualFunc)pango_fc_font_key_equal); ++ priv->font_hash = g_hash_table_new (pango_fc_font_key_hash_adapter, ++ pango_fc_font_key_equal_adapter); + +- priv->fontset_hash = g_hash_table_new_full ((GHashFunc)pango_fc_fontset_key_hash, +- (GEqualFunc)pango_fc_fontset_key_equal, ++ priv->fontset_hash = g_hash_table_new_full (pango_fc_fontset_key_hash_adapter, ++ pango_fc_fontset_key_equal_adapter, + NULL, +- (GDestroyNotify)g_object_unref); ++ my_g_object_unref_adapter); + priv->fontset_cache = g_queue_new (); + + priv->patterns_hash = g_hash_table_new (NULL, NULL); + +- priv->pattern_hash = g_hash_table_new_full ((GHashFunc) FcPatternHash, +- (GEqualFunc) FcPatternEqual, +- (GDestroyNotify) FcPatternDestroy, ++ priv->pattern_hash = g_hash_table_new_full (FcPatternHashAdapter, ++ FcPatternEqualAdapter, ++ FcPatternDestroyAdapter, + NULL); + +- priv->font_face_data_hash = g_hash_table_new_full ((GHashFunc)pango_fc_font_face_data_hash, +- (GEqualFunc)pango_fc_font_face_data_equal, +- (GDestroyNotify)pango_fc_font_face_data_free, ++ priv->font_face_data_hash = g_hash_table_new_full (pango_fc_font_face_data_hash_adapter, ++ pango_fc_font_face_data_equal_adapter, ++ pango_fc_font_face_data_free_adapter, + NULL); + priv->dpi = -1; + +@@ -2656,6 +2735,13 @@ shutdown_font (gpointer key, + _pango_fc_font_set_font_key (fcfont, NULL); + pango_fc_font_key_free (key); + } ++static void ++shutdown_font_adapter (gpointer key, ++ gpointer fcfont, ++ gpointer fcfontmap) ++{ ++ shutdown_font (key, (PangoFcFont*) fcfont, (PangoFcFontMap*) fcfontmap); ++} + + /** + * pango_fc_font_map_shutdown: +@@ -2682,7 +2768,7 @@ pango_fc_font_map_shutdown (PangoFcFontMap *fcfontmap) + if (priv->closed) + return; + +- g_hash_table_foreach (priv->font_hash, (GHFunc) shutdown_font, fcfontmap); ++ g_hash_table_foreach (priv->font_hash, shutdown_font_adapter, fcfontmap); + for (i = 0; i < priv->n_families; i++) + priv->families[i]->fontmap = NULL; + +@@ -3174,9 +3260,14 @@ pango_fc_family_list_model_init (GListModelInterface *iface) + iface->get_n_items = pango_fc_family_get_n_items; + iface->get_item = pango_fc_family_get_item; + } ++static void ++pango_fc_family_list_model_init_adapter (gpointer iface, gpointer dummy) ++{ ++ pango_fc_family_list_model_init ((GListModelInterface *) iface); ++} + + G_DEFINE_TYPE_WITH_CODE (PangoFcFamily, pango_fc_family, PANGO_TYPE_FONT_FAMILY, +- G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, pango_fc_family_list_model_init)) ++ G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, pango_fc_family_list_model_init_adapter)) + + static PangoFcFace * + create_face (PangoFcFamily *fcfamily, +diff --git a/pango/pangoft2-render.c b/pango/pangoft2-render.c +index f2da8e7..9236da6 100644 +--- a/pango/pangoft2-render.c ++++ b/pango/pangoft2-render.c +@@ -100,6 +100,11 @@ pango_ft2_free_rendered_glyph (PangoFT2RenderedGlyph *rendered) + g_free (rendered->bitmap.buffer); + g_slice_free (PangoFT2RenderedGlyph, rendered); + } ++static void ++pango_ft2_free_rendered_glyph_adapter (gpointer rendered) ++{ ++ pango_ft2_free_rendered_glyph ((PangoFT2RenderedGlyph*) rendered); ++} + + static PangoFT2RenderedGlyph * + pango_ft2_font_render_box_glyph (int width, +@@ -372,7 +377,7 @@ pango_ft2_renderer_draw_glyph (PangoRenderer *renderer, + if (add_glyph_to_cache) + { + _pango_ft2_font_set_glyph_cache_destroy (font, +- (GDestroyNotify) pango_ft2_free_rendered_glyph); ++ pango_ft2_free_rendered_glyph_adapter); + _pango_ft2_font_set_cache_glyph_data (font, + glyph, rendered_glyph); + } +diff --git a/pango/serializer.c b/pango/serializer.c +index e3a2280..7e0f559 100644 +--- a/pango/serializer.c ++++ b/pango/serializer.c +@@ -410,7 +410,7 @@ add_attr_list (GtkJsonPrinter *printer, + PangoAttribute *attr = l->data; + add_attribute (printer, attr); + } +- g_slist_free_full (attributes, (GDestroyNotify) pango_attribute_destroy); ++ g_slist_free_full (attributes, pango_attribute_destroy_adapter); + + gtk_json_printer_end (printer); + } +diff --git a/pango/shape.c b/pango/shape.c +index acf4be5..a2059f0 100644 +--- a/pango/shape.c ++++ b/pango/shape.c +@@ -414,7 +414,8 @@ pango_hb_shape (const char *item_text, + /* setup buffer */ + + hb_buffer_set_direction (hb_buffer, hb_direction); +- hb_buffer_set_script (hb_buffer, (hb_script_t) g_unicode_script_to_iso15924 (analysis->script)); ++ guint32 result = g_unicode_script_to_iso15924 (analysis->script); ++ hb_buffer_set_script (hb_buffer, (hb_script_t) result); + hb_buffer_set_language (hb_buffer, hb_language_from_string (pango_language_to_string (analysis->language), -1)); + hb_buffer_set_cluster_level (hb_buffer, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS); + hb_buffer_set_flags (hb_buffer, hb_buffer_flags); diff --git a/ports/pango/support-no-func-ptr-casts-glib.patch b/ports/pango/support-no-func-ptr-casts-glib.patch new file mode 100644 index 00000000000000..9f88bb35b993be --- /dev/null +++ b/ports/pango/support-no-func-ptr-casts-glib.patch @@ -0,0 +1,176 @@ +diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c +index 47aa0aa..764fae3 100644 +--- a/pango/pango-attributes.c ++++ b/pango/pango-attributes.c +@@ -162,6 +162,11 @@ pango_attribute_destroy (PangoAttribute *attr) + + attr->klass->destroy (attr); + } ++void ++pango_attribute_destroy_adapter (gpointer attr) ++{ ++ pango_attribute_destroy ((PangoAttribute*) attr); ++} + + G_DEFINE_BOXED_TYPE (PangoAttribute, pango_attribute, + pango_attribute_copy, +@@ -1919,6 +1924,11 @@ pango_attr_list_unref (PangoAttrList *list) + g_slice_free (PangoAttrList, list); + } + } ++void ++pango_attr_list_unref_adapter (gpointer list) ++{ ++ pango_attr_list_unref((PangoAttrList*) list); ++} + + /** + * pango_attr_list_copy: +@@ -3334,6 +3344,11 @@ pango_attr_iterator_destroy (PangoAttrIterator *iterator) + _pango_attr_iterator_destroy (iterator); + g_slice_free (PangoAttrIterator, iterator); + } ++void ++pango_attr_iterator_destroy_adapter (gpointer iterator) ++{ ++ pango_attr_iterator_destroy ((PangoAttrIterator*) iterator); ++} + + /** + * pango_attr_iterator_get: +diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h +index 69ff9e5..108f92a 100644 +--- a/pango/pango-attributes.h ++++ b/pango/pango-attributes.h +@@ -511,6 +511,7 @@ PANGO_AVAILABLE_IN_ALL + PangoAttribute * pango_attribute_copy (const PangoAttribute *attr); + PANGO_AVAILABLE_IN_ALL + void pango_attribute_destroy (PangoAttribute *attr); ++void pango_attribute_destroy_adapter (gpointer attr); + PANGO_AVAILABLE_IN_ALL + gboolean pango_attribute_equal (const PangoAttribute *attr1, + const PangoAttribute *attr2) G_GNUC_PURE; +@@ -673,6 +674,7 @@ PANGO_AVAILABLE_IN_1_10 + PangoAttrList * pango_attr_list_ref (PangoAttrList *list); + PANGO_AVAILABLE_IN_ALL + void pango_attr_list_unref (PangoAttrList *list); ++void pango_attr_list_unref_adapter (gpointer list); + PANGO_AVAILABLE_IN_ALL + PangoAttrList * pango_attr_list_copy (PangoAttrList *list); + PANGO_AVAILABLE_IN_ALL +@@ -728,6 +730,7 @@ PANGO_AVAILABLE_IN_ALL + PangoAttrIterator * pango_attr_iterator_copy (PangoAttrIterator *iterator); + PANGO_AVAILABLE_IN_ALL + void pango_attr_iterator_destroy (PangoAttrIterator *iterator); ++void pango_attr_iterator_destroy_adapter (gpointer iterator); + PANGO_AVAILABLE_IN_ALL + PangoAttribute * pango_attr_iterator_get (PangoAttrIterator *iterator, + PangoAttrType type); +@@ -739,9 +742,9 @@ void pango_attr_iterator_get_font (PangoAttrIterator * + PANGO_AVAILABLE_IN_1_2 + GSList * pango_attr_iterator_get_attrs (PangoAttrIterator *iterator); + +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoAttribute, pango_attribute_destroy) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoAttrList, pango_attr_list_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoAttrIterator, pango_attr_iterator_destroy) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoAttribute, pango_attribute_destroy_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoAttrList, pango_attr_list_unref_adapter) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoAttrIterator, pango_attr_iterator_destroy_adapter) + + G_END_DECLS + +diff --git a/pango/pango-font.h b/pango/pango-font.h +index 9fc63b3..209f472 100644 +--- a/pango/pango-font.h ++++ b/pango/pango-font.h +@@ -259,6 +259,7 @@ gboolean pango_font_description_equal (const PangoFontDescrip + const PangoFontDescription *desc2) G_GNUC_PURE; + PANGO_AVAILABLE_IN_ALL + void pango_font_description_free (PangoFontDescription *desc); ++void pango_font_description_free_adapter(gpointer desc); + PANGO_AVAILABLE_IN_ALL + void pango_font_descriptions_free (PangoFontDescription **descs, + int n_descs); +@@ -692,7 +693,7 @@ PangoFont * pango_font_deserialize (PangoContext *context, + G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoFontFamily, g_object_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoFontFace, g_object_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoFont, g_object_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoFontDescription, pango_font_description_free) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoFontDescription, pango_font_description_free_adapter) + + G_END_DECLS + +diff --git a/pango/pango-layout.c b/pango/pango-layout.c +index 59e0645..8d8770c 100644 +--- a/pango/pango-layout.c ++++ b/pango/pango-layout.c +@@ -7278,6 +7278,11 @@ pango_layout_iter_free (PangoLayoutIter *iter) + _pango_layout_iter_destroy (iter); + g_slice_free (PangoLayoutIter, iter); + } ++void ++pango_layout_iter_free_adapter (gpointer iter) ++{ ++ pango_layout_iter_free ((PangoLayoutIter*) iter); ++} + + /** + * pango_layout_iter_get_index: +diff --git a/pango/pango-layout.h b/pango/pango-layout.h +index 12fc76c..afffc11 100644 +--- a/pango/pango-layout.h ++++ b/pango/pango-layout.h +@@ -488,6 +488,7 @@ PANGO_AVAILABLE_IN_1_20 + PangoLayoutIter *pango_layout_iter_copy (PangoLayoutIter *iter); + PANGO_AVAILABLE_IN_ALL + void pango_layout_iter_free (PangoLayoutIter *iter); ++void pango_layout_iter_free_adapter (gpointer iter); + + PANGO_AVAILABLE_IN_ALL + int pango_layout_iter_get_index (PangoLayoutIter *iter); +@@ -546,7 +547,7 @@ int pango_layout_iter_get_run_baseline (PangoLayoutIter *iter); + + + G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoLayout, g_object_unref) +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoLayoutIter, pango_layout_iter_free) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoLayoutIter, pango_layout_iter_free_adapter) + + G_END_DECLS + +diff --git a/pango/pango-tabs.c b/pango/pango-tabs.c +index bc8a7cb..8963424 100644 +--- a/pango/pango-tabs.c ++++ b/pango/pango-tabs.c +@@ -209,6 +209,11 @@ pango_tab_array_free (PangoTabArray *tab_array) + + g_slice_free (PangoTabArray, tab_array); + } ++void ++pango_tab_array_free_adapter (gpointer tab_array) ++{ ++ pango_tab_array_free ((PangoTabArray*) tab_array); ++} + + /** + * pango_tab_array_get_size: +diff --git a/pango/pango-tabs.h b/pango/pango-tabs.h +index 07b3353..9ac80ea 100644 +--- a/pango/pango-tabs.h ++++ b/pango/pango-tabs.h +@@ -67,6 +67,7 @@ PANGO_AVAILABLE_IN_ALL + PangoTabArray *pango_tab_array_copy (PangoTabArray *src); + PANGO_AVAILABLE_IN_ALL + void pango_tab_array_free (PangoTabArray *tab_array); ++void pango_tab_array_free_adapter (gpointer tab_array); + PANGO_AVAILABLE_IN_ALL + gint pango_tab_array_get_size (PangoTabArray *tab_array); + PANGO_AVAILABLE_IN_ALL +@@ -110,7 +111,7 @@ gunichar pango_tab_array_get_decimal_point (PangoTabArray *tab_array, + PANGO_AVAILABLE_IN_1_50 + void pango_tab_array_sort (PangoTabArray *tab_array); + +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoTabArray, pango_tab_array_free) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoTabArray, pango_tab_array_free_adapter) + + G_END_DECLS + diff --git a/ports/pango/vcpkg.json b/ports/pango/vcpkg.json index 35248a357d66d3..badd4f05f0f8b5 100644 --- a/ports/pango/vcpkg.json +++ b/ports/pango/vcpkg.json @@ -8,10 +8,7 @@ "supports": "!xbox", "dependencies": [ { - "name": "cairo", - "features": [ - "gobject" - ] + "name": "cairo" }, "fontconfig", "freetype", diff --git a/ports/pcre2/portfile.cmake b/ports/pcre2/portfile.cmake index b247e97d8c8a30..db4da7b103a56b 100644 --- a/ports/pcre2/portfile.cmake +++ b/ports/pcre2/portfile.cmake @@ -34,7 +34,7 @@ vcpkg_cmake_configure( -DCMAKE_DISABLE_FIND_PACKAGE_Readline=ON -DCMAKE_DISABLE_FIND_PACKAGE_Editline=ON -DINSTALL_MSVC_PDB=${INSTALL_PDB} - -DCMAKE_REQUIRE_FIND_PACKAGE_BZip2=ON + -DCMAKE_REQUIRE_FIND_PACKAGE_BZip2=OFF -DCMAKE_REQUIRE_FIND_PACKAGE_ZLIB=ON ) diff --git a/ports/pixman/portfile.cmake b/ports/pixman/portfile.cmake index 9835b6bff128a1..f7d1e80626feaf 100644 --- a/ports/pixman/portfile.cmake +++ b/ports/pixman/portfile.cmake @@ -27,6 +27,11 @@ elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "mips") -Dmmx=disabled -Dsse2=disabled -Dssse3=disabled) +elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "wasm32") + list(APPEND OPTIONS + -Dmmx=disabled + -Dsse2=disabled + -Dssse3=disabled) endif() if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE MATCHES "arm")