After some poking and hacking I have arrived to the settings that work.
Please refer to the commit for details.

Some of these issues may re-occur in other components; in that case
we need to come up with more generic solutions or upstream fixes.

So far, it's a learning exercise for everybody in getting to know the rust 
toolchain.

Signed-off-by: Alexander Kanavin <a...@linutronix.de>
---
 ...t-Bsymbolic-fixes-configure-on-macOS.patch | 35 -----------
 ...-rust-target-to-cargo-also-when-not-.patch | 47 +++++++++++++++
 .../0001-Remove-non-reproducible-SRCDIR.patch | 30 ----------
 ...lib.rs-do-not-probe-into-harcoded-li.patch | 53 ++++++++++++++++
 .../librsvg/librsvg/gtk-option.patch          | 60 -------------------
 .../{librsvg_2.40.21.bb => librsvg_2.52.0.bb} | 42 +++++++++----
 6 files changed, 130 insertions(+), 137 deletions(-)
 delete mode 100644 
meta/recipes-gnome/librsvg/librsvg/0001-Auto-detect-Bsymbolic-fixes-configure-on-macOS.patch
 create mode 100644 
meta/recipes-gnome/librsvg/librsvg/0001-Makefile.am-pass-rust-target-to-cargo-also-when-not-.patch
 delete mode 100644 
meta/recipes-gnome/librsvg/librsvg/0001-Remove-non-reproducible-SRCDIR.patch
 create mode 100644 
meta/recipes-gnome/librsvg/librsvg/0001-system-deps-src-lib.rs-do-not-probe-into-harcoded-li.patch
 delete mode 100644 meta/recipes-gnome/librsvg/librsvg/gtk-option.patch
 rename meta/recipes-gnome/librsvg/{librsvg_2.40.21.bb => librsvg_2.52.0.bb} 
(51%)

diff --git 
a/meta/recipes-gnome/librsvg/librsvg/0001-Auto-detect-Bsymbolic-fixes-configure-on-macOS.patch
 
b/meta/recipes-gnome/librsvg/librsvg/0001-Auto-detect-Bsymbolic-fixes-configure-on-macOS.patch
deleted file mode 100644
index 954bb60880c..00000000000
--- 
a/meta/recipes-gnome/librsvg/librsvg/0001-Auto-detect-Bsymbolic-fixes-configure-on-macOS.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From b99891e31eb6ce550e7e1cb2ca592095b3050a93 Mon Sep 17 00:00:00 2001
-From: Brion Vibber <br...@pobox.com>
-Date: Sun, 25 Feb 2018 18:42:36 -0800
-Subject: Auto-detect -Bsymbolic, fixes configure on macOS
-
-The -Bsymbolic linker option is ELF-specific, and was breaking
-configure on macOS unless --disable-Bsymbolic was explicitly passed.
-
-Switching the behavior from requiring -Bsymbolic to be available
-by default to just warning and continuing on without.
-
-Fixes https://gitlab.gnome.org/GNOME/librsvg/issues/211
-
-Upstream-Status: Backport
-Signed-off-by: Adrian Bunk <b...@stusta.de>
----
- configure.ac | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/configure.ac b/configure.ac
-index 15b26b2d..9f8dce29 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -216,7 +216,7 @@ AM_CONDITIONAL([ENABLE_PIXBUF_LOADER],[test 
"$enable_pixbuf_loader" = "yes"])
- AC_ARG_ENABLE([Bsymbolic],
-   [AS_HELP_STRING([--disable-Bsymbolic],
-                   [disable linking with -Bsymbolic])],
--  [],[enable_Bsymbolic=yes])
-+  [enable_Bsymbolic=no],[enable_Bsymbolic=auto])
- 
- BSYMBOLIC_LDFLAG=
- if test "$enable_Bsymbolic" != "no"; then
--- 
-2.20.1
-
diff --git 
a/meta/recipes-gnome/librsvg/librsvg/0001-Makefile.am-pass-rust-target-to-cargo-also-when-not-.patch
 
