Skip to content
Snippets Groups Projects
Commit bfbd6f53 authored by Andreas Henriksson's avatar Andreas Henriksson
Browse files

Improve lzfse SOVERSION patch

Use the ABI version (1) instead of the full version (1.0)
of the library, as suggested by Timo Röhling in
https://lists.debian.org/debian-devel/2023/11/msg00025.html

Try both SOVERSIONed and unversioned names, which should make
it possible to upstream this patch:
https://github.com/AsahiLinux/asahi-installer/pull/235
parent 38e35161
No related branches found
No related tags found
No related merge requests found
From: Tobias Heider <me@tobhe.de>
Date: Wed, 1 Nov 2023 15:59:17 +0100
Subject: Use versioned library name for liblzfse
---
asahi_firmware/img4.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/asahi_firmware/img4.py b/asahi_firmware/img4.py
index a7bbfa4..efe67a2 100644
--- a/asahi_firmware/img4.py
+++ b/asahi_firmware/img4.py
@@ -6,7 +6,7 @@ from ctypes import *
__all__ = ["img4p_extract_compressed", "img4p_extract"]
def decode_lzfse_liblzfse(cdata, raw_size):
- lzfse = CDLL("liblzfse.so")
+ lzfse = CDLL("liblzfse.so.1.0")
dest = create_string_buffer(raw_size)
decoded = lzfse.lzfse_decode_buffer(dest, raw_size, cdata, len(cdata), None)
From 36c7be589d301252d2fca4cecb1554e0e30c9a35 Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <andreas@fatal.se>
Date: Sat, 4 Nov 2023 22:31:22 +0100
Subject: [PATCH] asahi_firmware.img4: Try lzfse SOVERSION 1 first
Upstream lzfse library has no SOVERSION set, but distributions
with library packaging guidelines wants them.
Fedora[1][2] is apparently already using SOVERSION 1 (and patching this
file using sed on package builds). Debian[3] is about to do the same.
Try first to load liblzfse.so.1 and if not found, fall back on the
unversioned soname as before. This should make everyone happy without
having to patch it everywhere.
[1]: https://src.fedoraproject.org/rpms/lzfse/blob/rawhide/f/60.patch
[2]: https://src.fedoraproject.org/rpms/asahi-installer/blob/fb68ade87292d3210fbe8845da829add6b1187c4/f/asahi-installer.spec#_54
[3]: https://salsa.debian.org/bananas-team/lzfse/-/blob/debian/unstable/debian/patches/0001-debian-set-library-SONAME.patch
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
---
asahi_firmware/img4.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/asahi_firmware/img4.py b/asahi_firmware/img4.py
index a7bbfa4..2e5dd44 100644
--- a/asahi_firmware/img4.py
+++ b/asahi_firmware/img4.py
@@ -6,7 +6,10 @@ from ctypes import *
__all__ = ["img4p_extract_compressed", "img4p_extract"]
def decode_lzfse_liblzfse(cdata, raw_size):
- lzfse = CDLL("liblzfse.so")
+ try:
+ lzfse = CDLL("liblzfse.so.1")
+ except OSError:
+ lzfse = CDLL("liblzfse.so")
dest = create_string_buffer(raw_size)
decoded = lzfse.lzfse_decode_buffer(dest, raw_size, cdata, len(cdata), None)
--
2.39.2
0001-Use-versioned-library-name-for-liblzfse.patch
0001-asahi_firmware.img4-Try-lzfse-SOVERSION-1-first.patch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment