Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 19 commits into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions ports/kf5archive/add_support_for_static_builds.patch
Original file line number Diff line number Diff line change
@@ -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

26 changes: 26 additions & 0 deletions ports/kf5archive/add_zstd_to_cmake_config.patch
Original file line number Diff line number Diff line change
@@ -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

27 changes: 27 additions & 0 deletions ports/kf5archive/only_pkg_check_modules_if_pkgconfig_found.patch
Original file line number Diff line number Diff line change
@@ -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

32 changes: 20 additions & 12 deletions ports/kf5archive/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,38 @@ vcpkg_from_github(
REF v5.84.0
SHA512 82926f62424446df0f4fc300f57ae9bd5baf8e13da2ce4135ac56c0c52a0307bffb06f84ac7e8e658e96ace2ae3d530f27e232061284ac87271404f218e9fdd4
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
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DBUILD_HTML_DOCS=OFF
-DBUILD_MAN_DOCS=OFF
-DBUILD_QTHELP_DOCS=OFF
-DBUILD_TESTING=OFF
${FEATURE_OPTIONS}
)

vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/KF5Archive)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME KF5Archive CONFIG_PATH lib/cmake/KF5Archive)
vcpkg_copy_pdbs()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
NancyLi1013 marked this conversation as resolved.
Show resolved Hide resolved
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/etc)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/etc)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/etc")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/etc")
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")
49 changes: 49 additions & 0 deletions ports/kf5archive/use_cmake_to_find_zstd.patch
Original file line number Diff line number Diff line change
@@ -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

27 changes: 25 additions & 2 deletions ports/kf5archive/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
{
"name": "kf5archive",
"version": "5.84.0",
"version-semver": "5.84.0",
"port-version": 1,
"description": "File compression",
"homepage": "https://api.kde.org/frameworks/karchive/html/index.html",
"dependencies": [
"bzip2",
"ecm",
"qt5-base",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
"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"
]
}
}
}
NancyLi1013 marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2862,7 +2862,7 @@
},
"kf5archive": {
"baseline": "5.84.0",
"port-version": 0
"port-version": 1
},
"kf5auth": {
"baseline": "5.84.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/k-/kf5archive.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "03f6943556e1d7600443c1f30445560de3f9b2f7",
"version-semver": "5.84.0",
"port-version": 1
},
{
"git-tree": "bc7b88da4daf014c751e4ab246a0104d850f5785",
"version": "5.84.0",
Expand Down