From 14dd6ea5cd2e88b482088d43b46a9a53858a08b0 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Wed, 30 Oct 2024 09:56:11 +0700 Subject: [PATCH 1/5] Add 7z and rar archive handling support in gdal --- vcpkg/ports/gdal/cmake-project-include.cmake | 13 + vcpkg/ports/gdal/find-link-libraries.patch | 109 ++++++ .../gdal/fix-gdal-target-interfaces.patch | 15 + vcpkg/ports/gdal/libkml.patch | 46 +++ vcpkg/ports/gdal/portfile.cmake | 173 ++++++++++ vcpkg/ports/gdal/target-is-valid.patch | 21 ++ vcpkg/ports/gdal/usage | 4 + vcpkg/ports/gdal/vcpkg-cmake-wrapper.cmake | 23 ++ vcpkg/ports/gdal/vcpkg.json | 326 ++++++++++++++++++ 9 files changed, 730 insertions(+) create mode 100644 vcpkg/ports/gdal/cmake-project-include.cmake create mode 100644 vcpkg/ports/gdal/find-link-libraries.patch create mode 100644 vcpkg/ports/gdal/fix-gdal-target-interfaces.patch create mode 100644 vcpkg/ports/gdal/libkml.patch create mode 100644 vcpkg/ports/gdal/portfile.cmake create mode 100644 vcpkg/ports/gdal/target-is-valid.patch create mode 100644 vcpkg/ports/gdal/usage create mode 100644 vcpkg/ports/gdal/vcpkg-cmake-wrapper.cmake create mode 100644 vcpkg/ports/gdal/vcpkg.json diff --git a/vcpkg/ports/gdal/cmake-project-include.cmake b/vcpkg/ports/gdal/cmake-project-include.cmake new file mode 100644 index 0000000000..409b7b1a64 --- /dev/null +++ b/vcpkg/ports/gdal/cmake-project-include.cmake @@ -0,0 +1,13 @@ +if(GDAL_USE_KEA) + find_package(Kealib CONFIG REQUIRED) + add_library(KEA::KEA ALIAS Kealib::Kealib) + set(GDAL_CHECK_PACKAGE_KEA_NAMES Kealib CACHE INTERNAL "vcpkg") + set(GDAL_CHECK_PACKAGE_KEA_TARGETS Kealib::Kealib CACHE INTERNAL "vcpkg") +endif() + +if(GDAL_USE_WEBP) + find_package(WebP CONFIG REQUIRED) + add_library(WEBP::WebP ALIAS WebP::webp) + set(GDAL_CHECK_PACKAGE_WebP_NAMES WebP CACHE INTERNAL "vcpkg") + set(GDAL_CHECK_PACKAGE_WebP_TARGETS WebP::webp CACHE INTERNAL "vcpkg") +endif() diff --git a/vcpkg/ports/gdal/find-link-libraries.patch b/vcpkg/ports/gdal/find-link-libraries.patch new file mode 100644 index 0000000000..a802e42645 --- /dev/null +++ b/vcpkg/ports/gdal/find-link-libraries.patch @@ -0,0 +1,109 @@ +diff --git a/cmake/modules/packages/FindFreeXL.cmake b/cmake/modules/packages/FindFreeXL.cmake +index 6c86fb8..0634412 100644 +--- a/cmake/modules/packages/FindFreeXL.cmake ++++ b/cmake/modules/packages/FindFreeXL.cmake +@@ -37,7 +37,15 @@ include(SelectLibraryConfigurations) + + find_package(PkgConfig QUIET) + if(PKG_CONFIG_FOUND) +- pkg_check_modules(PC_FREEXL QUIET freexl) ++ pkg_check_modules(PC_FREEXL QUIET IMPORTED_TARGET freexl) ++endif() ++if(PC_FREEXL_FOUND) ++ set(FREEXL_INCLUDE_DIR "${PC_FREEXL_INCLUDE_DIRS}" CACHE STRING "") ++ set(FREEXL_LIBRARY "${PC_FREEXL_LIBRARIES}" CACHE STRING "") ++ if(NOT TARGET FREEXL::freexl) ++ add_library(FREEXL::freexl INTERFACE IMPORTED) ++ set_target_properties(FREEXL::freexl PROPERTIES INTERFACE_LINK_LIBRARIES PkgConfig::PC_FREEXL) ++ endif() + endif() + + find_path(FREEXL_INCLUDE_DIR +diff --git a/cmake/modules/packages/FindOpenJPEG.cmake b/cmake/modules/packages/FindOpenJPEG.cmake +index c697484..6e83222 100644 +--- a/cmake/modules/packages/FindOpenJPEG.cmake ++++ b/cmake/modules/packages/FindOpenJPEG.cmake +@@ -32,9 +32,18 @@ endfunction() + + find_package(PkgConfig QUIET) + if(PKG_CONFIG_FOUND) +- pkg_check_modules(PC_OPENJPEG QUIET libopenjp2) ++ pkg_check_modules(PC_OPENJPEG QUIET IMPORTED_TARGET libopenjp2) + set(OpenJPEG_VERSION_STRING ${PC_OPENJPEG_VERSION}) + endif() ++if(PC_OPENJPEG_FOUND) ++ set(OPENJPEG_INCLUDE_DIR "${PC_OPENJPEG_INCLUDE_DIRS}" CACHE STRING "") ++ set(OPENJPEG_LIBRARY "${PC_OPENJPEG_LIBRARIES}" CACHE STRING "") ++ if(NOT TARGET OPENJPEG::OpenJPEG) ++ add_library(OPENJPEG::OpenJPEG INTERFACE IMPORTED) ++ set_target_properties(OPENJPEG::OpenJPEG PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PC_OPENJPEG_INCLUDE_DIRS}") ++ set_target_properties(OPENJPEG::OpenJPEG PROPERTIES INTERFACE_LINK_LIBRARIES PkgConfig::PC_OPENJPEG) ++ endif() ++endif() + + + find_path(OPENJPEG_INCLUDE_DIR opj_config.h +diff --git a/cmake/modules/packages/FindPoppler.cmake b/cmake/modules/packages/FindPoppler.cmake +index 3807ec0..8059eb4 100644 +--- a/cmake/modules/packages/FindPoppler.cmake ++++ b/cmake/modules/packages/FindPoppler.cmake +@@ -42,11 +42,19 @@ This module defines the following variables: + + find_package(PkgConfig QUIET) + if(PKG_CONFIG_FOUND) +- pkg_check_modules(PC_Poppler QUIET poppler) ++ pkg_check_modules(PC_Poppler QUIET IMPORTED_TARGET poppler) + if(PC_Poppler_VERSION) + set(Poppler_VERSION_STRING ${PC_Poppler_VERSION}) + endif() + endif() ++if(PC_Poppler_FOUND) ++ find_path(Poppler_INCLUDE_DIR NAMES Object.h PATHS ${PC_Poppler_INCLUDE_DIRS} NO_DEFAULT_PATH) ++ set(Poppler_LIBRARY "${PC_Poppler_LIBRARIES}" CACHE STRING "") ++ if(NOT TARGET Poppler::Poppler) ++ add_library(Poppler::Poppler INTERFACE IMPORTED) ++ set_target_properties(Poppler::Poppler PROPERTIES INTERFACE_LINK_LIBRARIES PkgConfig::PC_Poppler) ++ endif() ++endif() + find_path(Poppler_INCLUDE_DIR NAMES "poppler-config.h" "cpp/poppler-version.h" "qt5/poppler-qt5.h" "qt4/poppler-qt4.h" + "glib/poppler.h" + HINTS ${PC_Poppler_INCLUDE_DIRS} +@@ -77,6 +85,15 @@ endforeach() + foreach(_comp IN LISTS Poppler_known_components) + list(FIND Poppler_FIND_COMPONENTS "${_comp}" _nextcomp) + if(_nextcomp GREATER -1) ++ pkg_check_modules(PC_Poppler_${_comp} QUIET IMPORTED_TARGET ${Poppler_${_comp}_pkg_config}) ++ if(PC_Poppler_${_comp}_FOUND) ++ set(Poppler_${_comp}_INCLUDE_DIR "${PC_Poppler_${_comp}_INCLUDE_DIRS}" CACHE STRING "") ++ set(Poppler_${_comp}_LIBRARY "${PC_Poppler_${_comp}_LIBRARIES}" CACHE STRING "") ++ if(NOT TARGET Poppler::Poppler_${_comp}) ++ add_library(Poppler::${_comp} INTERFACE IMPORTED) ++ set_target_properties(Poppler::${_comp} PROPERTIES INTERFACE_LINK_LIBRARIES PkgConfig::PC_Poppler_${_comp}) ++ endif() ++ endif() + find_path(Poppler_${_comp}_INCLUDE_DIR + NAMES ${Poppler_${_comp}_header} + PATH_SUFFIXES poppler +diff --git a/cmake/modules/packages/FindSPATIALITE.cmake b/cmake/modules/packages/FindSPATIALITE.cmake +index 00612b0..6388719 100644 +--- a/cmake/modules/packages/FindSPATIALITE.cmake ++++ b/cmake/modules/packages/FindSPATIALITE.cmake +@@ -38,9 +38,17 @@ endif() + + find_package(PkgConfig QUIET) + if(PKG_CONFIG_FOUND) +- pkg_check_modules(PC_SPATIALITE QUIET spatialite) ++ pkg_check_modules(PC_SPATIALITE QUIET IMPORTED_TARGET spatialite) + set(SPATIALITE_VERSION_STRING ${PC_SPATIALITE_VERSION}) + endif() ++if(PC_SPATIALITE_FOUND) ++ set(SPATIALITE_INCLUDE_DIR "${PC_SPATIALITE_INCLUDE_DIRS}" CACHE STRING "") ++ set(SPATIALITE_LIBRARY "${PC_SPATIALITE_LIBRARIES}" CACHE STRING "") ++ if(NOT TARGET SPATIALITE::SPATIALITE) ++ add_library(SPATIALITE::SPATIALITE INTERFACE IMPORTED) ++ set_target_properties(SPATIALITE::SPATIALITE PROPERTIES INTERFACE_LINK_LIBRARIES PkgConfig::PC_SPATIALITE) ++ endif() ++endif() + + find_path(SPATIALITE_INCLUDE_DIR + NAMES spatialite.h diff --git a/vcpkg/ports/gdal/fix-gdal-target-interfaces.patch b/vcpkg/ports/gdal/fix-gdal-target-interfaces.patch new file mode 100644 index 0000000000..bf159fce59 --- /dev/null +++ b/vcpkg/ports/gdal/fix-gdal-target-interfaces.patch @@ -0,0 +1,15 @@ +diff --git a/cmake/helpers/GdalDriverHelper.cmake b/cmake/helpers/GdalDriverHelper.cmake +index 838f0fd..380e20d 100644 +--- a/cmake/helpers/GdalDriverHelper.cmake ++++ b/cmake/helpers/GdalDriverHelper.cmake +@@ -248,6 +248,10 @@ function(gdal_target_interfaces _TARGET) + if (_res) + target_compile_options(${_TARGET} PRIVATE ${_res}) + endif () ++ get_property(_res TARGET ${_LIB} PROPERTY INTERFACE_LINK_LIBRARIES) ++ if (_res) ++ gdal_target_interfaces(${_TARGET} ${_res}) ++ endif () + endif () + endforeach () + endfunction() diff --git a/vcpkg/ports/gdal/libkml.patch b/vcpkg/ports/gdal/libkml.patch new file mode 100644 index 0000000000..ef25d06de5 --- /dev/null +++ b/vcpkg/ports/gdal/libkml.patch @@ -0,0 +1,46 @@ +diff --git a/cmake/modules/packages/FindLibKML.cmake b/cmake/modules/packages/FindLibKML.cmake +index 9418247..589b83d 100644 +--- a/cmake/modules/packages/FindLibKML.cmake ++++ b/cmake/modules/packages/FindLibKML.cmake +@@ -56,6 +56,8 @@ find_library(LIBKML_BASE_LIBRARY + HINTS ${PC_LIBKML_LIBRARY_DIRS} ) + mark_as_advanced(LIBKML_BASE_LIBRARY) + ++cmake_policy(PUSH) ++cmake_policy(SET CMP0057 NEW) + set(libkml_known_components DOM CONVENIENCE ENGINE REGIONATOR) + foreach(_comp IN LISTS libkml_known_components) + if(${_comp} IN_LIST LibKML_FIND_COMPONENTS) +@@ -99,21 +101,20 @@ find_package_handle_standard_args(LibKML + if(LIBKML_FOUND) + set(LIBKML_INCLUDE_DIRS "${LIBKML_INCLUDE_DIR}") + set(LIBKML_LIBRARIES "${LIBKML_BASE_LIBRARY}") ++ find_package(LibKML CONFIG REQUIRED) + if(NOT TARGET LIBKML::LibKML) +- add_library(LIBKML::LibKML UNKNOWN IMPORTED) ++ add_library(LIBKML::LibKML INTERFACE IMPORTED) + set_target_properties(LIBKML::LibKML PROPERTIES +- INTERFACE_INCLUDE_DIRECTORIES "${LIBKML_INCLUDE_DIR}" +- IMPORTED_LINK_INTERFACE_LANGUAGES "C++" +- IMPORTED_LOCATION "${LIBKML_BASE_LIBRARY}") ++ INTERFACE_LINK_LIBRARIES kmlbase) + endif() + foreach(_comp IN LISTS libkml_known_components) + if(${_comp} IN_LIST LibKML_FIND_COMPONENTS) ++ string(TOLOWER ${_comp} _name) + list(APPEND LIBKML_LIBRARIES "${LIBKML_${_comp}_LIBRARY}") + if(NOT TARGET LIBKML::${_comp}) +- add_library(LIBKML::${_comp} UNKNOWN IMPORTED) ++ add_library(LIBKML::${_comp} INTERFACE IMPORTED) + set_target_properties(LIBKML::${_comp} PROPERTIES +- IMPORTED_LINK_INTERFACE_LANGUAGES "C++" +- IMPORTED_LOCATION "${LIBKML_${_comp}_LIBRARY}") ++ INTERFACE_LINK_LIBRARIES kml${_name}) + endif() + endif() + endforeach() +@@ -129,3 +130,4 @@ if(LIBKML_FOUND) + endif() + endforeach() + endif() ++cmake_policy(POP) diff --git a/vcpkg/ports/gdal/portfile.cmake b/vcpkg/ports/gdal/portfile.cmake new file mode 100644 index 0000000000..297a755d38 --- /dev/null +++ b/vcpkg/ports/gdal/portfile.cmake @@ -0,0 +1,173 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO OSGeo/gdal + REF "v${VERSION}" + SHA512 fccdcf484bdc833dc5f0d6ad1fce9d152fa8b861cf23b634400d8bf7fd97d2c33a6b87050538c5a6c896d4ba870469134521cc44fdad3e071adffbf29329cb9b + HEAD_REF master + PATCHES + find-link-libraries.patch + fix-gdal-target-interfaces.patch + libkml.patch + target-is-valid.patch +) +# `vcpkg clean` stumbles over one subdir +file(REMOVE_RECURSE "${SOURCE_PATH}/autotest") + +# Avoid abseil, no matter if vcpkg or system +vcpkg_replace_string("${SOURCE_PATH}/ogr/ogrsf_frmts/flatgeobuf/flatbuffers/base.h" [[__has_include("absl/strings/string_view.h")]] "(0)") + +# Cf. cmake/helpers/CheckDependentLibraries.cmake +# The default for all `GDAL_USE_` dependencies is `OFF`. +# Here, we explicitly control dependencies provided via vpcpkg. +# "core" is used for a dependency which must be enabled to avoid vendored lib. +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + archive GDAL_USE_ARCHIVE + cfitsio GDAL_USE_CFITSIO + curl GDAL_USE_CURL + expat GDAL_USE_EXPAT + freexl GDAL_USE_FREEXL + geos GDAL_USE_GEOS + core GDAL_USE_GEOTIFF + gif GDAL_USE_GIF + hdf5 GDAL_USE_HDF5 + iconv GDAL_USE_ICONV + jpeg GDAL_USE_JPEG + core GDAL_USE_JSONC + kea GDAL_USE_KEA + lerc GDAL_USE_LERC + libkml GDAL_USE_LIBKML + lzma GDAL_USE_LIBLZMA + libxml2 GDAL_USE_LIBXML2 + mysql-libmariadb GDAL_USE_MYSQL + netcdf GDAL_USE_NETCDF + odbc GDAL_USE_ODBC + openjpeg GDAL_USE_OPENJPEG + openssl GDAL_USE_OPENSSL + pcre2 GDAL_USE_PCRE2 + png GDAL_USE_PNG + poppler GDAL_USE_POPPLER + postgresql GDAL_USE_POSTGRESQL + qhull GDAL_USE_QHULL + #core GDAL_USE_SHAPELIB # https://github.com/OSGeo/gdal/issues/5711, https://github.com/microsoft/vcpkg/issues/16041 + core GDAL_USE_SHAPELIB_INTERNAL + libspatialite GDAL_USE_SPATIALITE + sqlite3 GDAL_USE_SQLITE3 + core GDAL_USE_TIFF + webp GDAL_USE_WEBP + core GDAL_USE_ZLIB + zstd GDAL_USE_ZSTD + tools BUILD_APPS + INVERTED_FEATURES + libspatialite CMAKE_DISABLE_FIND_PACKAGE_SPATIALITE +) +if(GDAL_USE_ICONV AND VCPKG_TARGET_IS_WINDOWS) + list(APPEND FEATURE_OPTIONS -D_ICONV_SECOND_ARGUMENT_IS_NOT_CONST=ON) +endif() + +# Compatibility with older Android versions https://github.com/OSGeo/gdal/pull/5941 +if(VCPKG_TARGET_IS_ANDROID AND ANRDOID_PLATFORM VERSION_LESS 24 AND (VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")) + list(APPEND FEATURE_OPTIONS -DBUILD_WITHOUT_64BIT_OFFSET=ON) +endif() + +string(REPLACE "dynamic" "" qhull_target "Qhull::qhull${VCPKG_LIBRARY_LINKAGE}_r") + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DVCPKG_HOST_TRIPLET=${HOST_TRIPLET} # for host pkgconf in PATH + ${FEATURE_OPTIONS} + -DBUILD_DOCS=OFF + -DBUILD_PYTHON_BINDINGS=OFF + -DBUILD_TESTING=OFF + -DCMAKE_DISABLE_FIND_PACKAGE_CSharp=ON + -DCMAKE_DISABLE_FIND_PACKAGE_Java=ON + -DCMAKE_DISABLE_FIND_PACKAGE_JNI=ON + -DCMAKE_DISABLE_FIND_PACKAGE_SWIG=ON + -DCMAKE_DISABLE_FIND_PACKAGE_Arrow=ON + -DGDAL_USE_INTERNAL_LIBS=OFF + -DGDAL_USE_EXTERNAL_LIBS=OFF + -DGDAL_BUILD_OPTIONAL_DRIVERS=ON + -DOGR_BUILD_OPTIONAL_DRIVERS=ON + -DFIND_PACKAGE2_KEA_ENABLED=OFF + -DGDAL_CHECK_PACKAGE_MySQL_NAMES=unofficial-libmariadb + -DGDAL_CHECK_PACKAGE_MySQL_TARGETS=unofficial::libmariadb + -DMYSQL_LIBRARIES=unofficial::libmariadb + -DGDAL_CHECK_PACKAGE_NetCDF_NAMES=netCDF + -DGDAL_CHECK_PACKAGE_NetCDF_TARGETS=netCDF::netcdf + -DGDAL_CHECK_PACKAGE_QHULL_NAMES=Qhull + "-DGDAL_CHECK_PACKAGE_QHULL_TARGETS=${qhull_target}" + "-DQHULL_LIBRARY=${qhull_target}" + "-DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_LIST_DIR}/cmake-project-include.cmake" + OPTIONS_DEBUG + -DBUILD_APPS=OFF + MAYBE_UNUSED_VARIABLES + QHULL_LIBRARY +) +vcpkg_cmake_install() +vcpkg_copy_pdbs() +vcpkg_fixup_pkgconfig() +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/gdal) +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/gdal/GDALConfig.cmake" + "include(CMakeFindDependencyMacro)" + "include(CMakeFindDependencyMacro) +# gdal needs a pkg-config tool. A host dependency provides pkgconf. +get_filename_component(vcpkg_host_prefix \"\${CMAKE_CURRENT_LIST_DIR}/../../../${HOST_TRIPLET}\" ABSOLUTE) +list(APPEND CMAKE_PROGRAM_PATH \"\${vcpkg_host_prefix}/tools/pkgconf\")" +) + +if (BUILD_APPS) + vcpkg_copy_tools( + TOOL_NAMES + gdal_contour + gdal_create + gdal_footprint + gdal_grid + gdal_rasterize + gdal_translate + gdal_viewshed + gdaladdo + gdalbuildvrt + gdaldem + gdalenhance + gdalinfo + gdallocationinfo + gdalmanage + gdalmdiminfo + gdalmdimtranslate + gdalsrsinfo + gdaltindex + gdaltransform + gdalwarp + gnmanalyse + gnmmanage + nearblack + ogr2ogr + ogrinfo + ogrlineref + ogrtindex + sozip + AUTO_CLEAN + ) +endif() + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share" +) + +file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/gdal-config" "${CURRENT_PACKAGES_DIR}/debug/bin/gdal-config") + +file(GLOB bin_files "${CURRENT_PACKAGES_DIR}/bin/*") +if(NOT bin_files) + file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/bin" + "${CURRENT_PACKAGES_DIR}/debug/bin" + ) +endif() + +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/cpl_config.h" "#define GDAL_PREFIX \"${CURRENT_PACKAGES_DIR}\"" "") + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.TXT") diff --git a/vcpkg/ports/gdal/target-is-valid.patch b/vcpkg/ports/gdal/target-is-valid.patch new file mode 100644 index 0000000000..c7acf73906 --- /dev/null +++ b/vcpkg/ports/gdal/target-is-valid.patch @@ -0,0 +1,21 @@ +diff --git a/cmake/helpers/CheckDependentLibraries.cmake b/cmake/helpers/CheckDependentLibraries.cmake +index f5c920a..53494c9 100644 +--- a/cmake/helpers/CheckDependentLibraries.cmake ++++ b/cmake/helpers/CheckDependentLibraries.cmake +@@ -41,6 +41,7 @@ endif() + # https://github.com/OSGeo/gdal/issues/5324 + function (gdal_check_target_is_valid target res_var) + get_target_property(_interface_include_directories ${target} "INTERFACE_INCLUDE_DIRECTORIES") ++ get_target_property(_type ${target} "TYPE") + if(_interface_include_directories) + foreach(_dir IN LISTS _interface_include_directories) + if(NOT EXISTS "${_dir}") +@@ -54,7 +55,7 @@ function (gdal_check_target_is_valid target res_var) + # property, but a GeoTIFF_INCLUDE_DIRS variable. + set_target_properties(${target} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GeoTIFF_INCLUDE_DIRS}") +- else() ++ elseif(NOT _type STREQUAL "INTERFACE" AND _type STREQUAL "ALIAS") + message(WARNING "Target ${target} has no INTERFACE_INCLUDE_DIRECTORIES property. Ignoring that target.") + set(${res_var} FALSE PARENT_SCOPE) + return() diff --git a/vcpkg/ports/gdal/usage b/vcpkg/ports/gdal/usage new file mode 100644 index 0000000000..6982a9a242 --- /dev/null +++ b/vcpkg/ports/gdal/usage @@ -0,0 +1,4 @@ +The package GDAL provides CMake targets: + + find_package(GDAL CONFIG REQUIRED) + target_link_libraries(main PRIVATE GDAL::GDAL) diff --git a/vcpkg/ports/gdal/vcpkg-cmake-wrapper.cmake b/vcpkg/ports/gdal/vcpkg-cmake-wrapper.cmake new file mode 100644 index 0000000000..5b70b673b0 --- /dev/null +++ b/vcpkg/ports/gdal/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,23 @@ +cmake_policy(PUSH) +cmake_policy(SET CMP0012 NEW) +cmake_policy(SET CMP0054 NEW) + +list(REMOVE_ITEM ARGS "NO_MODULE" "CONFIG" "MODULE") +list(APPEND ARGS "CONFIG") +# The current port version should satisfy GDAL 3.0 ... 3.5 +list(GET ARGS 1 vcpkg_gdal_maybe_version) +if(vcpkg_gdal_maybe_version MATCHES "(^3\$|^3[.][0-5])") + list(REMOVE_AT ARGS "1") +endif() +unset(vcpkg_gdal_maybe_version) +_find_package(${ARGS} CONFIG) +if(GDAL_FOUND) + get_filename_component(vcpkg_gdal_prefix "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE) + set(GDAL_INCLUDE_DIR "${vcpkg_gdal_prefix}/include" CACHE INTERNAL "") + set(GDAL_INCLUDE_DIRS "${GDAL_INCLUDE_DIR}") + set(GDAL_LIBRARY GDAL::GDAL CACHE INTERNAL "") + set(GDAL_LIBRARIES "${GDAL_LIBRARY}") + unset(vcpkg_gdal_prefix) +endif() + +cmake_policy(POP) diff --git a/vcpkg/ports/gdal/vcpkg.json b/vcpkg/ports/gdal/vcpkg.json new file mode 100644 index 0000000000..1ff0781ec3 --- /dev/null +++ b/vcpkg/ports/gdal/vcpkg.json @@ -0,0 +1,326 @@ +{ + "name": "gdal", + "version-semver": "3.9.3", + "description": "The Geographic Data Abstraction Library for reading and writing geospatial raster and vector data", + "homepage": "https://gdal.org", + "license": null, + "supports": "!uwp", + "dependencies": [ + "json-c", + "libgeotiff", + { + "name": "pkgconf", + "host": true + }, + { + "name": "proj", + "default-features": false, + "features": [ + "tiff" + ] + }, + { + "name": "tiff", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + { + "name": "vcpkg-pkgconfig-get-modules", + "host": true + }, + "zlib" + ], + "default-features": [ + "default-features" + ], + "features": { + "archive": { + "description": "Enable the libarchive driver", + "dependencies": [ + "libarchive" + ] + }, + "aws-ec2-windows": { + "description": "Optimized detection of AWS EC2 Windows hosts", + "dependencies": [ + "atl" + ] + }, + "cfitsio": { + "description": "Enable cfitsio support", + "dependencies": [ + "cfitsio" + ] + }, + "curl": { + "description": "Enable CURL network support", + "dependencies": [ + { + "name": "curl", + "default-features": false + } + ] + }, + "default-features": { + "description": "Default set of features, including recommended features", + "dependencies": [ + { + "name": "gdal", + "default-features": false, + "features": [ + "gif", + "iconv", + "libkml", + "libxml2", + "lzma", + "openjpeg", + "openssl", + "pcre2", + "recommended-features", + "webp", + "zstd" + ] + }, + { + "name": "gdal", + "default-features": false, + "features": [ + "libspatialite", + "postgresql" + ], + "platform": "!uwp" + }, + { + "name": "gdal", + "default-features": false, + "features": [ + "hdf5", + "netcdf" + ], + "platform": "!uwp & !(windows & arm64) & !android & !ios" + } + ] + }, + "expat": { + "description": "Use EXPAT library", + "dependencies": [ + "expat" + ] + }, + "freexl": { + "description": "Enable FREEXL support", + "dependencies": [ + "freexl" + ] + }, + "geos": { + "description": "Enable GEOS support", + "dependencies": [ + "geos" + ] + }, + "gif": { + "description": "Enable GIF support", + "dependencies": [ + "giflib" + ] + }, + "hdf5": { + "description": "Enable HDF5 support", + "dependencies": [ + { + "name": "hdf5", + "default-features": false, + "features": [ + "cpp" + ] + } + ] + }, + "iconv": { + "description": "Use iconv library", + "dependencies": [ + "libiconv" + ] + }, + "jpeg": { + "description": "Use JPEG compression library", + "dependencies": [ + "libjpeg-turbo" + ] + }, + "kea": { + "description": "Enable KEA driver", + "dependencies": [ + { + "name": "gdal", + "default-features": false, + "features": [ + "hdf5" + ] + }, + "kealib" + ] + }, + "lerc": { + "description": "Enable LERC support", + "dependencies": [ + "lerc" + ] + }, + "libkml": { + "description": "Enable the LibKML driver", + "dependencies": [ + "libkml" + ] + }, + "libspatialite": { + "description": "Create or update SpatiaLite databases using libspatialite", + "dependencies": [ + "libspatialite" + ] + }, + "libxml2": { + "description": "Use LibXML2 library", + "dependencies": [ + "libxml2" + ] + }, + "lzma": { + "description": "Use LZMA library", + "dependencies": [ + "liblzma" + ] + }, + "mysql-libmariadb": { + "description": "Add mysql support using libmariadb", + "dependencies": [ + "libmariadb" + ] + }, + "netcdf": { + "description": "Enable NetCDF support", + "dependencies": [ + { + "name": "netcdf-c", + "default-features": false + } + ] + }, + "openjpeg": { + "description": "Use OpenJPEG library", + "dependencies": [ + "openjpeg" + ] + }, + "openssl": { + "description": "Use OpenSSL library", + "dependencies": [ + "openssl" + ] + }, + "pcre2": { + "description": "Enable PCRE2 support for sqlite3", + "dependencies": [ + "pcre2" + ] + }, + "png": { + "description": "Use PNG compression library", + "dependencies": [ + "libpng" + ] + }, + "poppler": { + "description": "Enable PDF reading support via poppler", + "dependencies": [ + { + "name": "poppler", + "default-features": false, + "features": [ + "private-api" + ] + } + ] + }, + "postgresql": { + "description": "Enable PostgreSQL support", + "dependencies": [ + "libpq" + ] + }, + "qhull": { + "description": "Use QHULL library", + "dependencies": [ + "qhull" + ] + }, + "recommended-features": { + "description": "Features that are explicity marked as recommended by GDAL.", + "dependencies": [ + { + "name": "gdal", + "default-features": false, + "features": [ + "curl", + "expat", + "geos", + "jpeg", + "lerc", + "png", + "qhull", + "sqlite3" + ] + } + ] + }, + "sqlite3": { + "description": "Enable SQLite3 support", + "dependencies": [ + { + "name": "sqlite3", + "features": [ + "rtree" + ] + } + ] + }, + "supported-default-features": { + "description": "This feature is an alias for default-features. It is retained for compatibility.", + "dependencies": [ + { + "name": "gdal", + "features": [ + "default-features" + ] + } + ] + }, + "system-libraries": { + "$supports": "!windows", + "description": "This feature does nothing. It is retained for compatibility." + }, + "tools": { + "description": "Builds gdal and ogr executables" + }, + "webp": { + "description": "Enable WEBP support", + "dependencies": [ + "libwebp" + ] + }, + "zstd": { + "description": "Use ZSTD library", + "dependencies": [ + "zstd" + ] + } + } +} From 040da75d34cac17719cf8532558d0db1359adfd2 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Wed, 30 Oct 2024 09:56:38 +0700 Subject: [PATCH 2/5] Support opening of 7z and rar archives in QField --- src/core/qgismobileapp.cpp | 8 +++++--- src/core/qgismobileapp.h | 4 ++-- vcpkg/ports/qgis/vcpkg.json | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/core/qgismobileapp.cpp b/src/core/qgismobileapp.cpp index 2caa5b909d..c7bc840f90 100644 --- a/src/core/qgismobileapp.cpp +++ b/src/core/qgismobileapp.cpp @@ -841,11 +841,12 @@ void QgisMobileapp::readProjectFile() QgsRectangle extent; QStringList files; - if ( suffix == QStringLiteral( "zip" ) ) + if ( suffix == QStringLiteral( "zip" ) || suffix == QStringLiteral( "7z" ) || suffix == QStringLiteral( "rar" ) ) { // get list of files inside zip file QString tmpPath; - char **papszSiblingFiles = VSIReadDirRecursive( QString( "/vsizip/" + mProjectFilePath ).toLocal8Bit().constData() ); + char **papszSiblingFiles = VSIReadDirRecursive( QStringLiteral( "/vsi%1/%2" ).arg( suffix, mProjectFilePath ).toLocal8Bit().constData() ); + qDebug() << QStringLiteral( "/vsi%1/%2" ).arg( suffix, mProjectFilePath ); if ( papszSiblingFiles ) { for ( int i = 0; papszSiblingFiles[i]; i++ ) @@ -854,9 +855,10 @@ void QgisMobileapp::readProjectFile() // skip directories (files ending with /) if ( tmpPath.right( 1 ) != QLatin1String( "/" ) ) { + qDebug() << tmpPath; const QFileInfo tmpFi( tmpPath ); if ( SUPPORTED_VECTOR_EXTENSIONS.contains( tmpFi.suffix().toLower() ) || SUPPORTED_RASTER_EXTENSIONS.contains( tmpFi.suffix().toLower() ) ) - files << QStringLiteral( "/vsizip/%1/%2" ).arg( mProjectFilePath, tmpPath ); + files << QStringLiteral( "/vsi%1/%2/%3" ).arg( suffix, mProjectFilePath, tmpPath ); } } CSLDestroy( papszSiblingFiles ); diff --git a/src/core/qgismobileapp.h b/src/core/qgismobileapp.h index 708f08a4a7..63830a1e75 100644 --- a/src/core/qgismobileapp.h +++ b/src/core/qgismobileapp.h @@ -61,8 +61,8 @@ class QgsPrintLayout; #define REGISTER_SINGLETON( uri, _class, name ) qmlRegisterSingletonType<_class>( uri, 1, 0, name, []( QQmlEngine *engine, QJSEngine *scriptEngine ) -> QObject * { Q_UNUSED(engine); Q_UNUSED(scriptEngine); return new _class(); } ) #define SUPPORTED_PROJECT_EXTENSIONS QStringList( { QStringLiteral( "qgs" ), QStringLiteral( "qgz" ) } ) -#define SUPPORTED_VECTOR_EXTENSIONS QStringList( { QStringLiteral( "gpkg" ), QStringLiteral( "shp" ), QStringLiteral( "kml" ), QStringLiteral( "kmz" ), QStringLiteral( "geojson" ), QStringLiteral( "json" ), QStringLiteral( "pdf" ), QStringLiteral( "gpx" ), QStringLiteral( "gml" ), QStringLiteral( "mif" ), QStringLiteral( "fgb" ), QStringLiteral( "db" ), QStringLiteral( "sqlite" ), QStringLiteral( "mbtiles" ), QStringLiteral( "vrt" ), QStringLiteral( "zip" ) } ) -#define SUPPORTED_RASTER_EXTENSIONS QStringList( { QStringLiteral( "tif" ), QStringLiteral( "tiff" ), QStringLiteral( "pdf" ), QStringLiteral( "jpg" ), QStringLiteral( "jpeg" ), QStringLiteral( "png" ), QStringLiteral( "gpkg" ), QStringLiteral( "jp2" ), QStringLiteral( "webp" ), QStringLiteral( "mbtiles" ), QStringLiteral( "vrt" ), QStringLiteral( "zip" ) } ) +#define SUPPORTED_VECTOR_EXTENSIONS QStringList( { QStringLiteral( "gpkg" ), QStringLiteral( "shp" ), QStringLiteral( "kml" ), QStringLiteral( "kmz" ), QStringLiteral( "geojson" ), QStringLiteral( "json" ), QStringLiteral( "pdf" ), QStringLiteral( "gpx" ), QStringLiteral( "gml" ), QStringLiteral( "mif" ), QStringLiteral( "fgb" ), QStringLiteral( "db" ), QStringLiteral( "sqlite" ), QStringLiteral( "mbtiles" ), QStringLiteral( "vrt" ), QStringLiteral( "zip" ), QStringLiteral( "7z" ), QStringLiteral( "rar" ) } ) +#define SUPPORTED_RASTER_EXTENSIONS QStringList( { QStringLiteral( "tif" ), QStringLiteral( "tiff" ), QStringLiteral( "pdf" ), QStringLiteral( "jpg" ), QStringLiteral( "jpeg" ), QStringLiteral( "png" ), QStringLiteral( "gpkg" ), QStringLiteral( "jp2" ), QStringLiteral( "webp" ), QStringLiteral( "mbtiles" ), QStringLiteral( "vrt" ), QStringLiteral( "zip" ), QStringLiteral( "7z" ) } ) /** * \defgroup core diff --git a/vcpkg/ports/qgis/vcpkg.json b/vcpkg/ports/qgis/vcpkg.json index c597b938f8..2e8e9e360d 100644 --- a/vcpkg/ports/qgis/vcpkg.json +++ b/vcpkg/ports/qgis/vcpkg.json @@ -15,6 +15,7 @@ { "name": "gdal", "features": [ + "archive", "poppler" ] }, From 7d48caeb45e3799c6b90f6b6ca2f61a088072645 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Wed, 30 Oct 2024 10:40:18 +0700 Subject: [PATCH 3/5] Disable for iOS --- vcpkg/ports/qgis/vcpkg.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vcpkg/ports/qgis/vcpkg.json b/vcpkg/ports/qgis/vcpkg.json index 2e8e9e360d..d046e7285c 100644 --- a/vcpkg/ports/qgis/vcpkg.json +++ b/vcpkg/ports/qgis/vcpkg.json @@ -15,7 +15,10 @@ { "name": "gdal", "features": [ - "archive", + { + "name": "archive", + "platform": "!ios" + }, "poppler" ] }, From 210eabc0761bcd14d455748eff7a5489b3da9a71 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 1 Nov 2024 08:22:37 +0700 Subject: [PATCH 4/5] Allow for libarchive to build on iOS by disabling tools building --- vcpkg/ports/libarchive/disable-warnings.patch | 14 + vcpkg/ports/libarchive/fix-buildsystem.patch | 110 ++++++++ vcpkg/ports/libarchive/fix-cpu-set.patch | 15 + vcpkg/ports/libarchive/fix-deps.patch | 257 ++++++++++++++++++ vcpkg/ports/libarchive/portfile.cmake | 99 +++++++ vcpkg/ports/libarchive/usage | 9 + .../libarchive/vcpkg-cmake-wrapper.cmake.in | 70 +++++ vcpkg/ports/libarchive/vcpkg.json | 81 ++++++ vcpkg/ports/qgis/vcpkg.json | 5 +- 9 files changed, 656 insertions(+), 4 deletions(-) create mode 100644 vcpkg/ports/libarchive/disable-warnings.patch create mode 100644 vcpkg/ports/libarchive/fix-buildsystem.patch create mode 100644 vcpkg/ports/libarchive/fix-cpu-set.patch create mode 100644 vcpkg/ports/libarchive/fix-deps.patch create mode 100644 vcpkg/ports/libarchive/portfile.cmake create mode 100644 vcpkg/ports/libarchive/usage create mode 100644 vcpkg/ports/libarchive/vcpkg-cmake-wrapper.cmake.in create mode 100644 vcpkg/ports/libarchive/vcpkg.json diff --git a/vcpkg/ports/libarchive/disable-warnings.patch b/vcpkg/ports/libarchive/disable-warnings.patch new file mode 100644 index 0000000000..455939479a --- /dev/null +++ b/vcpkg/ports/libarchive/disable-warnings.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b2634da..d037071 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -155,9 +155,6 @@ IF (MSVC) + ################################################################# + # Set compile flags for debug build. + # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" +- # Enable level 4 C4062: The enumerate has no associated handler in a switch +- # statement and there is no default that can catch it. +- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /w14062") + # Enable level 4 C4254: A larger bit field was assigned to a smaller bit + # field. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /w14254") diff --git a/vcpkg/ports/libarchive/fix-buildsystem.patch b/vcpkg/ports/libarchive/fix-buildsystem.patch new file mode 100644 index 0000000000..4ae72167d6 --- /dev/null +++ b/vcpkg/ports/libarchive/fix-buildsystem.patch @@ -0,0 +1,110 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b2634da6..0d846877 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -148,10 +148,6 @@ IF (CMAKE_C_COMPILER_ID MATCHES "^XL$") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -qinfo=pro:use") + ENDIF(CMAKE_C_COMPILER_ID MATCHES "^XL$") + IF (MSVC) +- if (ENABLE_WERROR) +- # /WX option is the same as gcc's -Werror option. +- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") +- endif () + ################################################################# + # Set compile flags for debug build. + # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" +@@ -382,8 +378,6 @@ IF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}") + # Maybe DLL path is "C:/Program Files/GnuWin32/bin". + # The zlib and the bzip2 Setup program have installed programs and DLLs into + # "C:/Program Files/GnuWin32" by default. +- # This is convenience setting for Windows. +- SET(CMAKE_PREFIX_PATH ${__GNUWIN32PATH} $(CMAKE_PREFIX_PATH)) + # + # If you didn't use Setup program or installed into nonstandard path, + # cmake cannot find out your zlib or bzip2 libraries and include files, +@@ -420,14 +414,7 @@ IF(ZLIB_FOUND) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) + IF(WIN32 AND NOT CYGWIN) +- # +- # Test if ZLIB_WINAPI macro is needed to use. +- # +- TRY_MACRO_FOR_LIBRARY( +- "${ZLIB_INCLUDE_DIR}" "${ZLIB_LIBRARIES}" +- RUNS +- "#include \nint main() {uLong f = zlibCompileFlags(); return (f&(1U<<10))?0:-1; }" +- ZLIB_WINAPI) ++ SET(ZLIB_WINAPI OFF) # skip following test, it crashes with weird message box + IF(ZLIB_WINAPI) + ADD_DEFINITIONS(-DZLIB_WINAPI) + ELSE(ZLIB_WINAPI) +@@ -1356,7 +1341,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(localtime_r HAVE_LOCALTIME_R) + CHECK_FUNCTION_EXISTS_GLIBC(lstat HAVE_LSTAT) + CHECK_FUNCTION_EXISTS_GLIBC(lutimes HAVE_LUTIMES) + CHECK_FUNCTION_EXISTS_GLIBC(mbrtowc HAVE_MBRTOWC) +-CHECK_FUNCTION_EXISTS_GLIBC(memmove HAVE_MEMMOVE) ++set(HAVE_MEMMOVE 1) + CHECK_FUNCTION_EXISTS_GLIBC(mkdir HAVE_MKDIR) + CHECK_FUNCTION_EXISTS_GLIBC(mkfifo HAVE_MKFIFO) + CHECK_FUNCTION_EXISTS_GLIBC(mknod HAVE_MKNOD) +@@ -1388,10 +1373,10 @@ CHECK_FUNCTION_EXISTS_GLIBC(utime HAVE_UTIME) + CHECK_FUNCTION_EXISTS_GLIBC(utimes HAVE_UTIMES) + CHECK_FUNCTION_EXISTS_GLIBC(utimensat HAVE_UTIMENSAT) + CHECK_FUNCTION_EXISTS_GLIBC(vfork HAVE_VFORK) +-CHECK_FUNCTION_EXISTS_GLIBC(wcrtomb HAVE_WCRTOMB) +-CHECK_FUNCTION_EXISTS_GLIBC(wcscmp HAVE_WCSCMP) +-CHECK_FUNCTION_EXISTS_GLIBC(wcscpy HAVE_WCSCPY) +-CHECK_FUNCTION_EXISTS_GLIBC(wcslen HAVE_WCSLEN) +-CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB) ++set(HAVE_WCRTOMB 1) ++set(HAVE_WCSCMP 1) ++set(HAVE_WCSCPY 1) ++set(HAVE_WCSLEN 1) ++set(HAVE_WCTOMB 1) + CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64) + CHECK_FUNCTION_EXISTS_GLIBC(_get_timezone HAVE__GET_TIMEZONE) +@@ -1405,10 +1390,10 @@ CHECK_FUNCTION_EXISTS(cygwin_conv_path HAVE_CYGWIN_CONV_PATH) + CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO) + CHECK_FUNCTION_EXISTS(strerror_r HAVE_STRERROR_R) + CHECK_FUNCTION_EXISTS(strftime HAVE_STRFTIME) +-CHECK_FUNCTION_EXISTS(vprintf HAVE_VPRINTF) +-CHECK_FUNCTION_EXISTS(wmemcmp HAVE_WMEMCMP) +-CHECK_FUNCTION_EXISTS(wmemcpy HAVE_WMEMCPY) +-CHECK_FUNCTION_EXISTS(wmemmove HAVE_WMEMMOVE) ++set(HAVE_VPRINTF 1) ++set(HAVE_WMEMCMP 1) ++set(HAVE_WMEMCPY 1) ++set(HAVE_WMEMMOVE 1) + + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + +@@ -2018,7 +2007,7 @@ INCLUDE(CreatePkgConfigFile) + # + # Register installation of PDF documents. + # +-IF(WIN32 AND NOT CYGWIN) ++IF(0) + # + # On Windows platform, It's better that we install PDF documents + # on one's computer. +diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt +index f7fdfb68a..98d287e8c 100644 +--- a/libarchive/CMakeLists.txt ++++ b/libarchive/CMakeLists.txt +@@ -267,11 +267,12 @@ IF(ENABLE_INSTALL) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) ++ ELSE() ++ INSTALL(TARGETS archive_static ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) + ENDIF(BUILD_SHARED_LIBS) +- INSTALL(TARGETS archive_static +- RUNTIME DESTINATION bin +- LIBRARY DESTINATION lib +- ARCHIVE DESTINATION lib) + INSTALL_MAN(${libarchive_MANS}) + INSTALL(FILES ${include_HEADERS} DESTINATION include) + ENDIF() diff --git a/vcpkg/ports/libarchive/fix-cpu-set.patch b/vcpkg/ports/libarchive/fix-cpu-set.patch new file mode 100644 index 0000000000..8d1924dbe8 --- /dev/null +++ b/vcpkg/ports/libarchive/fix-cpu-set.patch @@ -0,0 +1,15 @@ +diff --git a/libarchive/archive_random.c b/libarchive/archive_random.c +index 65ea691..63217ec 100644 +--- a/libarchive/archive_random.c ++++ b/libarchive/archive_random.c +@@ -48,6 +48,10 @@ __FBSDID("$FreeBSD$"); + #include + #endif + #ifdef HAVE_PTHREAD_H ++#ifdef __GNUC__ ++#define _GNU_SOURCE ++#include ++#endif + #include + #endif + diff --git a/vcpkg/ports/libarchive/fix-deps.patch b/vcpkg/ports/libarchive/fix-deps.patch new file mode 100644 index 0000000000..83531aab0e --- /dev/null +++ b/vcpkg/ports/libarchive/fix-deps.patch @@ -0,0 +1,257 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3539519..95b44ba 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -407,6 +407,8 @@ IF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}") + ENDIF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}") + + SET(ADDITIONAL_LIBS "") ++SET(LIBARCHIVE_LIBS_PRIVATE "") # additional libs for which the pc module is unknown ++SET(LIBSREQUIRED "") # pc modules for additonal libs + # + # Find ZLIB + # +@@ -420,6 +422,7 @@ IF(ZLIB_FOUND) + SET(HAVE_ZLIB_H 1) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) ++ STRING(APPEND LIBSREQUIRED " zlib") + IF(WIN32 AND NOT CYGWIN) + SET(ZLIB_WINAPI OFF) # skip following test, it crashes with weird message box + IF(ZLIB_WINAPI) +@@ -452,6 +455,7 @@ IF(BZIP2_FOUND) + SET(HAVE_BZLIB_H 1) + INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${BZIP2_LIBRARIES}) ++ STRING(APPEND LIBSREQUIRED " bzip2") + # Test if a macro is needed for the library. + TRY_MACRO_FOR_LIBRARY( + "${BZIP2_INCLUDE_DIR}" "${BZIP2_LIBRARIES}" +@@ -480,6 +484,8 @@ ENDIF() + IF(LIBLZMA_FOUND) + SET(HAVE_LIBLZMA 1) + SET(HAVE_LZMA_H 1) ++ LIST(APPEND ADDITIONAL_LIBS LibLZMA::LibLZMA) ++ STRING(APPEND LIBSREQUIRED " liblzma") + CMAKE_PUSH_CHECK_STATE() + SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIR}) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBLZMA_LIBRARIES}) +@@ -521,6 +528,7 @@ IF(LZO2_FOUND) + SET(HAVE_LZO_LZO1X_H 1) + INCLUDE_DIRECTORIES(${LZO2_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${LZO2_LIBRARY}) ++ STRING(APPEND LIBSREQUIRED " lzo2") + # + # TODO: test for static library. + # +@@ -548,7 +556,8 @@ IF(LIBB2_FOUND) + SET(HAVE_BLAKE2_H 1) + SET(ARCHIVE_BLAKE2 FALSE) + LIST(APPEND ADDITIONAL_LIBS ${LIBB2_LIBRARY}) + INCLUDE_DIRECTORIES(${LIBB2_INCLUDE_DIR}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${LIBB2_LIBRARY}) + CMAKE_PUSH_CHECK_STATE() + SET(CMAKE_REQUIRED_LIBRARIES ${LIBB2_LIBRARY}) + SET(CMAKE_REQUIRED_INCLUDES ${LIBB2_INCLUDE_DIR}) +@@ -560,6 +569,8 @@ ENDIF(LIBB2_FOUND) + # Find LZ4 + # + IF(ENABLE_LZ4) ++ FIND_PACKAGE(LZ4 NAMES lz4 CONFIG REQUIRED) ++elseif(0) + IF (LZ4_INCLUDE_DIR) + # Already in cache, be silent + SET(LZ4_FIND_QUIETLY TRUE) +@@ -575,6 +586,10 @@ ENDIF(ENABLE_LZ4) + IF(LZ4_FOUND) + SET(HAVE_LIBLZ4 1) + SET(HAVE_LZ4_H 1) ++ SET(HAVE_LZ4HC_H 1) ++ LIST(APPEND ADDITIONAL_LIBS lz4::lz4) ++ STRING(APPEND LIBSREQUIRED " liblz4") ++elseif(0) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + SET(CMAKE_REQUIRED_INCLUDES ${LZ4_INCLUDE_DIR}) + CHECK_INCLUDE_FILES("lz4hc.h" HAVE_LZ4HC_H) +@@ -591,6 +606,8 @@ MARK_AS_ADVANCED(CLEAR LZ4_LIBRARY) + # Find Zstd + # + IF(ENABLE_ZSTD) ++ FIND_PACKAGE(ZSTD NAMES zstd CONFIG REQUIRED) ++elseif(0) + IF (ZSTD_INCLUDE_DIR) + # Already in cache, be silent + SET(ZSTD_FIND_QUIETLY TRUE) +@@ -610,6 +627,15 @@ ELSE(ENABLE_ZSTD) + ENDIF(ENABLE_ZSTD) + IF(ZSTD_FOUND) + SET(HAVE_ZSTD_H 1) ++ SET(HAVE_LIBZSTD 1) ++ SET(HAVE_LIBZSTD_COMPRESSOR 1) ++ IF(TARGET zstd::libzstd_shared) ++ LIST(APPEND ADDITIONAL_LIBS zstd::libzstd_shared) ++ ELSE() ++ LIST(APPEND ADDITIONAL_LIBS zstd::libzstd_static) ++ ENDIF(TARGET zstd::libzstd_shared) ++ STRING(APPEND LIBSREQUIRED " libzstd") ++elseif(0) + INCLUDE_DIRECTORIES(${ZSTD_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${ZSTD_LIBRARY}) + CMAKE_PUSH_CHECK_STATE() +@@ -718,6 +744,7 @@ IF(ENABLE_CNG) + LA_CHECK_INCLUDE_FILE("bcrypt.h" HAVE_BCRYPT_H) + IF(HAVE_BCRYPT_H) + LIST(APPEND ADDITIONAL_LIBS "bcrypt") ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE "bcrypt") + ENDIF(HAVE_BCRYPT_H) + ELSE(ENABLE_CNG) + UNSET(HAVE_BCRYPT_H CACHE) +@@ -749,6 +776,7 @@ IF(ENABLE_MBEDTLS) + IF(MBEDTLS_FOUND) + SET(HAVE_LIBMBEDCRYPTO 1) + LIST(APPEND ADDITIONAL_LIBS ${MBEDCRYPTO_LIBRARY}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${MBEDCRYPTO_LIBRARY}) + INCLUDE_DIRECTORIES(${MBEDTLS_INCLUDE_DIRS}) + + LIST(APPEND CMAKE_REQUIRED_INCLUDES ${MBEDTLS_INCLUDE_DIRS}) +@@ -769,6 +797,7 @@ IF(ENABLE_NETTLE) + IF(NETTLE_FOUND) + SET(HAVE_LIBNETTLE 1) + LIST(APPEND ADDITIONAL_LIBS ${NETTLE_LIBRARIES}) ++ STRING(APPEND LIBSREQUIRED " nettle") + INCLUDE_DIRECTORIES(${NETTLE_INCLUDE_DIR}) + + LIST(APPEND CMAKE_REQUIRED_INCLUDES ${NETTLE_INCLUDE_DIR}) +@@ -792,8 +821,8 @@ IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") + FIND_PACKAGE(OpenSSL) + IF(OPENSSL_FOUND) + SET(HAVE_LIBCRYPTO 1) +- INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) +- LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_CRYPTO_LIBRARY}) ++ LIST(APPEND ADDITIONAL_LIBS OpenSSL::Crypto) ++ STRING(APPEND LIBSREQUIRED " libcrypto") + SET(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY}) + SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) + LA_CHECK_INCLUDE_FILE("openssl/evp.h" HAVE_OPENSSL_EVP_H) +@@ -807,6 +836,7 @@ IF(NOT OPENSSL_FOUND) + SET(CMAKE_REQUIRED_LIBRARIES "md") + FIND_LIBRARY(LIBMD_LIBRARY NAMES md) + LIST(APPEND ADDITIONAL_LIBS ${LIBMD_LIBRARY}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${LIBMD_LIBRARY}) + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + ENDIF(LIBMD_FOUND) + ENDIF(NOT OPENSSL_FOUND) +@@ -912,7 +942,8 @@ main(int argc, char **argv) + IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_LIBRARIES}) +- LIST(REMOVE_DUPLICATES ADDITIONAL_LIBS) ++ #LIST(REMOVE_DUPLICATES ADDITIONAL_LIBS) ++ STRING(APPEND LIBSREQUIRED " libssl") + ENDIF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + ENDIF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + ENDIF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) +@@ -1086,6 +1117,7 @@ IF(ENABLE_ICONV) + CHECK_ICONV("libiconv" "") + IF (HAVE_ICONV) + LIST(APPEND ADDITIONAL_LIBS ${LIBICONV_PATH}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${LIBICONV_PATH}) + ENDIF(HAVE_ICONV) + ENDIF(NOT HAVE_ICONV AND LIBICONV_PATH) + ENDIF(ICONV_INCLUDE_DIR) +@@ -1119,6 +1151,7 @@ IF(ENABLE_ICONV) + ENDIF(WIN32 AND NOT CYGWIN) + IF(HAVE_LOCALE_CHARSET) + LIST(APPEND ADDITIONAL_LIBS ${LIBCHARSET_PATH}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${LIBCHARSET_PATH}) + ENDIF(HAVE_LOCALE_CHARSET) + ENDIF(LIBCHARSET_PATH) + ENDIF(LIBICONV_PATH) +@@ -1152,6 +1185,7 @@ IF(LIBXML2_FOUND) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${LIBXML2_LIBRARIES}) ++ STRING(APPEND LIBSREQUIRED " libxml-2.0") + SET(HAVE_LIBXML2 1) + # libxml2's include files use iconv.h + SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR}) +@@ -1181,6 +1215,7 @@ ELSE(LIBXML2_FOUND) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${EXPAT_LIBRARIES}) ++ STRING(APPEND LIBSREQUIRED " expat") + SET(HAVE_LIBEXPAT 1) + LA_CHECK_INCLUDE_FILE("expat.h" HAVE_EXPAT_H) + CMAKE_POP_CHECK_STATE() # Restore the state of the variables +@@ -1211,6 +1246,7 @@ IF(POSIX_REGEX_LIB MATCHES "^(AUTO|LIBC|LIBREGEX)$") + CHECK_FUNCTION_EXISTS_GLIBC(regcomp HAVE_REGCOMP_LIBREGEX) + IF(HAVE_REGCOMP_LIBREGEX) + LIST(APPEND ADDITIONAL_LIBS ${REGEX_LIBRARY}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${REGEX_LIBRARY}) + # + # If regex.h is not found, retry looking for regex.h at + # REGEX_INCLUDE_DIR +@@ -1260,6 +1296,7 @@ IF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX)$" + IF(PCREPOSIX_FOUND) + INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${PCREPOSIX_LIBRARIES}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${PCREPOSIX_LIBRARIES}) + # Test if a macro is needed for the library. + TRY_MACRO_FOR_LIBRARY( + "${PCRE_INCLUDE_DIR}" "${PCREPOSIX_LIBRARIES}" +@@ -1271,6 +1308,7 @@ IF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX)$" + ELSEIF(NOT WITHOUT_PCRE_STATIC AND NOT PCRE_STATIC AND PCRE_FOUND) + # Determine if pcre static libraries are to be used. + LIST(APPEND ADDITIONAL_LIBS ${PCRE_LIBRARIES}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${PCRE_LIBRARIES}) + SET(TMP_LIBRARIES ${PCREPOSIX_LIBRARIES} ${PCRE_LIBRARIES}) + MESSAGE(STATUS "trying again with -lpcre included") + TRY_MACRO_FOR_LIBRARY( +@@ -1286,6 +1324,7 @@ IF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX)$" + # ___chkstk_ms. + MESSAGE(STATUS "Visual Studio build detected, trying again with -lgcc included") + LIST(APPEND ADDITIONAL_LIBS ${LIBGCC_LIBRARIES}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${LIBGCC_LIBRARIES}) + SET(TMP_LIBRARIES ${PCREPOSIX_LIBRARIES} ${PCRE_LIBRARIES} ${LIBGCC_LIBRARIES}) + TRY_MACRO_FOR_LIBRARY( + "${PCRE_INCLUDE_DIR}" "${TMP_LIBRARIES}" +@@ -1805,6 +1844,7 @@ IF(ENABLE_ACL) + SET(CMAKE_REQUIRED_LIBRARIES "acl") + FIND_LIBRARY(ACL_LIBRARY NAMES acl) + LIST(APPEND ADDITIONAL_LIBS ${ACL_LIBRARY}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${ACL_LIBRARY}) + ENDIF(HAVE_LIBACL) + + CHECK_TYPE_EXISTS(acl_t "sys/types.h;sys/acl.h" HAVE_ACL_T) +@@ -1944,6 +1984,7 @@ int main(void) { return ACL_SYNCHRONIZE; }" HAVE_DECL_ACL_SYNCHRONIZE) + SET(CMAKE_REQUIRED_LIBRARIES "richacl") + FIND_LIBRARY(RICHACL_LIBRARY NAMES richacl) + LIST(APPEND ADDITIONAL_LIBS ${RICHACL_LIBRARY}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${RICHACL_LIBRARY}) + ENDIF(HAVE_LIBRICHACL) + + CHECK_STRUCT_HAS_MEMBER("struct richace" e_type "sys/richacl.h" +diff --git a/build/cmake/CreatePkgConfigFile.cmake b/build/cmake/CreatePkgConfigFile.cmake +index bc5a43f..422b83b 100644 +--- a/build/cmake/CreatePkgConfigFile.cmake ++++ b/build/cmake/CreatePkgConfigFile.cmake +@@ -8,7 +8,7 @@ SET(libdir \${exec_prefix}/lib) + SET(includedir \${prefix}/include) + # Now, this is not particularly pretty, nor is it terribly accurate... + # Loop over all our additional libs +-FOREACH(mylib ${ADDITIONAL_LIBS}) ++FOREACH(mylib ${LIBARCHIVE_LIBS_PRIVATE}) + # Extract the filename from the absolute path + GET_FILENAME_COMPONENT(mylib_name ${mylib} NAME_WE) + # Strip the lib prefix +@@ -16,10 +16,6 @@ FOREACH(mylib ${ADDITIONAL_LIBS}) + # Append it to our LIBS string + SET(LIBS "${LIBS} -l${mylib_name}") + ENDFOREACH() +-# libxml2 is easier, since it's already using pkg-config +-FOREACH(mylib ${PC_LIBXML_STATIC_LDFLAGS}) +- SET(LIBS "${LIBS} ${mylib}") +-ENDFOREACH() + # FIXME: The order of the libraries doesn't take dependencies into account, + # thus there's a good chance it'll make some binutils versions unhappy... + # This only affects Libs.private (looked up for static builds) though. diff --git a/vcpkg/ports/libarchive/portfile.cmake b/vcpkg/ports/libarchive/portfile.cmake new file mode 100644 index 0000000000..548dc872e4 --- /dev/null +++ b/vcpkg/ports/libarchive/portfile.cmake @@ -0,0 +1,99 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO libarchive/libarchive + REF "v${VERSION}" + SHA512 95c6232d178b26daa0eeba43d64ea4235aa96fa279c85fff715ac5e6cc73b2e65f276770f91c3538cb8ca989380555169497628d73e120bfa52e12f657049ff0 + HEAD_REF master + PATCHES + disable-warnings.patch + fix-buildsystem.patch + fix-cpu-set.patch + fix-deps.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + bzip2 ENABLE_BZip2 + bzip2 CMAKE_REQUIRE_FIND_PACKAGE_BZip2 + libxml2 ENABLE_LIBXML2 + libxml2 CMAKE_REQUIRE_FIND_PACKAGE_LibXml2 + lz4 ENABLE_LZ4 + lz4 CMAKE_REQUIRE_FIND_PACKAGE_lz4 + lzma ENABLE_LZMA + lzma CMAKE_REQUIRE_FIND_PACKAGE_LibLZMA + lzo ENABLE_LZO + tools ENABLE_TAR + tools ENABLE_CPIO + tools ENABLE_CAT + tools ENABLE_UNZIP + zstd ENABLE_ZSTD +) +# Default crypto backend is OpenSSL, but it is ignored for DARWIN +set(WRAPPER_ENABLE_OPENSSL OFF) +if(NOT "crypto" IN_LIST FEATURES) + list(APPEND FEATURE_OPTIONS + -DLIBMD_FOUND=FALSE + -DENABLE_OPENSSL=OFF + ) +elseif(VCPKG_TARGET_IS_OSX) + list(APPEND FEATURE_OPTIONS + -DENABLE_MBEDTLS=ON + -DENABLE_OPENSSL=OFF + -DCMAKE_REQUIRE_FIND_PACKAGE_MbedTLS=ON + ) +else() + set(WRAPPER_ENABLE_OPENSSL ON) + list(APPEND FEATURE_OPTIONS + -DCMAKE_REQUIRE_FIND_PACKAGE_OpenSSL=ON + ) +endif() + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} + -DENABLE_ZLIB=ON + -DENABLE_PCREPOSIX=OFF + -DPOSIX_REGEX_LIB=NONE + -DENABLE_MBEDTLS=OFF + -DENABLE_NETTLE=OFF + -DENABLE_EXPAT=OFF + -DENABLE_LibGCC=OFF + -DENABLE_CNG=OFF + -DENABLE_TAR=OFF + -DENABLE_CPIO=OFF + -DENABLE_CAT=OFF + -DENABLE_XATTR=OFF + -DENABLE_ACL=OFF + -DENABLE_ICONV=OFF + -DENABLE_LIBB2=OFF + -DENABLE_TEST=OFF + -DENABLE_WERROR=OFF + MAYBE_UNUSED_VARIABLES + CMAKE_REQUIRE_FIND_PACKAGE_BZip2 + CMAKE_REQUIRE_FIND_PACKAGE_LibLZMA + CMAKE_REQUIRE_FIND_PACKAGE_LibXml2 + CMAKE_REQUIRE_FIND_PACKAGE_lz4 + ENABLE_LibGCC +) + +vcpkg_cmake_install() + +vcpkg_fixup_pkgconfig() + +vcpkg_copy_pdbs() + +configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY) + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share" + "${CURRENT_PACKAGES_DIR}/share/man" +) + +foreach(header "include/archive.h" "include/archive_entry.h") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/${header}" "(!defined LIBARCHIVE_STATIC)" "0") +endforeach() + +file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/vcpkg/ports/libarchive/usage b/vcpkg/ports/libarchive/usage new file mode 100644 index 0000000000..75ccb94e90 --- /dev/null +++ b/vcpkg/ports/libarchive/usage @@ -0,0 +1,9 @@ +libarchive is compatible with the CMake Find Module: + + find_package(LibArchive REQUIRED) + target_link_libraries(main PRIVATE LibArchive::LibArchive) # since CMake 3.17 + +libarchive provides pkg-config modules: + + # library that can create and read several streaming archive formats + libarchive diff --git a/vcpkg/ports/libarchive/vcpkg-cmake-wrapper.cmake.in b/vcpkg/ports/libarchive/vcpkg-cmake-wrapper.cmake.in new file mode 100644 index 0000000000..e23a0936b7 --- /dev/null +++ b/vcpkg/ports/libarchive/vcpkg-cmake-wrapper.cmake.in @@ -0,0 +1,70 @@ +cmake_policy(PUSH) +cmake_policy(SET CMP0012 NEW) +cmake_policy(SET CMP0057 NEW) +set(z_vcpkg_libarchive_args "") +if("REQUIRED" IN_LIST ARGS) + list(APPEND z_vcpkg_libarchive_args "REQUIRED") +endif() +if("QUIET" IN_LIST ARGS) + list(APPEND z_vcpkg_libarchive_args "QUIET") +endif() + +_find_package(${ARGS}) + +if(LibArchive_FOUND AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static") + set(z_vcpkg_libarchive_libs "") + find_package(ZLIB ${z_vcpkg_libarchive_args}) + list(APPEND z_vcpkg_libarchive_libs ZLIB::ZLIB) + if("@ENABLE_BZip2@") + find_package(BZip2 ${z_vcpkg_libarchive_args}) + list(APPEND z_vcpkg_libarchive_libs BZip2::BZip2) + endif() + if("@ENABLE_LIBXML2@") + find_package(LibXml2 ${z_vcpkg_libarchive_args}) + list(APPEND z_vcpkg_libarchive_libs LibXml2::LibXml2) + endif() + if("@ENABLE_LZ4@") + find_package(lz4 CONFIG ${z_vcpkg_libarchive_args}) + list(APPEND z_vcpkg_libarchive_libs lz4::lz4) + endif() + if("@ENABLE_LZMA@") + find_package(LibLZMA ${z_vcpkg_libarchive_args}) + list(APPEND z_vcpkg_libarchive_libs LibLZMA::LibLZMA) + endif() + if("@ENABLE_LZO@") + include(SelectLibraryConfigurations) + find_library(Z_VCPKG_LZO_LIBRARY_DEBUG NAMES lzo2d lzo2 NAMES_PER_DIR PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" NO_DEFAULT_PATH) + find_library(Z_VCPKG_LZO_LIBRARY_RELEASE NAMES lzo2 NAMES_PER_DIR PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" NO_DEFAULT_PATH) + select_library_configurations(Z_VCPKG_LZO) + if(Z_VCPKG_LZO_LIBRARY) + list(APPEND z_vcpkg_libarchive_libs ${Z_VCPKG_LZO_LIBRARY}) + else() + set(LibArchive_FOUND FALSE) + endif() + endif() + if("@ENABLE_ZSTD@") + find_package(zstd ${z_vcpkg_libarchive_args}) + list(APPEND z_vcpkg_libarchive_libs zstd::libzstd) + endif() + if("@WRAPPER_ENABLE_OPENSSL@") + find_package(OpenSSL ${z_vcpkg_libarchive_args}) + list(APPEND z_vcpkg_libarchive_libs OpenSSL::Crypto) + endif() + + if(TARGET LibArchive::LibArchive) + set(LibArchive_LIBRARIES LibArchive::LibArchive) + if(Z_VCPKG_LZO_LIBRARY AND Z_VCPKG_LZO_LIBRARY_DEBUG) + list(REMOVE_ITEM z_vcpkg_libarchive_libs ${Z_VCPKG_LZO_LIBRARY}) + list(APPEND z_vcpkg_libarchive_libs + "\$<\$>:${Z_VCPKG_LZO_LIBRARY_RELEASE}>" + "\$<\$:${Z_VCPKG_LZO_LIBRARY_DEBUG}>" + ) + endif() + set_property(TARGET LibArchive::LibArchive APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${z_vcpkg_libarchive_libs}) + else() + list(APPEND LibArchive_LIBRARIES ${z_vcpkg_libarchive_libs}) + endif() + unset(z_vcpkg_libarchive_libs) +endif() +unset(z_vcpkg_libarchive_args) +cmake_policy(POP) diff --git a/vcpkg/ports/libarchive/vcpkg.json b/vcpkg/ports/libarchive/vcpkg.json new file mode 100644 index 0000000000..3d035d8e6a --- /dev/null +++ b/vcpkg/ports/libarchive/vcpkg.json @@ -0,0 +1,81 @@ +{ + "name": "libarchive", + "version": "3.7.7", + "description": "Library for reading and writing streaming archives", + "homepage": "https://www.libarchive.org", + "license": null, + "supports": "!uwp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + "zlib" + ], + "default-features": [ + "bzip2", + "crypto", + "libxml2", + "lz4", + "lzma", + { + "name": "tools", + "platform": "!ios" + }, + "zstd" + ], + "features": { + "bzip2": { + "description": "BZip2 support", + "dependencies": [ + "bzip2" + ] + }, + "crypto": { + "description": "Support for cryptographic features", + "dependencies": [ + { + "name": "mbedtls", + "platform": "osx" + }, + { + "name": "openssl", + "platform": "!osx" + } + ] + }, + "libxml2": { + "description": "Libxml2 support", + "dependencies": [ + "libxml2" + ] + }, + "lz4": { + "description": "Lz4 support", + "dependencies": [ + "lz4" + ] + }, + "lzma": { + "description": "Lzma support", + "dependencies": [ + "liblzma" + ] + }, + "lzo": { + "description": "Lzo support", + "dependencies": [ + "lzo" + ] + }, + "tools": { + "description": "Tools support" + }, + "zstd": { + "description": "Zstd support", + "dependencies": [ + "zstd" + ] + } + } +} diff --git a/vcpkg/ports/qgis/vcpkg.json b/vcpkg/ports/qgis/vcpkg.json index d046e7285c..2e8e9e360d 100644 --- a/vcpkg/ports/qgis/vcpkg.json +++ b/vcpkg/ports/qgis/vcpkg.json @@ -15,10 +15,7 @@ { "name": "gdal", "features": [ - { - "name": "archive", - "platform": "!ios" - }, + "archive", "poppler" ] }, From b5153f89865660dd2ddfbdf27b8e6ce796a9b63d Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 1 Nov 2024 10:55:44 +0700 Subject: [PATCH 5/5] Remove debug crumbs --- src/core/qgismobileapp.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/core/qgismobileapp.cpp b/src/core/qgismobileapp.cpp index c7bc840f90..b9f003d4bd 100644 --- a/src/core/qgismobileapp.cpp +++ b/src/core/qgismobileapp.cpp @@ -846,7 +846,6 @@ void QgisMobileapp::readProjectFile() // get list of files inside zip file QString tmpPath; char **papszSiblingFiles = VSIReadDirRecursive( QStringLiteral( "/vsi%1/%2" ).arg( suffix, mProjectFilePath ).toLocal8Bit().constData() ); - qDebug() << QStringLiteral( "/vsi%1/%2" ).arg( suffix, mProjectFilePath ); if ( papszSiblingFiles ) { for ( int i = 0; papszSiblingFiles[i]; i++ ) @@ -855,7 +854,6 @@ void QgisMobileapp::readProjectFile() // skip directories (files ending with /) if ( tmpPath.right( 1 ) != QLatin1String( "/" ) ) { - qDebug() << tmpPath; const QFileInfo tmpFi( tmpPath ); if ( SUPPORTED_VECTOR_EXTENSIONS.contains( tmpFi.suffix().toLower() ) || SUPPORTED_RASTER_EXTENSIONS.contains( tmpFi.suffix().toLower() ) ) files << QStringLiteral( "/vsi%1/%2/%3" ).arg( suffix, mProjectFilePath, tmpPath );