diff --git a/changelog b/changelog
index 9647702eb..a4aed4bc8 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,15 @@
+libreoffice (4:26.2.0~alpha0~git20250629-1) UNRELEASED; urgency=medium
+
+  * New upstream snapshot
+
+  * debian/patches/system-crates.diff: don't rely on upstream-fetched
+    rust crates
+  
+  * debian/rules:
+    - add conditionals for rust and to build yffi. Don't enable yet.
+
+ -- Rene Engelhard <rene@debian.org>  Mon, 09 Jun 2025 13:47:13 +0200
+
 libreoffice (4:25.8.0~rc1~git20250622-1) UNRELEASED; urgency=medium
 
   * New upstream snapshot
diff --git a/control b/control
index 838d63f79..a65ddcf9b 100644
--- a/control
+++ b/control
@@ -455,6 +457,8 @@ Description: office productivity suite -- Indic language packages
 
 Package: libreoffice-core
 Architecture: alpha amd64 arm64 armel armhf hppa i386 ia64 kfreebsd-amd64 kfreebsd-i386 loong64 m68k mips mipsel mips64 mips64el powerpc powerpcspe ppc64 ppc64el riscv64 s390x sparc sparc64
+Built-Using: ${cargo:Built-Using}
+Static-Built-Using: ${cargo:Static-Built-Using}
 Depends: fontconfig,
          fonts-opensymbol (>= 2:102.12),
          libreoffice-common (>> ${base-version}),
@@ -509,6 +513,8 @@ Description: office productivity suite -- arch-dependent files
 
 Package: libreoffice-core-nogui
 Architecture: amd64 arm64 armhf i386 ppc64 ppc64el s390x
+Built-Using: ${cargo:Built-Using}
+Static-Built-Using: ${cargo:Static-Built-Using}
 Depends: fontconfig,
          fonts-opensymbol (>= 2:102.12),
          libreoffice-common (>> ${base-version}),
diff --git a/control.in b/control.in
index eb9694cda..4e01297c0 100644
--- a/control.in
+++ b/control.in
@@ -210,6 +210,8 @@ Description: office productivity suite -- Indic language packages
 
 Package: libreoffice-core
 Architecture: %OOO_ARCHS%
+Built-Using: ${cargo:Built-Using}
+Static-Built-Using: ${cargo:Static-Built-Using}
 Depends: fontconfig,
          fonts-opensymbol (>= 2:102.12),
          libreoffice-common (>> ${base-version}),
@@ -258,6 +260,8 @@ Description: office productivity suite -- arch-dependent files
 
 Package: libreoffice-core-nogui
 Architecture: %OOO_NOGUI_ARCHS%
+Built-Using: ${cargo:Built-Using}
+Static-Built-Using: ${cargo:Static-Built-Using}
 Depends: fontconfig,
          fonts-opensymbol (>= 2:102.12),
          libreoffice-common (>> ${base-version}),
