summaryrefslogtreecommitdiffstats
path: root/meta-oe
diff options
context:
space:
mode:
authorPeter Marko <peter.marko@siemens.com>2025-04-07 18:16:25 +0200
committerKhem Raj <raj.khem@gmail.com>2025-04-07 12:21:23 -0700
commit3e7086cdde4aaadc10bc7275d0d46faf6d41a5fa (patch)
tree81307aa9dfb7ab87ab6b21c7ff3e00cd4c5bfc6b /meta-oe
parentc7001b404894d721c430ddd79d12f1dce4ae890e (diff)
downloadmeta-openembedded-3e7086cdde4aaadc10bc7275d0d46faf6d41a5fa.tar.gz
bit7z: add new recipe
bit7z is a cross-platform C++ static library that allows the compression/extraction of archive files through a clean and simple wrapper interface to the dynamic libraries from the 7-Zip project. It supports compression and extraction to and from the filesystem or the memory, reading archives metadata, updating existing ones, creating multi-volume archives, operation progress callbacks, and many other functionalities. Recipe comments: * 2 patches needed for successful build+ptest were submitted upstream * to upstream dependency inclusion patch we'd have to completely rework dependency handling and would be probably against their concepts Signed-off-by: Peter Marko <peter.marko@siemens.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe')
-rw-r--r--meta-oe/recipes-extended/7zip/bit7z/0001-Fix-int8_t-storage-in-BitPropVariant-on-Arm-architec.patch41
-rw-r--r--meta-oe/recipes-extended/7zip/bit7z/0001-Fix-reinterpret-cast-compiler-errors.patch52
-rw-r--r--meta-oe/recipes-extended/7zip/bit7z/0001-cmake-disable-dependency-inclusion.patch29
-rw-r--r--meta-oe/recipes-extended/7zip/bit7z_4.0.9.bb29
4 files changed, 151 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/7zip/bit7z/0001-Fix-int8_t-storage-in-BitPropVariant-on-Arm-architec.patch b/meta-oe/recipes-extended/7zip/bit7z/0001-Fix-int8_t-storage-in-BitPropVariant-on-Arm-architec.patch
new file mode 100644
index 0000000000..b1bf6923f2
--- /dev/null
+++ b/meta-oe/recipes-extended/7zip/bit7z/0001-Fix-int8_t-storage-in-BitPropVariant-on-Arm-architec.patch
@@ -0,0 +1,41 @@
1From d504abaf2b0a514193f52df42098bc16de4718b2 Mon Sep 17 00:00:00 2001
2From: Oz <rik20@live.it>
3Date: Fri, 17 Jan 2025 21:23:59 +0100
4Subject: [PATCH] Fix int8_t storage in BitPropVariant on Arm architectures
5
6Upstream-Status: Backport [https://github.com/rikyoz/bit7z/commit/d504abaf2b0a514193f52df42098bc16de4718b2]
7Signed-off-by: Peter Marko <peter.marko@siemens.com>
8---
9 include/bit7z/bitwindows.hpp | 4 ++++
10 src/bitpropvariant.cpp | 2 +-
11 2 files changed, 5 insertions(+), 1 deletion(-)
12
13diff --git a/include/bit7z/bitwindows.hpp b/include/bit7z/bitwindows.hpp
14index 5849b956..2f29a989 100644
15--- a/include/bit7z/bitwindows.hpp
16+++ b/include/bit7z/bitwindows.hpp
17@@ -126,7 +126,11 @@ struct PROPVARIANT {
18 WORD wReserved2;
19 WORD wReserved3;
20 union {
21+#if defined( __arm__ ) || defined( __aarch64__ )
22+ signed char cVal;
23+#else
24 char cVal;
25+#endif
26 unsigned char bVal;
27 short iVal;
28 unsigned short uiVal;
29diff --git a/src/bitpropvariant.cpp b/src/bitpropvariant.cpp
30index 1e7f094f..642e1268 100644
31--- a/src/bitpropvariant.cpp
32+++ b/src/bitpropvariant.cpp
33@@ -157,7 +157,7 @@ BitPropVariant::BitPropVariant( uint64_t value ) noexcept: PROPVARIANT() {
34 BitPropVariant::BitPropVariant( int8_t value ) noexcept: PROPVARIANT() {
35 vt = VT_I1;
36 wReserved1 = 0;
37- cVal = static_cast< char >( value );
38+ cVal = static_cast< decltype(cVal) >( value );
39 }
40
41 BitPropVariant::BitPropVariant( int16_t value ) noexcept: PROPVARIANT() {
diff --git a/meta-oe/recipes-extended/7zip/bit7z/0001-Fix-reinterpret-cast-compiler-errors.patch b/meta-oe/recipes-extended/7zip/bit7z/0001-Fix-reinterpret-cast-compiler-errors.patch
new file mode 100644
index 0000000000..08b64f4999
--- /dev/null
+++ b/meta-oe/recipes-extended/7zip/bit7z/0001-Fix-reinterpret-cast-compiler-errors.patch
@@ -0,0 +1,52 @@
1From bedeec4d57d29be7de91697277ace00ba87d3e75 Mon Sep 17 00:00:00 2001
2From: Peter Marko <peter.marko@siemens.com>
3Date: Tue, 1 Apr 2025 15:23:51 +0200
4Subject: [PATCH] Fix reinterpret-cast compiler errors
5
6Building on 32-bit arm, following warning/error occurs:
7
8src/internal/windows.cpp: In function 'bit7z::OLECHAR* AllocStringBuffer(LPCSTR, uint32_t)':
9src/internal/windows.cpp:79:6: error: cast from 'unsigned char*' to 'bstr_prefix_t*' {aka 'unsigned int*'} increases required alignment of target type [-Werror=cast-align]
10 79 | *reinterpret_cast< bstr_prefix_t* >( bstrBuffer ) = byteLength;
11 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12git/src/internal/windows.cpp:83:19: error: cast from 'unsigned char*' to 'bit7z::BSTR' {aka 'wchar_t*'} increases required alignment of target type [-Werror=cast-align]
13 83 | BSTR result = reinterpret_cast< BSTR >( bstrBuffer + sizeof( bstr_prefix_t ) );
14 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15cc1plus: all warnings being treated as errors
16
17Fix it by using the desired variable size right away and thus avoid
18casting to an array with different alignment.
19
20Upstream-Status: Backport [https://github.com/rikyoz/bit7z/commit/b2789ea9b0fbb2a74dbf6764ddb72d60659a3bce]
21Signed-off-by: Peter Marko <peter.marko@siemens.com>
22---
23 src/internal/windows.cpp | 7 +++----
24 1 file changed, 3 insertions(+), 4 deletions(-)
25
26diff --git a/src/internal/windows.cpp b/src/internal/windows.cpp
27index 9304aed7..7bee5959 100644
28--- a/src/internal/windows.cpp
29+++ b/src/internal/windows.cpp
30@@ -68,19 +68,18 @@ auto AllocStringBuffer( LPCSTR str, uint32_t byteLength ) -> BSTR {
31
32 // Allocating memory for storing the BSTR as a byte array.
33 // NOLINTNEXTLINE(cppcoreguidelines-no-malloc, cppcoreguidelines-owning-memory)
34- auto* bstrBuffer = static_cast< byte_t* >( std::calloc( bufferSize, sizeof( byte_t ) ) );
35+ auto* bstrBuffer = static_cast< bstr_prefix_t* >( std::calloc( bufferSize, sizeof( byte_t ) ) );
36
37 if ( bstrBuffer == nullptr ) { // Failed to allocate memory for the BSTR buffer.
38 return nullptr;
39 }
40
41 // Storing the number of bytes of the BSTR as a prefix of it.
42- // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
43- *reinterpret_cast< bstr_prefix_t* >( bstrBuffer ) = byteLength;
44+ *bstrBuffer = byteLength;
45
46 // The actual BSTR must point after the byteLength prefix.
47 // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic, cppcoreguidelines-pro-type-reinterpret-cast)
48- BSTR result = reinterpret_cast< BSTR >( bstrBuffer + sizeof( bstr_prefix_t ) );
49+ BSTR result = reinterpret_cast< BSTR >( bstrBuffer + 1 );
50 if ( str != nullptr ) {
51 // Copying byte-by-byte the input string to the BSTR.
52 // Note: flawfinder warns about not checking for buffer overflows; this is a false alarm,
diff --git a/meta-oe/recipes-extended/7zip/bit7z/0001-cmake-disable-dependency-inclusion.patch b/meta-oe/recipes-extended/7zip/bit7z/0001-cmake-disable-dependency-inclusion.patch
new file mode 100644
index 0000000000..1b0dfa1eb1
--- /dev/null
+++ b/meta-oe/recipes-extended/7zip/bit7z/0001-cmake-disable-dependency-inclusion.patch
@@ -0,0 +1,29 @@
1From 5e23482b89dfbed025eb5e505aba6420512bd9c3 Mon Sep 17 00:00:00 2001
2From: Peter Marko <peter.marko@siemens.com>
3Date: Tue, 1 Apr 2025 11:31:38 +0200
4Subject: [PATCH] cmake: disable dependency inclusion
5
6In Yocto we don't download dependencies, they are satisfied from
7sysroot.
8This cmake file would try to download dependency management tool CPM
9even if all dependencies are satisfied.
10
11Upstream-Status: Inappropriate [OE-specific]
12Signed-off-by: Peter Marko <peter.marko@siemens.com>
13---
14 CMakeLists.txt | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/CMakeLists.txt b/CMakeLists.txt
18index 5378bb3..5916025 100644
19--- a/CMakeLists.txt
20+++ b/CMakeLists.txt
21@@ -194,7 +194,7 @@ include( cmake/BuildOptions.cmake )
22 include( cmake/CompilerOptions.cmake )
23
24 # dependencies
25-include( cmake/Dependencies.cmake )
26+#include( cmake/Dependencies.cmake )
27
28 # 7-zip source code
29 target_link_libraries( ${LIB_TARGET} PRIVATE 7-zip )
diff --git a/meta-oe/recipes-extended/7zip/bit7z_4.0.9.bb b/meta-oe/recipes-extended/7zip/bit7z_4.0.9.bb
new file mode 100644
index 0000000000..2b9029d9e3
--- /dev/null
+++ b/meta-oe/recipes-extended/7zip/bit7z_4.0.9.bb
@@ -0,0 +1,29 @@
1SUMMARY = "A C++ static library offering a clean and simple interface to the 7-Zip shared libraries"
2HOMEPAGE = "https://github.com/rikyoz/bit7z"
3LICENSE = "MPL-2.0"
4LIC_FILES_CHKSUM = "file://LICENSE;md5=48a3fe23ed1353e0995dadfda05ffdb6"
5
6SRC_URI = " \
7 git://github.com/rikyoz/bit7z.git;protocol=https;branch=master \
8 file://0001-cmake-disable-dependency-inclusion.patch \
9 file://0001-Fix-reinterpret-cast-compiler-errors.patch \
10 file://0001-Fix-int8_t-storage-in-BitPropVariant-on-Arm-architec.patch \
11"
12
13SRCREV = "386e00ad3286e7a10e5bb6d05a5b41b523fce623"
14
15S = "${WORKDIR}/git"
16
17inherit cmake
18
19DEPENDS = "7zip"
20
21EXTRA_OECMAKE += "-DBIT7Z_CUSTOM_7ZIP_PATH=${STAGING_INCDIR}/7zip"
22
23do_install() {
24 install -d ${D}${libdir}
25 install -m 0644 ${S}/lib/*/*.a ${D}${libdir}
26
27 install -d ${D}${includedir}/${BPN}
28 install -m 0644 ${S}/include/${BPN}/*.hpp ${D}${includedir}/${BPN}
29}