zstd: update to 1.4.0
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
_realname=zstd
|
||||
pkgbase=mingw-w64-${_realname}
|
||||
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
|
||||
pkgver=1.3.8
|
||||
pkgrel=2
|
||||
pkgver=1.4.0
|
||||
pkgrel=1
|
||||
pkgdesc="Zstandard - Fast real-time compression algorithm (mingw-w64)"
|
||||
arch=('any')
|
||||
url='https://facebook.github.io/zstd/'
|
||||
@@ -12,19 +12,23 @@ license=('BSD')
|
||||
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
|
||||
"${MINGW_PACKAGE_PREFIX}-cmake")
|
||||
source=(${_realname}-${pkgver}.tar.gz::"https://github.com/facebook/${_realname}/archive/v${pkgver}.tar.gz"
|
||||
install-pkgconfig.patch)
|
||||
sha256sums=('90d902a1282cc4e197a8023b6d6e8d331c1fd1dfe60f7f8e4ee9da40da886dc3'
|
||||
'9a8864dd11ad6f1eaf1e11ee19adfdbc4e023f20b14b429b8af2b387ffffdef4')
|
||||
install-pkgconfig.patch
|
||||
zstd-1.4.0-fileio-mingw.patch
|
||||
zstd-1.4.0-fix-build-pzstd.patch)
|
||||
sha256sums=('63be339137d2b683c6d19a9e34f4fb684790e864fee13c7dd40e197a64c705c1'
|
||||
'9a8864dd11ad6f1eaf1e11ee19adfdbc4e023f20b14b429b8af2b387ffffdef4'
|
||||
'0674aeaca4e4ce4ff2f87e91f251cb4e2772c99e831b06bbebc6d0b3608f30ca'
|
||||
'5095624a5d59054053a257c6b8ec2156b410a44e0e491b259c276c4b7650f499')
|
||||
|
||||
prepare() {
|
||||
cd "${srcdir}/${_realname}-${pkgver}"
|
||||
patch -p1 -i ${srcdir}/install-pkgconfig.patch
|
||||
patch -Np1 -i "${srcdir}/install-pkgconfig.patch"
|
||||
patch -Np1 -i "${srcdir}/zstd-1.4.0-fileio-mingw.patch"
|
||||
patch -Np1 -i "${srcdir}/zstd-1.4.0-fix-build-pzstd.patch"
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "${srcdir}"/${_realname}-${pkgver}
|
||||
[[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
|
||||
|
||||
mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}
|
||||
|
||||
declare -a extra_config
|
||||
@@ -39,6 +43,7 @@ build() {
|
||||
-G'MSYS Makefiles' \
|
||||
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
|
||||
"${extra_config[@]}" \
|
||||
-DZSTD_BUILD_CONTRIB=ON \
|
||||
../${_realname}-${pkgver}/build/cmake
|
||||
|
||||
make
|
||||
@@ -49,11 +54,9 @@ package() {
|
||||
cd "${srcdir}"/build-${CARCH}
|
||||
make install DESTDIR="${pkgdir}"
|
||||
|
||||
cd "${srcdir}"/${_realname}-${pkgver}
|
||||
install -D -m644 "LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
|
||||
install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
|
||||
|
||||
for pcfile in "${pkgdir}${MINGW_PREFIX}"/lib/pkgconfig/*.pc; do
|
||||
sed -s "s|$(cygpath -m ${MINGW_PREFIX})|${MINGW_PREFIX}|g" -i "${pcfile}"
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
38
mingw-w64-zstd/zstd-1.4.0-fileio-mingw.patch
Normal file
38
mingw-w64-zstd/zstd-1.4.0-fileio-mingw.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
diff -Naur zstd-1.4.0.orig/programs/fileio.c zstd-1.4.0/programs/fileio.c
|
||||
--- zstd-1.4.0.orig/programs/fileio.c 2019-04-17 08:39:25.543111900 -0400
|
||||
+++ zstd-1.4.0/programs/fileio.c 2019-04-17 08:39:27.889423900 -0400
|
||||
@@ -242,33 +242,9 @@
|
||||
/*-************************************************************
|
||||
* Avoid fseek()'s 2GiB barrier with MSVC, macOS, *BSD, MinGW
|
||||
***************************************************************/
|
||||
-#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
+#if defined(_WIN32)
|
||||
# define LONG_SEEK _fseeki64
|
||||
# define LONG_TELL _ftelli64
|
||||
-#elif !defined(__64BIT__) && (PLATFORM_POSIX_VERSION >= 200112L) /* No point defining Large file for 64 bit */
|
||||
-# define LONG_SEEK fseeko
|
||||
-# define LONG_TELL ftello
|
||||
-#elif defined(__MINGW32__) && !defined(__STRICT_ANSI__) && !defined(__NO_MINGW_LFS) && defined(__MSVCRT__)
|
||||
-# define LONG_SEEK fseeko64
|
||||
-# define LONG_TELL ftello64
|
||||
-#elif defined(_WIN32) && !defined(__DJGPP__)
|
||||
-# include <windows.h>
|
||||
- static int LONG_SEEK(FILE* file, __int64 offset, int origin) {
|
||||
- LARGE_INTEGER off;
|
||||
- DWORD method;
|
||||
- off.QuadPart = offset;
|
||||
- if (origin == SEEK_END)
|
||||
- method = FILE_END;
|
||||
- else if (origin == SEEK_CUR)
|
||||
- method = FILE_CURRENT;
|
||||
- else
|
||||
- method = FILE_BEGIN;
|
||||
-
|
||||
- if (SetFilePointerEx((HANDLE) _get_osfhandle(_fileno(file)), off, NULL, method))
|
||||
- return 0;
|
||||
- else
|
||||
- return -1;
|
||||
- }
|
||||
#else
|
||||
# define LONG_SEEK fseek
|
||||
# define LONG_TELL ftell
|
||||
134
mingw-w64-zstd/zstd-1.4.0-fix-build-pzstd.patch
Normal file
134
mingw-w64-zstd/zstd-1.4.0-fix-build-pzstd.patch
Normal file
@@ -0,0 +1,134 @@
|
||||
diff -Naur zstd-1.4.0.orig/contrib/pzstd/Logging.h zstd-1.4.0/contrib/pzstd/Logging.h
|
||||
--- zstd-1.4.0.orig/contrib/pzstd/Logging.h 2019-04-17 08:39:25.480683500 -0400
|
||||
+++ zstd-1.4.0/contrib/pzstd/Logging.h 2019-04-17 08:50:22.814999100 -0400
|
||||
@@ -13,10 +13,10 @@
|
||||
|
||||
namespace pzstd {
|
||||
|
||||
-constexpr int ERROR = 1;
|
||||
-constexpr int INFO = 2;
|
||||
-constexpr int DEBUG = 3;
|
||||
-constexpr int VERBOSE = 4;
|
||||
+constexpr int ERROR_pzstd = 1;
|
||||
+constexpr int INFO_pzstd = 2;
|
||||
+constexpr int DEBUG_pzstd = 3;
|
||||
+constexpr int VERBOSE_pzstd = 4;
|
||||
|
||||
class Logger {
|
||||
std::mutex mutex_;
|
||||
diff -Naur zstd-1.4.0.orig/contrib/pzstd/Pzstd.cpp zstd-1.4.0/contrib/pzstd/Pzstd.cpp
|
||||
--- zstd-1.4.0.orig/contrib/pzstd/Pzstd.cpp 2019-04-17 08:39:25.480683500 -0400
|
||||
+++ zstd-1.4.0/contrib/pzstd/Pzstd.cpp 2019-04-17 08:52:22.445926500 -0400
|
||||
@@ -94,12 +94,12 @@
|
||||
if (!options.decompress) {
|
||||
double ratio = static_cast<double>(bytesWritten) /
|
||||
static_cast<double>(bytesRead + !bytesRead);
|
||||
- state.log(INFO, "%-20s :%6.2f%% (%6" PRIu64 " => %6" PRIu64
|
||||
+ state.log(INFO_pzstd, "%-20s :%6.2f%% (%6" PRIu64 " => %6" PRIu64
|
||||
" bytes, %s)\n",
|
||||
inputFileName.c_str(), ratio * 100, bytesRead, bytesWritten,
|
||||
outputFileName.c_str());
|
||||
} else {
|
||||
- state.log(INFO, "%-20s: %" PRIu64 " bytes \n",
|
||||
+ state.log(INFO_pzstd, "%-20s: %" PRIu64 " bytes \n",
|
||||
inputFileName.c_str(),bytesWritten);
|
||||
}
|
||||
}
|
||||
@@ -139,12 +139,12 @@
|
||||
auto outputFd = std::fopen(outputFile.c_str(), "rb");
|
||||
if (outputFd != nullptr) {
|
||||
std::fclose(outputFd);
|
||||
- if (!state.log.logsAt(INFO)) {
|
||||
+ if (!state.log.logsAt(INFO_pzstd)) {
|
||||
state.errorHolder.setError("Output file exists");
|
||||
return nullptr;
|
||||
}
|
||||
state.log(
|
||||
- INFO,
|
||||
+ INFO_pzstd,
|
||||
"pzstd: %s already exists; do you wish to overwrite (y/n) ? ",
|
||||
outputFile.c_str());
|
||||
int c = getchar();
|
||||
@@ -170,7 +170,7 @@
|
||||
auto printErrorGuard = makeScopeGuard([&] {
|
||||
if (state.errorHolder.hasError()) {
|
||||
returnCode = 1;
|
||||
- state.log(ERROR, "pzstd: %s: %s.\n", input.c_str(),
|
||||
+ state.log(ERROR_pzstd, "pzstd: %s: %s.\n", input.c_str(),
|
||||
state.errorHolder.getError().c_str());
|
||||
}
|
||||
});
|
||||
@@ -388,7 +388,7 @@
|
||||
// Break the input up into chunks of size `step` and compress each chunk
|
||||
// independently.
|
||||
size_t step = calculateStep(size, numThreads, params);
|
||||
- state.log(DEBUG, "Chosen frame size: %zu\n", step);
|
||||
+ state.log(DEBUG_pzstd, "Chosen frame size: %zu\n", step);
|
||||
auto status = FileStatus::Continue;
|
||||
while (status == FileStatus::Continue && !state.errorHolder.hasError()) {
|
||||
// Make a new input queue that we will put the chunk's input data into.
|
||||
@@ -403,7 +403,7 @@
|
||||
});
|
||||
// Pass the output queue to the writer thread.
|
||||
chunks.push(std::move(out));
|
||||
- state.log(VERBOSE, "%s\n", "Starting a new frame");
|
||||
+ state.log(VERBOSE_pzstd, "%s\n", "Starting a new frame");
|
||||
// Fill the input queue for the compression job we just started
|
||||
status = readData(*in, ZSTD_CStreamInSize(), step, fd, &bytesRead);
|
||||
}
|
||||
@@ -540,14 +540,14 @@
|
||||
if (frameSize == 0) {
|
||||
// We hit a non SkippableFrame ==> not compressed by pzstd or corrupted
|
||||
// Pass the rest of the source to this decompression task
|
||||
- state.log(VERBOSE, "%s\n",
|
||||
+ state.log(VERBOSE_pzstd, "%s\n",
|
||||
"Input not in pzstd format, falling back to serial decompression");
|
||||
while (status == FileStatus::Continue && !state.errorHolder.hasError()) {
|
||||
status = readData(*in, chunkSize, chunkSize, fd, &totalBytesRead);
|
||||
}
|
||||
break;
|
||||
}
|
||||
- state.log(VERBOSE, "Decompressing a frame of size %zu", frameSize);
|
||||
+ state.log(VERBOSE_pzstd, "Decompressing a frame of size %zu", frameSize);
|
||||
// Fill the input queue for the decompression job we just started
|
||||
status = readData(*in, chunkSize, frameSize, fd, &totalBytesRead);
|
||||
}
|
||||
@@ -573,7 +573,7 @@
|
||||
bool decompress) {
|
||||
auto& errorHolder = state.errorHolder;
|
||||
auto lineClearGuard = makeScopeGuard([&state] {
|
||||
- state.log.clear(INFO);
|
||||
+ state.log.clear(INFO_pzstd);
|
||||
});
|
||||
std::uint64_t bytesWritten = 0;
|
||||
std::shared_ptr<BufferWorkQueue> out;
|
||||
@@ -602,7 +602,7 @@
|
||||
return bytesWritten;
|
||||
}
|
||||
bytesWritten += buffer.size();
|
||||
- state.log.update(INFO, "Written: %u MB ",
|
||||
+ state.log.update(INFO_pzstd, "Written: %u MB ",
|
||||
static_cast<std::uint32_t>(bytesWritten >> 20));
|
||||
}
|
||||
}
|
||||
diff -Naur zstd-1.4.0.orig/contrib/pzstd/Pzstd.h zstd-1.4.0/contrib/pzstd/Pzstd.h
|
||||
--- zstd-1.4.0.orig/contrib/pzstd/Pzstd.h 2019-04-17 08:39:25.480683500 -0400
|
||||
+++ zstd-1.4.0/contrib/pzstd/Pzstd.h 2019-04-17 08:52:47.487047400 -0400
|
||||
@@ -41,7 +41,7 @@
|
||||
auto parameters = options.determineParameters();
|
||||
cStreamPool.reset(new ResourcePool<ZSTD_CStream>{
|
||||
[this, parameters]() -> ZSTD_CStream* {
|
||||
- this->log(VERBOSE, "%s\n", "Creating new ZSTD_CStream");
|
||||
+ this->log(VERBOSE_pzstd, "%s\n", "Creating new ZSTD_CStream");
|
||||
auto zcs = ZSTD_createCStream();
|
||||
if (zcs) {
|
||||
auto err = ZSTD_initCStream_advanced(
|
||||
@@ -59,7 +59,7 @@
|
||||
} else {
|
||||
dStreamPool.reset(new ResourcePool<ZSTD_DStream>{
|
||||
[this]() -> ZSTD_DStream* {
|
||||
- this->log(VERBOSE, "%s\n", "Creating new ZSTD_DStream");
|
||||
+ this->log(VERBOSE_pzstd, "%s\n", "Creating new ZSTD_DStream");
|
||||
auto zds = ZSTD_createDStream();
|
||||
if (zds) {
|
||||
auto err = ZSTD_initDStream(zds);
|
||||
Reference in New Issue
Block a user