LOCRDT y-crdt: bundle as external

Unfortunately it has 144 dependencies so hack Makefile.fetch to invoke
cargo fetch to get them all at once, based on the Cargo.lock file
extracted from the tarball; this all ends up in a "cargo" subdirectory
below $TARFILE_LOCATION.

Then $CARGO_HOME must be set consistently in the ExternalProject file
and cargo invoked with --offline to prevent downloading during the
build; altogether uses about 720 MB of storage here.

Change-Id: I6126fdd988f12bf9da48b6c2d9123d349eb7cb96
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186903
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
This commit is contained in:
Michael Stahl
2025-06-24 19:06:51 +02:00
parent 88055a2f43
commit b28efcf06f
20 changed files with 1567 additions and 5 deletions
+4
View File
@@ -241,6 +241,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_$(gb_Side).mk $(SRCDIR)/download.lst $(S
$(call fetch_Optional,WPG,WPG_TARBALL) \
$(call fetch_Optional,WPS,WPS_TARBALL) \
$(call fetch_Optional,XSLTML,XSLTML_TARBALL) \
$(call fetch_Optional,YRS,YRS_TARBALL) \
$(call fetch_Optional,ZLIB,ZLIB_TARBALL) \
$(call fetch_Optional,ZSTD,ZSTD_TARBALL) \
$(call fetch_Optional,ZMF,ZMF_TARBALL) \
@@ -250,6 +251,9 @@ $(WORKDIR)/download: $(BUILDDIR)/config_$(gb_Side).mk $(SRCDIR)/download.lst $(S
$(call fetch_Optional,ODFVALIDATOR,ODFVALIDATOR_JAR) \
$(call fetch_Optional,OFFICEOTRON,OFFICEOTRON_JAR) \
,$(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)
@mkdir -p $(dir $@) && touch $@
@mkdir -p $(dir $@)/Executable
+3 -2
View File
@@ -4466,11 +4466,12 @@ endif
ifneq ($(WITH_YRS),)
define gb_LinkTarget__use_yrs
$(call gb_LinkTarget_use_external_project,$(1),y-crdt)
$(call gb_LinkTarget_set_include,$(1),\
$$(INCLUDE) \
-I$(WITH_YRS)/tests-ffi/include \
-I$(gb_UnpackedTarball_workdir)/y-crdt/tests-ffi/include \
)
$(call gb_LinkTarget_add_libs,$(1),$(WITH_YRS)/target/debug/libyrs.a)
$(call gb_LinkTarget_add_libs,$(1),$(gb_UnpackedTarball_workdir)/y-crdt/target/debug/libyrs.a)
endef
else
+8 -3
View File
@@ -2874,12 +2874,17 @@ AC_ARG_WITH(hamcrest,
,with_hamcrest=yes)
AC_ARG_WITH(yrs,
AS_HELP_STRING([--with-yrs=<absolute path to yrs build>],
[Specifies the built yrs git repo for very experimental experiments.]),
AS_HELP_STRING([--with-yrs],
[Enables very experimental experiments.]),[
WITH_YRS=$withval
if test "x$withval" != "xno"; then
AC_PATH_PROG([CARGO], [cargo])
if test -z "${CARGO}"; then
AC_MSG_ERROR([install cargo to build yrs])
fi
BUILD_TYPE="${BUILD_TYPE} YRS"
AC_DEFINE(ENABLE_YRS)
fi)
fi])
AC_SUBST(WITH_YRS)
AC_ARG_WITH(perl-home,
+5
View File
@@ -686,6 +686,11 @@ XSLTML_TARBALL := a7983f859eafb2677d7ff386a023bc40-xsltml_2.1.2.zip
# three static lines
# so that git cherry-pick
# will not run into conflicts
YRS_SHA256SUM := 67c02f1b74fda33bcc824a310028c100ce2a84b6e63ade46ae1a3258e867a225
YRS_TARBALL := y-crdt-0.23.5.tar.gz
# three static lines
# so that git cherry-pick
# will not run into conflicts
ZLIB_SHA256SUM := 38ef96b8dfe510d42707d9c781877914792541133e1870841463bfa73f883e32
ZLIB_TARBALL := zlib-1.3.1.tar.xz
# three static lines
+1
View File
@@ -102,6 +102,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\
$(call gb_Helper_optional,WPG,libwpg) \
$(call gb_Helper_optional,WPS,libwps) \
$(call gb_Helper_optional,XSLTML,xsltml) \
$(call gb_Helper_optional,YRS,y-crdt) \
$(call gb_Helper_optional,ZLIB,zlib) \
$(call gb_Helper_optional,ZSTD,zstd) \
$(call gb_Helper_optional,ZMF,libzmf) \
Generated Vendored
+1326
View File
File diff suppressed because it is too large Load Diff
+7
View File
@@ -0,0 +1,7 @@
[workspace]
members = [
"yrs",
"ywasm",
"yffi"
]
+23
View File
@@ -0,0 +1,23 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
#
# This file is part of the LibreOffice project.
#
# 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 http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_ExternalProject_ExternalProject,y-crdt))
$(eval $(call gb_ExternalProject_register_targets,y-crdt,\
build \
))
$(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 \
)
$(call gb_Trace_EndRange,y-crdt,EXTERNAL)
# vim: set noet sw=4 ts=4:
+7
View File
@@ -0,0 +1,7 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
include $(module_directory)/../../solenv/gbuild/partial_build.mk
# vim: set noet sw=4 ts=4:
+17
View File
@@ -0,0 +1,17 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
#
# This file is part of the LibreOffice project.
#
# 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 http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_Module_Module,y-crdt))
$(eval $(call gb_Module_add_targets,y-crdt,\
UnpackedTarball_y-crdt \
ExternalProject_y-crdt \
))
# vim: set noet sw=4 ts=4:
+12
View File
@@ -0,0 +1,12 @@
y-crdt - Rust port of Yjs
[https://github.com/y-crdt/y-crdt/]
The yffi crate and its dependency yrs crate are used by LO code.
In order to download all the 144 (currently) dependencies with cargo, a bit
of scaffolding is required: not only the Cargo.lock file that actually lists
all the dependencies, but also all the Cargo.toml files from the tarball,
and empty dummy src/lib.rs files are all required so that cargo fetch stops
complaining and starts downloading.
+14
View File
@@ -0,0 +1,14 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
#
# This file is part of the LibreOffice project.
#
# 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 http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_UnpackedTarball_UnpackedTarball,y-crdt))
$(eval $(call gb_UnpackedTarball_set_tarball,y-crdt,$(YRS_TARBALL)))
# vim: set noet sw=4 ts=4:
+20
View File
@@ -0,0 +1,20 @@
[package]
name = "yffi"
version = "0.23.5"
authors = ["Kevin Jahns <kevin.jahns@protonmail.com>", "Bartosz Sypytkowski <b.sypytkowski@gmail.com>"]
keywords = ["crdt", "c-ffi", "yrs"]
edition = "2018"
license = "MIT"
description = "Bindings for the Yrs native C foreign function interface"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dev-dependencies]
[dependencies]
yrs = { path = "../yrs", version = "0.23.5", features = ["weak"] }
serde_json = { version = "1.0" }
[lib]
crate-type = ["staticlib", "cdylib"]
name = "yrs"
View File
+47
View File
@@ -0,0 +1,47 @@
[package]
name = "yrs"
version = "0.23.5"
description = "High performance implementation of the Yjs CRDT"
license = "MIT"
authors = ["Kevin Jahns <kevin.jahns@pm.me>", "Bartosz Sypytkowski <b.sypytkowski@gmail.com>"]
keywords = ["crdt", "yrs"]
edition = "2018"
homepage = "https://github.com/y-crdt/y-crdt/"
repository = "https://github.com/y-crdt/y-crdt/"
readme = "./README.md"
[features]
default = []
weak = []
sync = []
[dependencies]
thiserror = "2"
fastrand = { version = "2", features = ["js"] }
smallstr = { version = "0.3", features = ["union"] }
smallvec = { version = "1.13", features = ["union", "const_generics", "const_new"] }
async-lock = "3.4"
async-trait = "0.1"
arc-swap = "1.7"
serde = { version = "1.0", features = ["derive", "rc"] }
serde_json = "1.0"
dashmap = "6.0"
[dev-dependencies]
criterion = "0.5"
flate2 = { version = "1", features = ["zlib-ng-compat"], default-features = false }
ropey = "1.6.0"
proptest = "1.2"
proptest-derive = "0.4.0"
rand = "0.8.5"
assert_matches2 = "0.1"
uuid = "1.16.0"
[[bench]]
name = "benches"
harness = false
[lib]
doctest = true
bench = true
doc = true
View File
View File
+49
View File
@@ -0,0 +1,49 @@
[package]
name = "ywasm"
version = "0.23.5"
authors = ["Kevin Jahns <kevin.jahns@protonmail.com>", "Bartosz Sypytkowski <b.sypytkowski@gmail.com>"]
keywords = ["crdt", "wasm", "yrs"]
edition = "2018"
license = "MIT"
description = "High performance implementation of the Yjs CRDT"
homepage = "https://github.com/yjs/y-crdt/"
repository = "https://github.com/yjs/y-crdt/"
readme = "./README.md"
[lib]
crate-type = ["cdylib", "rlib"]
[features]
default = ["console_error_panic_hook"]
[dependencies]
yrs = { path = "../yrs", version = "0.23.5", features = ["weak"] }
wasm-bindgen = { version = "0.2" }
serde = { version = "1.0", features = ["derive", "rc"] }
serde_json = "1.0"
gloo-utils = { version = "0.2", features = ["serde"] }
base64_light = "0.1"
# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
# code size when deploying.
console_error_panic_hook = { version = "0.1.7", optional = true }
# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
# compared to the default allocator's ~10K. It is slower than the default
# allocator, however.
#
# Unfortunately, `wee_alloc` requires nightly Rust when targeting wasm for now.
wee_alloc = { version = "0.4.5", optional = true }
js-sys = "0.3"
[dev-dependencies]
wasm-bindgen-test = "0.3"
[profile.release]
# optimization over all codebase ( better optimization, slower build )
codegen-units = 1
opt-level = 3 # use "z" for size optimization, however it doesn't seem to have any effect
lto = true
panic = 'abort'
View File
+24
View File
@@ -2242,6 +2242,30 @@
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.</p>
</div>
<div class="YRS">
<h2>Y-CRDT</h2>
<p>The following software may be included in this product: Y-CRDT Library. Use of any of this software is
governed by the terms of the license below:</p>
<h3>The MIT License (MIT)</h3>
<p>Copyright (c) 2020</p>
<p>- Bartosz Sypytkowski (b.sypytkowski@gmail.com)</p>
<p>- Kevin Jahns (kevin.jahns@pm.me).</p>
<p>Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.</p>
</div>
<div class="ZLIB">
<h2>zlib</h2>
<p>The following software may be included in this product: zlib. Use of any of this software is governed by the