From 25bea2213231ac43a3af1e67ffa7e8c9d6a19566 Mon Sep 17 00:00:00 2001 From: nia Date: Wed, 2 Aug 2023 16:00:49 +0000 Subject: [PATCH] 7-zip: Fix building with GCC 7. --- archivers/7-zip/Makefile | 3 ++- archivers/7-zip/distinfo | 3 ++- archivers/7-zip/patches/patch-C_SwapBytes.c | 20 ++++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 archivers/7-zip/patches/patch-C_SwapBytes.c diff --git a/archivers/7-zip/Makefile b/archivers/7-zip/Makefile index 20ca11aeaf9c..3278878fec03 100644 --- a/archivers/7-zip/Makefile +++ b/archivers/7-zip/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2023/07/30 07:55:48 nia Exp $ +# $NetBSD: Makefile,v 1.3 2023/08/02 16:00:49 nia Exp $ DISTNAME= 7z2301-src PKGNAME= 7-zip-23.01 @@ -37,6 +37,7 @@ SUBST_STAGE.crlf= post-extract SUBST_FILES.crlf= CPP/7zip/Common/* SUBST_FILES.crlf+= CPP/7zip/UI/Common/* SUBST_FILES.crlf+= CPP/Windows/* +SUBST_FILES.crlf+= C/* SUBST_FILTER_CMD.crlf= ${TR} -d '\r' do-install: diff --git a/archivers/7-zip/distinfo b/archivers/7-zip/distinfo index 33cc5913f3da..bd124b6a02a9 100644 --- a/archivers/7-zip/distinfo +++ b/archivers/7-zip/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.1 2023/07/21 22:42:04 ryoon Exp $ +$NetBSD: distinfo,v 1.2 2023/08/02 16:00:49 nia Exp $ BLAKE2s (7z2301-src.tar.xz) = 1d6243ac12be9625f9df3ba889ebeeb1f3f8a34f2629ec264aa692f5414c354f SHA512 (7z2301-src.tar.xz) = e39f660c023aa65e55388be225b5591fe2a5c9138693f3c9107e2eb4ce97fafde118d3375e01ada99d29de9633f56221b5b3d640c982178884670cd84c8aa986 @@ -7,3 +7,4 @@ SHA1 (patch-CPP_7zip_Common_FileStreams.cpp) = 712924b060cc2b00d0ce131afe2940197 SHA1 (patch-CPP_7zip_UI_Common_UpdateCallback.cpp) = 6d8612b37bcfbb8f8b46a1d7afb0a8c28f02becc SHA1 (patch-CPP_Windows_System.cpp) = 5183de07924c82dbe46b130ce4f2edbb2bc48803 SHA1 (patch-CPP_Windows_SystemInfo.cpp) = d78be248fd24fee1900c4d36eb9d5937f2bdaf95 +SHA1 (patch-C_SwapBytes.c) = 1e32b0dd26a3c16251c74d48a97da0aada43f506 diff --git a/archivers/7-zip/patches/patch-C_SwapBytes.c b/archivers/7-zip/patches/patch-C_SwapBytes.c new file mode 100644 index 000000000000..717f38c21ec9 --- /dev/null +++ b/archivers/7-zip/patches/patch-C_SwapBytes.c @@ -0,0 +1,20 @@ +$NetBSD: patch-C_SwapBytes.c,v 1.1 2023/08/02 16:00:49 nia Exp $ + +Fix compiling with GCC 7 and earlier versions. + +--- C/SwapBytes.c.orig 2023-08-02 08:09:50.974230468 +0000 ++++ C/SwapBytes.c +@@ -22,7 +22,12 @@ typedef UInt32 CSwapUInt32; + // #if defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1900) + #if defined(__clang__) && (__clang_major__ >= 4) \ + || defined(Z7_GCC_VERSION) && (Z7_GCC_VERSION >= 40701) +- #define k_SwapBytes_Mode_MAX k_SwapBytes_Mode_AVX2 ++ // mm256_set_m128i is not present in GCC 7 ++ #if !defined(__clang__) && __GNUC__ >= 8 ++ #define k_SwapBytes_Mode_MAX k_SwapBytes_Mode_AVX2 ++ #else ++ #define k_SwapBytes_Mode_MAX k_SwapBytes_Mode_SSE2 ++ #endif + #define SWAP_ATTRIB_SSE2 __attribute__((__target__("sse2"))) + #define SWAP_ATTRIB_SSSE3 __attribute__((__target__("ssse3"))) + #define SWAP_ATTRIB_AVX2 __attribute__((__target__("avx2")))