diff --git a/patches/cargo-verbose.diff b/patches/cargo-verbose.diff
new file mode 100644
index 000000000..74c12cf5c
--- /dev/null
+++ b/patches/cargo-verbose.diff
@@ -0,0 +1,26 @@
+diff --git a/Makefile.fetch b/Makefile.fetch
+index 239fcc01753f..77857381b14f 100644
+--- a/Makefile.fetch
++++ b/Makefile.fetch
+@@ -253,7 +253,7 @@
+ 	,$(call fetch_Download_item,https://dev-www.libreoffice.org/extern,$(item)))
+ 	-@mkdir -p $(TARFILE_LOCATION)/cargo
+ 	$(if $(call fetch_Optional,YRS,1),\
+-		CARGO_HOME=$(TARFILE_LOCATION)/cargo cargo fetch --locked --manifest-path $(SRCDIR)/external/y-crdt/Cargo.toml)
++		CARGO_HOME=$(TARFILE_LOCATION)/cargo cargo fetch $(if $(verbose),--verbose,) --locked --manifest-path $(SRCDIR)/external/y-crdt/Cargo.toml)
+ 	@mkdir -p $(dir $@) && touch $@
+ 	@mkdir -p $(dir $@)/Executable
+ 
+diff --git a/external/y-crdt/ExternalProject_y-crdt.mk b/external/y-crdt/ExternalProject_y-crdt.mk
+index dce34d6a133e..14d4d170f61f 100644
+--- a/external/y-crdt/ExternalProject_y-crdt.mk
++++ b/external/y-crdt/ExternalProject_y-crdt.mk
+@@ -16,7 +16,7 @@ $(eval $(call gb_ExternalProject_register_targets,y-crdt,\
+ $(call gb_ExternalProject_get_state_target,y-crdt,build):
+ 	$(call gb_Trace_StartRange,y-crdt,EXTERNAL)
+ 	$(call gb_ExternalProject_run,build,\
+-		CARGO_HOME=$(TARFILE_LOCATION)/cargo cargo build --offline --locked -p yffi \
++		CARGO_HOME=$(TARFILE_LOCATION)/cargo cargo build $(if $(verbose),--verbose,) --offline --locked -p yffi \
+ 	)
+ 	$(call gb_Trace_EndRange,y-crdt,EXTERNAL)
+ 
diff --git a/patches/series b/patches/series
index ee0436b2f..15d9080c8 100644
--- a/patches/series
+++ b/patches/series
@@ -52,4 +52,5 @@ disable-uitest-xmlsecurity-gpg.diff
 system-colamd.diff
 apparmor-allow-local-override.diff
 apparmor-thunderbird.diff
-fix-tests.diff
+cargo-verbose.diff
+system-crates.diff
diff --git a/patches/system-crates.diff b/patches/system-crates.diff
new file mode 100644
index 000000000..1e1c08c49
--- /dev/null
+++ b/patches/system-crates.diff
@@ -0,0 +1,94 @@
+diff --git a/configure.ac b/configure.ac
+index a5ee782a9e9f..bb2a8c035f8e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -2880,12 +2890,30 @@ AC_ARG_WITH(yrs,
+     if test "x$withval" != "xno"; then
+         AC_PATH_PROG([CARGO], [cargo])
+         if test -z "${CARGO}"; then
+-            AC_MSG_ERROR([install cargo to build yrs])
++            AC_MSG_ERROR([install cargo])
+         fi
+-        BUILD_TYPE="${BUILD_TYPE} YRS"
+         AC_DEFINE(ENABLE_YRS)
++    	if test "$with_system_yrs" = "yes"; then
++	    SYSTEM_YRS=TRUE
++	else
++            BUILD_TYPE="${BUILD_TYPE} YRS"
++	fi
+     fi])
+ AC_SUBST(WITH_YRS)
++AC_SUBST(SYSTEM_YRS)
++
++# call it yrs even though the crate is built is yffi. But it's clearer
++# that way that it belongs to the above --with-yrs
++AC_ARG_WITH(system-yrs,
++    AS_HELP_STRING([--with-system-yrs],
++        [Use yrs/yffi crates already on system]),,
++    [with_system_yrs="$with_system_crates"])
++
++AC_ARG_WITH(system-crates,
++    AS_HELP_STRING([--without-system-crates],
++        [When building with --with-system-libs, also the needed crates are expected
++         on the system. Use this to disable that]),,
++    [with_system_crates="$with_system_libs"])
+ 
+ AC_ARG_WITH(perl-home,
+     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
+diff --git a/config_host.mk.in b/config_host.mk.in
+index 9b7a7a747e2d..4e1fc5d128cc 100644
+--- a/config_host.mk.in
++++ b/config_host.mk.in
+@@ -732,6 +741,7 @@ SYSTEM_WPD=@SYSTEM_WPD@
+ SYSTEM_WPG=@SYSTEM_WPG@
+ SYSTEM_WPS=@SYSTEM_WPS@
+ SYSTEM_XMLSEC=@SYSTEM_XMLSEC@
++SYSTEM_YRS=@SYSTEM_YRS@
+ SYSTEM_ZLIB=@SYSTEM_ZLIB@
+ SYSTEM_ZSTD=@SYSTEM_ZSTD@
+ SYSTEM_ZMF=@SYSTEM_ZMF@
+diff --git a/Makefile.fetch b/Makefile.fetch
+index 239fcc01753f..1175e65cee70 100644
+--- a/Makefile.fetch
++++ b/Makefile.fetch
+@@ -252,8 +252,10 @@ $(WORKDIR)/download: $(BUILDDIR)/config_$(gb_Side).mk $(SRCDIR)/download.lst $(S
+ 		$(call fetch_Optional,OFFICEOTRON,OFFICEOTRON_JAR) \
+ 	,$(call fetch_Download_item,https://dev-www.libreoffice.org/extern,$(item)))
+ 	-@mkdir -p $(TARFILE_LOCATION)/cargo
++	$(if $(filter TRUE,$(SYSTEM_YRS)), \
+ 	$(if $(call fetch_Optional,YRS,1),\
+-		CARGO_HOME=$(TARFILE_LOCATION)/cargo cargo fetch $(if $(verbose),--verbose,) --locked --manifest-path $(SRCDIR)/external/y-crdt/Cargo.toml)
++		CARGO_HOME=$(TARFILE_LOCATION)/cargo cargo fetch $(if $(verbose),--verbose,) --locked --manifest-path $(SRCDIR)/external/y-crdt/Cargo.toml) \
++	)
+ 	@mkdir -p $(dir $@) && touch $@
+ 	@mkdir -p $(dir $@)/Executable
+ 
+diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
+index dce2138d1df2..a45fbea93f4a 100644
+--- a/RepositoryExternal.mk
++++ b/RepositoryExternal.mk
+@@ -4465,6 +4466,7 @@ endif
+ 
+ ifneq ($(WITH_YRS),)
+ 
++ifeq ($(SYSTEM_YRS),)
+ define gb_LinkTarget__use_yrs
+ $(call gb_LinkTarget_use_external_project,$(1),y-crdt)
+ $(call gb_LinkTarget_set_include,$(1),\
+@@ -4476,6 +4478,16 @@ endef
+ 
+ else
+ 
++define gb_LinkTarget__use_yrs
++$(call gb_LinkTarget_set_include,$(1),\
++	$$(INCLUDE) \
++)
++$(call gb_LinkTarget_add_libs,$(1),$(SRC_ROOT)/debian/cargo_registry/yffi/target/$(DEB_HOST_RUST_TYPE)/$(CARGO_CHANNEL)/libyrs.a)
++endef
++endif
++
++else
++
+ gb_LinkTarget__use_yrs :=
+ 
+ endif
diff --git a/rules b/rules
index ef645b460..b13775c79 100755
--- a/rules
+++ b/rules
@@ -243,6 +243,18 @@ endif
 endif
 SYSTEM_STUFF += xmlsec
 SYSTEM_STUFF += zxcvbn
+SYSTEM_STUFF += md4c
+ifeq (,$(filter $(DEB_HOST_ARCH),$(OOO_RUST_ARCHS)))
+  ENABLE_RUST=y
+  ifeq "$(ENABLE_RUST)" "y"
+    ENABLE_YRS=y
+  ifeq ($(filter upstream-cargo,$(DEB_BUILD_PROFILES)),)
+    SYSTEM_STUFF += yrs
+  endif
+  # FIXME: if not using yffi from the system yet maybe it might make sense to use that one internally
+  # and use the other libs from the system?
+  endif
+endif
 
 ifeq ($(filter noinsttest,$(DEB_BUILD_PROFILES)),)
  # this changes the packages built/contents of packages (-subsequentcheckbase)
@@ -601,6 +613,7 @@ endif
 
 ifneq (terse,$(findstring terse,$(DEB_BUILD_OPTIONS)))
 export verbose=t
+CARGO_FLAGS += --verbose
 endif
 
 #############
@@ -726,6 +739,10 @@ $(eval $(call gen_no_archs,OOO_JAVA_ARCHS))
 OOO_CLI_ARCHS := amd64 arm64
 $(eval $(call gen_no_archs,OOO_CLI_ARCHS))
 
+# Rust
+OOO_RUST_ARCHS := amd64 arm64 armel armhf i386 loong64 mips64el ppc64 ppc64el riscv64 s390x sparc64
+$(eval $(call gen_no_archs,OOO_RUST_ARCHS))
+
 OOO_ARCH_DEP_EXTENSIONS_ARCHS := $(OOO_ARCHS)
 OOO_EXTENSIONS_ARCHS := $(OOO_ARCH_DEP_EXTENSIONS_ARCHS)
 
@@ -810,6 +827,10 @@ ifeq "$(DEB_DISTRIBUTION)" "trixie-backports"
   BUGS=mailto:debian-backports@lists.debian.org
   SYSTEM_STUFF := $(filter-out mdds orcus,$(SYSTEM_STUFF))
   TRIXIE_BACKPORT=y
+  # dependencies not there and no sense to backport getrandom/fastrand changes *and*
+  # completely new rust packages. Internal is no senseful alternative here (320M
+  # cargo dir...)
+  ENABLE_YRS=n
 endif
 
 # for t64
@@ -1171,6 +1192,10 @@ export DPKG_EXPORT_BUILDFLAGS=y
 include /usr/share/dpkg/buildflags.mk
 ifeq (debug,$(findstring debug,$(DEB_BUILD_OPTIONS)))
 	CONFIGURE_FLAGS += --enable-debug
+	export CARGO_CHANNEL := debug
+else
+	export CARGO_CHANNEL := release
+	CARGO_FLAGS += --release
 endif
 ifeq (noopt,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
 	CONFIGURE_FLAGS += --disable-optimized
@@ -1587,6 +1616,27 @@ else
 	CONFIGURE_FLAGS+= --disable-cairo
 endif
 
+ifeq "$(ENABLE_RUST)" "y"
+	BUILD_DEPS += , rustc $(OOO_NO_RUST_ARCHS)
+	BUILD_DEPS += , dh-cargo $(OOO_NO_RUST_ARCHS)
+include /usr/share/rustc/architecture.mk
+export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE
+	BUILD_DEPS += , cargo $(OOO_NO_RUST_ARCHS)
+export PATH := /usr/share/cargo/bin:$(PATH)
+export CARGO=/usr/share/cargo/bin/cargo
+export CARGO_HOME=$(CURDIR)/debian/cargo_home
+export DEB_CARGO_CRATE=$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM)
+  ifeq "$(ENABLE_YRS)" "y"
+	CONFIGURE_FLAGS += --with-yrs
+    ifeq ($(filter upstream-cargo,$(DEB_BUILD_PROFILES)),)
+	# FIXME. Needs to be packaged. Which needs the +js feature enabled in fastrand
+	CONFIGURE_FLAGS += --with-system-yrs
+	BUILD_DEPS_ARCH += , cbindgen $(OOO_NO_RUST_ARCHS) <!upstream-cargo>
+	BUILD_DEPS_ARCH += , librust-yffi-dev $(OOO_NO_RUST_ARCHS) <!upstream-cargo>
+    endif
+  endif
+endif
+
 ifeq "$(ENABLE_KF5)" "y"
 	CONFIGURE_FLAGS += --enable-kf5
 	BUILD_DEPS_ARCH += , libkf5coreaddons-dev, libkf5i18n-dev, libkf5config-dev, libkf5windowsystem-dev, libkf5kio-dev
@@ -2059,6 +2109,10 @@ clean-debdir:
 
 	rm -rf $(CURDIR)/debian/locales
 
+ifeq "$(ENABLE_RUST)" "y"
+	rm -rf debian/cargo_registry
+endif
+
 	dh_clean
 
 clean:
@@ -2093,6 +2147,14 @@ endif
 		rm -f prism.js && \
 		rm -f prism.css
 
+ifeq "$(ENABLE_RUST)" "y"
+  ifeq "$(ENABLE_YRS)" "y"
+    ifneq (,$(filter yrs, $(SYSTEM_STUFF)))
+	rm -f $(CURDIR)/include/libyrs.h
+    endif
+  endif
+endif
+
 	# remove only if we linked it over. otherwise we remove the one
 	# intentionally added there if so
 	cd $(SOURCE_TREE)/tarballs && \
@@ -2445,6 +2507,25 @@ ifeq ($(filter pkg.libreoffice.opensymbolbuild,$(DEB_BUILD_PROFILES)),)
 			f543e6e2d7275557a839a164941c0a86e5f2c3f2a0042bfc434c88c6dde9e140-opens___.ttf
 endif
 
+ifeq "$(ENABLE_RUST)" "y"
+  ifeq ($(filter upstream-cargo,$(DEB_BUILD_PROFILES)),)
+# 20:26 < f_g> debcargo is only really for translating a single crate's Cargo.toml in debian/ . if all you want to do is call cargo to build Rust code in a 
+#             Debian context, than the cargo wrapper (/usr/share/cargo/bin/cargo) is probably what you want. it requires a bit of setup and then a call to its 
+#             prepare-debian in dh_auto_configure, after that all cargo invocations going through it should DTRT
+	$(CARGO) prepare-debian debian/cargo_registry --link-from-system
+    ifneq (,$(filter yrs, $(SYSTEM_STUFF)))
+	# Copy over since cargo wants to write inside there which it of course can't if it's in /usr/share
+	rm -rf debian/cargo_registry/yffi-*
+	cd debian/cargo_registry && \
+		cp -r /usr/share/cargo/registry/yffi-* .
+	# create version-agnostic dir so we don't need to update this (and system-crates.diff)
+	# if the version changes...
+	cd debian/cargo_registry && \
+		ln -s yffi-* yffi
+    endif
+  endif
+endif
+
 	touch $@
 
 .PHONY: config_host.mk
@@ -2464,6 +2545,18 @@ $(STAMP_DIR)/build-arch:
 #build-arch: ENABLE_HELP = n PACKAGE_SDK_DOCS = n ENABLE_MEDIAWIKI = n ENABLE_SCRIPT_PROVIDER_BSH = n ENABLE_SCRIPT_PROVIDER_JS = n
 	dh_testdir
 
+ifeq "$(ENABLE_RUST)" "y"
+  ifeq "$(ENABLE_YRS)" "y"
+    ifneq (,$(filter yrs, $(SYSTEM_STUFF)))
+	# build yffi (to be used by "standard" make) and generate needed header manually.
+	# Done upstream in external (and used directly from there) but we disable that via system-crates.diff,
+	# which now harcodes debian/cargo_registry/yffi instead :-) and relies on the standard include path
+	cd $(CURDIR)/debian/cargo_registry/yffi && $(CARGO) build $(CARGO_FLAGS) --offline -p yffi
+	cd $(CURDIR)/debian/cargo_registry/yffi && cbindgen -o $(CURDIR)/include/libyrs.h
+    endif
+  endif
+endif
+
 ifeq "$(BUILD_NOGUI_PACKAGES)" "y"
 	# build with --disable-gui first
 	PATH=$(BUILD_PATH) LD_LIBRARY_PATH=$(BUILD_LD_LIBRARY_PATH) \
@@ -4431,6 +4524,20 @@ endif
 		>> debian/libuno-sal3t64.substvars
 	echo "salhelper-private-abi:Provides=libreoffice-salhelper-private-abi (= $(shell grep UREPACKAGEVERSION $(SOURCE_TREE)/instsetoo_native/util/openoffice.lst | awk '{ print $$2 }' | cut -d. -f1-3))" \
 		>> debian/libuno-salhelpergcc3-3t64.substvars
+ifeq "$(ENABLE_RUST)" "y"
+	# Generate (Static-)Built-Using
+  ifeq "$(ENABLE_YRS)" "y"
+	# Symlink the build target dir to target/$(DEB_HOST_RUST_TYPE)/release
+	# since dh-cargo-built-using expects it there
+	mkdir -p $(CURDIR)/target/$(DEB_HOST_RUST_TYPE)/
+	ln -s $(CURDIR)/debian/cargo_registry/yffi/target/$(DEB_HOST_RUST_TYPE)/$(CARGO_CHANNEL) target/$(DEB_HOST_RUST_TYPE)/
+	/usr/share/cargo/bin/dh-cargo-built-using libreoffice-core
+    ifeq "$(BUILD_NOGUI_PACKAGES)" "y"
+	/usr/share/cargo/bin/dh-cargo-built-using libreoffice-core-nogui
+    endif
+	rm -rf $(CURDIR)/target
+  endif
+endif
 	dh_gencontrol -a $(DEBHELPER_OPTIONS) \
 		-- \
 		-V'base-version=$(BASE_VERSION)' \
