[kf5archive] fix cmake.in to allow consumption by static builds (#19194)

* [kf5archive] fix cmake.in to allow consumption by static builds

* [kf5archive] update versions

* [kf5archive] add lzma, zstd features

* [kf5archive] update versions

* [kf5archive] fix MAYBE_UNUSED_VARIABLES usage

* [kf5archive] replace deprecated functions

* [kf5archive] use semVer

* [kf5archive] update versions

* [kf5archive] add vcpkg_check_features

* [kf5archive] update versions

* [kf5archive] remove redundant option

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* [kf5archive] wrap all paths in quotes

* [kf5archive] update versions

* [kf5archive] lookup ZSTD using CMake

* [kf5archive] update versions

* [kf5archive] fix vcpkg_cmake_config_fixup() usage

* [kf5archive] update versions

* [kf5archive] rename patch files

* [kf5archive] update versions

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
This commit is contained in:
Dawid Wróbel 2021-09-01 20:19:07 +02:00 committed by GitHub
parent 021e10a7d5
commit d55546a5bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 199 additions and 15 deletions

View File

@ -0,0 +1,46 @@
From 5dc3f846c27ee6d55131db475975e3c24cd0c19c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dawid=20Wro=CC=81bel?= <me@dawidwrobel.com>
Date: Wed, 28 Jul 2021 11:39:30 +0200
Subject: [PATCH] Add support for static builds
---
KF5ArchiveConfig.cmake.in | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/KF5ArchiveConfig.cmake.in b/KF5ArchiveConfig.cmake.in
index 3d32642..0a738c2 100644
--- a/KF5ArchiveConfig.cmake.in
+++ b/KF5ArchiveConfig.cmake.in
@@ -4,9 +4,29 @@ include(CMakeFindDependencyMacro)
find_dependency(Qt5Core @REQUIRED_QT_VERSION@)
+set(KArchive_HAVE_ZLIB "@ZLIB_FOUND@")
set(KArchive_HAVE_BZIP2 "@BZIP2_FOUND@")
set(KArchive_HAVE_LZMA "@LIBLZMA_FOUND@")
set(KArchive_HAVE_ZSTD "@LibZstd_FOUND@")
+if (NOT @BUILD_SHARED_LIBS@)
+ if (@ZLIB_FOUND@)
+ find_dependency(ZLIB)
+ endif()
+
+ if (@BZIP2_FOUND@)
+ find_dependency(BZip2)
+ endif()
+
+ if (@LIBLZMA_FOUND@)
+ find_dependency(LibLZMA)
+ endif()
+
+ if (@LibZstd_FOUND@)
+ find_package(PkgConfig)
+ pkg_check_modules(LibZstd IMPORTED_TARGET "libzstd")
+ endif()
+endif()
+
include("${CMAKE_CURRENT_LIST_DIR}/KF5ArchiveTargets.cmake")
@PACKAGE_INCLUDE_QCHTARGETS@
--
GitLab

View File

@ -0,0 +1,26 @@
From 5a79756f381e1a1843cb2171bdc151dad53fb7db Mon Sep 17 00:00:00 2001
From: "Friedrich W. H. Kossebau" <kossebau@kde.org>
Date: Wed, 7 Jul 2021 03:09:38 +0200
Subject: [PATCH] Report KArchive_HAVE_ZSTD in CMake Config file to consumers
Allows users of KArchive to query whether zstd is available,
in the same way as lzma & bzip2
---
KF5ArchiveConfig.cmake.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/KF5ArchiveConfig.cmake.in b/KF5ArchiveConfig.cmake.in
index 0d59d63..3d32642 100644
--- a/KF5ArchiveConfig.cmake.in
+++ b/KF5ArchiveConfig.cmake.in
@@ -6,6 +6,7 @@ find_dependency(Qt5Core @REQUIRED_QT_VERSION@)
set(KArchive_HAVE_BZIP2 "@BZIP2_FOUND@")
set(KArchive_HAVE_LZMA "@LIBLZMA_FOUND@")
+set(KArchive_HAVE_ZSTD "@LibZstd_FOUND@")
include("${CMAKE_CURRENT_LIST_DIR}/KF5ArchiveTargets.cmake")
@PACKAGE_INCLUDE_QCHTARGETS@
--
GitLab

View File

@ -0,0 +1,27 @@
From 9ab5f2bfbe59038b0d0b6ca7f1b22d1c9229c67e Mon Sep 17 00:00:00 2001
From: Dawid Wrobel <me@dawidwrobel.com>
Date: Fri, 30 Jul 2021 10:23:48 +0000
Subject: [PATCH] Only pkg_check_modules() if PkgConfig is found
---
CMakeLists.txt | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bab7661..2cdda70 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -45,7 +45,9 @@ set_package_properties(LibLZMA PROPERTIES
)
find_package(PkgConfig)
-pkg_check_modules(LibZstd IMPORTED_TARGET "libzstd")
+if (PkgConfig_FOUND)
+ pkg_check_modules(LibZstd IMPORTED_TARGET "libzstd")
+endif()
add_feature_info(LibZstd LibZstd_FOUND
"Support for zstd compressed files and data streams"
)
--
GitLab

View File

@ -4,30 +4,38 @@ vcpkg_from_github(
REF v5.84.0 REF v5.84.0
SHA512 82926f62424446df0f4fc300f57ae9bd5baf8e13da2ce4135ac56c0c52a0307bffb06f84ac7e8e658e96ace2ae3d530f27e232061284ac87271404f218e9fdd4 SHA512 82926f62424446df0f4fc300f57ae9bd5baf8e13da2ce4135ac56c0c52a0307bffb06f84ac7e8e658e96ace2ae3d530f27e232061284ac87271404f218e9fdd4
HEAD_REF master HEAD_REF master
PATCHES
only_pkg_check_modules_if_pkgconfig_found.patch # https://invent.kde.org/frameworks/karchive/-/commit/9ab5f2bfbe59038b0d0b6ca7f1b22d1c9229c67e
add_zstd_to_cmake_config.patch # https://invent.kde.org/frameworks/karchive/-/commit/5a79756f381e1a1843cb2171bdc151dad53fb7db
add_support_for_static_builds.patch # https://invent.kde.org/frameworks/karchive/-/merge_requests/23
use_cmake_to_find_zstd.patch # https://invent.kde.org/frameworks/karchive/-/merge_requests/24
) )
vcpkg_configure_cmake( vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
INVERTED_FEATURES
"lzma" CMAKE_DISABLE_FIND_PACKAGE_LibLZMA
"zstd" CMAKE_DISABLE_FIND_PACKAGE_ZSTD
)
vcpkg_cmake_configure(
DISABLE_PARALLEL_CONFIGURE DISABLE_PARALLEL_CONFIGURE
SOURCE_PATH ${SOURCE_PATH} SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS OPTIONS
-DBUILD_HTML_DOCS=OFF
-DBUILD_MAN_DOCS=OFF
-DBUILD_QTHELP_DOCS=OFF
-DBUILD_TESTING=OFF -DBUILD_TESTING=OFF
${FEATURE_OPTIONS}
) )
vcpkg_install_cmake() vcpkg_cmake_install()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/KF5Archive) vcpkg_cmake_config_fixup(PACKAGE_NAME KF5Archive CONFIG_PATH lib/cmake/KF5Archive)
vcpkg_copy_pdbs() vcpkg_copy_pdbs()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif() endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/etc) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/etc")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/etc) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/etc")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(INSTALL ${SOURCE_PATH}/LICENSES/ DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright) file(INSTALL "${SOURCE_PATH}/LICENSES/" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright")

View File

@ -0,0 +1,49 @@
From 82fc20234d4cf8abdec1a2b4fea9823154f1aecc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dawid=20Wro=CC=81bel?= <me@dawidwrobel.com>
Date: Fri, 27 Aug 2021 01:48:53 +0200
Subject: [PATCH] Use CMake to find ZSTD
---
CMakeLists.txt | 11 +++++------
KF5ArchiveConfig.cmake.in | 3 +--
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8ab85f4..ece1f77 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,12 +44,11 @@ set_package_properties(LibLZMA PROPERTIES
PURPOSE "Support for xz compressed files and data streams"
)
-find_package(PkgConfig)
-if (PkgConfig_FOUND)
- pkg_check_modules(LibZstd IMPORTED_TARGET "libzstd")
-endif()
-add_feature_info(LibZstd LibZstd_FOUND
- "Support for zstd compressed files and data streams"
+find_package(ZSTD)
+set_package_properties(LibZstd PROPERTIES
+ URL "http://www.zstd.net"
+ DESCRIPTION "Support for zstd compressed files and data streams"
+ PURPOSE "Support for zstd compressed files and data streams"
)
include(ECMSetupVersion)
diff --git a/KF5ArchiveConfig.cmake.in b/KF5ArchiveConfig.cmake.in
index 0a738c2..d868324 100644
--- a/KF5ArchiveConfig.cmake.in
+++ b/KF5ArchiveConfig.cmake.in
@@ -23,8 +23,7 @@ if (NOT @BUILD_SHARED_LIBS@)
endif()
if (@LibZstd_FOUND@)
- find_package(PkgConfig)
- pkg_check_modules(LibZstd IMPORTED_TARGET "libzstd")
+ find_dependency(ZSTD)
endif()
endif()
--
GitLab

View File

@ -1,12 +1,35 @@
{ {
"name": "kf5archive", "name": "kf5archive",
"version": "5.84.0", "version-semver": "5.84.0",
"port-version": 1,
"description": "File compression", "description": "File compression",
"homepage": "https://api.kde.org/frameworks/karchive/html/index.html", "homepage": "https://api.kde.org/frameworks/karchive/html/index.html",
"dependencies": [ "dependencies": [
"bzip2", "bzip2",
"ecm", "ecm",
"qt5-base", "qt5-base",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
"zlib" "zlib"
] ],
"features": {
"lzma": {
"description": "Support for xz compressed files and data streams",
"dependencies": [
"liblzma"
]
},
"zstd": {
"description": "Support for zstd compressed files and data streams",
"dependencies": [
"zstd"
]
}
}
} }

View File

@ -2882,7 +2882,7 @@
}, },
"kf5archive": { "kf5archive": {
"baseline": "5.84.0", "baseline": "5.84.0",
"port-version": 0 "port-version": 1
}, },
"kf5attica": { "kf5attica": {
"baseline": "5.84.0", "baseline": "5.84.0",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "03f6943556e1d7600443c1f30445560de3f9b2f7",
"version-semver": "5.84.0",
"port-version": 1
},
{ {
"git-tree": "bc7b88da4daf014c751e4ab246a0104d850f5785", "git-tree": "bc7b88da4daf014c751e4ab246a0104d850f5785",
"version": "5.84.0", "version": "5.84.0",