diff options
Diffstat (limited to 'meta-oe/recipes-extended/7zip')
11 files changed, 505 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/7zip/7zip_24.09.bb b/meta-oe/recipes-extended/7zip/7zip_24.09.bb new file mode 100644 index 0000000000..74e44c44e3 --- /dev/null +++ b/meta-oe/recipes-extended/7zip/7zip_24.09.bb | |||
@@ -0,0 +1,76 @@ | |||
1 | SUMMARY = "7-zip is a commandline utility handling 7z archives." | ||
2 | HOMEPAGE = "http://www.7-zip.org/" | ||
3 | LICENSE = "LGPL-2.1-or-later & unRAR & PD & BSD-2-Clause & BSD-3-Clause" | ||
4 | LIC_FILES_CHKSUM = "file://DOC/copying.txt;md5=4fbd65380cdd255951079008b364516c \ | ||
5 | file://DOC/unRarLicense.txt;md5=9c87ddde469ef94aed153b0951d088de \ | ||
6 | file://DOC/License.txt;md5=44483e232b64ffca25fe001f3d6418d0" | ||
7 | |||
8 | CVE_PRODUCT = "7-zip 7zip" | ||
9 | SRC_URI = "git://github.com/ip7z/7zip.git;protocol=https;branch=main \ | ||
10 | file://0001-support-yocto-cross-compiling.patch \ | ||
11 | file://7z_wrapper.sh \ | ||
12 | " | ||
13 | SRCREV = "e5431fa6f5505e385c6f9367260717e9c47dc2ee" | ||
14 | |||
15 | UPSTREAM_CHECK_URI = "https://github.com/ip7z/7zip/releases/latest" | ||
16 | |||
17 | |||
18 | # Support Yocto cross compiling | ||
19 | CXXFLAGS:append:toolchain-clang = " -Wno-error=cast-qual -Wno-error=sign-conversion \ | ||
20 | -Wno-error=disabled-macro-expansion \ | ||
21 | -Wno-error=shorten-64-to-32 \ | ||
22 | -Wno-error=cast-function-type-strict" | ||
23 | |||
24 | EXTRA_OEMAKE += " \ | ||
25 | CXXFLAGS_EXTRA='${CXXFLAGS}' \ | ||
26 | CFLAGS_BASE2='${CFLAGS}' \ | ||
27 | LDFLAGS_STATIC_3='${LDFLAGS}' \ | ||
28 | " | ||
29 | |||
30 | # Support clang | ||
31 | MAKEFILE ?= "../../cmpl_gcc.mak" | ||
32 | MAKEFILE:class-target:toolchain-clang = "../../cmpl_clang.mak" | ||
33 | |||
34 | do_compile() { | ||
35 | oe_runmake -C CPP/7zip/Bundles/Alone2 -f ${MAKEFILE} | ||
36 | oe_runmake -C CPP/7zip/Bundles/Format7zF -f ${MAKEFILE} | ||
37 | oe_runmake -C CPP/7zip/UI/Console -f ${MAKEFILE} | ||
38 | oe_runmake -C CPP/7zip/Bundles/SFXCon -f ${MAKEFILE} | ||
39 | oe_runmake -C CPP/7zip/Bundles/Alone -f ${MAKEFILE} | ||
40 | oe_runmake -C CPP/7zip/Bundles/Alone7z -f ${MAKEFILE} | ||
41 | } | ||
42 | |||
43 | FILES:${PN} += "${libdir}/*" | ||
44 | |||
45 | FILES_SOLIBSDEV = "" | ||
46 | INSANE_SKIP:${PN} += "dev-so" | ||
47 | |||
48 | INSTALLDIR ?= "g" | ||
49 | INSTALLDIR:class-target:toolchain-clang = "c" | ||
50 | |||
51 | do_install() { | ||
52 | install -d ${D}${bindir} | ||
53 | install -m 0755 ${S}/CPP/7zip/Bundles/Alone/b/${INSTALLDIR}/7za ${D}${bindir} | ||
54 | install -m 0755 ${S}/CPP/7zip/Bundles/Alone7z/b/${INSTALLDIR}/7zr ${D}${bindir} | ||
55 | install -m 0755 ${S}/CPP/7zip/UI/Console/b/${INSTALLDIR}/7z ${D}${bindir}/7z.real | ||
56 | install -m 0755 ${UNPACKDIR}/7z_wrapper.sh ${D}${bindir}/7z | ||
57 | |||
58 | install -d ${D}${libdir} | ||
59 | install -m 0755 ${S}/CPP/7zip/Bundles/Format7zF/b/${INSTALLDIR}/7z.so ${D}${libdir}/lib7z.so | ||
60 | ln -rsn ${D}${libdir}/lib7z.so ${D}${bindir}/7z.so | ||
61 | |||
62 | # install headers (for development) and readme (for version information) | ||
63 | for header_file in $(find ${S}/CPP/${BPN} ${S}/CPP/Common ${S}/C -name "*.h"); do | ||
64 | header_dir=$(dirname $(echo $header_file | sed "s|${S}/||")) | ||
65 | install -d ${D}${includedir}/${BPN}/$header_dir | ||
66 | install -m 0644 $header_file ${D}${includedir}/${BPN}/$header_dir | ||
67 | done | ||
68 | install -d ${D}${includedir}/${BPN}/DOC | ||
69 | install -m 0644 ${S}/DOC/readme.txt ${D}${includedir}/${BPN}/DOC | ||
70 | } | ||
71 | |||
72 | PROVIDES += "p7zip" | ||
73 | RPROVIDES:${PN} += "lib7z.so()(64bit) 7z lib7z.so p7zip" | ||
74 | RPROVIDES:${PN}-dev += "lib7z.so()(64bit) 7z lib7z.so" | ||
75 | |||
76 | BBCLASSEXTEND = "native nativesdk" | ||
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 | ||
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..033461d614 --- /dev/null +++ b/meta-oe/recipes-extended/7zip/bit7z_4.0.9.bb | |||
@@ -0,0 +1,88 @@ | |||
1 | SUMMARY = "A C++ static library offering a clean and simple interface to the 7-Zip shared libraries" | ||
2 | HOMEPAGE = "https://github.com/rikyoz/bit7z" | ||
3 | LICENSE = "MPL-2.0" | ||
4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=48a3fe23ed1353e0995dadfda05ffdb6" | ||
5 | |||
6 | SRC_URI = " \ | ||
7 | git://github.com/rikyoz/bit7z.git;protocol=https;branch=master \ | ||
8 | ${@bb.utils.contains('PTEST_ENABLED', '1', d.getVar('SRC_URI_PTEST'), 'file://0001-cmake-disable-dependency-inclusion.patch', d)} \ | ||
9 | file://0001-Fix-reinterpret-cast-compiler-errors.patch \ | ||
10 | file://0001-Fix-int8_t-storage-in-BitPropVariant-on-Arm-architec.patch \ | ||
11 | file://0001-Allow-running-tests-on-target-when-cross-compiling.patch \ | ||
12 | file://0001-Allow-specifying-path-to-7z-library-in-tests.patch \ | ||
13 | file://0001-Fix-tests-with-musl.patch \ | ||
14 | " | ||
15 | |||
16 | SRCREV = "386e00ad3286e7a10e5bb6d05a5b41b523fce623" | ||
17 | |||
18 | # ptest dependencies and their revisions | ||
19 | SRC_URI_PTEST = " \ | ||
20 | git://github.com/rikyoz/filesystem.git;protocol=https;branch=glibcxx_wchar_streams_workaround;name=filesystem;destsuffix=filesystem \ | ||
21 | git://github.com/rikyoz/bit7z-test-data.git;protocol=https;branch=main;name=testdata;destsuffix=testdata \ | ||
22 | git://github.com/catchorg/Catch2.git;protocol=https;branch=v2.x;name=catch2;destsuffix=catch2;tag=${TAG_catch2} \ | ||
23 | https://github.com/cpm-cmake/CPM.cmake/releases/download/v${TAG_CPM}/CPM.cmake;downloadfilename=CPM_${TAG_CPM}.cmake \ | ||
24 | file://run-ptest \ | ||
25 | " | ||
26 | SRCREV_FORMAT = "${@bb.utils.contains('PTEST_ENABLED', '1', 'default_filesystem_testdata_catch2', 'default', d)}" | ||
27 | SRCREV_filesystem = "983650f374699e3979f9cdefe13ddff60bd4ac68" | ||
28 | SRCREV_testdata = "077e407b1c07b7443626b5902eeb4819388bf656" | ||
29 | SRCREV_catch2 = "182c910b4b63ff587a3440e08f84f70497e49a81" | ||
30 | TAG_catch2 = "v2.13.10" | ||
31 | SRCHASH_CPM = "c8cdc32c03816538ce22781ed72964dc864b2a34a310d3b7104812a5ca2d835d" | ||
32 | TAG_CPM = "0.40.2" | ||
33 | SRC_URI[sha256sum] = "${SRCHASH_CPM}" | ||
34 | |||
35 | |||
36 | inherit cmake ptest | ||
37 | |||
38 | DEPENDS = "7zip" | ||
39 | |||
40 | EXTRA_OECMAKE += "-DBIT7Z_CUSTOM_7ZIP_PATH=${STAGING_INCDIR}/7zip" | ||
41 | |||
42 | PACKAGECONFIG ??= "${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" | ||
43 | PACKAGECONFIG[tests] = " \ | ||
44 | -DBIT7Z_BUILD_TESTS=ON -DBIT7Z_DISABLE_USE_STD_FILESYSTEM=ON \ | ||
45 | -DBIT7Z_TESTS_USE_SYSTEM_7ZIP=OFF -DBIT7Z_TESTS_7Z_LIBRARY_PATH=${libdir}/lib7z.so \ | ||
46 | -DBIT7Z_TESTS_DATA_DIR_TARGET=${PTEST_PATH}/data \ | ||
47 | -DCPM_SOURCE_CACHE=${B}/cpm_cache -DFETCHCONTENT_SOURCE_DIR_BIT7Z-TEST-DATA=${UNPACKDIR}/testdata -DFETCHCONTENT_SOURCE_DIR_CATCH2=${B}/catch2 \ | ||
48 | " | ||
49 | |||
50 | do_configure:prepend() { | ||
51 | # verify that all dependencies have correct version | ||
52 | grep -q ${SRCREV_filesystem} ${S}/cmake/Dependencies.cmake || bbfatal "ERROR: dependency version mismatch, please update 'SRCREV_filesystem'!" | ||
53 | grep -q ${SRCREV_testdata} ${S}/tests/CMakeLists.txt || bbfatal "ERROR: dependency version mismatch, please update 'SRCREV_testdata'!" | ||
54 | grep -q ${TAG_catch2} ${S}/tests/cmake/Catch2.cmake || bbfatal "ERROR: dependency version mismatch, please update 'SRCREV_catch2'!" | ||
55 | grep -q ${SRCHASH_CPM} ${S}/cmake/Dependencies.cmake || bbfatal "ERROR: dependency version mismatch, please update 'SRCHASH_CPM'!" | ||
56 | |||
57 | if ${@bb.utils.contains('PTEST_ENABLED', '1', 'true', 'false', d)}; then | ||
58 | # use cache instead of download for CPM (CMake's missing package manager) | ||
59 | mkdir -p ${B}/cmake | ||
60 | cp ${UNPACKDIR}/CPM_${TAG_CPM}.cmake ${B}/cmake | ||
61 | mkdir -p ${B}/cpm_cache/ghc_filesystem | ||
62 | cp -r ${UNPACKDIR}/filesystem ${B}/cpm_cache/ghc_filesystem/fbcc9a9e94e6365273cf51294173f21ff5efdb4f | ||
63 | # avoid buildpaths issue as unpackdir is not in prefix maps | ||
64 | cp -r ${UNPACKDIR}/catch2 ${B} | ||
65 | fi | ||
66 | } | ||
67 | do_configure[cleandirs] += "${B}" | ||
68 | |||
69 | do_install() { | ||
70 | install -d ${D}${libdir} | ||
71 | install -m 0644 ${S}/lib/*/*.a ${D}${libdir} | ||
72 | |||
73 | install -d ${D}${includedir}/${BPN} | ||
74 | install -m 0644 ${S}/include/${BPN}/*.hpp ${D}${includedir}/${BPN} | ||
75 | } | ||
76 | |||
77 | do_install_ptest() { | ||
78 | install -m 0755 ${S}/bin/*/* ${D}${PTEST_PATH} | ||
79 | install -d ${D}${PTEST_PATH}/data | ||
80 | cp -r ${UNPACKDIR}/testdata/test_archives ${UNPACKDIR}/testdata/test_filesystem ${B}/tests/data/test_filesystem ${D}${PTEST_PATH}/data | ||
81 | } | ||
82 | |||
83 | # this package contains static library so main package is empty, but ptest package rdepends on it | ||
84 | ALLOW_EMPTY:${PN} = "1" | ||
85 | # these are loaded via dlopen, so need explicit rdepends | ||
86 | RDEPENDS:${PN}-ptest += "libstdc++ 7zip" | ||
87 | # test data contains various file types with different architectures | ||
88 | INSANE_SKIP:${PN}-ptest += "arch" | ||
diff --git a/meta-oe/recipes-extended/7zip/files/0001-support-yocto-cross-compiling.patch b/meta-oe/recipes-extended/7zip/files/0001-support-yocto-cross-compiling.patch new file mode 100644 index 0000000000..e3d0477930 --- /dev/null +++ b/meta-oe/recipes-extended/7zip/files/0001-support-yocto-cross-compiling.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | From fd0d54f96576a8ff572bb7c7d28df6b097f99a30 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Wed, 18 Dec 2024 16:38:11 +0800 | ||
4 | Subject: [PATCH] support yocto cross compiling | ||
5 | |||
6 | Remove -s from $LFLAGS_STRIP, do not strip binary to workaournd | ||
7 | Yocto build warning | ||
8 | ... | ||
9 | WARNING: 7zip-native-24.09-r0 do_populate_sysroot: File 'tmp/work/x86_64-linux/ | ||
10 | 7zip-native/24.09/recipe-sysroot-native/usr/lib/7z.so' from 7zip-native was already stripped, | ||
11 | this will prevent future debugging! | ||
12 | ... | ||
13 | |||
14 | Apply CC, CXX from environments | ||
15 | |||
16 | Upstream-Status: Inappropriate [Yocto specific] | ||
17 | |||
18 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
19 | --- | ||
20 | CPP/7zip/7zip_gcc.mak | 2 +- | ||
21 | CPP/7zip/var_gcc.mak | 2 -- | ||
22 | 2 files changed, 1 insertion(+), 3 deletions(-) | ||
23 | |||
24 | --- a/CPP/7zip/7zip_gcc.mak | ||
25 | +++ b/CPP/7zip/7zip_gcc.mak | ||
26 | @@ -45,7 +45,7 @@ CFLAGS_DEBUG = -g | ||
27 | else | ||
28 | CFLAGS_DEBUG = -DNDEBUG | ||
29 | ifneq ($(CC), $(CROSS_COMPILE)clang) | ||
30 | -LFLAGS_STRIP = -s | ||
31 | +LFLAGS_STRIP = | ||
32 | endif | ||
33 | endif | ||
34 | |||
35 | --- a/CPP/7zip/var_gcc.mak | ||
36 | +++ b/CPP/7zip/var_gcc.mak | ||
37 | @@ -6,7 +6,5 @@ IS_ARM64= | ||
38 | CROSS_COMPILE= | ||
39 | MY_ARCH= | ||
40 | USE_ASM= | ||
41 | -CC=$(CROSS_COMPILE)gcc | ||
42 | -CXX=$(CROSS_COMPILE)g++ | ||
43 | |||
44 | # -march=armv8-a+crc+crypto | ||
45 | --- a/CPP/7zip/var_clang.mak | ||
46 | +++ b/CPP/7zip/var_clang.mak | ||
47 | @@ -6,6 +6,4 @@ IS_ARM64= | ||
48 | CROSS_COMPILE= | ||
49 | MY_ARCH= | ||
50 | USE_ASM= | ||
51 | -CC=$(CROSS_COMPILE)clang | ||
52 | -CXX=$(CROSS_COMPILE)clang++ | ||
53 | USE_CLANG=1 | ||
diff --git a/meta-oe/recipes-extended/7zip/files/7z_wrapper.sh b/meta-oe/recipes-extended/7zip/files/7z_wrapper.sh new file mode 100755 index 0000000000..af5b9b393a --- /dev/null +++ b/meta-oe/recipes-extended/7zip/files/7z_wrapper.sh | |||
@@ -0,0 +1,4 @@ | |||
1 | #!/bin/sh | ||
2 | realpath=`readlink -fn $0` | ||
3 | realdir=`dirname $realpath` | ||
4 | exec $realdir/7z.real "$@" | ||