Skip to contentSkip to conversation

package/pkg-cargo: add support to bundle a custom Cargo.lock file

PATCH Superseded Thomas Devoogdt 1 participant 3 messages Sep 25, 2025 Arm/Amlogic Meson SoC support

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 package/pkg-cargo: add support to bundle a custom Cargo.lock file

E.g. https://github.com/lu-zero/cargo-c/releases/tag/v0.10.15

Cargo-c releases a separate Cargo.lock file, but doesn't bundle one in its normal .tar.gz code source target.

We can't use extra downloads/patches/... as cargo is a vendored package, which is done quite early in the chain.

This patch allows us to define a custom Cargo.lock source. Both a local bundled file and remote (only wget) file can be linked.

Usage:

<PKG>_CARGO_LOCK_FILE = <PKG>_PKGDIR/Cargo.lock

<PKG>_CARGO_LOCK_FILE = https://.../Cargo.lock

---
Superseeds https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/.
v2: no change
v3: no change

---
 package/pkg-cargo.mk                |  5 +++++
 support/download/cargo-post-process | 14 +++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)
package/pkg-cargo.mk +5 -0
index 47a6353f25..626e5ea472 100644
@@ -195,6 +195,11 @@ ifneq ($$($(2)_SUBDIR),)
 $(2)_DOWNLOAD_POST_PROCESS_OPTS += -m$$($(2)_SUBDIR)/Cargo.toml
 endif
 
+# Allow to download a custom Cargo.lock file.
+ifneq ($$($(3)_CARGO_LOCK_FILE),)
+$(2)_DOWNLOAD_POST_PROCESS_OPTS += -l$$($(3)_CARGO_LOCK_FILE)
+endif
+
 # Because we append vendored info, we can't rely on the values being empty
 # once we eventually get into the generic-package infra. So, we duplicate
 # the heuristics here
support/download/cargo-post-process +13 -1
index b0e59ad74d..7913724fe2 100755
@@ -11,11 +11,12 @@ if [ "${BR_CARGO_MANIFEST_PATH}" ]; then
 fi
 
 manifest=Cargo.toml
-while getopts "n:o:m:" OPT; do
+while getopts "n:o:m:l:" OPT; do
     case "${OPT}" in
     o)  output="${OPTARG}";;
     n)  base_name="${OPTARG}";;
     m)  manifest="${OPTARG}";;
+    l)  lockfile="${OPTARG}";;
     :)  error "option '%s' expects a mandatory argument\n" "${OPTARG}";;
     \?) error "unknown option '%s'\n" "${OPTARG}";;
     esac
@@ -31,6 +32,17 @@ post_process_unpack "${base_name}" "${output}"
 # Do the Cargo vendoring
 pushd "${base_name}" > /dev/null
 
+# Copy the custom lockfile path if given
+# TODO: use --lockfile-path once stable
+if [ -n "${lockfile}" ] ; then
+    rm -f "${lockfile}"
+    if [ -f "${lockfile}" ] ; then
+        cp "${lockfile}" Cargo.lock
+    else
+        ${WGET} "${lockfile}" -O Cargo.lock
+    fi
+fi
+
 # Create the local .cargo/config.toml with vendor info
 mkdir -p .cargo/
 mkdir -p "${CARGO_HOME}"
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v3 2/3 package/cargo-c: add new package

From: Guillaume Chaye <[email protected]>

Cargo-c is a cargo applet to build and install C-ABI compatible dynamic and static libraries.

It will be required for librsvg.

---
Superseeds https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/.
v2: no change
v3: no change

---
 DEVELOPERS                   |  1 +
 package/cargo-c/cargo-c.hash |  3 +++
 package/cargo-c/cargo-c.mk   | 15 +++++++++++++++
 3 files changed, 19 insertions(+)
 create mode 100644 package/cargo-c/cargo-c.hash
 create mode 100644 package/cargo-c/cargo-c.mk
DEVELOPERS +1 -0
index fc561eb1ea..4f017cb03b 100644
@@ -1364,6 +1364,7 @@ F:	package/rpi-rgb-led-matrix/
 
 N:	Guillaume Chaye <[email protected]>
 F:	package/sane-airscan/
+F:	package/cargo-c/
 
 N:	Guillaume William Brs <[email protected]>
 F:	package/libnids/
