diff options
Diffstat (limited to 'meta-oe/recipes-extended/7zip/bit7z')
7 files changed, 284 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/7zip/bit7z/0001-Allow-running-tests-on-target-when-cross-compiling.patch b/meta-oe/recipes-extended/7zip/bit7z/0001-Allow-running-tests-on-target-when-cross-compiling.patch new file mode 100644 index 0000000000..b6e24a9519 --- /dev/null +++ b/meta-oe/recipes-extended/7zip/bit7z/0001-Allow-running-tests-on-target-when-cross-compiling.patch | |||
@@ -0,0 +1,45 @@ | |||
1 | From 9f0eed91d32ec2f310bd5c23af187f888394fcb4 Mon Sep 17 00:00:00 2001 | ||
2 | From: Peter Marko <peter.marko@siemens.com> | ||
3 | Date: Wed, 2 Apr 2025 09:33:03 +0200 | ||
4 | Subject: [PATCH] Allow running tests on target when cross-compiling | ||
5 | |||
6 | When bit7z is Cross-compiled, target device does not contain | ||
7 | source/build directory anymore and thus path to test data is different. | ||
8 | Make it possible to pass the new path to cmake. | ||
9 | |||
10 | Upstream-Status: Submitted [https://github.com/rikyoz/bit7z/pull/289] | ||
11 | Signed-off-by: Peter Marko <peter.marko@siemens.com> | ||
12 | --- | ||
13 | tests/CMakeLists.txt | 9 +++++++-- | ||
14 | 1 file changed, 7 insertions(+), 2 deletions(-) | ||
15 | |||
16 | diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt | ||
17 | index 60da280..dbdff1f 100644 | ||
18 | --- a/tests/CMakeLists.txt | ||
19 | +++ b/tests/CMakeLists.txt | ||
20 | @@ -49,6 +49,11 @@ add_executable( ${TESTS_TARGET_PUBLIC} ${SOURCE_FILES} ${PUBLIC_API_SOURCE_FILES | ||
21 | |||
22 | if( BIT7Z_TESTS_FILESYSTEM ) | ||
23 | set( BIT7Z_TESTS_DATA_DIR ${CMAKE_CURRENT_BINARY_DIR}/data ) | ||
24 | + if( NOT BIT7Z_TESTS_DATA_DIR_TARGET ) | ||
25 | + set( BIT7Z_TESTS_DATA_DIR_TARGET ${BIT7Z_TESTS_DATA_DIR} ) | ||
26 | + else() | ||
27 | + message( STATUS "Custom test data dir on target: ${BIT7Z_TESTS_DATA_DIR_TARGET}" ) | ||
28 | + endif() | ||
29 | |||
30 | include( FetchContent ) | ||
31 | FetchContent_Declare( bit7z-test-data | ||
32 | @@ -61,11 +66,11 @@ if( BIT7Z_TESTS_FILESYSTEM ) | ||
33 | message( STATUS "Tests data directory: ${BIT7Z_TESTS_DATA_DIR}" ) | ||
34 | target_compile_definitions( ${TESTS_TARGET} PRIVATE | ||
35 | BIT7Z_TESTS_FILESYSTEM | ||
36 | - BIT7Z_TESTS_DATA_DIR="${BIT7Z_TESTS_DATA_DIR}" ) | ||
37 | + BIT7Z_TESTS_DATA_DIR="${BIT7Z_TESTS_DATA_DIR_TARGET}" ) | ||
38 | target_compile_definitions( ${TESTS_TARGET_PUBLIC} PRIVATE | ||
39 | BIT7Z_TESTS_PUBLIC_API_ONLY | ||
40 | BIT7Z_TESTS_FILESYSTEM | ||
41 | - BIT7Z_TESTS_DATA_DIR="${BIT7Z_TESTS_DATA_DIR}" ) | ||
42 | + BIT7Z_TESTS_DATA_DIR="${BIT7Z_TESTS_DATA_DIR_TARGET}" ) | ||
43 | if( NOT EXISTS ${BIT7Z_TESTS_DATA_DIR}/test_filesystem/empty ) | ||
44 | file( MAKE_DIRECTORY ${BIT7Z_TESTS_DATA_DIR}/test_filesystem/empty ) | ||
45 | endif() | ||
diff --git a/meta-oe/recipes-extended/7zip/bit7z/0001-Allow-specifying-path-to-7z-library-in-tests.patch b/meta-oe/recipes-extended/7zip/bit7z/0001-Allow-specifying-path-to-7z-library-in-tests.patch new file mode 100644 index 0000000000..adc0d67d97 --- /dev/null +++ b/meta-oe/recipes-extended/7zip/bit7z/0001-Allow-specifying-path-to-7z-library-in-tests.patch | |||
@@ -0,0 +1,48 @@ | |||
1 | From 60137ec132951f941f2fb98cd6353717b322cbf1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Peter Marko <peter.marko@siemens.com> | ||
3 | Date: Wed, 2 Apr 2025 10:17:38 +0200 | ||
4 | Subject: [PATCH] Allow specifying path to 7z library in tests | ||
5 | |||
6 | For instance to override path to library on Linux when using real 7-zip | ||
7 | instead of pzip: /usr/lib/lib7z.so | ||
8 | |||
9 | Upstream-Status: Submitted [https://github.com/rikyoz/bit7z/pull/288] | ||
10 | Signed-off-by: Peter Marko <peter.marko@siemens.com> | ||
11 | --- | ||
12 | tests/CMakeLists.txt | 7 +++++++ | ||
13 | tests/src/utils/shared_lib.hpp | 4 +++- | ||
14 | 2 files changed, 10 insertions(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt | ||
17 | index 60da280d..1307366a 100644 | ||
18 | --- a/tests/CMakeLists.txt | ||
19 | +++ b/tests/CMakeLists.txt | ||
20 | @@ -103,6 +103,13 @@ message( STATUS "Use system 7-zip for tests: ${BIT7Z_TESTS_USE_SYSTEM_7ZIP}" ) | ||
21 | if( BIT7Z_TESTS_USE_SYSTEM_7ZIP ) | ||
22 | target_compile_definitions( ${TESTS_TARGET} PRIVATE BIT7Z_TESTS_USE_SYSTEM_7ZIP ) | ||
23 | target_compile_definitions( ${TESTS_TARGET_PUBLIC} PRIVATE BIT7Z_TESTS_USE_SYSTEM_7ZIP ) | ||
24 | +else() | ||
25 | + set( BIT7Z_TESTS_7Z_LIBRARY_PATH "" CACHE STRING "The path of the 7-Zip library to be used for running the tests" ) | ||
26 | + if( NOT BIT7Z_TESTS_7Z_LIBRARY_PATH STREQUAL "" ) | ||
27 | + message( STATUS "Use custom 7-zip library for tests: ${BIT7Z_TESTS_7Z_LIBRARY_PATH}" ) | ||
28 | + target_compile_definitions( ${TESTS_TARGET} PRIVATE BIT7Z_TESTS_7Z_LIBRARY_PATH="${BIT7Z_TESTS_7Z_LIBRARY_PATH}" ) | ||
29 | + target_compile_definitions( ${TESTS_TARGET_PUBLIC} PRIVATE BIT7Z_TESTS_7Z_LIBRARY_PATH="${BIT7Z_TESTS_7Z_LIBRARY_PATH}" ) | ||
30 | + endif() | ||
31 | endif() | ||
32 | |||
33 | # Avoiding linking unnecessary libraries. | ||
34 | diff --git a/tests/src/utils/shared_lib.hpp b/tests/src/utils/shared_lib.hpp | ||
35 | index 41435a9b..8bc02939 100644 | ||
36 | --- a/tests/src/utils/shared_lib.hpp | ||
37 | +++ b/tests/src/utils/shared_lib.hpp | ||
38 | @@ -20,7 +20,9 @@ namespace bit7z { | ||
39 | namespace test { | ||
40 | |||
41 | inline auto sevenzip_lib_path() -> tstring { | ||
42 | -#ifdef BIT7Z_TESTS_USE_SYSTEM_7ZIP | ||
43 | +#ifdef BIT7Z_TESTS_7Z_LIBRARY_PATH | ||
44 | + static const tstring lib_path = BIT7Z_STRING( BIT7Z_TESTS_7Z_LIBRARY_PATH ); | ||
45 | +#elif defined( BIT7Z_TESTS_USE_SYSTEM_7ZIP ) | ||
46 | #ifdef _WIN64 | ||
47 | static const tstring lib_path = BIT7Z_STRING( "C:\\Program Files\\7-Zip\\7z.dll" ); | ||
48 | #elif defined( _WIN32 ) | ||
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 @@ | |||
1 | From d504abaf2b0a514193f52df42098bc16de4718b2 Mon Sep 17 00:00:00 2001 | ||
2 | From: Oz <rik20@live.it> | ||
3 | Date: Fri, 17 Jan 2025 21:23:59 +0100 | ||
4 | Subject: [PATCH] Fix int8_t storage in BitPropVariant on Arm architectures | ||
5 | |||
6 | Upstream-Status: Backport [https://github.com/rikyoz/bit7z/commit/d504abaf2b0a514193f52df42098bc16de4718b2] | ||
7 | Signed-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 | |||
13 | diff --git a/include/bit7z/bitwindows.hpp b/include/bit7z/bitwindows.hpp | ||
14 | index 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; | ||
29 | diff --git a/src/bitpropvariant.cpp b/src/bitpropvariant.cpp | ||
30 | index 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 @@ | |||
1 | From bedeec4d57d29be7de91697277ace00ba87d3e75 Mon Sep 17 00:00:00 2001 | ||
2 | From: Peter Marko <peter.marko@siemens.com> | ||
3 | Date: Tue, 1 Apr 2025 15:23:51 +0200 | ||
4 | Subject: [PATCH] Fix reinterpret-cast compiler errors | ||
5 | |||
6 | Building on 32-bit arm, following warning/error occurs: | ||
7 | |||
8 | src/internal/windows.cpp: In function 'bit7z::OLECHAR* AllocStringBuffer(LPCSTR, uint32_t)': | ||
9 | src/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 | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
12 | git/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 | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
15 | cc1plus: all warnings being treated as errors | ||
16 | |||
17 | Fix it by using the desired variable size right away and thus avoid | ||
18 | casting to an array with different alignment. | ||
19 | |||
20 | Upstream-Status: Backport [https://github.com/rikyoz/bit7z/commit/b2789ea9b0fbb2a74dbf6764ddb72d60659a3bce] | ||
21 | Signed-off-by: Peter Marko <peter.marko@siemens.com> | ||
22 | --- | ||
23 | src/internal/windows.cpp | 7 +++---- | ||
24 | 1 file changed, 3 insertions(+), 4 deletions(-) | ||
25 | |||
26 | diff --git a/src/internal/windows.cpp b/src/internal/windows.cpp | ||
27 | index 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-Fix-tests-with-musl.patch b/meta-oe/recipes-extended/7zip/bit7z/0001-Fix-tests-with-musl.patch new file mode 100644 index 0000000000..b1f3d0f2ec --- /dev/null +++ b/meta-oe/recipes-extended/7zip/bit7z/0001-Fix-tests-with-musl.patch | |||
@@ -0,0 +1,51 @@ | |||
1 | From bc5f2e5af90854c8f84b5829493dd01facf9af84 Mon Sep 17 00:00:00 2001 | ||
2 | From: Peter Marko <peter.marko@siemens.com> | ||
3 | Date: Mon, 7 Apr 2025 16:29:32 +0200 | ||
4 | Subject: [PATCH] Fix tests with musl | ||
5 | |||
6 | Upstream-Status: Submitted [https://github.com/rikyoz/bit7z/pull/292] | ||
7 | Signed-off-by: Peter Marko <peter.marko@siemens.com> | ||
8 | --- | ||
9 | tests/src/test_bitexception.cpp | 8 ++++++++ | ||
10 | 1 file changed, 8 insertions(+) | ||
11 | |||
12 | diff --git a/tests/src/test_bitexception.cpp b/tests/src/test_bitexception.cpp | ||
13 | index 7161fcc5..d85d430d 100644 | ||
14 | --- a/tests/src/test_bitexception.cpp | ||
15 | +++ b/tests/src/test_bitexception.cpp | ||
16 | @@ -49,6 +49,8 @@ constexpr PortableErrorTest hresult_tests[] = { // NOLINT(*-avoid-c-arrays) | ||
17 | { HRESULT_WIN32_TEST( ERROR_OPEN_FAILED ), | ||
18 | #ifdef _WIN32 | ||
19 | "The system cannot open the device or file specified.", | ||
20 | +#elif defined( __linux__ ) && !defined ( __GLIBC__ ) | ||
21 | + "I/O error", | ||
22 | #else | ||
23 | "Input/output error", | ||
24 | #endif | ||
25 | @@ -67,6 +69,8 @@ constexpr PortableErrorTest hresult_tests[] = { // NOLINT(*-avoid-c-arrays) | ||
26 | { HRESULT_WIN32_TEST( ERROR_SEEK ), | ||
27 | #ifdef _WIN32 | ||
28 | "The drive cannot locate a specific area or track on the disk.", | ||
29 | +#elif defined( __linux__ ) && !defined ( __GLIBC__ ) | ||
30 | + "I/O error", | ||
31 | #else | ||
32 | "Input/output error", | ||
33 | #endif | ||
34 | @@ -74,6 +78,8 @@ constexpr PortableErrorTest hresult_tests[] = { // NOLINT(*-avoid-c-arrays) | ||
35 | { HRESULT_WIN32_TEST( ERROR_READ_FAULT ), | ||
36 | #ifdef _WIN32 | ||
37 | "The system cannot read from the specified device.", | ||
38 | +#elif defined( __linux__ ) && !defined ( __GLIBC__ ) | ||
39 | + "I/O error", | ||
40 | #else | ||
41 | "Input/output error", | ||
42 | #endif | ||
43 | @@ -81,6 +87,8 @@ constexpr PortableErrorTest hresult_tests[] = { // NOLINT(*-avoid-c-arrays) | ||
44 | { HRESULT_WIN32_TEST( ERROR_WRITE_FAULT ), | ||
45 | #ifdef _WIN32 | ||
46 | "The system cannot write to the specified device.", | ||
47 | +#elif defined( __linux__ ) && !defined ( __GLIBC__ ) | ||
48 | + "I/O error", | ||
49 | #else | ||
50 | "Input/output error", | ||
51 | #endif | ||
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 @@ | |||
1 | From 5e23482b89dfbed025eb5e505aba6420512bd9c3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Peter Marko <peter.marko@siemens.com> | ||
3 | Date: Tue, 1 Apr 2025 11:31:38 +0200 | ||
4 | Subject: [PATCH] cmake: disable dependency inclusion | ||
5 | |||
6 | In Yocto we don't download dependencies, they are satisfied from | ||
7 | sysroot. | ||
8 | This cmake file would try to download dependency management tool CPM | ||
9 | even if all dependencies are satisfied. | ||
10 | |||
11 | Upstream-Status: Inappropriate [OE-specific] | ||
12 | Signed-off-by: Peter Marko <peter.marko@siemens.com> | ||
13 | --- | ||
14 | CMakeLists.txt | 2 +- | ||
15 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
18 | index 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/run-ptest b/meta-oe/recipes-extended/7zip/bit7z/run-ptest new file mode 100644 index 0000000000..dd1776cab6 --- /dev/null +++ b/meta-oe/recipes-extended/7zip/bit7z/run-ptest | |||
@@ -0,0 +1,18 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Disabled tests: | ||
4 | # "winapi: Allocating BSTR string from nullptr C strings" | ||
5 | # this test is memory hungry, it allocates 800MB chunks | ||
6 | # it succeeds when there is enough free RAM, but most machines don't have it | ||
7 | |||
8 | if /usr/lib/bit7z/ptest/bit7z-tests ~"winapi: Allocating BSTR string from nullptr C strings"; then | ||
9 | echo "PASS: bit7z-tests" | ||
10 | else | ||
11 | echo "FAIL: bit7z-tests" | ||
12 | fi | ||
13 | |||
14 | if /usr/lib/bit7z/ptest/bit7z-tests-public; then | ||
15 | echo "PASS: bit7z-tests-public" | ||
16 | else | ||
17 | echo "FAIL: bit7z-tests-public" | ||
18 | fi | ||