commit:     59467b8282469d3878a8096c3d36422fc9d2d90f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 14 23:57:32 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Feb 15 01:29:23 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59467b82

app-arch/zstd: fix build w/ USE=-zlib

Closes: https://bugs.gentoo.org/894058
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../zstd/files/zstd-1.5.4-fix-no-zlib-build.patch  | 61 ++++++++++++++++++++++
 app-arch/zstd/zstd-1.5.4-r2.ebuild                 | 15 +++++-
 2 files changed, 75 insertions(+), 1 deletion(-)

diff --git a/app-arch/zstd/files/zstd-1.5.4-fix-no-zlib-build.patch 
b/app-arch/zstd/files/zstd-1.5.4-fix-no-zlib-build.patch
new file mode 100644
index 000000000000..c6e65cbe2b16
--- /dev/null
+++ b/app-arch/zstd/files/zstd-1.5.4-fix-no-zlib-build.patch
@@ -0,0 +1,61 @@
+https://bugs.gentoo.org/894058
+https://github.com/facebook/zstd/pull/3497
+
+From cc94fac7c879c47984bba7d60d5ce0c9834ff4c7 Mon Sep 17 00:00:00 2001
+From: "Alex Xu (Hello71)" <alex_y...@yahoo.ca>
+Date: Fri, 10 Feb 2023 19:30:30 -0500
+Subject: [PATCH] Use correct types in LZMA comp/decomp
+
+Bytef and uInt are zlib types, not available when zlib is disabled
+
+Fixes: 1598e6c634ac ("Async write for decompression")
+Fixes: cc0657f27d81 ("AsyncIO compression part 2 - added async read and 
asyncio to compression code (#3022)")
+---
+ programs/fileio.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/programs/fileio.c b/programs/fileio.c
+index 9a8300cdd8..d3ed9217d5 100644
+--- a/programs/fileio.c
++++ b/programs/fileio.c
+@@ -1173,8 +1173,8 @@ FIO_compressLzmaFrame(cRess_t* ress,
+     }
+ 
+     writeJob =AIO_WritePool_acquireJob(ress->writeCtx);
+-    strm.next_out = (Bytef*)writeJob->buffer;
+-    strm.avail_out = (uInt)writeJob->bufferSize;
++    strm.next_out = (BYTE*)writeJob->buffer;
++    strm.avail_out = writeJob->bufferSize;
+     strm.next_in = 0;
+     strm.avail_in = 0;
+ 
+@@ -1201,7 +1201,7 @@ FIO_compressLzmaFrame(cRess_t* ress,
+                 writeJob->usedBufferSize = compBytes;
+                 AIO_WritePool_enqueueAndReacquireWriteJob(&writeJob);
+                 outFileSize += compBytes;
+-                strm.next_out = (Bytef*)writeJob->buffer;
++                strm.next_out = (BYTE*)writeJob->buffer;
+                 strm.avail_out = writeJob->bufferSize;
+         }   }
+         if (srcFileSize == UTIL_FILESIZE_UNKNOWN)
+@@ -2316,8 +2316,8 @@ FIO_decompressLzmaFrame(dRess_t* ress,
+     }
+ 
+     writeJob = AIO_WritePool_acquireJob(ress->writeCtx);
+-    strm.next_out = (Bytef*)writeJob->buffer;
+-    strm.avail_out = (uInt)writeJob->bufferSize;
++    strm.next_out = (BYTE*)writeJob->buffer;
++    strm.avail_out = writeJob->bufferSize;
+     strm.next_in = (BYTE const*)ress->readCtx->srcBuffer;
+     strm.avail_in = ress->readCtx->srcBufferLoaded;
+ 
+@@ -2345,7 +2345,7 @@ FIO_decompressLzmaFrame(dRess_t* ress,
+                 writeJob->usedBufferSize = decompBytes;
+                 AIO_WritePool_enqueueAndReacquireWriteJob(&writeJob);
+                 outFileSize += decompBytes;
+-                strm.next_out = (Bytef*)writeJob->buffer;
++                strm.next_out = (BYTE*)writeJob->buffer;
+                 strm.avail_out = writeJob->bufferSize;
+         }   }
+         if (ret == LZMA_STREAM_END) break;
+

diff --git a/app-arch/zstd/zstd-1.5.4-r2.ebuild 
b/app-arch/zstd/zstd-1.5.4-r2.ebuild
index fc646ce06670..3d848f5e471a 100644
--- a/app-arch/zstd/zstd-1.5.4-r2.ebuild
+++ b/app-arch/zstd/zstd-1.5.4-r2.ebuild
@@ -25,13 +25,26 @@ RDEPEND="
 "
 DEPEND="${RDEPEND}"
 
-PATCHES=(
+MESON_PATCHES=(
        # Workaround until Valgrind bugfix lands
        "${FILESDIR}"/${PN}-1.5.4-no-find-valgrind.patch
        # Allow building tests w/o programs (useful for multilib)
        "${FILESDIR}"/${PN}-1.5.4-tests-no-programs.patch
 )
 
+PATCHES=(
+       # Fix build w/o zlib, bug #894058
+       "${FILESDIR}"/${P}-fix-no-zlib-build.patch
+)
+
+src_prepare() {
+       cd "${WORKDIR}"/${P} || die
+       default
+
+       cd "${S}" || die
+       eapply "${MESON_PATCHES[@]}"
+}
+
 multilib_src_configure() {
        local native_file="${T}"/meson.${CHOST}.${ABI}.ini.local
 

Reply via email to