diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /toolkit/crashreporter/client/gtkbind | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/crashreporter/client/gtkbind')
-rw-r--r-- | toolkit/crashreporter/client/gtkbind/Cargo.toml | 8 | ||||
-rw-r--r-- | toolkit/crashreporter/client/gtkbind/build.rs | 43 | ||||
-rw-r--r-- | toolkit/crashreporter/client/gtkbind/src/lib.rs | 9 |
3 files changed, 60 insertions, 0 deletions
diff --git a/toolkit/crashreporter/client/gtkbind/Cargo.toml b/toolkit/crashreporter/client/gtkbind/Cargo.toml new file mode 100644 index 0000000000..813d43dbe3 --- /dev/null +++ b/toolkit/crashreporter/client/gtkbind/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "gtkbind" +version = "0.1.0" +edition = "2021" + +[build-dependencies] +bindgen = { version = "0.69.0", default-features = false, features = ["runtime"] } +mozbuild = "0.1.0" diff --git a/toolkit/crashreporter/client/gtkbind/build.rs b/toolkit/crashreporter/client/gtkbind/build.rs new file mode 100644 index 0000000000..fa3402fdf2 --- /dev/null +++ b/toolkit/crashreporter/client/gtkbind/build.rs @@ -0,0 +1,43 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +use mozbuild::config::{ + CC_BASE_FLAGS as CFLAGS, MOZ_GTK3_CFLAGS as GTK_CFLAGS, MOZ_GTK3_LIBS as GTK_LIBS, +}; + +const HEADER: &str = r#" +#include "gtk/gtk.h" +#include "pango/pango.h" +#include "gdk-pixbuf/gdk-pixbuf.h" +"#; + +fn main() { + let bindings = bindgen::Builder::default() + .header_contents("gtk_bindings.h", HEADER) + .clang_args(CFLAGS) + .clang_args(GTK_CFLAGS) + .allowlist_function("gtk_.*") + .allowlist_function( + "g_(application|main_context|memory_input_stream|object|signal|timeout)_.*", + ) + .allowlist_function("gdk_pixbuf_new_from_stream") + .allowlist_function("pango_attr_.*") + // The gtk/glib valist functions generate FFI-unsafe signatures on aarch64 which cause + // compile errors. We don't use them anyway. + .blocklist_function(".*_valist") + .derive_default(true) + .generate() + .expect("unable to generate gtk bindings"); + for flag in GTK_LIBS { + if let Some(lib) = flag.strip_prefix("-l") { + println!("cargo:rustc-link-lib={lib}"); + } else if let Some(path) = flag.strip_prefix("-L") { + println!("cargo:rustc-link-search={path}"); + } + } + let out_path = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap()); + bindings + .write_to_file(out_path.join("gtk_bindings.rs")) + .expect("failed to write gtk bindings"); +} diff --git a/toolkit/crashreporter/client/gtkbind/src/lib.rs b/toolkit/crashreporter/client/gtkbind/src/lib.rs new file mode 100644 index 0000000000..714f3ed047 --- /dev/null +++ b/toolkit/crashreporter/client/gtkbind/src/lib.rs @@ -0,0 +1,9 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] + +include!(concat!(env!("OUT_DIR"), "/gtk_bindings.rs")); |