diff mbox series

[meta-oe,v2] cabextract: add utility to extract Microsft cabinet files

Message ID 20240612075214.2234052-1-dmitry.baryshkov@linaro.org
State Accepted
Headers show
Series [meta-oe,v2] cabextract: add utility to extract Microsft cabinet files | expand

Commit Message

Dmitry Baryshkov June 12, 2024, 7:52 a.m. UTC
WoA firmware, fonts and some other useful files are being distributed as
a Microsoft cabinet files. Add recipes for the cabextract utility, which
is used to extract such files.

Cabextract can either use a bundled source tree for libmspack library or
an externally provided library. Package the library separately in order
to be able to share it with the meta-security layer.

Cc: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---

Changes since v1:
- Added fnmatch.c patch to fix rpl_fnmatch-related build issues.

---
 .../cabextract/cabextract/fix-fnmatch.patch   | 40 +++++++++++++++++++
 .../cabextract/cabextract_1.11.bb             | 22 ++++++++++
 .../cabextract/libmspack_0.11alpha.bb         | 16 ++++++++
 3 files changed, 78 insertions(+)
 create mode 100644 meta-oe/recipes-support/cabextract/cabextract/fix-fnmatch.patch
 create mode 100644 meta-oe/recipes-support/cabextract/cabextract_1.11.bb
 create mode 100644 meta-oe/recipes-support/cabextract/libmspack_0.11alpha.bb
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/cabextract/cabextract/fix-fnmatch.patch b/meta-oe/recipes-support/cabextract/cabextract/fix-fnmatch.patch
new file mode 100644
index 000000000000..bd486283b67d
--- /dev/null
+++ b/meta-oe/recipes-support/cabextract/cabextract/fix-fnmatch.patch
@@ -0,0 +1,40 @@ 
+From - Mon Jun 11 00:00:00 2024
+From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Subject: [PATCH] Don't play with fnmatch.c replacement
+
+Currently fnmatch.c, even if it is selected, conditionally disables compilation
+of fnmatch() funciton even though the rest of the code expects to get it (e.g.
+because Autoconf didn't detect the working implementation and enabled fnmatch.c
+to replace it). Drop the extra conditionals, to fix Autoconf magic.
+
+Observed error:
+
+ld: src/cabextract.o: in function `process_cabinet':
+/usr/src/debug/cabextract/1.11/src/cabextract.c:499:(.text.startup+0xf1c): undefined reference to `rpl_fnmatch'
+collect2: error: ld returned 1 exit status
+
+Upstream-Status: Submitted [https://github.com/kyz/libmspack/pull/51]
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+
+Index: cabextract-1.11/fnmatch.c
+===================================================================
+--- cabextract-1.11.orig/fnmatch.c
++++ cabextract-1.11/fnmatch.c
+@@ -49,11 +49,6 @@ static const char rcsid[] =
+    it is simpler to just do this in the source for each such file.
+ */
+ 
+-#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
+-
+-#if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS)
+-#endif
+-
+ /* Match STRING against the filename pattern PATTERN, returning zero if
+    it matches, nonzero if not.  */
+ int
+@@ -216,5 +211,3 @@ int         flags;
+ 
+         return FNM_NOMATCH;
+ }
+-
+-#endif /* _LIBC or not __GNU_LIBRARY__.  */
diff --git a/meta-oe/recipes-support/cabextract/cabextract_1.11.bb b/meta-oe/recipes-support/cabextract/cabextract_1.11.bb
new file mode 100644
index 000000000000..0f06489ca978
--- /dev/null
+++ b/meta-oe/recipes-support/cabextract/cabextract_1.11.bb
@@ -0,0 +1,22 @@ 
+SUMMARY = "Software for extracting Microsoft cabinet files"
+DESCRIPTION = "tool for extracting Microsoft cabinet files"
+HOMEPAGE = "http://www.cabextract.org.uk/"
+SECTION = "console/utils"
+
+LICENSE = "GPL-3.0-or-later"
+LIC_FILES_CHKSUM = "file://src/cabextract.c;beginline=4;endline=11;md5=b0a10c6d3843f262114e7ecf91fc7e78"
+
+SRC_URI = "\
+    https://www.cabextract.org.uk/cabextract-${PV}.tar.gz \
+    file://fix-fnmatch.patch \
+"
+
+SRC_URI[sha256sum] = "b5546db1155e4c718ff3d4b278573604f30dd64c3c5bfd4657cd089b823a3ac6"
+
+DEPENDS = "libmspack"
+
+EXTRA_OECONF = "--with-external-libmspack"
+
+inherit autotools pkgconfig
+
+BBCLASSEXTEND += "native nativesdk"
diff --git a/meta-oe/recipes-support/cabextract/libmspack_0.11alpha.bb b/meta-oe/recipes-support/cabextract/libmspack_0.11alpha.bb
new file mode 100644
index 000000000000..169a5f271be9
--- /dev/null
+++ b/meta-oe/recipes-support/cabextract/libmspack_0.11alpha.bb
@@ -0,0 +1,16 @@ 
+SUMMARY = "A library for Microsoft compression formats"
+DESCRIPTION = "The library provides compressors and decompressors,\
+archivers and dearchivers for Microsoft compression formats: CAB, CHM, WIM,\
+LIT, HLP, KWAJ and SZDD."
+HOMEPAGE = "http://www.cabextract.org.uk/libmspack/"
+SECTION = "lib"
+LICENSE = "LGPL-2.1-only"
+
+LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=7fbc338309ac38fefcd64b04bb903e34"
+
+SRC_URI = "https://www.cabextract.org.uk/libmspack/libmspack-${PV}.tar.gz"
+SRC_URI[sha256sum] = "70dd1fb2f0aecc36791b71a1e1840e62173079eadaa081192d1c323a0eeea21b"
+
+inherit autotools
+
+BBCLASSEXTEND += "native nativesdk"