package/cargo-c/cargo-c.hash new file +3 -0
new file mode 100644
index 0000000000..64353c5628
@@ -0,0 +1,3 @@
+# locally computed
+sha256  757034535d42b345cd7b47c9d5e3624073332437805634153a19259439491be2  cargo-c-0.10.15-cargo4.tar.gz
+sha256  d69f24ad84ec2ade64c0b68bdb31b41170e997b158370342056918329cc9af1e  LICENSE
package/cargo-c/cargo-c.mk new file +15 -0
new file mode 100644
index 0000000000..1f9e1f786b
@@ -0,0 +1,15 @@
+################################################################################
+#
+# cargo-c
+#
+################################################################################
+
+CARGO_C_VERSION = 0.10.15
+CARGO_C_SITE = $(call github,lu-zero,cargo-c,v$(CARGO_C_VERSION))
+CARGO_C_CARGO_LOCK_FILE = https://github.com/lu-zero/cargo-c/releases/download/v$(CARGO_C_VERSION)/Cargo.lock
+CARGO_C_LICENSE = MIT
+CARGO_C_LICENSE_FILES = LICENSE
+
+HOST_CARGO_C_DEPENDENCIES = host-libopenssl host-pkgconf
+
+$(eval $(host-cargo-package))
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

PATCH v3 3/3 package/librsvg: bump version to 2.61.1

In reply to Thomas Devoogdt

This is a major update, which replaces autotools with meson. The package uses cargo in the background, so copy the relevant environment from the cargo package to get things working.

Note that the download URL has been changed because cargo vendoring needs .tar.gz for it's post_process_unpack.

