Skip to content

Instantly share code, notes, and snippets.

@Artoria2e5
Last active September 5, 2023 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Artoria2e5/458f3dfcf5aa68272648c1dc21c039ae to your computer and use it in GitHub Desktop.
Save Artoria2e5/458f3dfcf5aa68272648c1dc21c039ae to your computer and use it in GitHub Desktop.
can we backport librsvg to buster?

Environment

I took a WSL1 environment containing Bullseye and performed a downgrade to Buster per https://wiki.debian.org/SystemDowngrade. Apt isn't complaining at all, so it's probably a good enough buster.

Dependencies

apt install librsvg2-dev build-essential fakeroot devscripts
apt build-dep librsvg2-dev

Getting a new rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
which rustc

Just say yes to everything. And check that rustc gives the right one.

Getting librsvg

mkdir ~/build
cd ~/build
wget https://download.gnome.org/sources/librsvg/2.56/librsvg-2.56.0.tar.xz
tar xf librsvg-2.56.0.tar.xz
cd librsvg-2.56.0

Do the crime

wget https://gist.github.com/Artoria2e5/458f3dfcf5aa68272648c1dc21c039ae/raw/b47d6cba34e0fe6f29acaff80c17813afcde943f/crime.patch
patch -Np1 < ../crime.patch
autoreconf -fi

Work as usual

./configure --disable-gtk-doc --disable-pixbuf-loader --disable-shared --disable-static
make

Just get the rsvg-convert binary out of there. It has no dependency inside the build directory.

diff -x '*win32*' -x '*.in' -x '*.m4' -x '*~' -x configure -Naur librsvg-2.56.0/Cargo.toml librsvg-2.56.0-backport/Cargo.toml
--- librsvg-2.56.0/Cargo.toml 2023-03-18 04:14:02.000000000 +0800
+++ librsvg-2.56.0-backport/Cargo.toml 2023-05-21 16:05:00.470578271 +0800
@@ -22,11 +22,11 @@
gdk-pixbuf = { name = "gdk-pixbuf-2.0", version = "2.20" }
gio = { name = "gio-2.0", version = "2.24" }
glib = { name = "glib-2.0", version = "2.50" }
-pangocairo = "1.46"
+pangocairo = "1.42"
[package.metadata.system-deps.'cfg(windows)']
fontconfig = { version = "1.7", optional = true }
-pangoft2 = { version = "1.46", optional = true }
+pangoft2 = { version = "1.42", optional = true }
harfbuzz = { version = "2.0", optional = true }
freetype2 = { version = "20.0.14", optional = true }
cairo = { version = "1.16", optional = true }
@@ -36,7 +36,7 @@
[package.metadata.system-deps.'cfg(not(windows))']
fontconfig = { version = "1.7" }
-pangoft2 = { version = "1.46" }
+pangoft2 = { version = "1.42" }
cairo = "1.16"
cairo-gobject = "1.16"
cairo-png = "1.16"
@@ -73,7 +73,7 @@
nalgebra = "0.32.1"
num-traits = "0.2"
once_cell = "1.2.0"
-pango = { version = "0.17", features = ["v1_46"] }
+pango = { version = "0.17", features = ["v1_42"] }
pangocairo = "0.17"
rayon = "1"
rctree = "0.5.0"
diff -x '*win32*' -x '*.in' -x '*.m4' -x '*~' -x configure -Naur librsvg-2.56.0/configure.ac librsvg-2.56.0-backport/configure.ac
--- librsvg-2.56.0/configure.ac 2023-03-18 04:14:02.000000000 +0800
+++ librsvg-2.56.0-backport/configure.ac 2023-05-21 15:11:49.620783210 +0800
@@ -66,7 +66,7 @@
GLIB_REQUIRED=2.50.0
HARFBUZZ_REQUIRED=2.0.0
LIBXML_REQUIRED=2.9.0
-PANGO_REQUIRED=1.46.0
+PANGO_REQUIRED=1.42.0
dnl ===========================================================================
diff -x '*win32*' -x '*.in' -x '*.m4' -x '*~' -x configure -Naur librsvg-2.56.0/_rsvg_dummy.c librsvg-2.56.0-backport/_rsvg_dummy.c
--- librsvg-2.56.0/_rsvg_dummy.c 2023-03-18 04:14:30.000000000 +0800
+++ librsvg-2.56.0-backport/_rsvg_dummy.c 1970-01-01 08:00:00.000000000 +0800
@@ -1 +0,0 @@
-static int __attribute__((unused)) __rsvg_dummy;
diff -x '*win32*' -x '*.in' -x '*.m4' -x '*~' -x configure -Naur librsvg-2.56.0/src/drawing_ctx.rs librsvg-2.56.0-backport/src/drawing_ctx.rs
--- librsvg-2.56.0/src/drawing_ctx.rs 2023-03-18 04:14:02.000000000 +0800
+++ librsvg-2.56.0-backport/src/drawing_ctx.rs 2023-05-21 16:25:10.500497831 +0800
@@ -1861,8 +1861,6 @@
let font_map = pangocairo::FontMap::default();
let context = font_map.create_context();
- context.set_round_glyph_positions(false);
-
let pango_matrix = PangoMatrix {
xx: transform.xx,
xy: transform.xy,
diff -x '*win32*' -x '*.in' -x '*.m4' -x '*~' -x configure -Naur librsvg-2.56.0/src/text.rs librsvg-2.56.0-backport/src/text.rs
--- librsvg-2.56.0/src/text.rs 2023-03-18 04:14:02.000000000 +0800
+++ librsvg-2.56.0-backport/src/text.rs 2023-05-21 16:05:55.870574630 +0800
@@ -1294,7 +1294,7 @@
attributes.push(pango::AttrInt::new_letter_spacing(letter_spacing.0).upcast());
if props.text_decoration.overline {
- attributes.push(pango::AttrInt::new_overline(pango::Overline::Single).upcast());
+ // attributes.push(pango::AttrInt::new_overline(pango::Overline::Single).upcast());
}
if props.text_decoration.underline {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment