Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emscripten build #262

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
/.github/workflows export-ignore
/.pre-commit-config.yaml export-ignore
/pyproject.toml export-ignore
/.vscode export-ignore
34 changes: 28 additions & 6 deletions deps/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,43 @@ subproject(
'build_codec_apps=false',
],
)


host_system = host_machine.system()

# When trying to do with wasm32,
# this happen with pcre2, "Problem encountered: Your configuration is not supported"

if host_system != 'emscripten'
subproject(
'pcre2',
default_options : [
default_options: [
'grep=false',
'test=false',
],
)
endif

glib_options = [
'introspection=disabled',
'nls=disabled',
'tests=false',
]
if host_system == 'emscripten'
glib_options += [
'selinux=disabled',
'xattr=false',
'libmount=disabled',
'nls=disabled',
'force_fallback_for=pcr2, gvdb',
]
endif

subproject(
'glib',
default_options : [
'introspection=disabled',
'nls=disabled',
'tests=false',
],
default_options : glib_options,
)

subproject(
'gdk-pixbuf',
default_options : [
Expand Down
29 changes: 29 additions & 0 deletions machines/cross-emscripten.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[binaries]
c = 'emcc'
cpp = 'em++'
ld = 'wasm-ld'
ar = 'emar'
ranlib = 'emranlib'
#pkgconfig = '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
openslide_bin_platform = 'wasm32'
python_platform_tag = 'wasm32'

[built-in options]
# Ensure that '-s PTHREAD_POOL_SIZE=*' is not injected into .pc files
c_thread_count = 0
cpp_thread_count = 0
c_args = '-matomics -mbulk-memory'
cpp_args = '-matomics -mbulk-memory'

[host_machine]
system = 'emscripten'
cpu_family = 'wasm32'
cpu = 'wasm32'
endian = 'little'
2 changes: 1 addition & 1 deletion subprojects/gdk-pixbuf.wrap
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/gdk
wrapdb_version = 2.42.12-1

# https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/merge_requests/158
diff_files = gdk-pixbuf-intl.patch
diff_files = gdk-pixbuf-intl.patch, gdk-pixbuf-gmodule.patch

[provide]
gdk-pixbuf-2.0 = gdkpixbuf_dep
3 changes: 2 additions & 1 deletion subprojects/glib.wrap
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[wrap-file]
directory = glib-2.80.4
source_url = https://download.gnome.org/sources/glib/2.80/glib-2.80.4.tar.xz
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/glib_2.80.4-1/glib-2.80.4.tar.xz
source_filename = glib-2.80.4.tar.xz
source_hash = 24e029c5dfc9b44e4573697adf33078a9827c48938555004b3b9096fa4ea034f
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/glib_2.80.4-1/glib-2.80.4.tar.xz
wrapdb_version = 2.80.4-1
diff_files = glib.patch

[provide]
dependency_names = gthread-2.0, gobject-2.0, gmodule-no-export-2.0, gmodule-export-2.0, gmodule-2.0, glib-2.0, gio-2.0, gio-windows-2.0, gio-unix-2.0
Expand Down
1 change: 1 addition & 0 deletions subprojects/libffi.wrap
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ source_hash = d66c56ad259a82cf2a9dfc408b32bf5da52371500b84745f7fb8b645712df676
patch_filename = libffi_3.4.4-4_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/libffi_3.4.4-4/get_patch
patch_hash = 6babcedb6949383986f1b240a99cd2219a029d62421996d518865a2de855d35a
diff_files = libffi-wasm-3.4.4.patch
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/libffi_3.4.4-4/libffi-3.4.4.tar.gz
wrapdb_version = 3.4.4-4

Expand Down
14 changes: 14 additions & 0 deletions subprojects/packagefiles/gdk-pixbuf-gmodule.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/meson.build b/meson.build
index 3eb3fcc..c69e4ac 100644
--- a/meson.build
+++ b/meson.build
@@ -235,6 +235,9 @@ if gmodule_dep.type_name() == 'pkgconfig'
else
build_modules = subproject('glib').get_variable('g_module_impl') != '0'
endif
+if host_system == 'emscripten'
+ build_modules = false
+endif
gdk_pixbuf_conf.set('USE_GMODULE', build_modules)

# Check which loaders should be built into gdk-pixbuf
Loading
Loading