Announcement (for what it's worth):
- https://gitlab.gnome.org/GNOME/librsvg/-/releases/2.61.1

---
cat libgtk4.config
BR2_PACKAGE_MESA3D=y
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SOFTPIPE=y
BR2_PACKAGE_MESA3D_OPENGL_EGL=y
BR2_PACKAGE_LIBGTK4=y

./utils/test-pkg -p libgtk4 -c libgtk4.config -a

                             arm-aarch64 [ 1/35]: OK
                   bootlin-aarch64-glibc [ 2/35]: OK
               bootlin-arcle-hs38-uclibc [ 3/35]: SKIPPED
                    bootlin-armv5-uclibc [ 4/35]: SKIPPED
                     bootlin-armv7-glibc [ 5/35]: OK
                   bootlin-armv7m-uclibc [ 6/35]: SKIPPED
                      bootlin-armv7-musl [ 7/35]: OK
                bootlin-m68k-5208-uclibc [ 8/35]: SKIPPED
               bootlin-m68k-68040-uclibc [ 9/35]: SKIPPED
             bootlin-microblazeel-uclibc [10/35]: SKIPPED
                bootlin-mipsel32r6-glibc [11/35]: SKIPPED
                   bootlin-mipsel-uclibc [12/35]: SKIPPED
                 bootlin-openrisc-uclibc [13/35]: SKIPPED
        bootlin-powerpc64le-power8-glibc [14/35]: OK
           bootlin-powerpc-e500mc-uclibc [15/35]: SKIPPED
                   bootlin-riscv32-glibc [16/35]: SKIPPED
                   bootlin-riscv64-glibc [17/35]: SKIPPED
                    bootlin-riscv64-musl [18/35]: SKIPPED
                 bootlin-s390x-z13-glibc [19/35]: OK
                      bootlin-sh4-uclibc [20/35]: SKIPPED
                   bootlin-sparc64-glibc [21/35]: OK
                    bootlin-sparc-uclibc [22/35]: SKIPPED
                    bootlin-x86-64-glibc [23/35]: OK
                     bootlin-x86-64-musl [24/35]: OK
                   bootlin-x86-64-uclibc [25/35]: SKIPPED
                   bootlin-x86-i686-musl [26/35]: OK
                   bootlin-xtensa-uclibc [27/35]: SKIPPED
                            br-arm-basic [28/35]: SKIPPED
                    br-arm-full-nothread [29/35]: SKIPPED
                      br-arm-full-static [30/35]: SKIPPED
                   br-i386-pentium4-full [31/35]: SKIPPED
                      br-mips64-n64-full [32/35]: SKIPPED
                 br-mips64r6-el-hf-glibc [33/35]: SKIPPED
               br-powerpc-603e-basic-cpp [34/35]: SKIPPED
               br-powerpc64-power7-glibc [35/35]: OK

35 builds, 24 skipped, 0 build failed, 0 legal-info failed, 0 show-info failed

v2:
- added cargo vendoring for the DL phase
- disabled rsvg-convert by default to fix some compile errors v3:
- Ensure that -cargo4 is part of the dl file.

---
 ...o_wrapper-fixup-the-usage-of-cargo_c.patch | 57 +++++++++++++++++
 ...r-Makefile.am-set-GDK_PIXBUF_MODULED.patch | 41 -------------
 ...ake-building-rsvg-convert-selectable.patch | 59 ++++++++++++++++++
 package/librsvg/librsvg.hash                  |  4 +-
 package/librsvg/librsvg.mk                    | 61 +++++++++++++------
 5 files changed, 160 insertions(+), 62 deletions(-)
 create mode 100644 package/librsvg/0001-cargo_wrapper-fixup-the-usage-of-cargo_c.patch
 delete mode 100644 package/librsvg/0001-gdk-pixbuf-loader-Makefile.am-set-GDK_PIXBUF_MODULED.patch
 create mode 100644 package/librsvg/0002-meson-make-building-rsvg-convert-selectable.patch
package/librsvg/0001-cargo_wrapper-fixup-the-usage-of-cargo_c.patch new file +57 -0
new file mode 100644
index 0000000000..b9410f2ad7
@@ -0,0 +1,57 @@
+From 487eabde9ddac7571cbfdbccb33fd911ad4b17da Mon Sep 17 00:00:00 2001
+From: Thomas Devoogdt <[email protected]>
+Date: Sat, 20 Sep 2025 18:36:19 +0200
+Subject: [PATCH] cargo_wrapper: fixup the usage of cargo_c
+
+The wrong bin file was used, so add a second --cargo-c arg,
+which point to the right bin.
+
+Upstream: https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/1136
+Signed-off-by: Thomas Devoogdt <[email protected]>
+---
+ meson.build            | 1 +
+ meson/cargo_wrapper.py | 9 ++++++++-
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index ed8989939..3e7387348 100644
+--- a/meson.build
++++ b/meson.build
+@@ -466,6 +466,7 @@ endif
+ 
+ cargo_wrapper_args = [
+   '--cargo', cargo.full_path(),
++  '--cargo-c', cargo_c.full_path(),
+   '--manifest-path', cargo_toml,
+   '--project-build-root', meson.project_build_root(),
+   '--prefix', get_option('prefix'),
+diff --git a/meson/cargo_wrapper.py b/meson/cargo_wrapper.py
+index 5f1761cd2..54293154a 100755
+--- a/meson/cargo_wrapper.py
++++ b/meson/cargo_wrapper.py
+@@ -20,6 +20,10 @@ parser.add_argument(
+     "--cargo", required=True, type=Path, help="Path to the cargo executable"
+ )
+ 
++parser.add_argument(
++    "--cargo-c", required=True, type=Path, help="Path to the cargo-c executable"
++)
++
+ parser.add_argument(
+     "--manifest-path", required=True, type=Path, help="Path to Cargo.toml"
+ )
+@@ -136,7 +140,10 @@ cargo_prefixes = [
+     (Path(args.prefix) / args.libdir).as_posix(),
+ ]
+ 
+-cargo_cmd = [Path(args.cargo).as_posix()]
++if args.command == "cbuild":
++    cargo_cmd = [Path(args.cargo_c).as_posix()]
++else:
++    cargo_cmd = [Path(args.cargo).as_posix()]
+ 
+ if args.toolchain_version is not None:
+     if args.build_triplet is not None:
+-- 
+2.43.0
+
package/librsvg/0001-gdk-pixbuf-loader-Makefile.am-set-GDK_PIXBUF_MODULED.patch deleted +0 -41

41 lines not on this page · raw message

package/librsvg/0002-meson-make-building-rsvg-convert-selectable.patch new file +59 -0

59 lines not on this page · raw message

package/librsvg/librsvg.hash +1 -3
index 4eab8cdfba..c033682314 100644
@@ -1,5 +1,3 @@
-# From https://download.gnome.org/sources/librsvg/2.50/librsvg-2.50.9.sha256sum
-sha256  518905fffa879b6c7f3db1aae961cf31333e0eadc7b4cdd4f531707868c54b53  librsvg-2.50.9.tar.xz
-
 # Locally computed
+sha256  902edb88757cdb33bb2c660527768733a57487a8b6ed597ea492055f25345b13  librsvg-2.61.1-cargo4.tar.gz
 sha256  dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551  COPYING.LIB
package/librsvg/librsvg.mk +43 -18

74 lines not on this page · raw message

Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot