Skip to content

Commit

Permalink
[zstd] update to 1.5.0 (#18915)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonLiu1993 authored Aug 26, 2021
1 parent c13c218 commit dd3d6df
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 30 deletions.
15 changes: 15 additions & 0 deletions ports/zstd/fix-c4703-error.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/lib/compress/zstd_lazy.c b/lib/compress/zstd_lazy.c
index 3d523e8..3dd1426 100644
--- a/lib/compress/zstd_lazy.c
+++ b/lib/compress/zstd_lazy.c
@@ -1296,8 +1296,8 @@ size_t ZSTD_RowFindBestMatch_generic (
size_t ddsIdx;
U32 ddsExtraAttempts; /* cctx hash tables are limited in searches, but allow extra searches into DDS */
U32 dmsTag;
- U32* dmsRow;
- BYTE* dmsTagRow;
+ U32* dmsRow = NULL;
+ BYTE* dmsTagRow = NULL;

if (dictMode == ZSTD_dedicatedDictSearch) {
const U32 ddsHashLog = dms->cParams.hashLog - ZSTD_LAZY_DDSS_BUCKET_LOG;
7 changes: 3 additions & 4 deletions ports/zstd/install_pkgpc.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt
index 179c9762..f86efdbc 100644
index 5f75665..dabc9d5 100644
--- a/build/cmake/lib/CMakeLists.txt
+++ b/build/cmake/lib/CMakeLists.txt
@@ -134,7 +134,7 @@ if (ZSTD_BUILD_STATIC)
@@ -130,7 +130,7 @@ if (ZSTD_BUILD_STATIC)
OUTPUT_NAME ${STATIC_LIBRARY_BASE_NAME})
endif ()

-if (UNIX OR MINGW)
+if (1)
# pkg-config
set(PREFIX "${CMAKE_INSTALL_PREFIX}")
set(EXEC_PREFIX "\${prefix}")

39 changes: 16 additions & 23 deletions ports/zstd/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO facebook/zstd
REF v1.4.9
SHA512 f529db9c094f9ae26428bf1fdfcc91c6d783d400980e0f0d802d2cf13c2be2931465ef568907e03841ff76a369a1447e7371f8799d8526edb9a513ba5c6db133
REF a488ba114ec17ea1054b9057c26a046fc122b3b6 #v1.5.0
SHA512 659576d0f52d2271b6b53f638b407b873888b1cffe4f014c3149d33a961653c2fcf7ff270bc669a5647205b573ef2809907645a4c89ab6c030ad65bce15547ae
HEAD_REF dev
PATCHES
install_pkgpc.patch
fix-c4703-error.patch
)

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(ZSTD_STATIC 1)
set(ZSTD_SHARED 0)
else()
set(ZSTD_STATIC 0)
set(ZSTD_SHARED 1)
endif()
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" ZSTD_BUILD_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" ZSTD_BUILD_SHARED)

if(VCPKG_TARGET_IS_WINDOWS)
# Enable multithreaded mode. CMake build doesn't provide a multithreaded
Expand All @@ -23,12 +19,11 @@ if(VCPKG_TARGET_IS_WINDOWS)
set(VCPKG_CXX_FLAGS "${VCPKG_CXX_FLAGS}")
endif()

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}/build/cmake
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/build/cmake"
OPTIONS
-DZSTD_BUILD_SHARED=${ZSTD_SHARED}
-DZSTD_BUILD_STATIC=${ZSTD_STATIC}
-DZSTD_BUILD_SHARED=${ZSTD_BUILD_SHARED}
-DZSTD_BUILD_STATIC=${ZSTD_BUILD_STATIC}
-DZSTD_LEGACY_SUPPORT=1
-DZSTD_BUILD_PROGRAMS=0
-DZSTD_BUILD_TESTS=0
Expand All @@ -37,9 +32,9 @@ vcpkg_configure_cmake(
-DCMAKE_DEBUG_POSTFIX=d) # this is against the maintainer guidelines.
# Removing it probably requires a vcpkg-cmake-wrapper.cmake to correct downstreams FindZSTD.cmake

vcpkg_install_cmake()
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/zstd)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/zstd)

# This enables find_package(ZSTD) and find_package(zstd) to find zstd on Linux(case sensitive filesystems)
file(RENAME "${CURRENT_PACKAGES_DIR}/share/${PORT}/zstdConfig.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/zstd-config.cmake")
Expand All @@ -59,18 +54,16 @@ endif()

vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")

if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
foreach(HEADER zdict.h zstd.h zstd_errors.h)
file(READ ${CURRENT_PACKAGES_DIR}/include/${HEADER} HEADER_CONTENTS)
string(REPLACE "defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1)" "1" HEADER_CONTENTS "${HEADER_CONTENTS}")
file(WRITE ${CURRENT_PACKAGES_DIR}/include/${HEADER} "${HEADER_CONTENTS}")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/${HEADER}" "defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1)" "1" )
endforeach()
endif()

file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(WRITE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright "ZSTD is dual licensed - see LICENSE and COPYING files\n")
file(COPY "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(COPY "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "ZSTD is dual licensed - see LICENSE and COPYING files\n")


14 changes: 12 additions & 2 deletions ports/zstd/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
{
"name": "zstd",
"version": "1.4.9",
"version-semver": "1.5.0",
"description": "Zstandard - Fast real-time compression algorithm",
"homepage": "https://facebook.github.io/zstd/"
"homepage": "https://facebook.github.io/zstd/",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -6969,7 +6969,7 @@
"port-version": 0
},
"zstd": {
"baseline": "1.4.9",
"baseline": "1.5.0",
"port-version": 0
},
"zstr": {
Expand Down
5 changes: 5 additions & 0 deletions versions/z-/zstd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "b605e1bf30a124c99845c16733aac48289ae6a87",
"version-semver": "1.5.0",
"port-version": 0
},
{
"git-tree": "3a0ffa2a8fe8246a3937d9f6a77d577e351dd445",
"version": "1.4.9",
Expand Down

0 comments on commit dd3d6df

Please sign in to comment.