Re: git: b594c775ed2d - main - archivers/zstd: Update to 1.5.6

From: Daniel Engberg <daniel.engberg.lists_at_pyret.net>
Date: Sun, 31 Mar 2024 21:06:31 UTC
On 2024-03-31T20:56:10.000+02:00, Po-Chuan Hsieh <sunpoet@FreeBSD.org> wrote:
>  The branch main has been updated by sunpoet:
> 
> URL: https://cgit.FreeBSD.org/ports/commit/?id=b594c775ed2dbae25e509d198c462940f0dc9d5c
> 
> commit b594c775ed2dbae25e509d198c462940f0dc9d5c
> Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
> AuthorDate: 2024-03-31 18:50:47 +0000
> Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
> CommitDate: 2024-03-31 18:50:47 +0000
> 
>     archivers/zstd: Update to 1.5.6
>     
>     Changes:        https://github.com/facebook/zstd/releases
> ---
>  archivers/zstd/Makefile                            | 15 ++--------
>  archivers/zstd/distinfo                            |  6 ++--
>  archivers/zstd/files/zstdConfig.cmake              | 34 ++++++++++++++++++++++
>  archivers/zstd/files/zstdConfigVersion.cmake.in    |  5 ----
>  .../zstd/files/zstdTargets-BUILD_TYPE.cmake.in     |  2 +-
>  archivers/zstd/files/zstdTargets.cmake             | 16 +++++++---
>  archivers/zstd/pkg-plist                           |  1 -
>  7 files changed, 53 insertions(+), 26 deletions(-)
> 
> diff --git a/archivers/zstd/Makefile b/archivers/zstd/Makefile
> index 386af72d0ca8..00fefd673750 100644
> --- a/archivers/zstd/Makefile
> +++ b/archivers/zstd/Makefile
> @@ -1,6 +1,5 @@
>  PORTNAME=	zstd
> -PORTVERSION=	1.5.5
> -PORTREVISION=	1
> +PORTVERSION=	1.5.6
>  CATEGORIES=	archivers
>  MASTER_SITES=	https://github.com/facebook/zstd/releases/download/v${PORTVERSION}/
>  
> @@ -34,23 +33,15 @@ PLIST_SUB=	BUILD_TYPE=${BUILD_TYPE:tl} PORTVERSION=${PORTVERSION}
>  SUB_FILES=	zstdConfigVersion.cmake zstdTargets-BUILD_TYPE.cmake
>  SUB_LIST=	BUILD_TYPE_CAPS=${BUILD_TYPE:tu} BUILD_TYPE_MIXED=${BUILD_TYPE} PORTVERSION=${PORTVERSION}
>  
> -.if defined(WITH_DEBUG)
> -BUILD_TYPE=     Debug
> -.else
> -BUILD_TYPE=     Release
> -.endif
> +BUILD_TYPE=	${defined(WITH_DEBUG) :?Debug :Release}
>  
>  OPTIONS_DEFINE=	OPTIMIZED_CFLAGS
>  
>  OPTIMIZED_CFLAGS_VARS=	CFLAGS+=-O3
>  
> -post-build:
> -	cd ${WRKSRC}/programs && ${DO_MAKE_BUILD} zstd-frugal
> -
>  post-install:
>  	${MKDIR} ${STAGEDIR}${PREFIX}/lib/cmake/zstd
> -	${INSTALL_PROGRAM} ${WRKSRC}/programs/zstd-frugal ${STAGEDIR}${PREFIX}/bin/zstd-frugal
> -	${INSTALL_DATA} ${WRKSRC}/build/cmake/zstdConfig.cmake ${STAGEDIR}${PREFIX}/lib/cmake/zstd/zstdConfig.cmake
> +	${INSTALL_DATA} ${FILESDIR}/zstdConfig.cmake ${STAGEDIR}${PREFIX}/lib/cmake/zstd/zstdConfig.cmake
>  	${INSTALL_DATA} ${WRKDIR}/zstdConfigVersion.cmake ${STAGEDIR}${PREFIX}/lib/cmake/zstd/zstdConfigVersion.cmake
>  	${INSTALL_DATA} ${WRKDIR}/zstdTargets-BUILD_TYPE.cmake ${STAGEDIR}${PREFIX}/lib/cmake/zstd/zstdTargets-${BUILD_TYPE:tl}.cmake
>  	${INSTALL_DATA} ${FILESDIR}/zstdTargets.cmake ${STAGEDIR}${PREFIX}/lib/cmake/zstd/zstdTargets.cmake
> diff --git a/archivers/zstd/distinfo b/archivers/zstd/distinfo
> index d89bac34fc53..46a55033cd34 100644
> --- a/archivers/zstd/distinfo
> +++ b/archivers/zstd/distinfo
> @@ -1,3 +1,3 @@
> -TIMESTAMP = 1684104304
> -SHA256 (zstd-1.5.5.tar.zst) = ce264bca60eb2f0e99e4508cffd0d4d19dd362e84244d7fc941e79fa69ccf673
> -SIZE (zstd-1.5.5.tar.zst) = 1817544
> +TIMESTAMP = 1711540146
> +SHA256 (zstd-1.5.6.tar.zst) = 4aa8dd1c1115c0fd6b6b66c35c7f6ce7bd58cc1dfd3e4f175b45b39e84b14352
> +SIZE (zstd-1.5.6.tar.zst) = 1845516
> diff --git a/archivers/zstd/files/zstdConfig.cmake b/archivers/zstd/files/zstdConfig.cmake
> new file mode 100644
> index 000000000000..7cc9666dbaed
> --- /dev/null
> +++ b/archivers/zstd/files/zstdConfig.cmake
> @@ -0,0 +1,34 @@
> +
> +####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
> +####### Any changes to this file will be overwritten by the next CMake run ####
> +####### The input file was zstdConfig.cmake.in                            ########
> +
> +get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
> +
> +macro(set_and_check _var _file)
> +  set(${_var} "${_file}")
> +  if(NOT EXISTS "${_file}")
> +    message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
> +  endif()
> +endmacro()
> +
> +macro(check_required_components _NAME)
> +  foreach(comp ${${_NAME}_FIND_COMPONENTS})
> +    if(NOT ${_NAME}_${comp}_FOUND)
> +      if(${_NAME}_FIND_REQUIRED_${comp})
> +        set(${_NAME}_FOUND FALSE)
> +      endif()
> +    endif()
> +  endforeach()
> +endmacro()
> +
> +####################################################################################
> +
> +include(CMakeFindDependencyMacro)
> +if(ON AND "1")
> +  find_dependency(Threads)
> +endif()
> +
> +include("${CMAKE_CURRENT_LIST_DIR}/zstdTargets.cmake")
> +
> +check_required_components("zstd")
> diff --git a/archivers/zstd/files/zstdConfigVersion.cmake.in b/archivers/zstd/files/zstdConfigVersion.cmake.in
> index 74c5c7103a97..4528f77accac 100644
> --- a/archivers/zstd/files/zstdConfigVersion.cmake.in
> +++ b/archivers/zstd/files/zstdConfigVersion.cmake.in
> @@ -52,11 +52,6 @@ else()
>  endif()
>  
>  
> -# if the installed project requested no architecture check, don't perform the check
> -if("FALSE")
> -  return()
> -endif()
> -
>  # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
>  if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
>    return()
> diff --git a/archivers/zstd/files/zstdTargets-BUILD_TYPE.cmake.in b/archivers/zstd/files/zstdTargets-BUILD_TYPE.cmake.in
> index 72d7b1ba1e73..8dd7b7b22952 100644
> --- a/archivers/zstd/files/zstdTargets-BUILD_TYPE.cmake.in
> +++ b/archivers/zstd/files/zstdTargets-BUILD_TYPE.cmake.in
> @@ -18,7 +18,7 @@ list(APPEND _cmake_import_check_files_for_zstd::libzstd_shared "${_IMPORT_PREFIX
>  # Import target "zstd::libzstd_static" for configuration "%%BUILD_TYPE_MIXED%%"
>  set_property(TARGET zstd::libzstd_static APPEND PROPERTY IMPORTED_CONFIGURATIONS %%BUILD_TYPE_CAPS%%)
>  set_target_properties(zstd::libzstd_static PROPERTIES
> -  IMPORTED_LINK_INTERFACE_LANGUAGES_%%BUILD_TYPE_CAPS%% "C"
> +  IMPORTED_LINK_INTERFACE_LANGUAGES_%%BUILD_TYPE_CAPS%% "ASM;C"
>    IMPORTED_LOCATION_%%BUILD_TYPE_CAPS%% "${_IMPORT_PREFIX}/lib/libzstd.a"
>    )
>  
> diff --git a/archivers/zstd/files/zstdTargets.cmake b/archivers/zstd/files/zstdTargets.cmake
> index 60da8aa603e0..537317b1e571 100644
> --- a/archivers/zstd/files/zstdTargets.cmake
> +++ b/archivers/zstd/files/zstdTargets.cmake
> @@ -7,7 +7,7 @@ if(CMAKE_VERSION VERSION_LESS "2.8.3")
>     message(FATAL_ERROR "CMake &gt;= 2.8.3 required")
>  endif()
>  cmake_policy(PUSH)
> -cmake_policy(VERSION 2.8.3...3.23)
> +cmake_policy(VERSION 2.8.3...3.26)
>  #----------------------------------------------------------------
>  # Generated CMake target import file.
>  #----------------------------------------------------------------
> @@ -19,7 +19,7 @@ set(CMAKE_IMPORT_FILE_VERSION 1)
>  set(_cmake_targets_defined "")
>  set(_cmake_targets_not_defined "")
>  set(_cmake_expected_targets "")
> -foreach(_cmake_expected_target IN ITEMS zstd::libzstd_shared zstd::libzstd_static)
> +foreach(_cmake_expected_target IN ITEMS zstd::libzstd_shared zstd::libzstd_static zstd::libzstd)
>    list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
>    if(TARGET "${_cmake_expected_target}")
>      list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
> @@ -71,8 +71,16 @@ set_target_properties(zstd::libzstd_static PROPERTIES
>    INTERFACE_LINK_LIBRARIES "-pthread"
>  )
>  
> -if(CMAKE_VERSION VERSION_LESS 2.8.12)
> -  message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.")
> +# Create imported target zstd::libzstd
> +add_library(zstd::libzstd INTERFACE IMPORTED)
> +
> +set_target_properties(zstd::libzstd PROPERTIES
> +  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
> +  INTERFACE_LINK_LIBRARIES "zstd::libzstd_static"
> +)
> +
> +if(CMAKE_VERSION VERSION_LESS 3.0.0)
> +  message(FATAL_ERROR "This file relies on consumers using CMake 3.0.0 or greater.")
>  endif()
>  
>  # Load information for each installed configuration.
> diff --git a/archivers/zstd/pkg-plist b/archivers/zstd/pkg-plist
> index 2f26988884ce..5183e20b2d6c 100644
> --- a/archivers/zstd/pkg-plist
> +++ b/archivers/zstd/pkg-plist
> @@ -1,6 +1,5 @@
>  bin/unzstd
>  bin/zstd
> -bin/zstd-frugal
>  bin/zstdcat
>  bin/zstdgrep
> bin/zstdless

Hi,

Is there a reason why we can't adopt the CMake build instead which removes local patching, cleans up the Makefile and also builds quite a bit faster? It's already adoped by several other distros such as Arch Linux, Debian, Homebrew and OpenMandriva. Is there also any reason behind why zstd-frugal was removed?

PR 278008 is also related

Best regards,
Daniel