b/meta/recipes-gnome/librsvg/librsvg/0001-Makefile.am-pass-rust-target-to-cargo-also-when-not-.patch
new file mode 100644
index 00000000000..d7487c234cf
--- /dev/null
+++ 
b/meta/recipes-gnome/librsvg/librsvg/0001-Makefile.am-pass-rust-target-to-cargo-also-when-not-.patch
@@ -0,0 +1,47 @@
+From 95b2cd0169cb1b4694c2bce67169b1aa1d5e2be0 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <a...@linutronix.de>
+Date: Tue, 21 Sep 2021 16:27:14 +0200
+Subject: [PATCH] Makefile.am: pass rust target to cargo also when not cross
+ compiling
+
+Otherwise oe-core's native build doesn't work either.
+
+Upstream-Status: Inappropriate [oe-core specific]
+Signed-off-by: Alexander Kanavin <a...@linutronix.de>
+---
+ Makefile.am  | 2 --
+ configure.ac | 4 +---
+ 2 files changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index e93714e..effe5d3 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -137,9 +137,7 @@ else
+ CARGO_RELEASE_ARGS=--release
+ endif
+ 
+-if CROSS_COMPILING
+ CARGO_TARGET_ARGS=--target=$(RUST_TARGET)
+-endif
+ 
+ CARGO_VERBOSE = $(cargo_verbose_$(V))
+ cargo_verbose_ = $(cargo_verbose_$(AM_DEFAULT_VERBOSITY))
+diff --git a/configure.ac b/configure.ac
+index 41590ca..84cd56b 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -255,9 +255,7 @@ AC_ARG_VAR(RUST_TARGET, [Set rust target (default=$host)])
+ : ${RUST_TARGET:=$host}
+ 
+ AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes])
+-AS_IF([test "x$cross_compiling" = "xyes"], [
+-      RUST_TARGET_SUBDIR="$RUST_TARGET/$RUST_TARGET_SUBDIR"
+-])
++RUST_TARGET_SUBDIR="$RUST_TARGET/$RUST_TARGET_SUBDIR"
+ AC_SUBST([RUST_TARGET_SUBDIR])
+ 
+ dnl 
===========================================================================
+-- 
+2.20.1
+
diff --git 
a/meta/recipes-gnome/librsvg/librsvg/0001-Remove-non-reproducible-SRCDIR.patch 
b/meta/recipes-gnome/librsvg/librsvg/0001-Remove-non-reproducible-SRCDIR.patch
deleted file mode 100644
index 75fc7f9d0b9..00000000000
--- 
a/meta/recipes-gnome/librsvg/librsvg/0001-Remove-non-reproducible-SRCDIR.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From bea5156cd7e7122715b26c769c35928141a1da2c Mon Sep 17 00:00:00 2001
-From: Joshua Watt <jpewhac...@gmail.com>
-Date: Mon, 18 Nov 2019 14:46:34 -0600
-Subject: [PATCH] Remove non-reproducible SRCDIR
-
-Removes SRCDIR as the prefix for finding the test font. This wouldn't
-work anyway, since that path is not present on the target.
-
-This patch is specific to OE, since it appears that this entire method
-of testing was removed when upstream was re-written in rust
-
-Upstream-Status: Inappropriate [OE-specific, no longer present upstream]
-Signed-off-by: Joshua Watt <jpewhac...@gmail.com>
----
- rsvg-cairo-draw.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/rsvg-cairo-draw.c b/rsvg-cairo-draw.c
-index caa9104..cfb7ed2 100644
---- a/rsvg-cairo-draw.c
-+++ b/rsvg-cairo-draw.c
-@@ -398,7 +398,7 @@ set_font_options_for_testing (PangoContext *context)
- static void
- create_font_config_for_testing (RsvgCairoRender *render)
- {
--    const char *font_path = SRCDIR 
"/tests/resources/LiberationSans-Regular.ttf";
-+    const char *font_path = "/tests/resources/LiberationSans-Regular.ttf";
- 
-     if (render->font_config_for_testing != NULL)
-         return;
diff --git 
a/meta/recipes-gnome/librsvg/librsvg/0001-system-deps-src-lib.rs-do-not-probe-into-harcoded-li.patch
 
b/meta/recipes-gnome/librsvg/librsvg/0001-system-deps-src-lib.rs-do-not-probe-into-harcoded-li.patch
new file mode 100644
index 00000000000..849dd98c5f0
--- /dev/null
+++ 
b/meta/recipes-gnome/librsvg/librsvg/0001-system-deps-src-lib.rs-do-not-probe-into-harcoded-li.patch
@@ -0,0 +1,53 @@
+From 6d1f0740b111e86e99dcaf0222f3d1d67d3bf1e6 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <a...@linutronix.de>
+Date: Tue, 21 Sep 2021 16:54:23 +0200
+Subject: [PATCH] system-deps/src/lib.rs: do not probe into harcoded list of
+ targets
+
+Oe-core defines custom targets, and this probe fails.
+
+Upstream-Status: Inappropriate [oe-core specific]
+Signed-off-by: Alexander Kanavin <a...@linutronix.de>
+---
+ vendor/system-deps/.cargo-checksum.json |  2 +-
+ vendor/system-deps/src/lib.rs           | 16 +---------------
+ 2 files changed, 2 insertions(+), 16 deletions(-)
+
+diff --git a/vendor/system-deps/.cargo-checksum.json 
b/vendor/system-deps/.cargo-checksum.json
+index ecebb94..30d594e 100644
+--- a/vendor/system-deps/.cargo-checksum.json
++++ b/vendor/system-deps/.cargo-checksum.json
+@@ -1 +1 @@
+-{"files":{"Cargo.toml":"56ab5070dc9019b039c5e9904bb466b0879c33a7f69dd030b97abab321b7cc04","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"3fe7396637bf9233908f41c6001cfcb00a379225e06e36e508c8b3d7264a8aae","src/lib.rs":"015518f4337d80249d12c7e6c55e9063705a0b8805ebf46a445c89253edc5de0","src/metadata.rs":"4c8d6ac2c88646a5b97ecb50ed44b65e5b2865cce6897add85b29ca2ae08c2bb","src/test.rs":"1ec48d1e443a0a4ac8035a2b60ff0321543aa2fa998fee72cf7762a936bf5f8c","src/tests/testanotherlib.pc":"bb4fd942324e6d49ce3becd827aa5c948d1924ca6681904a3695c19b1424eb3c","src/tests/testdata.pc":"43f481e989c03674fed5ef78c6420b3f8d36a2ce001928d86c418d1844acd5e7","src/tests/testlib-2.0.pc":"152eb0c70c14c3d948118408f3d1fd3bb7531b02aa792db85bd957f7db90b45b","src/tests/testlib-3.0.pc":"cd39c2ef88f6828c9291150cc4b624e769abef484674eaebaa4f67979501315f","src/tests/testlib.pc":"75c0d8a5345f65794f583c83e1cf0dbf3385af6e6abea1d61bb86eef707a52db","src/tests/toml-missing-file/no-cargo-toml-here":"6ab4da4b56f15315df6538610cfcd2ba3d0f9a7a8414678ff00ab5a78f7d41fa"},"package":"480c269f870722b3b08d2f13053ce0c2ab722839f472863c3e2d61ff3a1c2fa6"}
+\ No newline at end of file
++{"files":{"Cargo.toml":"56ab5070dc9019b039c5e9904bb466b0879c33a7f69dd030b97abab321b7cc04","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"3fe7396637bf9233908f41c6001cfcb00a379225e06e36e508c8b3d7264a8aae","src/lib.rs":"594e5f14180590adc9ea0a8ba1cc35f9a8a260322d08de3037efac3ce1dc729b","src/metadata.rs":"4c8d6ac2c88646a5b97ecb50ed44b65e5b2865cce6897add85b29ca2ae08c2bb","src/test.rs":"1ec48d1e443a0a4ac8035a2b60ff0321543aa2fa998fee72cf7762a936bf5f8c","src/tests/testanotherlib.pc":"bb4fd942324e6d49ce3becd827aa5c948d1924ca6681904a3695c19b1424eb3c","src/tests/testdata.pc":"43f481e989c03674fed5ef78c6420b3f8d36a2ce001928d86c418d1844acd5e7","src/tests/testlib-2.0.pc":"152eb0c70c14c3d948118408f3d1fd3bb7531b02aa792db85bd957f7db90b45b","src/tests/testlib-3.0.pc":"cd39c2ef88f6828c9291150cc4b624e769abef484674eaebaa4f67979501315f","src/tests/testlib.pc":"75c0d8a5345f65794f583c83e1cf0dbf3385af6e6abea1d61bb86eef707a52db","src/tests/toml-missing-file/no-cargo-toml-here":"6ab4da4b56f15315df6538610cfcd2ba3d0f9a7a8414678ff00ab5a78f7d41fa"},"package":"480c269f870722b3b08d2f13053ce0c2ab722839f472863c3e2d61ff3a1c2fa6"}
+diff --git a/vendor/system-deps/src/lib.rs b/vendor/system-deps/src/lib.rs
+index a0d4f00..a666817 100644
+--- a/vendor/system-deps/src/lib.rs
++++ b/vendor/system-deps/src/lib.rs
+@@ -725,21 +725,7 @@ impl Config {
+     }
+ 
+     fn check_cfg(&self, cfg: &cfg_expr::Expression) -> Result<bool, Error> {
+-        use cfg_expr::{targets::get_builtin_target_by_triple, Predicate};
+-
+-        let target = self
+-            .env
+-            .get("TARGET")
+-            .expect("no TARGET env variable defined");
+-        let target = get_builtin_target_by_triple(&target)
+-            .unwrap_or_else(|| panic!("Invalid TARGET: {}", target));
+-
+-        let res = cfg.eval(|pred| match pred {
+-            Predicate::Target(tp) => Some(tp.matches(target)),
+-            _ => None,
+-        });
+-
+-        res.ok_or_else(|| Error::UnsupportedCfg(cfg.original().to_string()))
++        Ok(true)
+     }
+ }
+ 
+-- 
+2.20.1
+
diff --git a/meta/recipes-gnome/librsvg/librsvg/gtk-option.patch 
b/meta/recipes-gnome/librsvg/librsvg/gtk-option.patch
deleted file mode 100644
index 6c23071cd34..00000000000
--- a/meta/recipes-gnome/librsvg/librsvg/gtk-option.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From 4e0ce3f22d45033a108cbacca3e5ec6728bd44f3 Mon Sep 17 00:00:00 2001
-From: Jussi Kukkonen <jussi.kukko...@intel.com>
-Date: Tue, 11 Aug 2015 16:25:38 +0300
-Subject: [PATCH] configure: add option to enable/disable use of GTK+
-
-Distro packagers like predictability and automatically detected optional
-dependencies are not predicable.  Add a --with-gtk3 option (default to "auto")
-for forcibly controlling whether GTK+ will be used or not.
-
-Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=712693]
-
-Signed-off-by: Ross Burton <ross.bur...@intel.com>
-Signed-off-by: Jussi Kukkonen <jussi.kukko...@intel.com>
----
- configure.ac | 17 +++++++++++------
- 1 file changed, 11 insertions(+), 6 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index e61a952..c3aae84 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -130,17 +130,22 @@ AC_CHECK_FUNCS(strtok_r)
- # GTK
- # ===========================================================================
- 
--PKG_CHECK_MODULES([GTK3],[gtk+-3.0 >= 
$GTK3_REQUIRED],[have_gtk_3=yes],[have_gtk_3=no])
--
- GTK3_BINARY_VERSION=
- 
--if test "$have_gtk_3" = "yes"; then
--    GTK3_BINARY_VERSION="`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`"
-+AC_MSG_CHECKING([whether to use GTK+ 3])
-+AC_ARG_WITH([gtk3],
-+  [AS_HELP_STRING([--without-gtk3],[Don't build GTK+3 tools (default=auto)])],
-+  [],[PKG_CHECK_EXISTS([gtk+-3.0 >= 
$GTK3_REQUIRED],[with_gtk3=yes],[with_gtk3=no])])
-+AC_MSG_RESULT([$with_gtk3])
-+
-+if test "$with_gtk3" = "yes"; then
-+  PKG_CHECK_MODULES(GTK3, [gtk+-3.0 >= $GTK3_REQUIRED])
-+  GTK3_BINARY_VERSION="`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`"
- fi
- 
- AC_SUBST([GTK3_BINARY_VERSION])
- 
--AM_CONDITIONAL([HAVE_GTK_3],[test "$have_gtk_3" = "yes"])
-+AM_CONDITIONAL([HAVE_GTK_3],[test "$with_gtk3" = "yes"])
- 
- dnl 
===========================================================================
- dnl GDK-Pixbuf SVG loader
-@@ -298,6 +303,6 @@ librsvg-$VERSION
-       Build introspectable bindings:  ${found_introspection}
-       Build Vala bindings:            ${enable_vala}
-       Build GdkPixbuf loader:         ${enable_pixbuf_loader}
--        GTK+ $GTK3_REQUIRED or later:           ${have_gtk_3}
-+        GTK+ $GTK3_REQUIRED or later:           ${with_gtk_3}
-       Build miscellaneous tools:      ${build_misc_tools}
- "
--- 
-2.1.4
-
diff --git a/meta/recipes-gnome/librsvg/librsvg_2.40.21.bb 
b/meta/recipes-gnome/librsvg/librsvg_2.52.0.bb
similarity index 51%
rename from meta/recipes-gnome/librsvg/librsvg_2.40.21.bb
rename to meta/recipes-gnome/librsvg/librsvg_2.52.0.bb
index 39b9aeca5d7..4e3febc6a2f 100644
--- a/meta/recipes-gnome/librsvg/librsvg_2.40.21.bb
+++ b/meta/recipes-gnome/librsvg/librsvg_2.52.0.bb
@@ -6,24 +6,44 @@ the screen or to generate output for printing."
 HOMEPAGE = "https://gitlab.gnome.org/GNOME/librsvg";
 BUGTRACKER = "https://gitlab.gnome.org/GNOME/librsvg/issues";
 
-RECIPE_NO_UPDATE_REASON = "Versions from 2.41.0 requires Rust compiler to 
build it"
-
-LICENSE = "LGPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
-                    
file://rsvg.h;beginline=3;endline=24;md5=20b4113c4909bbf0d67e006778302bc6"
+LICENSE = "LGPLv2.1+"
+LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c \
+                   "
 
 SECTION = "x11/utils"
 DEPENDS = "cairo gdk-pixbuf glib-2.0 libcroco libxml2 pango"
 BBCLASSEXTEND = "native nativesdk"
 
-inherit gnomebase gtk-doc pixbufcache upstream-version-is-even 
gobject-introspection
+inherit gnomebase gtk-doc pixbufcache upstream-version-is-even 
gobject-introspection rust
 
-SRC_URI += "file://gtk-option.patch \
-            file://0001-Auto-detect-Bsymbolic-fixes-configure-on-macOS.patch \
-            file://0001-Remove-non-reproducible-SRCDIR.patch \
+SRC_URI += " 
file://0001-Makefile.am-pass-rust-target-to-cargo-also-when-not-.patch \
+             
file://0001-system-deps-src-lib.rs-do-not-probe-into-harcoded-li.patch \
 "
 
-SRC_URI[archive.sha256sum] = 
"f7628905f1cada84e87e2b14883ed57d8094dca3281d5bcb24ece4279e9a92ba"
+SRC_URI[archive.sha256sum] = 
"bd821fb3e16494b61f5185addd23b726b064f203122b3ab4b3d5d7a44e6bf393"
+
+# librsvg is still autotools-based, but is calling cargo from its 
automake-driven makefiles
+# so we cannot use cargo class directly, but still need bits and pieces from 
it 
+# for cargo to be happy
+BASEDEPENDS:append = " cargo-native"
+
+export RUST_BACKTRACE = "full"
+export RUSTFLAGS
+export RUST_TARGET_PATH
+
+export RUST_TARGET = "${HOST_SYS}"
+
+# rust-cross writes the target linker binary into target json definition 
without any flags.
+# This breaks here because the linker isn't going to work without at least 
knowing where
+# the sysroot is. So copy the json to workdir, and patch in the path to 
wrapper from rust class
+# which supplies the needed flags.
+do_compile:prepend() {
+    cp ${STAGING_LIBDIR_NATIVE}/rustlib/${HOST_SYS}.json ${WORKDIR}
+    cp ${STAGING_LIBDIR_NATIVE}/rustlib/${BUILD_SYS}.json ${WORKDIR}
+    sed -ie 's,"linker": ".*","linker": "${RUST_TARGET_CC}",g' 
${WORKDIR}/${HOST_SYS}.json
+    RUST_TARGET_PATH="${WORKDIR}"
+    export RUST_TARGET_PATH
+}
 
 # Issue only on windows
 CVE_CHECK_WHITELIST += "CVE-2018-1000041"
@@ -33,8 +53,6 @@ CACHED_CONFIGUREVARS = 
"ac_cv_path_GDK_PIXBUF_QUERYLOADERS=${STAGING_LIBDIR_NATI
 PACKAGECONFIG ??= "gdkpixbuf"
 # The gdk-pixbuf loader
 PACKAGECONFIG[gdkpixbuf] = 
"--enable-pixbuf-loader,--disable-pixbuf-loader,gdk-pixbuf-native"
-# GTK+ test application (rsvg-view)
-PACKAGECONFIG[gtk] = "--with-gtk3,--without-gtk3,gtk+3"
 
 do_install:append() {
        # Loadable modules don't need .a or .la on Linux
-- 
2.20.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#156796): 
https://lists.openembedded.org/g/openembedded-core/message/156796
Mute This Topic: https://lists.openembedded.org/mt/86220691/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to