[zstd] No debug postfix. No renaming of CMake config files. (#22822)

* Use upstream's standard filenames

* Update license info

* CMake style

* Revise downstream zstd patching

* Update versions

* Don't use '_static' lib name suffix

* Revise downstream zstd patching

* Add usage

* Update versions

* Update versions

* [zstd] Simplify consumers via fixed .pc and linkage alias

* [zstd] Fix missing IMPORTED

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
This commit is contained in:
Kai Pastor 2022-02-16 02:20:21 +01:00 committed by GitHub
parent 87179c1b43
commit d8783052cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 91 additions and 139 deletions

View File

@ -1,16 +1,3 @@
diff --git a/blosc/CMakeLists.txt b/blosc/CMakeLists.txt
index 1d1bebe..3a7a51c 100644
--- a/blosc/CMakeLists.txt
+++ b/blosc/CMakeLists.txt
@@ -109,7 +109,7 @@ endif(NOT DEACTIVATE_ZLIB)
if (NOT DEACTIVATE_ZSTD)
if (ZSTD_FOUND)
- set(LIBS ${LIBS} ${ZSTD_LIBRARY})
+ set(LIBS ${LIBS} ${ZSTD_LIBRARIES})
else (ZSTD_FOUND)
file(GLOB ZSTD_FILES
${ZSTD_LOCAL_DIR}/common/*.c
diff --git a/cmake/FindLZ4.cmake b/cmake/FindLZ4.cmake
index e581a80..8ce17c5 100644
--- a/cmake/FindLZ4.cmake
@ -63,45 +50,3 @@ index 688d4d5..c8b9a05 100644
+ SNAPPY DEFAULT_MSG
+ SNAPPY_LIBRARY SNAPPY_INCLUDE_DIR
+)
diff --git a/cmake/FindZstd.cmake b/cmake/FindZstd.cmake
index 7db4bb9..ba20ba6 100644
--- a/cmake/FindZstd.cmake
+++ b/cmake/FindZstd.cmake
@@ -1,10 +1,30 @@
+include(FindPackageHandleStandardArgs)
+
find_path(ZSTD_INCLUDE_DIR zstd.h)
-find_library(ZSTD_LIBRARY NAMES zstd)
+get_filename_component(_prefix_path ${ZSTD_INCLUDE_DIR} PATH)
+
+find_library(
+ ZSTD_LIBRARY_DEBUG
+ NAMES zstdd
+ PATHS ${_prefix_path}/debug/lib
+ NO_DEFAULT_PATH
+)
+
+find_library(
+ ZSTD_LIBRARY_RELEASE
+ NAMES zstd
+ PATHS ${_prefix_path}/lib
+ NO_DEFAULT_PATH
+)
+
+unset(_prefix_path)
+
+include(SelectLibraryConfigurations)
+select_library_configurations(ZSTD)
-if (ZSTD_INCLUDE_DIR AND ZSTD_LIBRARY)
- set(ZSTD_FOUND TRUE)
- message(STATUS "Found Zstd library: ${ZSTD_LIBRARY}")
-else ()
- message(STATUS "No Zstd library found. Using internal sources.")
-endif ()
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ ZSTD
+ REQUIRED_VARS ZSTD_LIBRARIES ZSTD_INCLUDE_DIR
+)

View File

@ -1,7 +1,7 @@
{
"name": "blosc",
"version-string": "1.18.1",
"port-version": 3,
"port-version": 4,
"description": "A blocking, shuffling and loss-less compression library that can be faster than `memcpy()`",
"homepage": "https://github.com/Blosc/c-blosc",
"dependencies": [

View File

@ -70,12 +70,6 @@ if("zstd" IN_LIST FEATURES)
list(APPEND B2_OPTIONS
-sZSTD_INCLUDE="${CURRENT_INSTALLED_DIR}/include"
)
# Overwride debug library name
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND B2_OPTIONS
-sZSTD_NAME=zstdd
)
endif()
list(APPEND B2_OPTIONS
-sZSTD_LIBRARY_PATH="${CURRENT_INSTALLED_DIR}/${lib_path_suffix}"
)

View File

@ -1,6 +1,7 @@
{
"name": "boost-iostreams",
"version": "1.78.0",
"port-version": 1,
"description": "Boost iostreams module",
"homepage": "https://github.com/boostorg/iostreams",
"supports": "!uwp",

View File

@ -39,8 +39,7 @@ index 5a2dc373e..b1928831e 100644
+eu_ZIPLIB(lzma,LZMA,[lzma lzmad],lzma_auto_decoder,[LZMA (xz)])
AS_IF([test "x$with_lzma" = xyes], [LIBLZMA="liblzma"], [LIBLZMA=""])
AC_SUBST([LIBLZMA])
-eu_ZIPLIB(zstd,ZSTD,zstd,ZSTD_decompress,[ZSTD (zst)])
+eu_ZIPLIB(zstd,ZSTD,[zstd zstdd zstd_static zstd_staticd],ZSTD_decompress,[ZSTD (zst)])
eu_ZIPLIB(zstd,ZSTD,zstd,ZSTD_decompress,[ZSTD (zst)])
AS_IF([test "x$with_zstd" = xyes], [LIBZSTD="libzstd"], [LIBLZSTD=""])
AC_SUBST([LIBZSTD])
-zip_LIBS="$LIBS"

View File

@ -1,6 +1,7 @@
{
"name": "elfutils",
"version-string": "0.186",
"port-version": 1,
"description": "elfutils is a collection of utilities and libraries to read, create and modify ELF binary files, find and handle DWARF debug data, symbols, thread state and stacktraces for processes and core files on GNU/Linux.",
"homepage": "https://sourceware.org/elfutils/",
"supports": "!windows",

View File

@ -67,23 +67,6 @@ index 4579fbb3d..f6be008c8 100644
fi
AC_DEFINE(HAVE_LIBLZMA, 1, "Compiled with lzma support")
with_lzma=yes],
@@ -215,12 +219,13 @@ AC_ARG_WITH([zstd],
AS_IF([test "x$with_zstd" != "xno"],
[
- AC_CHECK_LIB(zstd, ZSTD_createDStream, have_zstd=yes, have_zstd=no)
+ AC_SEARCH_LIBS(ZSTD_createDStream, [zstd zstdd], have_zstd=yes, have_zstd=no)
+ # AC_CHECK_LIB(zstd, ZSTD_createDStream, have_zstd=yes, have_zstd=no)
], [have_zstd=no])
AS_IF([test "x$have_zstd" = "xyes"], [
- if test "$ac_cv_lib_zstd_code" != "none required"; then
- LIBWANDIO_LIBS="$LIBWANDIO_LIBS -lzstd"
+ if test "$ac_cv_search_ZSTD_createDStream" != "none required"; then
+ LIBWANDIO_LIBS="$LIBWANDIO_LIBS $ac_cv_search_ZSTD_createDStream"
fi
AC_DEFINE(HAVE_LIBZSTD, 1, "Compiled with zstd support")
with_zstd=yes],
@@ -259,25 +264,28 @@ AC_ARG_WITH([lz4],
AS_IF([test "x$with_lz4" != "xno"],

View File

@ -1,7 +1,7 @@
{
"name": "libwandio",
"version-string": "4.2.1",
"port-version": 4,
"port-version": 5,
"description": "C library for simple and efficient file IO.",
"homepage": "https://github.com/wanduow/wandio",
"supports": "!windows",

View File

@ -1,16 +0,0 @@
diff --git a/configure.json b/configure.json
index 50d69b740..7149e6803 100644
--- a/configure.json
+++ b/configure.json
@@ -182,7 +182,10 @@
},
"sources": [
{ "type": "pkgConfig", "args": "libzstd >= 1.3" },
- "-lzstd"
+ "-lzstd",
+ "-lzstdd",
+ "-lzstd -pthread",
+ "-lzstdd -pthread"
]
},
"dbus": {

View File

@ -78,7 +78,6 @@ qt_download_submodule( OUT_SOURCE_PATH SOURCE_PATH
patches/icu.patch #Help configure find static icu builds in vcpkg on windows
patches/xlib.patch #Patches Xlib check to actually use Pkgconfig instead of makeSpec only
patches/egl.patch #Fix egl detection logic.
patches/zstdd.patch #Fix detection of zstd in debug builds
patches/mysql_plugin_include.patch #Fix include path of mysql plugin
patches/mysql-configure.patch #Fix mysql project
patches/cocoa.patch #Fix missing include on macOS Monterrey, https://code.qt.io/cgit/qt/qtbase.git/commit/src/plugins/platforms/cocoa?id=dece6f5840463ae2ddf927d65eb1b3680e34a547
@ -216,8 +215,8 @@ find_library(EXPAT_RELEASE NAMES expat PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_D
find_library(EXPAT_DEBUG NAMES expat PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
#Dependent libraries
find_library(ZSTD_RELEASE NAMES zstd zstd_static PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
find_library(ZSTD_DEBUG NAMES zstdd zstd_staticd PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
find_library(ZSTD_RELEASE NAMES zstd PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
find_library(ZSTD_DEBUG NAMES zstd PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
find_library(BZ2_RELEASE bz2 PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
find_library(BZ2_DEBUG bz2 bz2d PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
find_library(SSL_RELEASE ssl ssleay32 PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)

View File

@ -1,7 +1,7 @@
{
"name": "qt5-base",
"version-semver": "5.15.2",
"port-version": 19,
"port-version": 20,
"description": "Qt5 Application Framework Base Module. Includes Core, GUI, Widgets, Networking, SQL, Concurrent and other essential qt components.",
"homepage": "https://www.qt.io/",
"dependencies": [

View File

@ -0,0 +1,13 @@
diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt
index 8234060..765f003 100644
--- a/build/cmake/lib/CMakeLists.txt
+++ b/build/cmake/lib/CMakeLists.txt
@@ -112,7 +112,7 @@ endif ()
# With MSVC static library needs to be renamed to avoid conflict with import library
if (MSVC OR (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT MINGW))
- set(STATIC_LIBRARY_BASE_NAME zstd_static)
+ set(STATIC_LIBRARY_BASE_NAME zstd)
else ()
set(STATIC_LIBRARY_BASE_NAME zstd)
endif ()

View File

@ -6,18 +6,12 @@ vcpkg_from_github(
HEAD_REF dev
PATCHES
install_pkgpc.patch
no-static-suffix.patch
)
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
# library target, but it is the default in Makefile and VS projects.
set(VCPKG_C_FLAGS "${VCPKG_C_FLAGS} -DZSTD_MULTITHREAD")
set(VCPKG_CXX_FLAGS "${VCPKG_CXX_FLAGS}")
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/build/cmake"
OPTIONS
@ -27,40 +21,43 @@ vcpkg_cmake_configure(
-DZSTD_BUILD_PROGRAMS=0
-DZSTD_BUILD_TESTS=0
-DZSTD_BUILD_CONTRIB=0
OPTIONS_DEBUG
-DCMAKE_DEBUG_POSTFIX=d) # this is against the maintainer guidelines.
# Removing it probably requires a vcpkg-cmake-wrapper.cmake to correct downstreams FindZSTD.cmake
-DZSTD_MULTITHREAD_SUPPORT=1
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
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")
file(RENAME "${CURRENT_PACKAGES_DIR}/share/${PORT}/zstdConfigVersion.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/zstd-config-version.cmake")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
set(static_suffix "_static")
else()
set(static_suffix "")
endif()
if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libzstd.pc")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libzstd.pc" "-lzstd" "-lzstd${static_suffix}")
endif()
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libzstd.pc")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libzstd.pc" "-lzstd" "-lzstd${static_suffix}d")
endif()
vcpkg_fixup_pkgconfig()
file(READ "${CURRENT_PACKAGES_DIR}/share/zstd/zstdTargets.cmake" targets)
if(targets MATCHES "-pthread")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libzstd.pc" " -lzstd" " -lzstd -pthread")
if(NOT VCPKG_BUILD_TYPE)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libzstd.pc" " -lzstd" " -lzstd -pthread")
endif()
endif()
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)
foreach(HEADER IN ITEMS zdict.h zstd.h zstd_errors.h)
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")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(missing_target zstd::libzstd_static)
set(existing_target zstd::libzstd_shared)
else()
set(existing_target zstd::libzstd_static)
set(missing_target zstd::libzstd_shared)
endif()
file(WRITE "${CURRENT_PACKAGES_DIR}/share/zstd/zstdTargets-interface.cmake" "
add_library(${missing_target} IMPORTED INTERFACE)
set_target_properties(${missing_target} PROPERTIES INTERFACE_LINK_LIBRARIES ${existing_target})
")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(READ "${SOURCE_PATH}/LICENSE" bsd)
file(READ "${SOURCE_PATH}/COPYING" gpl)
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "ZSTD is dual licensed under BSD and GPLv2.\n\n${bsd}\n\n${gpl}")

4
ports/zstd/usage Normal file
View File

@ -0,0 +1,4 @@
The package zstd provides CMake targets:
find_package(zstd CONFIG REQUIRED)
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>)

View File

@ -1,8 +1,10 @@
{
"name": "zstd",
"version": "1.5.2",
"port-version": 1,
"description": "Zstandard - Fast real-time compression algorithm",
"homepage": "https://facebook.github.io/zstd/",
"license": "BSD-3-Clause OR GPL-2.0-only",
"dependencies": [
{
"name": "vcpkg-cmake",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a95e4b34ff47ed69f3e644405efe80b8c46aee14",
"version-string": "1.18.1",
"port-version": 4
},
{
"git-tree": "a9ae0480271a2db8d001d389b4c62af49ea50770",
"version-string": "1.18.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1e23d8d78c5a33ee92fc1ec70db8125db72032a2",
"version": "1.78.0",
"port-version": 1
},
{
"git-tree": "7e240f9d647c1142b5b61c9a635e3aa186756802",
"version": "1.78.0",

View File

@ -502,7 +502,7 @@
},
"blosc": {
"baseline": "1.18.1",
"port-version": 3
"port-version": 4
},
"boinc": {
"baseline": "7.18.1",
@ -766,7 +766,7 @@
},
"boost-iostreams": {
"baseline": "1.78.0",
"port-version": 0
"port-version": 1
},
"boost-iterator": {
"baseline": "1.78.0",
@ -2014,7 +2014,7 @@
},
"elfutils": {
"baseline": "0.186",
"port-version": 0
"port-version": 1
},
"embree2": {
"baseline": "2.17.7",
@ -4086,7 +4086,7 @@
},
"libwandio": {
"baseline": "4.2.1",
"port-version": 4
"port-version": 5
},
"libwebm": {
"baseline": "1.0.0.28",
@ -5594,7 +5594,7 @@
},
"qt5-base": {
"baseline": "5.15.2",
"port-version": 19
"port-version": 20
},
"qt5-canvas3d": {
"baseline": "0",
@ -7554,7 +7554,7 @@
},
"zstd": {
"baseline": "1.5.2",
"port-version": 0
"port-version": 1
},
"zstr": {
"baseline": "1.0.4",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1e219cc99d3cfb41ba24f835240acf510a62bc3c",
"version-string": "0.186",
"port-version": 1
},
{
"git-tree": "18162722eb91e8a24f6ce1ba945a8a2e1af90896",
"version-string": "0.186",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "8340fce2f7c5dd26c578bb7c59f8d3f8d982c105",
"version-string": "4.2.1",
"port-version": 5
},
{
"git-tree": "ffa2cfbc601c2a9a2fdcbc20f44b312597952ec6",
"version-string": "4.2.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "f21ebf7bf6644292d70d9c564c1408a224f26c77",
"version-semver": "5.15.2",
"port-version": 20
},
{
"git-tree": "5a9c2b85fd5f62bb1b52f18c4628b0e08d765dd4",
"version-semver": "5.15.2",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "2f8a5da3f925dc994500dabb2d3b5c7e11df0afd",
"version": "1.5.2",
"port-version": 1
},
{
"git-tree": "4e0feee1fa5d2c318aa16702dc6c89d9301a8ddb",
"version": "1.5.2",