diff --git a/.github/workflows/ci-linux_mac.yml b/.github/workflows/ci-linux_mac.yml index f682ab50255..bc1d5d7f281 100644 --- a/.github/workflows/ci-linux_mac.yml +++ b/.github/workflows/ci-linux_mac.yml @@ -96,7 +96,7 @@ jobs: if: ${{ startsWith(matrix.os, 'macos-') == true }} run: | set -e pipefail - brew install pkg-config + brew install automake pkg-config - name: 'Configure libtiledb build' id: configure diff --git a/bootstrap b/bootstrap index 63ee63388a7..3c7f8317a27 100755 --- a/bootstrap +++ b/bootstrap @@ -34,6 +34,7 @@ Configuration: --help print this message --prefix=PREFIX install files in tree rooted at PREFIX ['"${default_prefix}"'] + --enable-vcpkg use vcpkg for downloading and building dependnecies --dependency=DIRs specify the dependencies at DIRs, separated by colon ['"${default_dependency}"'] --force-build-all-deps force building of all dependencies, even those @@ -84,6 +85,7 @@ Example: # Parse arguments prefix_dirs="${default_prefix}" +tiledb_vcpkg="OFF" dependency_dir="${default_dependency}" sanitizer="" build_type="Release" @@ -114,6 +116,7 @@ while test $# != 0; do case "$1" in --prefix=*) dir=`arg "$1"` prefix_dirs="$dir";; + --enable-vcpkg) tiledb_vcpkg="ON";; --dependency=*) dir=`arg "$1"` dependency_dir="$dir";; --force-build-all-deps) tiledb_force_all_deps="ON";; @@ -155,6 +158,7 @@ done IFS=',' read -ra enables <<< "$enable_multiple" for en in "${enables[@]}"; do case "$en" in + vcpkg) tiledb_vcpkg="ON";; assertions) tiledb_assertions="ON";; debug) build_type="Debug";; release-symbols) build_type="RelWithDebInfo";; @@ -211,6 +215,7 @@ ${cmake} -DCMAKE_BUILD_TYPE=${build_type} \ -DCMAKE_C_COMPILER="${c_compiler}" \ -DCMAKE_CXX_COMPILER="${cxx_compiler}" \ -DCMAKE_PREFIX_PATH="${dependency_dir}" \ + -DTILEDB_VCPKG=${tiledb_vcpkg} \ -DTILEDB_ASSERTIONS=${tiledb_assertions} \ -DTILEDB_VERBOSE=${tiledb_verbose} \ -DTILEDB_HDFS=${tiledb_hdfs} \ diff --git a/cmake/Modules/FindAWSSDK_EP.cmake b/cmake/Modules/FindAWSSDK_EP.cmake index 0870a88436c..a43696db89a 100644 --- a/cmake/Modules/FindAWSSDK_EP.cmake +++ b/cmake/Modules/FindAWSSDK_EP.cmake @@ -31,6 +31,43 @@ # Include some common helper functions. include(TileDBCommon) +if(TILEDB_VCPKG) + find_package(AWSSDK QUIET CONFIG COMPONENTS core s3 REQUIRED) + set(AWS_SERVICES s3) + AWSSDK_DETERMINE_LIBS_TO_LINK(AWS_SERVICES AWS_LINKED_LIBS) + list(APPEND AWS_LINKED_LIBS aws-c-cal + aws-c-io + aws-cpp-sdk-identity-management + aws-cpp-sdk-sts) + + foreach (LIB ${AWS_LINKED_LIBS}) + if (NOT ${LIB} MATCHES "aws-*") + continue() + endif() + + find_library("AWS_FOUND_${LIB}" + NAMES ${LIB} + PATHS ${AWSSDK_LIB_DIR} + NO_DEFAULT_PATH + ) + message(STATUS "Found AWS lib: ${LIB} (${AWS_FOUND_${LIB}})") + if (NOT TARGET AWSSDK::${LIB}) + add_library(AWSSDK::${LIB} UNKNOWN IMPORTED) + set_target_properties(AWSSDK::${LIB} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${AWSSDK_INCLUDE_DIR}" + IMPORTED_LOCATION "${AWS_FOUND_${LIB}}" + ) + endif() + endforeach () + + # Add missing link directives here rather than adding + # conditional logic in tiledb/CMakeLists.txt + target_link_libraries(AWSSDK::aws-cpp-sdk-s3 INTERFACE AWSSDK::aws-c-cal) + target_link_libraries(AWSSDK::aws-cpp-sdk-s3 INTERFACE AWSSDK::aws-c-io) + + return() +endif() + ##----------------------------------- # early WIN32 audit of path length for aws sdk build where # insufficient available path length causes sdk build failure. diff --git a/cmake/Modules/FindMagic_EP.cmake b/cmake/Modules/FindMagic_EP.cmake index 5bde8a1c9b0..3b5fba8ce7d 100644 --- a/cmake/Modules/FindMagic_EP.cmake +++ b/cmake/Modules/FindMagic_EP.cmake @@ -34,6 +34,40 @@ # Include some common helper functions. include(TileDBCommon) +if(TILEDB_VCPKG) + find_path(libmagic_INCLUDE_DIR NAMES magic.h) + find_library(libmagic_LIBRARIES magic) + find_file(libmagic_DICTIONARY magic.mgc + PATH_SUFFIXES share/libmagic/misc + ) + + include(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(libmagic + REQUIRED_VARS + libmagic_INCLUDE_DIR + libmagic_LIBRARIES + libmagic_DICTIONARY + ) + + if(NOT libmagic_FOUND) + message(FATAL "Error finding libmagic") + endif() + + add_library(libmagic UNKNOWN IMPORTED) + set_target_properties(libmagic PROPERTIES + IMPORTED_LOCATION "${libmagic_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${libmagic_INCLUDE_DIR}" + ) + + # Some GitHub builders were finding a system installed liblzma when + # building the libmagic port. Rather than fight the issue we just force + # liblzma support everywhere. + find_package(liblzma CONFIG REQUIRED) + target_link_libraries(libmagic INTERFACE liblzma::liblzma) + + return() +endif() + # Search the path set during the superbuild for the EP. set(LIBMAGIC_PATHS ${TILEDB_EP_INSTALL_PREFIX}) diff --git a/cmake/Modules/FindOpenSSL_EP.cmake b/cmake/Modules/FindOpenSSL_EP.cmake index 8bdd315c620..99c13ec84b2 100644 --- a/cmake/Modules/FindOpenSSL_EP.cmake +++ b/cmake/Modules/FindOpenSSL_EP.cmake @@ -124,7 +124,9 @@ if (NOT OPENSSL_FOUND AND TILEDB_SUPERBUILD) endif() if (OPENSSL_FOUND) - message(STATUS "Found OpenSSL: ${OPENSSL_SSL_LIBRARY} -- OpenSSL crypto: ${OPENSSL_CRYPTO_LIBRARY} -- root: ${OPENSSL_ROOT_DIR}") + message(STATUS "Found OpenSSL: ${OPENSSL_SSL_LIBRARY}") + message(STATUS "Found OpenSSL crypto: ${OPENSSL_CRYPTO_LIBRARY}") + message(STATUS "OpenSSL Root: ${OPENSSL_ROOT_DIR}") if (DEFINED OPENSSL_INCLUDE_DIR AND "${OPENSSL_INCLUDE_DIR}" MATCHES "${HOMEBREW_BASE}.*") # define TILEDB_OPENSSL_DIR so we can ensure curl links the homebrew version diff --git a/cmake/Modules/FindWebp_EP.cmake b/cmake/Modules/FindWebp_EP.cmake index 0598e386ec8..e92a4f334e8 100644 --- a/cmake/Modules/FindWebp_EP.cmake +++ b/cmake/Modules/FindWebp_EP.cmake @@ -27,7 +27,13 @@ # Include some common helper functions. include(TileDBCommon) -if (TILEDB_WEBP_EP_BUILT) +if (TILEDB_VCPKG) + find_package(Threads REQUIRED) + find_package(WebP REQUIRED) + return() +endif() + +if(TILEDB_WEBP_EP_BUILT) find_package(WebP REQUIRED PATHS ${TILEDB_EP_INSTALL_PREFIX} ${TILEDB_DEPS_NO_DEFAULT_PATH}) endif() @@ -43,7 +49,7 @@ if(NOT TILEDB_WEBP_EP_BUILT) #GIT_TAG "release-1.?.?" # after 'static' addition in some release # from branch 'main' history as the 'static' support added apr 12 2022 # at implementation time is not yet in release branch/tag. - GIT_TAG "a19a25bb03757d5bb14f8d9755ab39f06d0ae5ef" + GIT_TAG "a19a25bb03757d5bb14f8d9755ab39f06d0ae5ef" GIT_SUBMODULES_RECURSE TRUE UPDATE_COMMAND "" CMAKE_ARGS diff --git a/cmake/Options/BuildOptions.cmake b/cmake/Options/BuildOptions.cmake index 23e6386d0e6..0b586e14f79 100644 --- a/cmake/Options/BuildOptions.cmake +++ b/cmake/Options/BuildOptions.cmake @@ -6,6 +6,7 @@ # in TileDB-Superbuild.cmake. option(TILEDB_SUPERBUILD "If true, perform a superbuild (builds all missing dependencies)." ON) +option(TILEDB_VCPKG "If true, use vcpkg to download and build dependencies." OFF) option(TILEDB_FORCE_ALL_DEPS "If true, force superbuild to download and build all dependencies, even those installed on the system." OFF) option(TILEDB_REMOVE_DEPRECATIONS "If true, do not build deprecated APIs." OFF) option(TILEDB_VERBOSE "Prints TileDB errors with verbosity" OFF) diff --git a/cmake/Options/TileDBToolchain.cmake b/cmake/Options/TileDBToolchain.cmake index f4086b120e4..57d7e518cae 100644 --- a/cmake/Options/TileDBToolchain.cmake +++ b/cmake/Options/TileDBToolchain.cmake @@ -3,7 +3,17 @@ ############################################################ # Only enable vcpkg on GCS builds for now -if (NOT TILEDB_GCS) +if (NOT TILEDB_VCPKG AND NOT TILEDB_GCS) + return() +endif() + +# For testing we're using --enable-gcs +if(TILEDB_GCS AND NOT TILEDB_VCPKG) + set(TILEDB_VCPKG ON) +endif() + +# We've already run vcpkg by the time the super build is finished +if (NOT TILEDB_SUPERBUILD) return() endif() @@ -19,4 +29,20 @@ else() endif() set(VCPKG_INSTALL_OPTIONS "--no-print-usage") -list(APPEND VCPKG_MANIFEST_FEATURES "gcs") + +macro(tiledb_vcpkg_enable_if tiledb_feature vcpkg_feature) + if(${tiledb_feature}) + list(APPEND VCPKG_MANIFEST_FEATURES ${vcpkg_feature}) + endif() +endmacro() + +tiledb_vcpkg_enable_if(TILEDB_ABSEIL "abseil") +tiledb_vcpkg_enable_if(TILEDB_AZURE "azure") +tiledb_vcpkg_enable_if(TILEDB_GCS "gcs") +tiledb_vcpkg_enable_if(TILEDB_SERIALIZATION "serialization") +tiledb_vcpkg_enable_if(TILEDB_S3 "s3") +tiledb_vcpkg_enable_if(TILEDB_TESTS "tests") +tiledb_vcpkg_enable_if(TILEDB_TOOLS "tools") +tiledb_vcpkg_enable_if(TILEDB_WEBP "webp") + +message("Using vcpkg features: ${VCPKG_MANIFEST_FEATURES}") diff --git a/cmake/TileDB-Superbuild.cmake b/cmake/TileDB-Superbuild.cmake index cd56cc5c7de..0b5dc1ba42c 100644 --- a/cmake/TileDB-Superbuild.cmake +++ b/cmake/TileDB-Superbuild.cmake @@ -29,6 +29,7 @@ set(INHERITED_CMAKE_ARGS -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} -DCOMPILER_SUPPORTS_AVX2=${COMPILER_SUPPORTS_AVX2} + -DTILEDB_VCPKG=${TILEDB_VCPKG} -DTILEDB_VERBOSE=${TILEDB_VERBOSE} -DTILEDB_ASSERTIONS=${TILEDB_ASSERTIONS} -DTILEDB_S3=${TILEDB_S3} diff --git a/ports/abseil/fix-32-bit-arm.patch b/ports/abseil/fix-32-bit-arm.patch new file mode 100644 index 00000000000..bc9ba4f1471 --- /dev/null +++ b/ports/abseil/fix-32-bit-arm.patch @@ -0,0 +1,23 @@ +diff --git a/absl/time/internal/cctz/src/zone_info_source.cc b/absl/time/internal/cctz/src/zone_info_source.cc +index 7209533..5ab5a59 100644 +--- a/absl/time/internal/cctz/src/zone_info_source.cc ++++ b/absl/time/internal/cctz/src/zone_info_source.cc +@@ -65,7 +65,7 @@ ZoneInfoSourceFactory zone_info_source_factory __attribute__((weak)) = + extern ZoneInfoSourceFactory zone_info_source_factory; + extern ZoneInfoSourceFactory default_factory; + ZoneInfoSourceFactory default_factory = DefaultFactory; +-#if defined(_M_IX86) ++#if defined(_M_IX86) || defined(_M_ARM) + #pragma comment( \ + linker, \ + "/alternatename:?zone_info_source_factory@cctz_extension@time_internal@" ABSL_INTERNAL_MANGLED_NS \ +@@ -83,8 +83,7 @@ ZoneInfoSourceFactory default_factory = DefaultFactory; + "@@U?$default_delete@VZoneInfoSource@cctz@time_internal@" ABSL_INTERNAL_MANGLED_NS \ + "@@@std@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z@" ABSL_INTERNAL_MANGLED_BACKREFERENCE \ + "@@ZA") +-#elif defined(_M_IA_64) || defined(_M_AMD64) || defined(_M_ARM) || \ +- defined(_M_ARM64) ++#elif defined(_M_IA_64) || defined(_M_AMD64) || defined(_M_ARM64) + #pragma comment( \ + linker, \ + "/alternatename:?zone_info_source_factory@cctz_extension@time_internal@" ABSL_INTERNAL_MANGLED_NS \ diff --git a/ports/abseil/fix-cxx-standard.patch b/ports/abseil/fix-cxx-standard.patch new file mode 100644 index 00000000000..83cdcbcc531 --- /dev/null +++ b/ports/abseil/fix-cxx-standard.patch @@ -0,0 +1,94 @@ +diff --git a/CMake/abslConfig.cmake.in b/CMake/abslConfig.cmake.in +index 62d246d..afcec1f 100644 +--- a/CMake/abslConfig.cmake.in ++++ b/CMake/abslConfig.cmake.in +@@ -6,3 +6,5 @@ find_dependency(Threads) + @PACKAGE_INIT@ + + include ("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") ++ ++set(ABSL_USE_CXX17 @ABSL_USE_CXX17@) +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 750a475..239977f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -67,6 +67,23 @@ else() + option(ABSL_ENABLE_INSTALL "Enable install rule" ON) + endif() + ++# CXX standard ++option(ABSL_USE_CXX17 "Enable CXX 17 standard" OFF) ++ ++if (ABSL_USE_CXX17) ++ set(CMAKE_CXX_STANDARD 17) ++ set(STD_ANY 1) ++ set(STD_OPTIONAL 1) ++ set(STD_STRING_VIEW 1) ++ set(STD_VARIANT 1) ++else() ++ set(CMAKE_CXX_STANDARD 11) ++ set(STD_ANY 0) ++ set(STD_OPTIONAL 0) ++ set(STD_STRING_VIEW 0) ++ set(STD_VARIANT 0) ++endif() ++ + option(ABSL_PROPAGATE_CXX_STD + "Use CMake C++ standard meta features (e.g. cxx_std_11) that propagate to targets that link to Abseil" + OFF) # TODO: Default to ON for CMake 3.8 and greater. +diff --git a/absl/base/CMakeLists.txt b/absl/base/CMakeLists.txt +index c7233cb..65a9076 100644 +--- a/absl/base/CMakeLists.txt ++++ b/absl/base/CMakeLists.txt +@@ -38,6 +38,11 @@ absl_cc_library( + COPTS + ${ABSL_DEFAULT_COPTS} + ) ++if (NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/options.h.in) ++ file(RENAME ${CMAKE_CURRENT_LIST_DIR}/options.h ${CMAKE_CURRENT_LIST_DIR}/options.h.in) ++endif() ++file(REMOVE ${CMAKE_CURRENT_LIST_DIR}/options.h) ++configure_file(${CMAKE_CURRENT_LIST_DIR}/options.h.in ${CMAKE_CURRENT_LIST_DIR}/options.h @ONLY) + + absl_cc_library( + NAME +diff --git a/absl/base/options.h b/absl/base/options.h +index 56b4e36..0b098ed 100644 +--- a/absl/base/options.h ++++ b/absl/base/options.h +@@ -100,7 +100,7 @@ + // User code should not inspect this macro. To check in the preprocessor if + // absl::any is a typedef of std::any, use the feature macro ABSL_USES_STD_ANY. + +-#define ABSL_OPTION_USE_STD_ANY 2 ++#define ABSL_OPTION_USE_STD_ANY @STD_ANY@ + + + // ABSL_OPTION_USE_STD_OPTIONAL +@@ -127,7 +127,7 @@ + // absl::optional is a typedef of std::optional, use the feature macro + // ABSL_USES_STD_OPTIONAL. + +-#define ABSL_OPTION_USE_STD_OPTIONAL 2 ++#define ABSL_OPTION_USE_STD_OPTIONAL @STD_OPTIONAL@ + + + // ABSL_OPTION_USE_STD_STRING_VIEW +@@ -154,7 +154,7 @@ + // absl::string_view is a typedef of std::string_view, use the feature macro + // ABSL_USES_STD_STRING_VIEW. + +-#define ABSL_OPTION_USE_STD_STRING_VIEW 2 ++#define ABSL_OPTION_USE_STD_STRING_VIEW @STD_STRING_VIEW@ + + // ABSL_OPTION_USE_STD_VARIANT + // +@@ -180,7 +180,7 @@ + // absl::variant is a typedef of std::variant, use the feature macro + // ABSL_USES_STD_VARIANT. + +-#define ABSL_OPTION_USE_STD_VARIANT 2 ++#define ABSL_OPTION_USE_STD_VARIANT @STD_VARIANT@ + + + // ABSL_OPTION_USE_INLINE_NAMESPACE diff --git a/ports/abseil/portfile.cmake b/ports/abseil/portfile.cmake new file mode 100644 index 00000000000..1289eed36a9 --- /dev/null +++ b/ports/abseil/portfile.cmake @@ -0,0 +1,55 @@ +if (NOT VCPKG_TARGET_IS_WINDOWS) + vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO abseil/abseil-cpp + REF 215105818dfde3174fe799600bb0f3cae233d0bf #LTS 20211102, Patch 1 + SHA512 75d234eac76be8790cf09e3e1144e4b4cf5cacb61e46961a9e4a35b37d0fa85243afdd5de5f47a006ef96af6fc91ecc0c233297c4c32258c08d46304b3361330 + HEAD_REF master + PATCHES + # in C++17 mode, use std::any, std::optional, std::string_view, std::variant + # instead of the library replacement types + # in C++11 mode, force use of library replacement types, otherwise the automatic + # detection can cause ABI issues depending on which compiler options + # are enabled for consuming user code + fix-cxx-standard.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + cxx17 ABSL_USE_CXX17 +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + DISABLE_PARALLEL_CONFIGURE + OPTIONS ${FEATURE_OPTIONS} +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(PACKAGE_NAME absl CONFIG_PATH lib/cmake/absl) +vcpkg_fixup_pkgconfig() + +vcpkg_copy_pdbs() +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share" + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/include/absl/copts" + "${CURRENT_PACKAGES_DIR}/include/absl/strings/testdata" + "${CURRENT_PACKAGES_DIR}/include/absl/time/internal/cctz/testdata" +) + +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/absl/base/config.h" + "#elif defined(ABSL_CONSUME_DLL)" "#elif 1" + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/absl/base/internal/thread_identity.h" + "&& !defined(ABSL_CONSUME_DLL)" "&& 0" + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/absl/container/internal/hashtablez_sampler.h" + "!defined(ABSL_CONSUME_DLL)" "0" + ) +endif() + +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/abseil/vcpkg.json b/ports/abseil/vcpkg.json new file mode 100644 index 00000000000..a3abb08e816 --- /dev/null +++ b/ports/abseil/vcpkg.json @@ -0,0 +1,26 @@ +{ + "name": "abseil", + "version-string": "20211102.0", + "description": [ + "an open-source collection designed to augment the C++ standard library.", + "Abseil is an open-source collection of C++ library code designed to augment the C++ standard library. The Abseil library code is collected from Google's own C++ code base, has been extensively tested and used in production, and is the same code we depend on in our daily coding lives.", + "In some cases, Abseil provides pieces missing from the C++ standard; in others, Abseil provides alternatives to the standard for special needs we've found through usage in the Google code base. We denote those cases clearly within the library code we provide you.", + "Abseil is not meant to be a competitor to the standard library; we've just found that many of these utilities serve a purpose within our code base, and we now want to provide those resources to the C++ community as a whole." + ], + "homepage": "https://github.com/abseil/abseil-cpp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "cxx17": { + "description": "Enable compiler C++17." + } + } +} diff --git a/ports/aws-c-cal/fix-cmake-target-path.patch b/ports/aws-c-cal/fix-cmake-target-path.patch new file mode 100644 index 00000000000..25d6749b873 --- /dev/null +++ b/ports/aws-c-cal/fix-cmake-target-path.patch @@ -0,0 +1,28 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6039819..b74b65c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -158,7 +158,7 @@ else() + endif() + + install(EXPORT "${PROJECT_NAME}-targets" +- DESTINATION "${LIBRARY_DIRECTORY}/${PROJECT_NAME}/cmake/${TARGET_DIR}/" ++ DESTINATION "${LIBRARY_DIRECTORY}/${PROJECT_NAME}/cmake/" + NAMESPACE AWS:: + COMPONENT Development) + +diff --git a/cmake/aws-c-cal-config.cmake b/cmake/aws-c-cal-config.cmake +index 73e7311..e87c43a 100644 +--- a/cmake/aws-c-cal-config.cmake ++++ b/cmake/aws-c-cal-config.cmake +@@ -7,9 +7,5 @@ if (NOT BYO_CRYPTO AND NOT WIN32 AND NOT APPLE) + find_dependency(LibCrypto) + endif() + +-if (BUILD_SHARED_LIBS) +- include(${CMAKE_CURRENT_LIST_DIR}/shared/@PROJECT_NAME@-targets.cmake) +-else() +- include(${CMAKE_CURRENT_LIST_DIR}/static/@PROJECT_NAME@-targets.cmake) +-endif() ++include(${CMAKE_CURRENT_LIST_DIR}/@CMAKE_PROJECT_NAME@-targets.cmake) + diff --git a/ports/aws-c-cal/portfile.cmake b/ports/aws-c-cal/portfile.cmake new file mode 100644 index 00000000000..e9c8e4f7e24 --- /dev/null +++ b/ports/aws-c-cal/portfile.cmake @@ -0,0 +1,40 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO awslabs/aws-c-cal + REF c4c5b175e05f2affe5e3f0203ca6c8bc5cdd8f51 # v0.5.12 + SHA512 25dd1d7f207f1324aed418555dda1c3d4ec64baf76431c9efd88fd3c34b163a2e5a6778192d2c0caf937f3efd31b2f21e6a0d0f7230684d176164da0e8bcc92e + HEAD_REF master + PATCHES fix-cmake-target-path.patch + remove-libcrypto-messages.patch +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + "-DCMAKE_MODULE_PATH=${CURRENT_INSTALLED_DIR}/share/aws-c-common" # use extra cmake files + -DBUILD_TESTING=FALSE +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(CONFIG_PATH lib/aws-c-cal/cmake) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/bin" + "${CURRENT_PACKAGES_DIR}/debug/bin" + ) +endif() + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/lib/aws-c-cal" + "${CURRENT_PACKAGES_DIR}/lib/aws-c-cal" + ) + +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +# Handle copyright +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/aws-c-cal/remove-libcrypto-messages.patch b/ports/aws-c-cal/remove-libcrypto-messages.patch new file mode 100644 index 00000000000..6115bb1d336 --- /dev/null +++ b/ports/aws-c-cal/remove-libcrypto-messages.patch @@ -0,0 +1,14 @@ +diff --git a/cmake/modules/FindLibCrypto.cmake b/cmake/modules/FindLibCrypto.cmake +index 564ba97..f748212 100644 +--- a/cmake/modules/FindLibCrypto.cmake ++++ b/cmake/modules/FindLibCrypto.cmake +@@ -89,9 +89,6 @@ else() + set(LIBCRYPTO_FOUND true) + set(LibCrypto_FOUND true) + +- message(STATUS "LibCrypto Include Dir: ${LibCrypto_INCLUDE_DIR}") +- message(STATUS "LibCrypto Shared Lib: ${LibCrypto_SHARED_LIBRARY}") +- message(STATUS "LibCrypto Static Lib: ${LibCrypto_STATIC_LIBRARY}") + if (NOT TARGET crypto AND + (EXISTS "${LibCrypto_LIBRARY}") + ) diff --git a/ports/aws-c-cal/vcpkg.json b/ports/aws-c-cal/vcpkg.json new file mode 100644 index 00000000000..94b2f10728a --- /dev/null +++ b/ports/aws-c-cal/vcpkg.json @@ -0,0 +1,19 @@ +{ + "name": "aws-c-cal", + "version": "0.5.12", + "port-version": 2, + "description": "C99 wrapper for cryptography primitives.", + "homepage": "https://github.com/awslabs/aws-c-cal", + "supports": "!(windows & arm) & !uwp", + "dependencies": [ + "aws-c-common", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/ports/aws-c-common/disable-internal-crt-option.patch b/ports/aws-c-common/disable-internal-crt-option.patch new file mode 100644 index 00000000000..6fec4b214d1 --- /dev/null +++ b/ports/aws-c-common/disable-internal-crt-option.patch @@ -0,0 +1,20 @@ +diff --git a/cmake/AwsCFlags.cmake b/cmake/AwsCFlags.cmake +index 249b7d5..41a31e2 100644 +--- a/cmake/AwsCFlags.cmake ++++ b/cmake/AwsCFlags.cmake +@@ -38,15 +38,6 @@ function(aws_set_common_properties target) + list(APPEND AWS_C_FLAGS /DAWS_SUPPORT_WIN7=1) + endif() + +- string(TOUPPER "${CMAKE_BUILD_TYPE}" _CMAKE_BUILD_TYPE) +- if(STATIC_CRT) +- string(REPLACE "/MD" "/MT" _FLAGS "${CMAKE_C_FLAGS_${_CMAKE_BUILD_TYPE}}") +- else() +- string(REPLACE "/MT" "/MD" _FLAGS "${CMAKE_C_FLAGS_${_CMAKE_BUILD_TYPE}}") +- endif() +- string(REPLACE " " ";" _FLAGS "${_FLAGS}") +- list(APPEND AWS_C_FLAGS "${_FLAGS}") +- + else() + list(APPEND AWS_C_FLAGS -Wall -Wstrict-prototypes) + diff --git a/ports/aws-c-common/fix-cmake-target-path.patch b/ports/aws-c-common/fix-cmake-target-path.patch new file mode 100644 index 00000000000..9ab97f6798d --- /dev/null +++ b/ports/aws-c-common/fix-cmake-target-path.patch @@ -0,0 +1,28 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9b01f56..3cc541d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -239,7 +239,7 @@ else() + endif() + + install(EXPORT "${PROJECT_NAME}-targets" +- DESTINATION "${LIBRARY_DIRECTORY}/${PROJECT_NAME}/cmake/${TARGET_DIR}" ++ DESTINATION "${LIBRARY_DIRECTORY}/${PROJECT_NAME}/cmake" + NAMESPACE AWS:: + COMPONENT Development) + +diff --git a/cmake/aws-c-common-config.cmake b/cmake/aws-c-common-config.cmake +index e495210..b7676c2 100644 +--- a/cmake/aws-c-common-config.cmake ++++ b/cmake/aws-c-common-config.cmake +@@ -4,9 +4,5 @@ if(WIN32 OR UNIX OR APPLE) + find_package(Threads REQUIRED) + endif() + +-if (BUILD_SHARED_LIBS) +- include(${CMAKE_CURRENT_LIST_DIR}/shared/@PROJECT_NAME@-targets.cmake) +-else() +- include(${CMAKE_CURRENT_LIST_DIR}/static/@PROJECT_NAME@-targets.cmake) +-endif() ++include(${CMAKE_CURRENT_LIST_DIR}/@CMAKE_PROJECT_NAME@-targets.cmake) + diff --git a/ports/aws-c-common/portfile.cmake b/ports/aws-c-common/portfile.cmake new file mode 100644 index 00000000000..d8672c140f9 --- /dev/null +++ b/ports/aws-c-common/portfile.cmake @@ -0,0 +1,34 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO awslabs/aws-c-common + REF 68f28f8df258390744f3c5b460250f8809161041 # v0.6.20 + SHA512 a8be405e0e1586a06db038a0068df2c9277772ff7b8df2c542d18d2aae4b2bc0fd89de668ab10d84476446834390e4e27383b68d86c7d9f0d0749b57802866f1 + HEAD_REF master + PATCHES + disable-internal-crt-option.patch # Disable internal crt option because vcpkg contains crt processing flow + fix-cmake-target-path.patch # Shared libraries and static libraries are not built at the same time +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DBUILD_TESTING=FALSE +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(CONFIG_PATH lib/aws-c-common/cmake) +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake) + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/lib/aws-c-common" + "${CURRENT_PACKAGES_DIR}/lib/aws-c-common" + ) + +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +# Handle copyright +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/aws-c-common/vcpkg.json b/ports/aws-c-common/vcpkg.json new file mode 100644 index 00000000000..a775cf692d9 --- /dev/null +++ b/ports/aws-c-common/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "aws-c-common", + "version": "0.6.20", + "description": "AWS common library for C", + "homepage": "https://github.com/awslabs/aws-c-common", + "supports": "!(windows & arm) & !uwp", + "dependencies": [ + "openssl", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/ports/aws-c-event-stream/fix-cmake-target-path.patch b/ports/aws-c-event-stream/fix-cmake-target-path.patch new file mode 100644 index 00000000000..37d28ca9bc5 --- /dev/null +++ b/ports/aws-c-event-stream/fix-cmake-target-path.patch @@ -0,0 +1,28 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index daf434c..32d7851 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -91,7 +91,7 @@ else() + endif() + + install(EXPORT "${PROJECT_NAME}-targets" +- DESTINATION "${LIBRARY_DIRECTORY}/${PROJECT_NAME}/cmake/${TARGET_DIR}/" ++ DESTINATION "${LIBRARY_DIRECTORY}/${PROJECT_NAME}/cmake/" + NAMESPACE AWS:: + COMPONENT Development) + +diff --git a/cmake/aws-c-event-stream-config.cmake b/cmake/aws-c-event-stream-config.cmake +index 76adb84..7884368 100644 +--- a/cmake/aws-c-event-stream-config.cmake ++++ b/cmake/aws-c-event-stream-config.cmake +@@ -2,9 +2,5 @@ include(CMakeFindDependencyMacro) + find_dependency(aws-c-io) + find_dependency(aws-checksums) + +-if (BUILD_SHARED_LIBS) +- include(${CMAKE_CURRENT_LIST_DIR}/shared/@PROJECT_NAME@-targets.cmake) +-else() +- include(${CMAKE_CURRENT_LIST_DIR}/static/@PROJECT_NAME@-targets.cmake) +-endif() ++include(${CMAKE_CURRENT_LIST_DIR}/@CMAKE_PROJECT_NAME@-targets.cmake) + diff --git a/ports/aws-c-event-stream/portfile.cmake b/ports/aws-c-event-stream/portfile.cmake new file mode 100644 index 00000000000..be821d66bd2 --- /dev/null +++ b/ports/aws-c-event-stream/portfile.cmake @@ -0,0 +1,32 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO awslabs/aws-c-event-stream + REF e87537be561d753ec82e783bc0929b1979c585f8 # v0.2.7 + SHA512 651b05ba6d87ad8f65f6cf7e8940b7ea500722848f3e65c2de0bf84d2e6321d0aa1631d4f64a78cf5ed5ed5adac6805a4e91e5c31b3ae86e8c37afb38da4c786 + HEAD_REF master + PATCHES fix-cmake-target-path.patch +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + "-DCMAKE_MODULE_PATH=${CURRENT_INSTALLED_DIR}/share/aws-c-common" + -DBUILD_TESTING=FALSE +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(CONFIG_PATH lib/aws-c-event-stream/cmake) + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/lib/aws-c-event-stream" + "${CURRENT_PACKAGES_DIR}/lib/aws-c-event-stream" + ) + +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +# Handle copyright +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/aws-c-event-stream/vcpkg.json b/ports/aws-c-event-stream/vcpkg.json new file mode 100644 index 00000000000..ebabcab6a4d --- /dev/null +++ b/ports/aws-c-event-stream/vcpkg.json @@ -0,0 +1,22 @@ +{ + "name": "aws-c-event-stream", + "version": "0.2.7", + "port-version": 2, + "description": "C99 implementation of the vnd.amazon.event-stream content-type.", + "homepage": "https://github.com/awslabs/aws-c-event-stream", + "supports": "!(windows & arm) & !uwp", + "dependencies": [ + "aws-c-cal", + "aws-c-common", + "aws-c-io", + "aws-checksums", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/ports/aws-c-io/fix-cmake-target-path.patch b/ports/aws-c-io/fix-cmake-target-path.patch new file mode 100644 index 00000000000..ca5d575e443 --- /dev/null +++ b/ports/aws-c-io/fix-cmake-target-path.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a8a9099..a657782 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -215,7 +215,7 @@ else() + endif() + + install(EXPORT "${PROJECT_NAME}-targets" +- DESTINATION "${LIBRARY_DIRECTORY}/${PROJECT_NAME}/cmake/${TARGET_DIR}" ++ DESTINATION "${LIBRARY_DIRECTORY}/${PROJECT_NAME}/cmake/" + NAMESPACE AWS:: + COMPONENT Development) + +diff --git a/cmake/aws-c-io-config.cmake b/cmake/aws-c-io-config.cmake +index d4bc525..72a78ec 100644 +--- a/cmake/aws-c-io-config.cmake ++++ b/cmake/aws-c-io-config.cmake +@@ -7,8 +7,4 @@ endif() + find_dependency(aws-c-common) + find_dependency(aws-c-cal) + +-if (BUILD_SHARED_LIBS) +- include(${CMAKE_CURRENT_LIST_DIR}/shared/@PROJECT_NAME@-targets.cmake) +-else() +- include(${CMAKE_CURRENT_LIST_DIR}/static/@PROJECT_NAME@-targets.cmake) +-endif() ++include(${CMAKE_CURRENT_LIST_DIR}/@CMAKE_PROJECT_NAME@-targets.cmake) diff --git a/ports/aws-c-io/portfile.cmake b/ports/aws-c-io/portfile.cmake new file mode 100644 index 00000000000..d72cdaed69a --- /dev/null +++ b/ports/aws-c-io/portfile.cmake @@ -0,0 +1,32 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO awslabs/aws-c-io + REF cfe553a770e9c2d1c93b8cdfb870b9f2a46b436e # v0.10.22 + SHA512 7a741f5b1c895ceb11f73b67828fd3623c180cb8a3863f3b63a67ac1437d2c47911d50510777b13ee66fd0a009ab09a8c83fd036a0fca2f25a0835f48f023de7 + HEAD_REF master + PATCHES fix-cmake-target-path.patch +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + "-DCMAKE_MODULE_PATH=${CURRENT_INSTALLED_DIR}/share/aws-c-common" # use extra cmake files + -DBUILD_TESTING=FALSE +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(CONFIG_PATH lib/aws-c-io/cmake) + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/lib/aws-c-io" + "${CURRENT_PACKAGES_DIR}/lib/aws-c-io" + ) + +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +# Handle copyright +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/aws-c-io/vcpkg.json b/ports/aws-c-io/vcpkg.json new file mode 100644 index 00000000000..203f3649fd7 --- /dev/null +++ b/ports/aws-c-io/vcpkg.json @@ -0,0 +1,23 @@ +{ + "name": "aws-c-io", + "version": "0.10.22", + "description": "Handles all IO and TLS work for application protocols.", + "homepage": "https://github.com/awslabs/aws-c-io", + "supports": "!(windows & arm) & !uwp", + "dependencies": [ + "aws-c-cal", + "aws-c-common", + { + "name": "s2n", + "platform": "!uwp & !windows" + }, + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/ports/aws-checksums/fix-cmake-target-path.patch b/ports/aws-checksums/fix-cmake-target-path.patch new file mode 100644 index 00000000000..101a5379f28 --- /dev/null +++ b/ports/aws-checksums/fix-cmake-target-path.patch @@ -0,0 +1,25 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 888742b..efdd817 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -140,7 +140,7 @@ else() + endif() + + install(EXPORT "${PROJECT_NAME}-targets" +- DESTINATION "${LIBRARY_DIRECTORY}/${PROJECT_NAME}/cmake/${TARGET_DIR}" ++ DESTINATION "${LIBRARY_DIRECTORY}/${PROJECT_NAME}/cmake/" + NAMESPACE AWS:: + COMPONENT Development) + +diff --git a/cmake/aws-checksums-config.cmake b/cmake/aws-checksums-config.cmake +index 6de2e44..84d55d1 100644 +--- a/cmake/aws-checksums-config.cmake ++++ b/cmake/aws-checksums-config.cmake +@@ -1,6 +1,2 @@ +-if (BUILD_SHARED_LIBS) +- include(${CMAKE_CURRENT_LIST_DIR}/shared/@PROJECT_NAME@-targets.cmake) +-else() +- include(${CMAKE_CURRENT_LIST_DIR}/static/@PROJECT_NAME@-targets.cmake) +-endif() ++include(${CMAKE_CURRENT_LIST_DIR}/@CMAKE_PROJECT_NAME@-targets.cmake) + diff --git a/ports/aws-checksums/portfile.cmake b/ports/aws-checksums/portfile.cmake new file mode 100644 index 00000000000..55f05f78471 --- /dev/null +++ b/ports/aws-checksums/portfile.cmake @@ -0,0 +1,39 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO awslabs/aws-checksums + REF 99bb0ad4b89d335d638536694352c45e0d2188f5 # v0.1.11 + SHA512 cb9c249496fd41fda1efb9330e823d8b965adca6c8f372a50fe97eda821e277780bf9af8f5977102c44121568993cca55edbb750967b41f323e07e06a93c50a8 + HEAD_REF master + PATCHES fix-cmake-target-path.patch +) + +if (VCPKG_CRT_LINKAGE STREQUAL static) + set(STATIC_CRT_LNK ON) +else() + set(STATIC_CRT_LNK OFF) +endif() + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DSTATIC_CRT=${STATIC_CRT_LNK} + "-DCMAKE_MODULE_PATH=${CURRENT_INSTALLED_DIR}/share/aws-c-common" # use extra cmake files + -DBUILD_TESTING=FALSE +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(CONFIG_PATH lib/aws-checksums/cmake) + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/lib/aws-checksums" + "${CURRENT_PACKAGES_DIR}/lib/aws-checksums" +) + +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +# Handle copyright +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/aws-checksums/vcpkg.json b/ports/aws-checksums/vcpkg.json new file mode 100644 index 00000000000..c31742e6a88 --- /dev/null +++ b/ports/aws-checksums/vcpkg.json @@ -0,0 +1,19 @@ +{ + "name": "aws-checksums", + "version": "0.1.11", + "port-version": 3, + "description": "Cross-Platform HW accelerated CRC32c and CRC32 with fallback to efficient SW implementations.", + "homepage": "https://github.com/awslabs/aws-checksums", + "supports": "!(windows & arm)", + "dependencies": [ + "aws-c-common", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/ports/aws-sdk-cpp/001-patch-relocatable-rpath.patch b/ports/aws-sdk-cpp/001-patch-relocatable-rpath.patch new file mode 100644 index 00000000000..9c5a5a2c5d0 --- /dev/null +++ b/ports/aws-sdk-cpp/001-patch-relocatable-rpath.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a653e38628..76d6067646 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -142,7 +142,6 @@ else() + endif() + + # Add Linker search paths to RPATH so as to fix the problem where some linkers can't find cross-compiled dependent libraries in customer paths when linking executables. +-set(CMAKE_INSTALL_RPATH_USE_LINK_PATH true) + + # build third-party targets + if (BUILD_DEPS) diff --git a/ports/aws-sdk-cpp/002-aws-c-common.patch b/ports/aws-sdk-cpp/002-aws-c-common.patch new file mode 100644 index 00000000000..0690361b3b6 --- /dev/null +++ b/ports/aws-sdk-cpp/002-aws-c-common.patch @@ -0,0 +1,13 @@ +diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt +index b4cf1be2..64f10d43 100644 +--- a/third-party/CMakeLists.txt ++++ b/third-party/CMakeLists.txt +@@ -15,7 +15,7 @@ set(AWS_DEPS_BUILD_DIR "${CMAKE_BINARY_DIR}/build" CACHE PATH "Dependencies buil + set(AWS_DEPS_DOWNLOAD_DIR "${AWS_DEPS_BUILD_DIR}/downloads" CACHE PATH "Dependencies download directory.") + + set(AWS_C_COMMON_URL "https://github.com/awslabs/aws-c-common.git") +-set(AWS_C_COMMON_TAG "v0.4.42") ++set(AWS_C_COMMON_TAG "v0.6.2") + include(BuildAwsCCommon) + + set(AWS_CHECKSUMS_URL "https://github.com/awslabs/aws-checksums.git") diff --git a/ports/aws-sdk-cpp/003-fix-AWSSDKCONFIG.patch b/ports/aws-sdk-cpp/003-fix-AWSSDKCONFIG.patch new file mode 100644 index 00000000000..c3f35935e94 --- /dev/null +++ b/ports/aws-sdk-cpp/003-fix-AWSSDKCONFIG.patch @@ -0,0 +1,50 @@ +diff --git a/cmake/AWSSDKConfig.cmake b/cmake/AWSSDKConfig.cmake +index c2f643e6aa..d33e64b453 100644 +--- a/cmake/AWSSDKConfig.cmake ++++ b/cmake/AWSSDKConfig.cmake +@@ -24,6 +24,10 @@ if(AWSSDK_FOUND) + return() + endif() + ++include(CMakeFindDependencyMacro) ++find_dependency(OpenSSL) ++find_dependency(ZLIB) ++ + include(${CMAKE_CURRENT_LIST_DIR}/AWSSDKConfigVersion.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/sdksCommon.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/platformDeps.cmake) +@@ -43,7 +47,6 @@ endif() + + # On Windows, dlls are treated as runtime target and installed in bindir + if (WIN32 AND AWSSDK_INSTALL_AS_SHARED_LIBS) +- set(AWSSDK_INSTALL_LIBDIR "${AWSSDK_INSTALL_BINDIR}") + # If installed CMake scripts are associated with dll library, define USE_IMPORT_EXPORT for customers + add_definitions(-DUSE_IMPORT_EXPORT) + endif() +@@ -54,7 +57,6 @@ endif() + get_filename_component(AWSSDK_DEFAULT_ROOT_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) + get_filename_component(AWSSDK_DEFAULT_ROOT_DIR "${AWSSDK_DEFAULT_ROOT_DIR}" PATH) + get_filename_component(AWSSDK_DEFAULT_ROOT_DIR "${AWSSDK_DEFAULT_ROOT_DIR}" PATH) +-get_filename_component(AWSSDK_DEFAULT_ROOT_DIR "${AWSSDK_DEFAULT_ROOT_DIR}" PATH) + get_filename_component(AWS_NATIVE_SDK_ROOT "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE) + + set(CPP_STANDARD "11" CACHE STRING "Flag to upgrade the C++ standard used. The default is 11. The minimum is 11.") +@@ -116,11 +118,13 @@ endif() + get_filename_component(TEMP_PATH "${AWSSDK_CORE_LIB_FILE}" PATH) + get_filename_component(TEMP_NAME "${TEMP_PATH}" NAME) + +-while (NOT TEMP_NAME STREQUAL ${LIB_SEARCH_PREFIX}) +- set(TEMP_PLATFORM_PREFIX "${TEMP_NAME}/${TEMP_PLATFORM_PREFIX}") +- get_filename_component(TEMP_PATH "${TEMP_PATH}" PATH) +- get_filename_component(TEMP_NAME "${TEMP_PATH}" NAME) +-endwhile() ++if(LIB_SEARCH_PATH) ++ while (NOT TEMP_NAME STREQUAL ${LIB_SEARCH_PREFIX}) ++ set(TEMP_PLATFORM_PREFIX "${TEMP_NAME}/${TEMP_PLATFORM_PREFIX}") ++ get_filename_component(TEMP_PATH "${TEMP_PATH}" PATH) ++ get_filename_component(TEMP_NAME "${TEMP_PATH}" NAME) ++ endwhile() ++endif() + + set(AWSSDK_PLATFORM_PREFIX "${TEMP_PLATFORM_PREFIX}") + diff --git a/ports/aws-sdk-cpp/004-fix-check-c-source-runs.patch b/ports/aws-sdk-cpp/004-fix-check-c-source-runs.patch new file mode 100644 index 00000000000..c782d56f407 --- /dev/null +++ b/ports/aws-sdk-cpp/004-fix-check-c-source-runs.patch @@ -0,0 +1,16 @@ +diff --git a/aws-cpp-sdk-core/CMakeLists.txt b/aws-cpp-sdk-core/CMakeLists.txt +index fa9f99326b..3cb60a9171 100644 +--- a/aws-cpp-sdk-core/CMakeLists.txt ++++ b/aws-cpp-sdk-core/CMakeLists.txt +@@ -89,9 +89,10 @@ include(CheckCXXSourceRuns) + + # http client implementations + if(ENABLE_CURL_CLIENT) ++ find_package(ZLIB REQUIRED) + file(GLOB HTTP_CURL_CLIENT_HEADERS "include/aws/core/http/curl/*.h") + file(GLOB HTTP_CURL_CLIENT_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/source/http/curl/*.cpp") +- set(CMAKE_REQUIRED_LIBRARIES ${CURL_LIBRARIES}) ++ set(CMAKE_REQUIRED_LIBRARIES ${CURL_LIBRARIES} ZLIB::ZLIB) + check_c_source_runs(" + #include + int main() { diff --git a/ports/aws-sdk-cpp/005-fix-cjson-sprintf.patch b/ports/aws-sdk-cpp/005-fix-cjson-sprintf.patch new file mode 100644 index 00000000000..a87f97056d2 --- /dev/null +++ b/ports/aws-sdk-cpp/005-fix-cjson-sprintf.patch @@ -0,0 +1,59 @@ +diff --git a/aws-cpp-sdk-core/source/external/cjson/cJSON.cpp b/aws-cpp-sdk-core/source/external/cjson/cJSON.cpp +index 2525976334..cf18a8391a 100644 +--- a/aws-cpp-sdk-core/source/external/cjson/cJSON.cpp ++++ b/aws-cpp-sdk-core/source/external/cjson/cJSON.cpp +@@ -88,7 +88,7 @@ CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item) { + CJSON_PUBLIC(const char*) cJSON_Version(void) + { + static char version[15]; +- sprintf(version, "%i.%i.%i", CJSON_VERSION_MAJOR, CJSON_VERSION_MINOR, CJSON_VERSION_PATCH); ++ snprintf(version, 15, "%i.%i.%i", CJSON_VERSION_MAJOR, CJSON_VERSION_MINOR, CJSON_VERSION_PATCH); + + return version; + } +@@ -500,23 +500,23 @@ static cJSON_bool print_number(const cJSON * const item, printbuffer * const out + /* For integer which is out of the range of [INT_MIN, INT_MAX], valuestring is an integer literal. */ + if (item->valuestring) + { +- length = sprintf((char*)number_buffer, "%s", item->valuestring); ++ length = snprintf((char*)number_buffer, 26, "%s", item->valuestring); + } + /* This checks for NaN and Infinity */ + else if ((d * 0) != 0) + { +- length = sprintf((char*)number_buffer, "null"); ++ length = snprintf((char*)number_buffer, 26, "null"); + } + else + { + /* Try 15 decimal places of precision to avoid nonsignificant nonzero digits */ +- length = sprintf((char*)number_buffer, "%1.15g", d); ++ length = snprintf((char*)number_buffer, 26, "%1.15g", d); + + /* Check whether the original double can be recovered */ + if ((sscanf((char*)number_buffer, "%lg", &test) != 1) || ((double)test != d)) + { + /* If not, print with 17 decimal places of precision */ +- length = sprintf((char*)number_buffer, "%1.17g", d); ++ length = snprintf((char*)number_buffer, 26, "%1.17g", d); + } + } + +@@ -949,7 +949,7 @@ static cJSON_bool print_string_ptr(const unsigned char * const input, printbuffe + break; + default: + /* escape and print as unicode codepoint */ +- sprintf((char*)output_pointer, "u%04x", *input_pointer); ++ snprintf((char*)output_pointer, 6, "u%04x", *input_pointer); + output_pointer += 4; + break; + } +@@ -2342,7 +2342,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateInt64(long long num) + if (num > INT_MAX || num < INT_MIN) + { + char buf[21]; +- sprintf(buf, "%lld", num); ++ snprintf(buf, 21, "%lld", num); + item->valuestring = (char*)cJSON_strdup((const unsigned char*)buf, &global_hooks); + } + diff --git a/ports/aws-sdk-cpp/CONTROL b/ports/aws-sdk-cpp/CONTROL new file mode 100644 index 00000000000..7ce44016085 --- /dev/null +++ b/ports/aws-sdk-cpp/CONTROL @@ -0,0 +1,539 @@ +Source: aws-sdk-cpp +Version: 1.8.84 +Port-Version: 0 +Homepage: https://github.com/aws/aws-sdk-cpp +Description: AWS SDK for C++ +Build-Depends: openssl (!uwp&!windows), curl (!uwp&!windows), aws-c-event-stream, zlib +Default-Features: dynamodb, s3, kinesis +# Automatically generated by generateFeatures.ps1 + +Feature: access-management +Description: C++ SDK for the AWS access-management service + +Feature: acm +Description: C++ SDK for the AWS acm service + +Feature: acm-pca +Description: C++ SDK for the AWS acm-pca service + +Feature: alexaforbusiness +Description: C++ SDK for the AWS alexaforbusiness service + +Feature: amplify +Description: C++ SDK for the AWS amplify service + +Feature: apigateway +Description: C++ SDK for the AWS apigateway service + +Feature: apigatewaymanagementapi +Description: C++ SDK for the AWS apigatewaymanagementapi service + +Feature: apigatewayv2 +Description: C++ SDK for the AWS apigatewayv2 service + +Feature: application-autoscaling +Description: C++ SDK for the AWS application-autoscaling service + +Feature: appmesh +Description: C++ SDK for the AWS appmesh service + +Feature: appstream +Description: C++ SDK for the AWS appstream service + +Feature: appsync +Description: C++ SDK for the AWS appsync service + +Feature: athena +Description: C++ SDK for the AWS athena service + +Feature: autoscaling +Description: C++ SDK for the AWS autoscaling service + +Feature: autoscaling-plans +Description: C++ SDK for the AWS autoscaling-plans service + +Feature: awsmigrationhub +Description: C++ SDK for the AWS AWSMigrationHub service + +Feature: awstransfer +Description: C++ SDK for the AWS awstransfer service + +Feature: backup +Description: C++ SDK for the AWS backup service + +Feature: batch +Description: C++ SDK for the AWS batch service + +Feature: budgets +Description: C++ SDK for the AWS budgets service + +Feature: ce +Description: C++ SDK for the AWS ce service + +Feature: chime +Description: C++ SDK for the AWS chime service + +Feature: cloud9 +Description: C++ SDK for the AWS cloud9 service + +Feature: clouddirectory +Description: C++ SDK for the AWS clouddirectory service + +Feature: cloudformation +Description: C++ SDK for the AWS cloudformation service + +Feature: cloudfront +Description: C++ SDK for the AWS cloudfront service + +Feature: cloudhsm +Description: C++ SDK for the AWS cloudhsm service + +Feature: cloudhsmv2 +Description: C++ SDK for the AWS cloudhsmv2 service + +Feature: cloudsearch +Description: C++ SDK for the AWS cloudsearch service + +Feature: cloudsearchdomain +Description: C++ SDK for the AWS cloudsearchdomain service + +Feature: cloudtrail +Description: C++ SDK for the AWS cloudtrail service + +Feature: codebuild +Description: C++ SDK for the AWS codebuild service + +Feature: codecommit +Description: C++ SDK for the AWS codecommit service + +Feature: codedeploy +Description: C++ SDK for the AWS codedeploy service + +Feature: codepipeline +Description: C++ SDK for the AWS codepipeline service + +Feature: codestar +Description: C++ SDK for the AWS codestar service + +Feature: cognito-identity +Description: C++ SDK for the AWS cognito-identity service + +Feature: cognito-idp +Description: C++ SDK for the AWS cognito-idp service + +Feature: cognito-sync +Description: C++ SDK for the AWS cognito-sync service + +Feature: comprehend +Description: C++ SDK for the AWS comprehend service + +Feature: comprehendmedical +Description: C++ SDK for the AWS comprehendmedical service + +Feature: config +Description: C++ SDK for the AWS config service + +Feature: connect +Description: C++ SDK for the AWS connect service + +Feature: cur +Description: C++ SDK for the AWS cur service + +Feature: datapipeline +Description: C++ SDK for the AWS datapipeline service + +Feature: datasync +Description: C++ SDK for the AWS datasync service + +Feature: dax +Description: C++ SDK for the AWS dax service + +Feature: devicefarm +Description: C++ SDK for the AWS devicefarm service + +Feature: directconnect +Description: C++ SDK for the AWS directconnect service + +Feature: discovery +Description: C++ SDK for the AWS discovery service + +Feature: dlm +Description: C++ SDK for the AWS dlm service + +Feature: dms +Description: C++ SDK for the AWS dms service + +Feature: docdb +Description: C++ SDK for the AWS docdb service + +Feature: ds +Description: C++ SDK for the AWS ds service + +Feature: dynamodb +Description: C++ SDK for the AWS dynamodb service + +Feature: dynamodbstreams +Description: C++ SDK for the AWS dynamodbstreams service + +Feature: ec2 +Description: C++ SDK for the AWS ec2 service + +Feature: ecr +Description: C++ SDK for the AWS ecr service + +Feature: ecs +Description: C++ SDK for the AWS ecs service + +Feature: eks +Description: C++ SDK for the AWS eks service + +Feature: elasticache +Description: C++ SDK for the AWS elasticache service + +Feature: elasticbeanstalk +Description: C++ SDK for the AWS elasticbeanstalk service + +Feature: elasticfilesystem +Description: C++ SDK for the AWS elasticfilesystem service + +Feature: elasticloadbalancing +Description: C++ SDK for the AWS elasticloadbalancing service + +Feature: elasticloadbalancingv2 +Description: C++ SDK for the AWS elasticloadbalancingv2 service + +Feature: elasticmapreduce +Description: C++ SDK for the AWS elasticmapreduce service + +Feature: elastictranscoder +Description: C++ SDK for the AWS elastictranscoder service + +Feature: email +Description: C++ SDK for the AWS email service + +Feature: es +Description: C++ SDK for the AWS es service + +Feature: events +Description: C++ SDK for the AWS events service + +Feature: firehose +Description: C++ SDK for the AWS firehose service + +Feature: fms +Description: C++ SDK for the AWS fms service + +Feature: fsx +Description: C++ SDK for the AWS fsx service + +Feature: gamelift +Description: C++ SDK for the AWS gamelift service + +Feature: glacier +Description: C++ SDK for the AWS glacier service + +Feature: globalaccelerator +Description: C++ SDK for the AWS globalaccelerator service + +Feature: glue +Description: C++ SDK for the AWS glue service + +Feature: greengrass +Description: C++ SDK for the AWS greengrass service + +Feature: guardduty +Description: C++ SDK for the AWS guardduty service + +Feature: health +Description: C++ SDK for the AWS health service + +Feature: iam +Description: C++ SDK for the AWS iam service + +Feature: identity-management +Description: C++ SDK for the AWS identity-management service + +Feature: importexport +Description: C++ SDK for the AWS importexport service + +Feature: inspector +Description: C++ SDK for the AWS inspector service + +Feature: iot +Description: C++ SDK for the AWS iot service + +Feature: iot-data +Description: C++ SDK for the AWS iot-data service + +Feature: iot-jobs-data +Description: C++ SDK for the AWS iot-jobs-data service + +Feature: iot1click-devices +Description: C++ SDK for the AWS iot1click-devices service + +Feature: iot1click-projects +Description: C++ SDK for the AWS iot1click-projects service + +Feature: iotanalytics +Description: C++ SDK for the AWS iotanalytics service + +Feature: kafka +Description: C++ SDK for the AWS kafka service + +Feature: kinesis +Description: C++ SDK for the AWS kinesis service + +Feature: kinesis-video-archived-media +Description: C++ SDK for the AWS kinesis-video-archived-media service + +Feature: kinesis-video-media +Description: C++ SDK for the AWS kinesis-video-media service + +Feature: kinesisanalytics +Description: C++ SDK for the AWS kinesisanalytics service + +Feature: kinesisanalyticsv2 +Description: C++ SDK for the AWS kinesisanalyticsv2 service + +Feature: kinesisvideo +Description: C++ SDK for the AWS kinesisvideo service + +Feature: kms +Description: C++ SDK for the AWS kms service + +Feature: lambda +Description: C++ SDK for the AWS lambda service + +Feature: lex +Description: C++ SDK for the AWS lex service + +Feature: lex-models +Description: C++ SDK for the AWS lex-models service + +Feature: license-manager +Description: C++ SDK for the AWS license-manager service + +Feature: lightsail +Description: C++ SDK for the AWS lightsail service + +Feature: logs +Description: C++ SDK for the AWS logs service + +Feature: machinelearning +Description: C++ SDK for the AWS machinelearning service + +Feature: macie +Description: C++ SDK for the AWS macie service + +Feature: marketplace-entitlement +Description: C++ SDK for the AWS marketplace-entitlement service + +Feature: marketplacecommerceanalytics +Description: C++ SDK for the AWS marketplacecommerceanalytics service + +Feature: mediaconnect +Description: C++ SDK for the AWS mediaconnect service + +Feature: mediaconvert +Description: C++ SDK for the AWS mediaconvert service + +Feature: medialive +Description: C++ SDK for the AWS medialive service + +Feature: mediapackage +Description: C++ SDK for the AWS mediapackage service + +Feature: mediastore +Description: C++ SDK for the AWS mediastore service + +Feature: mediastore-data +Description: C++ SDK for the AWS mediastore-data service + +Feature: mediatailor +Description: C++ SDK for the AWS mediatailor service + +Feature: meteringmarketplace +Description: C++ SDK for the AWS meteringmarketplace service + +Feature: mobile +Description: C++ SDK for the AWS mobile service + +Feature: mobileanalytics +Description: C++ SDK for the AWS mobileanalytics service + +Feature: monitoring +Description: C++ SDK for the AWS monitoring service + +Feature: mq +Description: C++ SDK for the AWS mq service + +Feature: mturk-requester +Description: C++ SDK for the AWS mturk-requester service + +Feature: neptune +Description: C++ SDK for the AWS neptune service + +Feature: opsworks +Description: C++ SDK for the AWS opsworks service + +Feature: opsworkscm +Description: C++ SDK for the AWS opsworkscm service + +Feature: organizations +Description: C++ SDK for the AWS organizations service + +Feature: pi +Description: C++ SDK for the AWS pi service + +Feature: pinpoint +Description: C++ SDK for the AWS pinpoint service + +Feature: pinpoint-email +Description: C++ SDK for the AWS pinpoint-email service + +Feature: polly +Description: C++ SDK for the AWS polly service + +Feature: pricing +Description: C++ SDK for the AWS pricing service + +Feature: queues +Description: C++ SDK for the AWS queues service + +Feature: quicksight +Description: C++ SDK for the AWS quicksight service + +Feature: ram +Description: C++ SDK for the AWS ram service + +Feature: rds +Description: C++ SDK for the AWS rds service + +Feature: rds-data +Description: C++ SDK for the AWS rds-data service + +Feature: redshift +Description: C++ SDK for the AWS redshift service + +Feature: rekognition +Description: C++ SDK for the AWS rekognition service + +Feature: resource-groups +Description: C++ SDK for the AWS resource-groups service + +Feature: resourcegroupstaggingapi +Description: C++ SDK for the AWS resourcegroupstaggingapi service + +Feature: robomaker +Description: C++ SDK for the AWS robomaker service + +Feature: route53 +Description: C++ SDK for the AWS route53 service + +Feature: route53domains +Description: C++ SDK for the AWS route53domains service + +Feature: route53resolver +Description: C++ SDK for the AWS route53resolver service + +Feature: s3 +Description: C++ SDK for the AWS s3 service + +Feature: s3-encryption +Description: C++ SDK for the AWS s3-encryption service + +Feature: s3control +Description: C++ SDK for the AWS s3control service + +Feature: sagemaker +Description: C++ SDK for the AWS sagemaker service + +Feature: sagemaker-runtime +Description: C++ SDK for the AWS sagemaker-runtime service + +Feature: sdb +Description: C++ SDK for the AWS sdb service + +Feature: secretsmanager +Description: C++ SDK for the AWS secretsmanager service + +Feature: securityhub +Description: C++ SDK for the AWS securityhub service + +Feature: serverlessrepo +Description: C++ SDK for the AWS serverlessrepo service + +Feature: servicecatalog +Description: C++ SDK for the AWS servicecatalog service + +Feature: servicediscovery +Description: C++ SDK for the AWS servicediscovery service + +Feature: shield +Description: C++ SDK for the AWS shield service + +Feature: signer +Description: C++ SDK for the AWS signer service + +Feature: sms +Description: C++ SDK for the AWS sms service + +Feature: sms-voice +Description: C++ SDK for the AWS sms-voice service + +Feature: snowball +Description: C++ SDK for the AWS snowball service + +Feature: sns +Description: C++ SDK for the AWS sns service + +Feature: sqs +Description: C++ SDK for the AWS sqs service + +Feature: ssm +Description: C++ SDK for the AWS ssm service + +Feature: states +Description: C++ SDK for the AWS states service + +Feature: storagegateway +Description: C++ SDK for the AWS storagegateway service + +Feature: sts +Description: C++ SDK for the AWS sts service + +Feature: support +Description: C++ SDK for the AWS support service + +Feature: swf +Description: C++ SDK for the AWS swf service + +Feature: text-to-speech +Description: C++ SDK for the AWS text-to-speech service + +Feature: transcribe +Description: C++ SDK for the AWS transcribe service + +Feature: transfer +Description: C++ SDK for the AWS transfer service + +Feature: translate +Description: C++ SDK for the AWS translate service + +Feature: waf +Description: C++ SDK for the AWS waf service + +Feature: waf-regional +Description: C++ SDK for the AWS waf-regional service + +Feature: workdocs +Description: C++ SDK for the AWS workdocs service + +Feature: workmail +Description: C++ SDK for the AWS workmail service + +Feature: workspaces +Description: C++ SDK for the AWS workspaces service + +Feature: xray +Description: C++ SDK for the AWS xray service diff --git a/ports/aws-sdk-cpp/CONTROL.in b/ports/aws-sdk-cpp/CONTROL.in new file mode 100644 index 00000000000..eae9ddb73c1 --- /dev/null +++ b/ports/aws-sdk-cpp/CONTROL.in @@ -0,0 +1,6 @@ +Source: aws-sdk-cpp +Version: 1.8.84 +Port-Version: 0 +Description: AWS SDK for C++ +Build-Depends: openssl (!uwp&!windows), curl (!uwp&!windows), aws-c-event-stream +Default-Features: dynamodb, s3, kinesis diff --git a/ports/aws-sdk-cpp/compute_build_only.cmake b/ports/aws-sdk-cpp/compute_build_only.cmake new file mode 100644 index 00000000000..ba9bcb26d59 --- /dev/null +++ b/ports/aws-sdk-cpp/compute_build_only.cmake @@ -0,0 +1,532 @@ +# Automatically generated by generateFeatures.ps1 +if("access-management" IN_LIST FEATURES) + list(APPEND BUILD_ONLY access-management) +endif() +if("acm" IN_LIST FEATURES) + list(APPEND BUILD_ONLY acm) +endif() +if("acm-pca" IN_LIST FEATURES) + list(APPEND BUILD_ONLY acm-pca) +endif() +if("alexaforbusiness" IN_LIST FEATURES) + list(APPEND BUILD_ONLY alexaforbusiness) +endif() +if("amplify" IN_LIST FEATURES) + list(APPEND BUILD_ONLY amplify) +endif() +if("apigateway" IN_LIST FEATURES) + list(APPEND BUILD_ONLY apigateway) +endif() +if("apigatewaymanagementapi" IN_LIST FEATURES) + list(APPEND BUILD_ONLY apigatewaymanagementapi) +endif() +if("apigatewayv2" IN_LIST FEATURES) + list(APPEND BUILD_ONLY apigatewayv2) +endif() +if("application-autoscaling" IN_LIST FEATURES) + list(APPEND BUILD_ONLY application-autoscaling) +endif() +if("appmesh" IN_LIST FEATURES) + list(APPEND BUILD_ONLY appmesh) +endif() +if("appstream" IN_LIST FEATURES) + list(APPEND BUILD_ONLY appstream) +endif() +if("appsync" IN_LIST FEATURES) + list(APPEND BUILD_ONLY appsync) +endif() +if("athena" IN_LIST FEATURES) + list(APPEND BUILD_ONLY athena) +endif() +if("autoscaling" IN_LIST FEATURES) + list(APPEND BUILD_ONLY autoscaling) +endif() +if("autoscaling-plans" IN_LIST FEATURES) + list(APPEND BUILD_ONLY autoscaling-plans) +endif() +if("awsmigrationhub" IN_LIST FEATURES) + list(APPEND BUILD_ONLY AWSMigrationHub) +endif() +if("awstransfer" IN_LIST FEATURES) + list(APPEND BUILD_ONLY awstransfer) +endif() +if("backup" IN_LIST FEATURES) + list(APPEND BUILD_ONLY backup) +endif() +if("batch" IN_LIST FEATURES) + list(APPEND BUILD_ONLY batch) +endif() +if("budgets" IN_LIST FEATURES) + list(APPEND BUILD_ONLY budgets) +endif() +if("ce" IN_LIST FEATURES) + list(APPEND BUILD_ONLY ce) +endif() +if("chime" IN_LIST FEATURES) + list(APPEND BUILD_ONLY chime) +endif() +if("cloud9" IN_LIST FEATURES) + list(APPEND BUILD_ONLY cloud9) +endif() +if("clouddirectory" IN_LIST FEATURES) + list(APPEND BUILD_ONLY clouddirectory) +endif() +if("cloudformation" IN_LIST FEATURES) + list(APPEND BUILD_ONLY cloudformation) +endif() +if("cloudfront" IN_LIST FEATURES) + list(APPEND BUILD_ONLY cloudfront) +endif() +if("cloudhsm" IN_LIST FEATURES) + list(APPEND BUILD_ONLY cloudhsm) +endif() +if("cloudhsmv2" IN_LIST FEATURES) + list(APPEND BUILD_ONLY cloudhsmv2) +endif() +if("cloudsearch" IN_LIST FEATURES) + list(APPEND BUILD_ONLY cloudsearch) +endif() +if("cloudsearchdomain" IN_LIST FEATURES) + list(APPEND BUILD_ONLY cloudsearchdomain) +endif() +if("cloudtrail" IN_LIST FEATURES) + list(APPEND BUILD_ONLY cloudtrail) +endif() +if("codebuild" IN_LIST FEATURES) + list(APPEND BUILD_ONLY codebuild) +endif() +if("codecommit" IN_LIST FEATURES) + list(APPEND BUILD_ONLY codecommit) +endif() +if("codedeploy" IN_LIST FEATURES) + list(APPEND BUILD_ONLY codedeploy) +endif() +if("codepipeline" IN_LIST FEATURES) + list(APPEND BUILD_ONLY codepipeline) +endif() +if("codestar" IN_LIST FEATURES) + list(APPEND BUILD_ONLY codestar) +endif() +if("cognito-identity" IN_LIST FEATURES) + list(APPEND BUILD_ONLY cognito-identity) +endif() +if("cognito-idp" IN_LIST FEATURES) + list(APPEND BUILD_ONLY cognito-idp) +endif() +if("cognito-sync" IN_LIST FEATURES) + list(APPEND BUILD_ONLY cognito-sync) +endif() +if("comprehend" IN_LIST FEATURES) + list(APPEND BUILD_ONLY comprehend) +endif() +if("comprehendmedical" IN_LIST FEATURES) + list(APPEND BUILD_ONLY comprehendmedical) +endif() +if("config" IN_LIST FEATURES) + list(APPEND BUILD_ONLY config) +endif() +if("connect" IN_LIST FEATURES) + list(APPEND BUILD_ONLY connect) +endif() +if("cur" IN_LIST FEATURES) + list(APPEND BUILD_ONLY cur) +endif() +if("datapipeline" IN_LIST FEATURES) + list(APPEND BUILD_ONLY datapipeline) +endif() +if("datasync" IN_LIST FEATURES) + list(APPEND BUILD_ONLY datasync) +endif() +if("dax" IN_LIST FEATURES) + list(APPEND BUILD_ONLY dax) +endif() +if("devicefarm" IN_LIST FEATURES) + list(APPEND BUILD_ONLY devicefarm) +endif() +if("directconnect" IN_LIST FEATURES) + list(APPEND BUILD_ONLY directconnect) +endif() +if("discovery" IN_LIST FEATURES) + list(APPEND BUILD_ONLY discovery) +endif() +if("dlm" IN_LIST FEATURES) + list(APPEND BUILD_ONLY dlm) +endif() +if("dms" IN_LIST FEATURES) + list(APPEND BUILD_ONLY dms) +endif() +if("docdb" IN_LIST FEATURES) + list(APPEND BUILD_ONLY docdb) +endif() +if("ds" IN_LIST FEATURES) + list(APPEND BUILD_ONLY ds) +endif() +if("dynamodb" IN_LIST FEATURES) + list(APPEND BUILD_ONLY dynamodb) +endif() +if("dynamodbstreams" IN_LIST FEATURES) + list(APPEND BUILD_ONLY dynamodbstreams) +endif() +if("ec2" IN_LIST FEATURES) + list(APPEND BUILD_ONLY ec2) +endif() +if("ecr" IN_LIST FEATURES) + list(APPEND BUILD_ONLY ecr) +endif() +if("ecs" IN_LIST FEATURES) + list(APPEND BUILD_ONLY ecs) +endif() +if("eks" IN_LIST FEATURES) + list(APPEND BUILD_ONLY eks) +endif() +if("elasticache" IN_LIST FEATURES) + list(APPEND BUILD_ONLY elasticache) +endif() +if("elasticbeanstalk" IN_LIST FEATURES) + list(APPEND BUILD_ONLY elasticbeanstalk) +endif() +if("elasticfilesystem" IN_LIST FEATURES) + list(APPEND BUILD_ONLY elasticfilesystem) +endif() +if("elasticloadbalancing" IN_LIST FEATURES) + list(APPEND BUILD_ONLY elasticloadbalancing) +endif() +if("elasticloadbalancingv2" IN_LIST FEATURES) + list(APPEND BUILD_ONLY elasticloadbalancingv2) +endif() +if("elasticmapreduce" IN_LIST FEATURES) + list(APPEND BUILD_ONLY elasticmapreduce) +endif() +if("elastictranscoder" IN_LIST FEATURES) + list(APPEND BUILD_ONLY elastictranscoder) +endif() +if("email" IN_LIST FEATURES) + list(APPEND BUILD_ONLY email) +endif() +if("es" IN_LIST FEATURES) + list(APPEND BUILD_ONLY es) +endif() +if("events" IN_LIST FEATURES) + list(APPEND BUILD_ONLY events) +endif() +if("firehose" IN_LIST FEATURES) + list(APPEND BUILD_ONLY firehose) +endif() +if("fms" IN_LIST FEATURES) + list(APPEND BUILD_ONLY fms) +endif() +if("fsx" IN_LIST FEATURES) + list(APPEND BUILD_ONLY fsx) +endif() +if("gamelift" IN_LIST FEATURES) + list(APPEND BUILD_ONLY gamelift) +endif() +if("glacier" IN_LIST FEATURES) + list(APPEND BUILD_ONLY glacier) +endif() +if("globalaccelerator" IN_LIST FEATURES) + list(APPEND BUILD_ONLY globalaccelerator) +endif() +if("glue" IN_LIST FEATURES) + list(APPEND BUILD_ONLY glue) +endif() +if("greengrass" IN_LIST FEATURES) + list(APPEND BUILD_ONLY greengrass) +endif() +if("guardduty" IN_LIST FEATURES) + list(APPEND BUILD_ONLY guardduty) +endif() +if("health" IN_LIST FEATURES) + list(APPEND BUILD_ONLY health) +endif() +if("iam" IN_LIST FEATURES) + list(APPEND BUILD_ONLY iam) +endif() +if("identity-management" IN_LIST FEATURES) + list(APPEND BUILD_ONLY identity-management) +endif() +if("importexport" IN_LIST FEATURES) + list(APPEND BUILD_ONLY importexport) +endif() +if("inspector" IN_LIST FEATURES) + list(APPEND BUILD_ONLY inspector) +endif() +if("iot" IN_LIST FEATURES) + list(APPEND BUILD_ONLY iot) +endif() +if("iot-data" IN_LIST FEATURES) + list(APPEND BUILD_ONLY iot-data) +endif() +if("iot-jobs-data" IN_LIST FEATURES) + list(APPEND BUILD_ONLY iot-jobs-data) +endif() +if("iot1click-devices" IN_LIST FEATURES) + list(APPEND BUILD_ONLY iot1click-devices) +endif() +if("iot1click-projects" IN_LIST FEATURES) + list(APPEND BUILD_ONLY iot1click-projects) +endif() +if("iotanalytics" IN_LIST FEATURES) + list(APPEND BUILD_ONLY iotanalytics) +endif() +if("kafka" IN_LIST FEATURES) + list(APPEND BUILD_ONLY kafka) +endif() +if("kinesis" IN_LIST FEATURES) + list(APPEND BUILD_ONLY kinesis) +endif() +if("kinesis-video-archived-media" IN_LIST FEATURES) + list(APPEND BUILD_ONLY kinesis-video-archived-media) +endif() +if("kinesis-video-media" IN_LIST FEATURES) + list(APPEND BUILD_ONLY kinesis-video-media) +endif() +if("kinesisanalytics" IN_LIST FEATURES) + list(APPEND BUILD_ONLY kinesisanalytics) +endif() +if("kinesisanalyticsv2" IN_LIST FEATURES) + list(APPEND BUILD_ONLY kinesisanalyticsv2) +endif() +if("kinesisvideo" IN_LIST FEATURES) + list(APPEND BUILD_ONLY kinesisvideo) +endif() +if("kms" IN_LIST FEATURES) + list(APPEND BUILD_ONLY kms) +endif() +if("lambda" IN_LIST FEATURES) + list(APPEND BUILD_ONLY lambda) +endif() +if("lex" IN_LIST FEATURES) + list(APPEND BUILD_ONLY lex) +endif() +if("lex-models" IN_LIST FEATURES) + list(APPEND BUILD_ONLY lex-models) +endif() +if("license-manager" IN_LIST FEATURES) + list(APPEND BUILD_ONLY license-manager) +endif() +if("lightsail" IN_LIST FEATURES) + list(APPEND BUILD_ONLY lightsail) +endif() +if("logs" IN_LIST FEATURES) + list(APPEND BUILD_ONLY logs) +endif() +if("machinelearning" IN_LIST FEATURES) + list(APPEND BUILD_ONLY machinelearning) +endif() +if("macie" IN_LIST FEATURES) + list(APPEND BUILD_ONLY macie) +endif() +if("marketplace-entitlement" IN_LIST FEATURES) + list(APPEND BUILD_ONLY marketplace-entitlement) +endif() +if("marketplacecommerceanalytics" IN_LIST FEATURES) + list(APPEND BUILD_ONLY marketplacecommerceanalytics) +endif() +if("mediaconnect" IN_LIST FEATURES) + list(APPEND BUILD_ONLY mediaconnect) +endif() +if("mediaconvert" IN_LIST FEATURES) + list(APPEND BUILD_ONLY mediaconvert) +endif() +if("medialive" IN_LIST FEATURES) + list(APPEND BUILD_ONLY medialive) +endif() +if("mediapackage" IN_LIST FEATURES) + list(APPEND BUILD_ONLY mediapackage) +endif() +if("mediastore" IN_LIST FEATURES) + list(APPEND BUILD_ONLY mediastore) +endif() +if("mediastore-data" IN_LIST FEATURES) + list(APPEND BUILD_ONLY mediastore-data) +endif() +if("mediatailor" IN_LIST FEATURES) + list(APPEND BUILD_ONLY mediatailor) +endif() +if("meteringmarketplace" IN_LIST FEATURES) + list(APPEND BUILD_ONLY meteringmarketplace) +endif() +if("mobile" IN_LIST FEATURES) + list(APPEND BUILD_ONLY mobile) +endif() +if("mobileanalytics" IN_LIST FEATURES) + list(APPEND BUILD_ONLY mobileanalytics) +endif() +if("monitoring" IN_LIST FEATURES) + list(APPEND BUILD_ONLY monitoring) +endif() +if("mq" IN_LIST FEATURES) + list(APPEND BUILD_ONLY mq) +endif() +if("mturk-requester" IN_LIST FEATURES) + list(APPEND BUILD_ONLY mturk-requester) +endif() +if("neptune" IN_LIST FEATURES) + list(APPEND BUILD_ONLY neptune) +endif() +if("opsworks" IN_LIST FEATURES) + list(APPEND BUILD_ONLY opsworks) +endif() +if("opsworkscm" IN_LIST FEATURES) + list(APPEND BUILD_ONLY opsworkscm) +endif() +if("organizations" IN_LIST FEATURES) + list(APPEND BUILD_ONLY organizations) +endif() +if("pi" IN_LIST FEATURES) + list(APPEND BUILD_ONLY pi) +endif() +if("pinpoint" IN_LIST FEATURES) + list(APPEND BUILD_ONLY pinpoint) +endif() +if("pinpoint-email" IN_LIST FEATURES) + list(APPEND BUILD_ONLY pinpoint-email) +endif() +if("polly" IN_LIST FEATURES) + list(APPEND BUILD_ONLY polly) +endif() +if("pricing" IN_LIST FEATURES) + list(APPEND BUILD_ONLY pricing) +endif() +if("queues" IN_LIST FEATURES) + list(APPEND BUILD_ONLY queues) +endif() +if("quicksight" IN_LIST FEATURES) + list(APPEND BUILD_ONLY quicksight) +endif() +if("ram" IN_LIST FEATURES) + list(APPEND BUILD_ONLY ram) +endif() +if("rds" IN_LIST FEATURES) + list(APPEND BUILD_ONLY rds) +endif() +if("rds-data" IN_LIST FEATURES) + list(APPEND BUILD_ONLY rds-data) +endif() +if("redshift" IN_LIST FEATURES) + list(APPEND BUILD_ONLY redshift) +endif() +if("rekognition" IN_LIST FEATURES) + list(APPEND BUILD_ONLY rekognition) +endif() +if("resource-groups" IN_LIST FEATURES) + list(APPEND BUILD_ONLY resource-groups) +endif() +if("resourcegroupstaggingapi" IN_LIST FEATURES) + list(APPEND BUILD_ONLY resourcegroupstaggingapi) +endif() +if("robomaker" IN_LIST FEATURES) + list(APPEND BUILD_ONLY robomaker) +endif() +if("route53" IN_LIST FEATURES) + list(APPEND BUILD_ONLY route53) +endif() +if("route53domains" IN_LIST FEATURES) + list(APPEND BUILD_ONLY route53domains) +endif() +if("route53resolver" IN_LIST FEATURES) + list(APPEND BUILD_ONLY route53resolver) +endif() +if("s3" IN_LIST FEATURES) + list(APPEND BUILD_ONLY s3) +endif() +if("s3-encryption" IN_LIST FEATURES) + list(APPEND BUILD_ONLY s3-encryption) +endif() +if("s3control" IN_LIST FEATURES) + list(APPEND BUILD_ONLY s3control) +endif() +if("sagemaker" IN_LIST FEATURES) + list(APPEND BUILD_ONLY sagemaker) +endif() +if("sagemaker-runtime" IN_LIST FEATURES) + list(APPEND BUILD_ONLY sagemaker-runtime) +endif() +if("sdb" IN_LIST FEATURES) + list(APPEND BUILD_ONLY sdb) +endif() +if("secretsmanager" IN_LIST FEATURES) + list(APPEND BUILD_ONLY secretsmanager) +endif() +if("securityhub" IN_LIST FEATURES) + list(APPEND BUILD_ONLY securityhub) +endif() +if("serverlessrepo" IN_LIST FEATURES) + list(APPEND BUILD_ONLY serverlessrepo) +endif() +if("servicecatalog" IN_LIST FEATURES) + list(APPEND BUILD_ONLY servicecatalog) +endif() +if("servicediscovery" IN_LIST FEATURES) + list(APPEND BUILD_ONLY servicediscovery) +endif() +if("shield" IN_LIST FEATURES) + list(APPEND BUILD_ONLY shield) +endif() +if("signer" IN_LIST FEATURES) + list(APPEND BUILD_ONLY signer) +endif() +if("sms" IN_LIST FEATURES) + list(APPEND BUILD_ONLY sms) +endif() +if("sms-voice" IN_LIST FEATURES) + list(APPEND BUILD_ONLY sms-voice) +endif() +if("snowball" IN_LIST FEATURES) + list(APPEND BUILD_ONLY snowball) +endif() +if("sns" IN_LIST FEATURES) + list(APPEND BUILD_ONLY sns) +endif() +if("sqs" IN_LIST FEATURES) + list(APPEND BUILD_ONLY sqs) +endif() +if("ssm" IN_LIST FEATURES) + list(APPEND BUILD_ONLY ssm) +endif() +if("states" IN_LIST FEATURES) + list(APPEND BUILD_ONLY states) +endif() +if("storagegateway" IN_LIST FEATURES) + list(APPEND BUILD_ONLY storagegateway) +endif() +if("sts" IN_LIST FEATURES) + list(APPEND BUILD_ONLY sts) +endif() +if("support" IN_LIST FEATURES) + list(APPEND BUILD_ONLY support) +endif() +if("swf" IN_LIST FEATURES) + list(APPEND BUILD_ONLY swf) +endif() +if("text-to-speech" IN_LIST FEATURES) + list(APPEND BUILD_ONLY text-to-speech) +endif() +if("transcribe" IN_LIST FEATURES) + list(APPEND BUILD_ONLY transcribe) +endif() +if("transfer" IN_LIST FEATURES) + list(APPEND BUILD_ONLY transfer) +endif() +if("translate" IN_LIST FEATURES) + list(APPEND BUILD_ONLY translate) +endif() +if("waf" IN_LIST FEATURES) + list(APPEND BUILD_ONLY waf) +endif() +if("waf-regional" IN_LIST FEATURES) + list(APPEND BUILD_ONLY waf-regional) +endif() +if("workdocs" IN_LIST FEATURES) + list(APPEND BUILD_ONLY workdocs) +endif() +if("workmail" IN_LIST FEATURES) + list(APPEND BUILD_ONLY workmail) +endif() +if("workspaces" IN_LIST FEATURES) + list(APPEND BUILD_ONLY workspaces) +endif() +if("xray" IN_LIST FEATURES) + list(APPEND BUILD_ONLY xray) +endif() diff --git a/ports/aws-sdk-cpp/generateFeatures.ps1 b/ports/aws-sdk-cpp/generateFeatures.ps1 new file mode 100644 index 00000000000..8c8b1a34268 --- /dev/null +++ b/ports/aws-sdk-cpp/generateFeatures.ps1 @@ -0,0 +1,51 @@ +[CmdletBinding()] +param( + [Parameter(Mandatory=$true)][string]$ExtractedSources, + [Parameter(Mandatory=$true)][string]$ControlFileIn, + [Parameter(Mandatory=$true)][string]$ControlFile, + [Parameter(Mandatory=$true)][string]$CMakeFragmentFile +) + +$subfolders = Get-Item $ExtractedSources\aws-cpp-sdk-* + +$controltext = gc $ControlFileIn +$controltext += @("# Automatically generated by generateFeatures.ps1") + +$cmakefragmenttext = @("# Automatically generated by generateFeatures.ps1") + +function GetDescription($dir, $modulename) +{ + if (Test-Path "$dir\CMakeLists.txt") + { + $descs = @(Select-String -Path "$dir\CMakeLists.txt" -Pattern "`"C\+\+ SDK for the AWS [^`"]*`"") + if ($descs.count -eq 1) { + $desc = $descs[0].Matches.Value -replace "`"","" + "Description: $desc" + } + else { "Description: C++ SDK for the AWS $modulename service" } + } + else { "Description: C++ SDK for the AWS $modulename service" } +} + +$subfolders | % { + $modulename = $_.name -replace "^aws-cpp-sdk-","" + if ($modulename -match "-tests`$") { return } + if ($modulename -match "-sample`$") { return } + if ($modulename -eq "core") { return } + + $controltext += @("") + $controltext += @("Feature: $modulename") + $controltext += @(GetDescription $_ $modulename) + + $cmakefragmenttext += @( + "if(`"$modulename`" IN_LIST FEATURES)", + " list(APPEND BUILD_ONLY $modulename)", + "endif()" + ) +} + +Write-Verbose ($controltext -join "`n") +[IO.File]::WriteAllText($ControlFile, ($controltext -join "`n")+"`n") + +Write-Verbose ($cmakefragmenttext -join "`n") +[IO.File]::WriteAllText($CMakeFragmentFile, ($cmakefragmenttext -join "`n") +"`n") diff --git a/ports/aws-sdk-cpp/portfile.cmake b/ports/aws-sdk-cpp/portfile.cmake new file mode 100644 index 00000000000..850ba18c33a --- /dev/null +++ b/ports/aws-sdk-cpp/portfile.cmake @@ -0,0 +1,92 @@ +vcpkg_buildpath_length_warning(37) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO aws/aws-sdk-cpp + REF 6b8d756658591088f0599e07dd72025c65c2aecb # 1.8.84 + SHA512 763d5e2fbfbe0aee4a5b803eba6e731a0712adf963b9e817a28ce6747e58abb47e5c811bf385f04b9c4a4cf0e768494d6efa2d6b5d788cf32ddd926435e788b6 + HEAD_REF master + PATCHES + 001-patch-relocatable-rpath.patch + 002-aws-c-common.patch + 003-fix-AWSSDKCONFIG.patch + 004-fix-check-c-source-runs.patch + 005-fix-cjson-sprintf.patch +) + +string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "dynamic" FORCE_SHARED_CRT) + +set(BUILD_ONLY core) + +include(${CMAKE_CURRENT_LIST_DIR}/compute_build_only.cmake) + +if(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_IOS) + set(rpath "@loader_path") +else() + set(rpath "\$ORIGIN") +endif() +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + DISABLE_PARALLEL_CONFIGURE + PREFER_NINJA + OPTIONS + -DENABLE_UNITY_BUILD=ON + -DENABLE_TESTING=OFF + -DFORCE_SHARED_CRT=${FORCE_SHARED_CRT} + -DCMAKE_DISABLE_FIND_PACKAGE_Git=TRUE + "-DBUILD_ONLY=${BUILD_ONLY}" + -DBUILD_DEPS=OFF + -DCMAKE_INSTALL_RPATH=${rpath} +) + +vcpkg_install_cmake() + +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake TARGET_PATH share) + +vcpkg_copy_pdbs() + +file(GLOB_RECURSE AWS_TARGETS "${CURRENT_PACKAGES_DIR}/share/*/*-targets-*.cmake") +foreach(AWS_TARGET IN LISTS AWS_TARGETS) + file(READ ${AWS_TARGET} _contents) + string(REGEX REPLACE + "bin\\/([A-Za-z0-9_.-]+\\.lib)" + "lib/\\1" + _contents "${_contents}") + file(WRITE ${AWS_TARGET} "${_contents}") +endforeach() + +file(GLOB AWS_CONFIGS "${CURRENT_PACKAGES_DIR}/share/*/aws-cpp-sdk-*-config.cmake") +list(FILTER AWS_CONFIGS EXCLUDE REGEX "aws-cpp-sdk-core-config\\.cmake\$") +foreach(AWS_CONFIG IN LISTS AWS_CONFIGS) + file(READ "${AWS_CONFIG}" _contents) + file(WRITE "${AWS_CONFIG}" "include(CMakeFindDependencyMacro)\nfind_dependency(aws-cpp-sdk-core)\n${_contents}") +endforeach() + +file(REMOVE_RECURSE + ${CURRENT_PACKAGES_DIR}/debug/include + ${CURRENT_PACKAGES_DIR}/debug/share + ${CURRENT_PACKAGES_DIR}/lib/pkgconfig + ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig + ${CURRENT_PACKAGES_DIR}/nuget + ${CURRENT_PACKAGES_DIR}/debug/nuget +) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + file(GLOB LIB_FILES ${CURRENT_PACKAGES_DIR}/bin/*.lib) + if(LIB_FILES) + file(COPY ${LIB_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/lib) + file(REMOVE ${LIB_FILES}) + endif() + file(GLOB DEBUG_LIB_FILES ${CURRENT_PACKAGES_DIR}/debug/bin/*.lib) + if(DEBUG_LIB_FILES) + file(COPY ${DEBUG_LIB_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) + file(REMOVE ${DEBUG_LIB_FILES}) + endif() + + file(APPEND ${CURRENT_PACKAGES_DIR}/include/aws/core/SDKConfig.h "#ifndef USE_IMPORT_EXPORT\n#define USE_IMPORT_EXPORT\n#endif") +endif() + +configure_file(${CURRENT_PORT_DIR}/usage ${CURRENT_PACKAGES_DIR}/share/${PORT}/usage @ONLY) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/aws-sdk-cpp/usage b/ports/aws-sdk-cpp/usage new file mode 100644 index 00000000000..7f317648352 --- /dev/null +++ b/ports/aws-sdk-cpp/usage @@ -0,0 +1,5 @@ +The package @PORT@:@TARGET_TRIPLET@ provides CMake targets: + + find_package(AWSSDK CONFIG COMPONENTS core dynamodb kinesis s3 REQUIRED) + target_include_directories(main PRVATE ${AWSSDK_INCLUDE_DIRS}) + target_link_libraries(main PRIVATE ${AWSSDK_LIBRARIES}) diff --git a/ports/azure-storage-cpplite/001-CMakeLists.patch b/ports/azure-storage-cpplite/001-CMakeLists.patch new file mode 100644 index 00000000000..c69eab8824e --- /dev/null +++ b/ports/azure-storage-cpplite/001-CMakeLists.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index dfb441e..71ad51b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -157,6 +157,16 @@ elseif(WIN32) + target_compile_definitions(azure-storage-lite PRIVATE azure_storage_lite_EXPORTS NOMINMAX) + endif() + ++#openssl3 md5 deprecation mitigation ++if(UNIX) ++ #sledge hammer approach ++ target_compile_options(azure-storage-lite PRIVATE "-Wno-deprecated-declarations") ++endif() ++if(MSVC) ++ #sledge hammer approach ++ target_compile_options(azure-storage-lite PRIVATE "/wd4996") ++endif() ++ + if(BUILD_TESTS) + find_package(Catch2) + if(NOT Catch2_FOUND) diff --git a/ports/azure-storage-cpplite/002-base64.cpp.patch b/ports/azure-storage-cpplite/002-base64.cpp.patch new file mode 100644 index 00000000000..780cd3489c3 --- /dev/null +++ b/ports/azure-storage-cpplite/002-base64.cpp.patch @@ -0,0 +1,43 @@ +diff --git a/src/base64.cpp b/src/base64.cpp +index 0b3e18e5..123e2274 100644 +--- a/src/base64.cpp ++++ b/src/base64.cpp +@@ -35,6 +35,20 @@ namespace azure { namespace storage_lite { + unsigned char _2_2 : 2; + }; + ++ struct _double_byte ++ { ++ unsigned char _1_1 : 2; ++ unsigned char _0 : 6; ++ unsigned char _2_1 : 4; ++ unsigned char _1_2 : 4; ++ }; ++ ++ struct _single_byte ++ { ++ unsigned char _1_1 : 2; ++ unsigned char _0 : 6; ++ }; ++ + std::string to_base64(const std::vector &input) + { + return to_base64(input.data(), input.size()); +@@ -65,7 +79,7 @@ namespace azure { namespace storage_lite { + switch (size) + { + case 1: { +- const _triple_byte* record = reinterpret_cast(ptr); ++ const _single_byte* record = reinterpret_cast(ptr); + unsigned char idx0 = record->_0; + unsigned char idx1 = (record->_1_1 << 4); + result.push_back(char(_base64_enctbl[idx0])); +@@ -76,7 +90,7 @@ namespace azure { namespace storage_lite { + } + case 2: + { +- const _triple_byte* record = reinterpret_cast(ptr); ++ const _double_byte* record = reinterpret_cast(ptr); + unsigned char idx0 = record->_0; + unsigned char idx1 = (record->_1_1 << 4) | record->_1_2; + unsigned char idx2 = (record->_2_1 << 2); diff --git a/ports/azure-storage-cpplite/003-misc.patch b/ports/azure-storage-cpplite/003-misc.patch new file mode 100644 index 00000000000..12fa5ff236f --- /dev/null +++ b/ports/azure-storage-cpplite/003-misc.patch @@ -0,0 +1,93 @@ +From 4e58dda184d9dbe405a8a21ad6aa9a1e46057831 Mon Sep 17 00:00:00 2001 +From: Joe maley +Date: Tue, 18 Feb 2020 15:54:40 -0500 +Subject: [PATCH 1/2] remove uuid dependency + +Signed-off-by: Isaiah Norton +--- + CMakeLists.txt | 10 +++++----- + src/utility.cpp | 9 ++++++++- + 2 files changed, 13 insertions(+), 6 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index dfb441e..cefd897 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -147,11 +147,11 @@ if (UNIX) + list(APPEND EXTRA_LIBRARIES ${GNUTLS_LIBRARIES}) + endif() + +- if(NOT APPLE) +- find_package(PkgConfig REQUIRED) +- pkg_check_modules(uuid REQUIRED IMPORTED_TARGET uuid) +- list(APPEND EXTRA_LIBRARIES PkgConfig::uuid) +- endif() ++# if(NOT APPLE) ++# find_package(PkgConfig REQUIRED) ++# pkg_check_modules(uuid REQUIRED IMPORTED_TARGET uuid) ++# list(APPEND EXTRA_LIBRARIES PkgConfig::uuid) ++# endif() + elseif(WIN32) + list(APPEND EXTRA_LIBRARIES rpcrt4 bcrypt) + target_compile_definitions(azure-storage-lite PRIVATE azure_storage_lite_EXPORTS NOMINMAX) +diff --git a/src/utility.cpp b/src/utility.cpp +index 747fcb1..07593e0 100644 +--- a/src/utility.cpp ++++ b/src/utility.cpp +@@ -8,7 +8,7 @@ + #define WIN32_LEAN_AND_MEAN + #include + #else +-#include ++//#include + #include + #include + #include +@@ -26,6 +26,7 @@ namespace azure { namespace storage_lite { + return str; + } + ++/* + std::string get_uuid() + { + std::string res; +@@ -46,6 +47,12 @@ namespace azure { namespace storage_lite { + + return res; + } ++*/ ++ ++ std::string get_uuid() { ++ std::cerr << "azure::storage_lite::get_uuid() unimplemented" << std::endl; ++ exit(1); ++ } + + bool create_or_resize_file(const std::string& path, unsigned long long length) noexcept + { +-- +2.22.0.windows.1 + + +From e9908d8c1956a05f5b33d8ffecd971c2b437e5aa Mon Sep 17 00:00:00 2001 +From: Jinming Hu +Date: Sun, 21 Jun 2020 22:44:31 +0800 +Subject: [PATCH 2/2] Fix build error on VS2019 + +--- + src/base64.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/base64.cpp b/src/base64.cpp +index e6dead7..0b3e18e 100644 +--- a/src/base64.cpp ++++ b/src/base64.cpp +@@ -1,5 +1,6 @@ + #include + #include ++#include + + #include "base64.h" + +-- +2.22.0.windows.1 + diff --git a/ports/azure-storage-cpplite/portfile.cmake b/ports/azure-storage-cpplite/portfile.cmake new file mode 100644 index 00000000000..7a513630f8c --- /dev/null +++ b/ports/azure-storage-cpplite/portfile.cmake @@ -0,0 +1,28 @@ + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO Azure/azure-storage-cpplite + REF v0.3.0 + SHA512 14a476fb9dcff0f8fe2e659cf81ad29433befba723b6440d21f7f563307f116726a15325b53cdc05e827634c00f90a7a8be6d5d212a1e7e442860f7075206b70 + HEAD_REF master + PATCHES + 001-CMakeLists.patch + 002-base64.cpp.patch + 003-misc.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DBUILD_TESTS=OFF + -DBUILD_SAMPLES=OFF + -DCURL_NO_CURL_CMAKE=ON +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +vcpkg_install_copyright(FILE_LIST ${SOURCE_PATH}/LICENSE ${SOURCE_PATH}/NOTICE.txt) + +vcpkg_copy_pdbs() diff --git a/ports/azure-storage-cpplite/vcpkg.json b/ports/azure-storage-cpplite/vcpkg.json new file mode 100644 index 00000000000..756db4261ae --- /dev/null +++ b/ports/azure-storage-cpplite/vcpkg.json @@ -0,0 +1,10 @@ +{ + "name": "azure-storage-cpplite", + "version-string": "0.3.0", + "port-version": 0, + "description": [ + "[legacy] Microsoft Azure Storage Client SDK for C++", + "A client library for working with Microsoft Azure storage services including blobs, files, tables, and queues. This client library enables working with the Microsoft Azure storage services which include the blob service for storing binary and text data, the file service for storing binary and text data, the table service for storing structured non-relational data, and the queue service for storing messages that may be accessed by a client." + ], + "homepage": "https://blogs.msdn.com/b/windowsazurestorage/" +} diff --git a/ports/bzip2/CMakeLists.txt b/ports/bzip2/CMakeLists.txt new file mode 100644 index 00000000000..e2da221d7de --- /dev/null +++ b/ports/bzip2/CMakeLists.txt @@ -0,0 +1,45 @@ +cmake_minimum_required(VERSION 3.0) +project(bzip2 C) + +if(CMAKE_BUILD_TYPE STREQUAL Debug) + add_definitions(-DBZ_DEBUG) # enable extra assertions +endif() + +set(BZ2_SOURCES + blocksort.c + huffman.c + crctable.c + randtable.c + compress.c + decompress.c + bzlib.c) + +add_library(bz2 ${BZ2_SOURCES}) +set_target_properties(bz2 PROPERTIES + DEBUG_POSTFIX d + VERSION 1.0.6 + SOVERSION 1.0) +if(BUILD_SHARED_LIBS) + target_compile_definitions(bz2 PRIVATE -DBZ_BUILD_DLL) +endif() + +if(MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) +endif() + +install(TARGETS bz2 + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) + +if(NOT BZIP2_SKIP_TOOLS) + add_executable(bzip2 bzip2.c ${BZ2_SOURCES}) + add_executable(bzip2recover bzip2recover.c ${BZ2_SOURCES}) + install(TARGETS bzip2 bzip2recover DESTINATION tools/bzip2) +endif() + +if(NOT BZIP2_SKIP_HEADERS) + install(FILES bzlib.h DESTINATION include) +endif() diff --git a/ports/bzip2/bzip2.pc.in b/ports/bzip2/bzip2.pc.in new file mode 100644 index 00000000000..91153c13b53 --- /dev/null +++ b/ports/bzip2/bzip2.pc.in @@ -0,0 +1,11 @@ +prefix=@BZIP2_PREFIX@ +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: bzip2 +Description: bzip2 +Version: 1.0.6 +Requires: +Libs: -L${libdir} -l@bzname@ +Cflags: -I${includedir} \ No newline at end of file diff --git a/ports/bzip2/fix-import-export-macros.patch b/ports/bzip2/fix-import-export-macros.patch new file mode 100644 index 00000000000..fc67887da4e --- /dev/null +++ b/ports/bzip2/fix-import-export-macros.patch @@ -0,0 +1,40 @@ +diff --git a/bzlib.h b/bzlib.h +index 8277123..84fbd0a 100644 +--- a/bzlib.h ++++ b/bzlib.h +@@ -65,29 +65,23 @@ typedef + } + bz_stream; + +- +-#ifndef BZ_IMPORT +-#define BZ_EXPORT +-#endif +- + #ifndef BZ_NO_STDIO + /* Need a definitition for FILE */ + #include + #endif + + #ifdef _WIN32 +-# include + # ifdef small + /* windows.h define small to char */ + # undef small + # endif +-# ifdef BZ_EXPORT +-# define BZ_API(func) WINAPI func +-# define BZ_EXTERN extern ++# define BZ_API(func) func ++# if defined(BZ_BUILD_DLL) ++# define BZ_EXTERN __declspec(dllexport) ++# elif defined(BZ_IMPORT) ++# define BZ_EXTERN __declspec(dllimport) + # else +- /* import windows dll dynamically */ +-# define BZ_API(func) (WINAPI * func) +-# define BZ_EXTERN ++# define BZ_EXTERN + # endif + #else + # define BZ_API(func) func diff --git a/ports/bzip2/portfile.cmake b/ports/bzip2/portfile.cmake new file mode 100644 index 00000000000..c03f48c48fb --- /dev/null +++ b/ports/bzip2/portfile.cmake @@ -0,0 +1,56 @@ +set(BZIP2_VERSION 1.0.8) +vcpkg_download_distfile(ARCHIVE + URLS "https://sourceware.org/pub/bzip2/bzip2-${BZIP2_VERSION}.tar.gz" + FILENAME "bzip2-${BZIP2_VERSION}.tar.gz" + SHA512 083f5e675d73f3233c7930ebe20425a533feedeaaa9d8cc86831312a6581cefbe6ed0d08d2fa89be81082f2a5abdabca8b3c080bf97218a1bd59dc118a30b9f3 +) + +vcpkg_extract_source_archive_ex( + OUT_SOURCE_PATH SOURCE_PATH + ARCHIVE ${ARCHIVE} + PATCHES fix-import-export-macros.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + INVERTED_FEATURES + tool BZIP2_SKIP_TOOLS +) + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") + +vcpkg_cmake_configure( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + ${FEATURE_OPTIONS} + OPTIONS_DEBUG + -DBZIP2_SKIP_HEADERS=ON + -DBZIP2_SKIP_TOOLS=ON +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() + +file(READ "${CURRENT_PACKAGES_DIR}/include/bzlib.h" BZLIB_H) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + string(REPLACE "defined(BZ_IMPORT)" "0" BZLIB_H "${BZLIB_H}") +else() + string(REPLACE "defined(BZ_IMPORT)" "1" BZLIB_H "${BZLIB_H}") +endif() +file(WRITE "${CURRENT_PACKAGES_DIR}/include/bzlib.h" "${BZLIB_H}") + +if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + set(BZIP2_PREFIX "${CURRENT_INSTALLED_DIR}") + set(bzname bz2) + configure_file("${CMAKE_CURRENT_LIST_DIR}/bzip2.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/bzip2.pc" @ONLY) +endif() + +if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + set(BZIP2_PREFIX "${CURRENT_INSTALLED_DIR}/debug") + set(bzname bz2d) + configure_file("${CMAKE_CURRENT_LIST_DIR}/bzip2.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/bzip2.pc" @ONLY) +endif() + +vcpkg_fixup_pkgconfig() + +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) +file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/ports/bzip2/usage b/ports/bzip2/usage new file mode 100644 index 00000000000..084bf390ad5 --- /dev/null +++ b/ports/bzip2/usage @@ -0,0 +1,4 @@ +The package bzip2 is compatible with built-in CMake targets: + + find_package(BZip2 REQUIRED) + target_link_libraries(main PRIVATE BZip2::BZip2) diff --git a/ports/bzip2/vcpkg.json b/ports/bzip2/vcpkg.json new file mode 100644 index 00000000000..b899ec15457 --- /dev/null +++ b/ports/bzip2/vcpkg.json @@ -0,0 +1,24 @@ +{ + "name": "bzip2", + "version-semver": "1.0.8", + "port-version": 0, + "description": "bzip2 is a freely available, patent free, high-quality data compressor. It typically compresses files to within 10% to 15% of the best available techniques (the PPM family of statistical compressors), whilst being around twice as fast at compression and six times faster at decompression.", + "homepage": "https://sourceware.org/bzip2/", + "documentation": "https://sourceware.org/bzip2/docs.html", + "license": "bzip2-1.0.6", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "tool": { + "description": "Builds bzip2 executable" + } + } +} diff --git a/ports/capnproto/portfile.cmake b/ports/capnproto/portfile.cmake new file mode 100644 index 00000000000..2a3aecc137d --- /dev/null +++ b/ports/capnproto/portfile.cmake @@ -0,0 +1,33 @@ +vcpkg_fail_port_install(ON_TARGET UWP) +if(VCPKG_TARGET_IS_WINDOWS) + vcpkg_fail_port_install(ON_ARCH arm arm64) +endif() + +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO capnproto/capnproto + REF 57a4ca5af5a7f55b768a9d9d6655250bffb1257f # v0.8.0 + SHA512 6550356a40a13d41fbeef3887027de1134c4bc37e4d79435e67da1f65665f3856f7cd663be392135cf4a08fffcfd4e171614026c20bfc5727adfd624b2d33e35 + HEAD_REF master +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() + +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/CapnProto) + +vcpkg_copy_tools(TOOL_NAMES capnp capnpc-c++ capnpc-capnp AUTO_CLEAN) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/capnproto/vcpkg.json b/ports/capnproto/vcpkg.json new file mode 100644 index 00000000000..49b619ee57f --- /dev/null +++ b/ports/capnproto/vcpkg.json @@ -0,0 +1,11 @@ +{ + "name": "capnproto", + "version-string": "0.8.0", + "port-version": 2, + "description": "Data interchange format and capability-based RPC system", + "homepage": "https://capnproto.org/", + "supports": "!uwp & !((arm | arm64) & windows)", + "dependencies": [ + "zlib" + ] +} diff --git a/ports/catch2/fix-install-path.patch b/ports/catch2/fix-install-path.patch new file mode 100644 index 00000000000..5813ffe81c9 --- /dev/null +++ b/ports/catch2/fix-install-path.patch @@ -0,0 +1,46 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -170,7 +170,7 @@ + + ## Provide some pkg-config integration + set(PKGCONFIG_INSTALL_DIR +- "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig" ++ "${CMAKE_INSTALL_LIBDIR}/pkgconfig" + CACHE PATH "Path where catch2.pc is installed" + ) + configure_file( +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -356,12 +356,28 @@ + install( + TARGETS + Catch2 +- Catch2WithMain + EXPORT + Catch2Targets +- DESTINATION ++ LIBRARY DESTINATION + ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ++ ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ++ ${CMAKE_INSTALL_BINDIR} + ) ++ ++ install( ++ TARGETS ++ Catch2WithMain ++ EXPORT ++ Catch2Targets ++ LIBRARY DESTINATION ++ ${CMAKE_INSTALL_LIBDIR}/manual-link ++ ARCHIVE DESTINATION ++ ${CMAKE_INSTALL_LIBDIR}/manual-link ++ RUNTIME DESTINATION ++ ${CMAKE_INSTALL_BINDIR} ++ ) + + + install( diff --git a/ports/catch2/fix-uwp-build.patch b/ports/catch2/fix-uwp-build.patch new file mode 100644 index 00000000000..feee34cfbae --- /dev/null +++ b/ports/catch2/fix-uwp-build.patch @@ -0,0 +1,34 @@ +diff --git a/src/catch2/catch_config.cpp b/src/catch2/catch_config.cpp +index 4465831d..7555a21f 100644 +--- a/src/catch2/catch_config.cpp ++++ b/src/catch2/catch_config.cpp +@@ -26,7 +26,12 @@ namespace { + # pragma warning( disable : 4996 ) + # endif + ++# if defined( WINAPI_FAMILY ) ++ // UWP doesn't support environment variables. ++ return false; ++# else + return std::getenv( "BAZEL_TEST" ) != nullptr; ++# endif + + # if defined( _MSC_VER ) + # pragma warning( pop ) +@@ -81,6 +86,8 @@ namespace Catch { + } ); + } + ++#if !defined( WINAPI_FAMILY ) ++ // UWP doesn't support environment variables. + if(provideBazelReporterOutput()){ + // Register a JUnit reporter for Bazel. Bazel sets an environment + // variable with the path to XML output. If this file is written to +@@ -102,6 +109,7 @@ namespace Catch { + { "junit", std::string( bazelOutputFilePtr ), {}, {} } ); + } + } ++#endif + + + // We now fixup the reporter specs to handle default output spec, diff --git a/ports/catch2/portfile.cmake b/ports/catch2/portfile.cmake new file mode 100644 index 00000000000..7e786c9dc29 --- /dev/null +++ b/ports/catch2/portfile.cmake @@ -0,0 +1,37 @@ + +if(VCPKG_TARGET_IS_WINDOWS) + vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO catchorg/Catch2 + REF v3.1.0 + SHA512 49e5339263190a6ef15284ef2dcc9e727ce0659cb750d4078024ccf6c6f339740a3a662273718ea73adfbc5928c3ef7268175ebda5ee9ec97ca58fed98747b44 + HEAD_REF devel + PATCHES + fix-install-path.patch + fix-uwp-build.patch +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DCATCH_INSTALL_DOCS=OFF + -DCMAKE_CXX_STANDARD=17 +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/Catch2) +vcpkg_fixup_pkgconfig() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +# We remove these folders because they are empty and cause warnings on the library installation +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/catch2/benchmark/internal") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/catch2/generators/internal") + +file(WRITE "${CURRENT_PACKAGES_DIR}/include/catch.hpp" "#include ") +file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/catch2/vcpkg.json b/ports/catch2/vcpkg.json new file mode 100644 index 00000000000..cf338398a2a --- /dev/null +++ b/ports/catch2/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "catch2", + "version-semver": "3.1.0", + "port-version": 1, + "description": "A modern, header-only test framework for unit testing.", + "homepage": "https://github.com/catchorg/Catch2", + "license": "BSL-1.0", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/ports/clipp/Fix-result_of-deprecated-in-C++20.patch b/ports/clipp/Fix-result_of-deprecated-in-C++20.patch new file mode 100644 index 00000000000..6613d21f534 --- /dev/null +++ b/ports/clipp/Fix-result_of-deprecated-in-C++20.patch @@ -0,0 +1,47 @@ +diff --git a/include/clipp.h b/include/clipp.h +index d7b101e..a1bec2d 100644 +--- a/include/clipp.h ++++ b/include/clipp.h +@@ -155,16 +155,27 @@ namespace traits { + * @brief function (class) signature type trait + * + *****************************************************************************/ ++#if defined(__cpp_lib_is_invocable) + template + constexpr auto + check_is_callable(int) -> decltype( + std::declval()(std::declval()...), + std::integral_constant::type>::value>{} ); ++ std::is_same::type>::value>{} ); + +-template ++template + constexpr auto +-check_is_callable(long) -> std::false_type; ++check_is_callable_without_arg(int) -> decltype( ++ std::declval()(), ++ std::integral_constant::type>::value>{} ); ++#else ++template ++constexpr auto ++check_is_callable(int) -> decltype( ++ std::declval()(std::declval()...), ++ std::integral_constant::type>::value>{} ); + + template + constexpr auto +@@ -172,6 +183,11 @@ check_is_callable_without_arg(int) -> decltype( + std::declval()(), + std::integral_constant::type>::value>{} ); ++#endif ++ ++template ++constexpr auto ++check_is_callable(long) -> std::false_type; + + template + constexpr auto diff --git a/ports/clipp/portfile.cmake b/ports/clipp/portfile.cmake new file mode 100644 index 00000000000..3db19afaf7f --- /dev/null +++ b/ports/clipp/portfile.cmake @@ -0,0 +1,18 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO "muellan/clipp" + REF 2c32b2f1f7cc530b1ec1f62c92f698643bb368db + SHA512 4645fafe85a8099ea97b85e939747a12e9b3b92213b5b8207a9c277537377b77b5daebd88a4c090ea89cfff2937a9fc155da6e8b5558574d7129227c28826e1c + HEAD_REF master + PATCHES + Fix-result_of-deprecated-in-C++20.patch # https://github.com/muellan/clipp/pull/54 +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" +) + +vcpkg_cmake_install() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug") +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/clipp/vcpkg.json b/ports/clipp/vcpkg.json new file mode 100644 index 00000000000..f3491d8f608 --- /dev/null +++ b/ports/clipp/vcpkg.json @@ -0,0 +1,13 @@ +{ + "name": "clipp", + "version-date": "2019-04-30", + "port-version": 2, + "description": "command line interfaces for modern C++", + "license": "MIT", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/ports/crc32c/fix_clang-cl.patch b/ports/crc32c/fix_clang-cl.patch new file mode 100644 index 00000000000..d120243209c --- /dev/null +++ b/ports/crc32c/fix_clang-cl.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 84907285c..8c446b0c8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -22,7 +22,7 @@ if(NOT CMAKE_CXX_STANDARD) + endif(NOT CMAKE_CXX_STANDARD) + + # https://github.com/izenecloud/cmake/blob/master/SetCompilerWarningAll.cmake +-if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") ++if(MSVC) + # Use the highest warning level for Visual Studio. + set(CMAKE_CXX_WARNING_LEVEL 4) + if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") diff --git a/ports/crc32c/portfile.cmake b/ports/crc32c/portfile.cmake new file mode 100644 index 00000000000..0280002fd2a --- /dev/null +++ b/ports/crc32c/portfile.cmake @@ -0,0 +1,33 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO google/crc32c + REF 1.1.2 + SHA512 6325c52b5a6850b9f90086e0c0c86798c008af36e7cfd3a0216184a2d37b3bf7323481ddc6bfe4cbd5b31288b3ee6c69772d03085a13094cf95d00a9756a7196 + HEAD_REF master + PATCHES + fix_clang-cl.patch +) + +vcpkg_cmake_configure( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DCRC32C_BUILD_TESTS=OFF + -DCRC32C_BUILD_BENCHMARKS=OFF + -DCRC32C_USE_GLOG=OFF +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/Crc32c) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/crc32c/vcpkg.json b/ports/crc32c/vcpkg.json new file mode 100644 index 00000000000..3acb74812e5 --- /dev/null +++ b/ports/crc32c/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "crc32c", + "version": "1.1.2", + "port-version": 1, + "description": "CRC32C implementation with support for CPU-specific acceleration instructions.", + "homepage": "https://github.com/google/crc32c", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/ports/curl/0002_fix_uwp.patch b/ports/curl/0002_fix_uwp.patch new file mode 100644 index 00000000000..5aa451bf401 --- /dev/null +++ b/ports/curl/0002_fix_uwp.patch @@ -0,0 +1,28 @@ +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +index 62b7b33..8a4bd71 100644 +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -107,6 +107,10 @@ endif() + + target_link_libraries(${LIB_NAME} ${CURL_LIBS}) + ++if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") ++ add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS) ++endif() ++ + if(WIN32) + add_definitions(-D_USRDLL) + endif() +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9e47967..7694f04 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -505,7 +505,7 @@ if(USE_QUICHE) + cmake_pop_check_state() + endif() + +-if(WIN32) ++if(WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(USE_WIN32_CRYPTO ON) + endif() + diff --git a/ports/curl/0004_nghttp2_staticlib.patch b/ports/curl/0004_nghttp2_staticlib.patch new file mode 100644 index 00000000000..4bd6e4afdd7 --- /dev/null +++ b/ports/curl/0004_nghttp2_staticlib.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5a13333..2dd274c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -431,6 +431,9 @@ if(USE_NGHTTP2) + find_package(NGHTTP2 REQUIRED) + include_directories(${NGHTTP2_INCLUDE_DIRS}) + list(APPEND CURL_LIBS ${NGHTTP2_LIBRARIES}) ++ if(NOT BUILD_SHARED_LIBS) ++ add_definitions(-DNGHTTP2_STATICLIB) ++ endif() + endif() + + function(CheckQuicSupportInOpenSSL) diff --git a/ports/curl/0005_remove_imp_suffix.patch b/ports/curl/0005_remove_imp_suffix.patch new file mode 100644 index 00000000000..c83a196520a --- /dev/null +++ b/ports/curl/0005_remove_imp_suffix.patch @@ -0,0 +1,13 @@ +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +index 1d71e14..62b7b33 100644 +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -128,7 +128,7 @@ if(CURL_HAS_LTO) + INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE) + endif() + +-if(WIN32) ++if(WIN32 AND 0) + if(BUILD_SHARED_LIBS) + # Add "_imp" as a suffix before the extension to avoid conflicting with the statically linked "libcurl.lib" + set_target_properties(${LIB_NAME} PROPERTIES IMPORT_SUFFIX "_imp.lib") diff --git a/ports/curl/0006_fix_tool_depends.patch b/ports/curl/0006_fix_tool_depends.patch new file mode 100644 index 00000000000..a918b08e2d7 --- /dev/null +++ b/ports/curl/0006_fix_tool_depends.patch @@ -0,0 +1,22 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 26e3cfe..74d00dd 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -61,6 +61,8 @@ if(MSVC) + list(APPEND CURL_FILES curl.rc) + endif() + ++find_package(ZLIB REQUIRED) ++ + # CURL_FILES comes from Makefile.inc + add_executable( + ${EXE_NAME} +@@ -91,7 +93,7 @@ include_directories( + ) + + #Build curl executable +-target_link_libraries(${EXE_NAME} libcurl ${CURL_LIBS}) ++target_link_libraries(${EXE_NAME} libcurl ${CURL_LIBS} ZLIB::ZLIB) + + ################################################################################ + diff --git a/ports/curl/0007_disable_tool_export_curl_target.patch b/ports/curl/0007_disable_tool_export_curl_target.patch new file mode 100644 index 00000000000..689104a938c --- /dev/null +++ b/ports/curl/0007_disable_tool_export_curl_target.patch @@ -0,0 +1,18 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 74d00dd..5838805 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -103,8 +103,8 @@ target_link_libraries(${EXE_NAME} libcurl ${CURL_LIBS} ZLIB::ZLIB) + + #INCLUDE(ModuleInstall OPTIONAL) + +-install(TARGETS ${EXE_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) +-export(TARGETS ${EXE_NAME} +- APPEND FILE ${PROJECT_BINARY_DIR}/curl-target.cmake +- NAMESPACE ${PROJECT_NAME}:: +-) ++install(TARGETS ${EXE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) ++#export(TARGETS ${EXE_NAME} ++# APPEND FILE ${PROJECT_BINARY_DIR}/curl-target.cmake ++# NAMESPACE ${PROJECT_NAME}:: ++#) diff --git a/ports/curl/0010_fix_othertests_cmake.patch b/ports/curl/0010_fix_othertests_cmake.patch new file mode 100644 index 00000000000..e54d33333e3 --- /dev/null +++ b/ports/curl/0010_fix_othertests_cmake.patch @@ -0,0 +1,12 @@ +diff --git a/CMake/OtherTests.cmake b/CMake/OtherTests.cmake +index 7cec6da..c836fc9 100644 +--- a/CMake/OtherTests.cmake ++++ b/CMake/OtherTests.cmake +@@ -212,6 +212,7 @@ if(HAVE_SIGNAL_H) + set(CMAKE_REQUIRED_FLAGS "-DHAVE_SIGNAL_H") + set(CMAKE_EXTRA_INCLUDE_FILES "signal.h") + endif() ++unset(CMAKE_TRY_COMPILE_TARGET_TYPE) + check_type_size("sig_atomic_t" SIZEOF_SIG_ATOMIC_T) + if(HAVE_SIZEOF_SIG_ATOMIC_T) + check_c_source_compiles(" diff --git a/ports/curl/0011_fix_static_build.patch b/ports/curl/0011_fix_static_build.patch new file mode 100644 index 00000000000..a50fa287f54 --- /dev/null +++ b/ports/curl/0011_fix_static_build.patch @@ -0,0 +1,13 @@ +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +index 8a4bd71..1927fb0 100644 +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -111,7 +111,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS) + endif() + +-if(WIN32) ++if(WIN32 AND BUILD_SHARED_LIBS) + add_definitions(-D_USRDLL) + endif() + diff --git a/ports/curl/0012-fix-dependency-idn2.patch b/ports/curl/0012-fix-dependency-idn2.patch new file mode 100644 index 00000000000..19d5b12307d --- /dev/null +++ b/ports/curl/0012-fix-dependency-idn2.patch @@ -0,0 +1,51 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index dc7223b..a661cb8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -620,9 +620,6 @@ if(NOT CURL_DISABLE_LDAPS) + check_include_file_concat("ldapssl.h" HAVE_LDAPSSL_H) + endif() + +-# Check for idn +-check_library_exists_concat("idn2" idn2_lookup_ul HAVE_LIBIDN2) +- + # Check for symbol dlopen (same as HAVE_LIBDL) + check_library_exists("${CURL_LIBS}" dlopen "" HAVE_DLOPEN) + +@@ -870,6 +867,20 @@ if(CURL_CA_PATH_SET AND NOT USE_OPENSSL AND NOT USE_MBEDTLS) + "Set CURL_CA_PATH=none or enable one of those TLS backends.") + endif() + ++if (CMAKE_USE_IDN2) ++ include(FindPackageHandleStandardArgs) ++ include(SelectLibraryConfigurations) ++ ++ find_path(LIBIDN2_INCLUDE_DIRS idn2.h) ++ find_library(LIBIDN2_LIBRARY_DEBUG NAMES libidn2 idn2 PATHS ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib NO_DEFAULT_PATH Release RelWithDebInfo MinSizeRel) ++ find_library(LIBIDN2_LIBRARY_RELEASE NAMES libidn2 idn2 PATHS ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib NO_DEFAULT_PATH Debug) ++ select_library_configurations(LIBIDN2) ++ ++ add_definitions(-DHAVE_IDN2_H -DHAVE_LIBIDN2) ++ include_directories(${LIBIDN2_INCLUDE_DIRS}) ++ link_libraries(${LIBIDN2_LIBRARY}) ++endif() ++ + # Check for header files + if(NOT UNIX) + check_include_file_concat("windows.h" HAVE_WINDOWS_H) +@@ -906,7 +917,6 @@ check_include_file_concat("crypto.h" HAVE_CRYPTO_H) + check_include_file_concat("err.h" HAVE_ERR_H) + check_include_file_concat("errno.h" HAVE_ERRNO_H) + check_include_file_concat("fcntl.h" HAVE_FCNTL_H) +-check_include_file_concat("idn2.h" HAVE_IDN2_H) + check_include_file_concat("ifaddrs.h" HAVE_IFADDRS_H) + check_include_file_concat("io.h" HAVE_IO_H) + check_include_file_concat("krb.h" HAVE_KRB_H) +@@ -1362,7 +1372,6 @@ _add_if("libz" HAVE_LIBZ) + _add_if("brotli" HAVE_BROTLI) + _add_if("zstd" HAVE_ZSTD) + _add_if("AsynchDNS" USE_ARES OR USE_THREADS_POSIX OR USE_THREADS_WIN32) +-_add_if("IDN" HAVE_LIBIDN2) + _add_if("Largefile" (CURL_SIZEOF_CURL_OFF_T GREATER 4) AND + ((SIZEOF_OFF_T GREATER 4) OR USE_WIN32_LARGE_FILES)) + # TODO SSP1 (Schannel) check is missing diff --git a/ports/curl/0020-fix-pc-file.patch b/ports/curl/0020-fix-pc-file.patch new file mode 100644 index 00000000000..cd795978219 --- /dev/null +++ b/ports/curl/0020-fix-pc-file.patch @@ -0,0 +1,16 @@ +diff -urw a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2021-05-10 20:46:52.204346972 +0200 ++++ b/CMakeLists.txt 2021-05-11 19:39:00.065235266 +0200 +@@ -1482,6 +1482,12 @@ + message(WARNING "Bad lib in library list: ${_libname}") + continue() + endif() ++ elseif(_lib MATCHES "^(.*)/([^/]*)[.]framework$") ++ if(CMAKE_MATCH_1 IN_LIST CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES) ++ set(_lib "-framework ${CMAKE_MATCH_2}") ++ else() ++ set(_lib "-framework ${_lib}") ++ endif() + endif() + if(_lib MATCHES ".*/.*" OR _lib MATCHES "^-") + set(LIBCURL_LIBS "${LIBCURL_LIBS} ${_lib}") diff --git a/ports/curl/portfile.cmake b/ports/curl/portfile.cmake new file mode 100644 index 00000000000..6d410fb58b9 --- /dev/null +++ b/ports/curl/portfile.cmake @@ -0,0 +1,150 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO curl/curl + REF e052859759b34d0e05ce0f17244873e5cd7b457b #curl-7_74_0 + SHA512 3dbbab00dda4f0e7d012fab358d2dd1362ff0c0f59c81f638fb547acba6f74a61c306906892447af3b18e8b0ebb93ebb8e0ac77e92247864bfa3a9c4ce7ea1d0 + HEAD_REF master + PATCHES + 0002_fix_uwp.patch + 0004_nghttp2_staticlib.patch + 0005_remove_imp_suffix.patch + 0006_fix_tool_depends.patch + 0007_disable_tool_export_curl_target.patch + 0010_fix_othertests_cmake.patch + 0011_fix_static_build.patch + 0012-fix-dependency-idn2.patch + 0020-fix-pc-file.patch +) + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" CURL_STATICLIB) + +# schannel will enable sspi, but sspi do not support uwp +foreach(feature "schannel" "sspi" "tool") + if(feature IN_LIST FEATURES AND VCPKG_TARGET_IS_UWP) + message(FATAL_ERROR "Feature ${feature} is not supported on UWP.") + endif() +endforeach() + +if("sectransp" IN_LIST FEATURES AND NOT VCPKG_TARGET_IS_OSX) + message(FATAL_ERROR "sectransp is not supported on non-Apple platforms") +endif() + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + # Support HTTP2 TLS Download https://curl.haxx.se/ca/cacert.pem rename to curl-ca-bundle.crt, copy it to libcurl.dll location. + http2 USE_NGHTTP2 + openssl CMAKE_USE_OPENSSL + mbedtls CMAKE_USE_MBEDTLS + ssh CMAKE_USE_LIBSSH2 + tool BUILD_CURL_EXE + c-ares ENABLE_ARES + sspi CURL_WINDOWS_SSPI + brotli CURL_BROTLI + schannel CMAKE_USE_SCHANNEL + sectransp CMAKE_USE_SECTRANSP + idn2 CMAKE_USE_IDN2 + + INVERTED_FEATURES + non-http HTTP_ONLY +) + +set(SECTRANSP_OPTIONS) +if("sectransp" IN_LIST FEATURES) + set(SECTRANSP_OPTIONS -DCURL_CA_PATH=none) +endif() + +# UWP targets +set(UWP_OPTIONS) +if(VCPKG_TARGET_IS_UWP) + set(UWP_OPTIONS + -DUSE_WIN32_LDAP=OFF + -DCURL_DISABLE_TELNET=ON + -DENABLE_IPV6=OFF + -DENABLE_UNIX_SOCKETS=OFF + ) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS ${FEATURE_OPTIONS} + ${UWP_OPTIONS} + ${ADDITIONAL_SCRIPTS} + ${EXTRA_ARGS} + ${SECTRANSP_OPTIONS} + -DBUILD_TESTING=OFF + -DENABLE_MANUAL=OFF + -DCURL_STATICLIB=${CURL_STATICLIB} + -DCMAKE_DISABLE_FIND_PACKAGE_Perl=ON + -DENABLE_DEBUG=ON + -DCURL_CA_FALLBACK=ON +) + +vcpkg_install_cmake() + +vcpkg_copy_pdbs() + +if ("tool" IN_LIST FEATURES) + vcpkg_copy_tools(TOOL_NAMES curl AUTO_CLEAN) +endif() + +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/CURL) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +#Fix install path +file(READ ${CURRENT_PACKAGES_DIR}/bin/curl-config CURL_CONFIG) +string(REPLACE "${CURRENT_PACKAGES_DIR}" "\${prefix}" CURL_CONFIG "${CURL_CONFIG}") +string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${prefix}" CURL_CONFIG "${CURL_CONFIG}") +string(REPLACE "\nprefix=\${prefix}" [=[prefix=$(CDPATH= cd -- "$(dirname -- "$0")"/../.. && pwd -P)]=] CURL_CONFIG "${CURL_CONFIG}") +file(WRITE ${CURRENT_PACKAGES_DIR}/bin/curl-config "${CURL_CONFIG}") +file(RENAME ${CURRENT_PACKAGES_DIR}/bin/curl-config ${CURRENT_PACKAGES_DIR}/share/${PORT}/curl-config) +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/curl-config) + +file(GLOB FILES ${CURRENT_PACKAGES_DIR}/bin/*) +if(NOT FILES) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) +endif() +file(GLOB FILES ${CURRENT_PACKAGES_DIR}/debug/bin/*) +if(NOT FILES) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/curl/curl.h + "#ifdef CURL_STATICLIB" + "#if 1" + ) +else() + vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/curl/curl.h + "#ifdef CURL_STATICLIB" + "#if 0" + ) +endif() + + +# Fix the pkgconfig file for debug +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(READ ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/libcurl.pc _contents) + string(REPLACE " -lcurl" " -lcurl-d" _contents "${_contents}") + string(REPLACE " -loptimized " " " _contents "${_contents}") + string(REPLACE " -ldebug " " " _contents "${_contents}") + string(REPLACE " ${CURRENT_INSTALLED_DIR}/lib/pthreadVC3.lib" "" _contents "${_contents}") + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig) + file(WRITE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libcurl.pc "${_contents}") +endif() + +# Fix the pkgconfig file for release +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(READ ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/libcurl.pc _contents) + string(REPLACE " -loptimized " " " _contents "${_contents}") + string(REPLACE " -ldebug " " " _contents "${_contents}") + string(REPLACE " ${CURRENT_INSTALLED_DIR}/debug/lib/pthreadVC3d.lib" "" _contents "${_contents}") + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib/pkgconfig) + file(WRITE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libcurl.pc "${_contents}") +endif() + +vcpkg_fixup_pkgconfig() + +file(INSTALL "${CURRENT_PORT_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/curl/vcpkg-cmake-wrapper.cmake b/ports/curl/vcpkg-cmake-wrapper.cmake new file mode 100644 index 00000000000..955d9353aca --- /dev/null +++ b/ports/curl/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,44 @@ +list(REMOVE_ITEM ARGS "NO_MODULE") +list(REMOVE_ITEM ARGS "CONFIG") +list(REMOVE_ITEM ARGS "MODULE") + +cmake_policy(SET CMP0012 NEW) + +_find_package(${ARGS} CONFIG) + +if(TARGET CURL::libcurl) + set(CURL_FOUND TRUE) + + get_target_property(_curl_include_dirs CURL::libcurl INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(_curl_link_libraries CURL::libcurl INTERFACE_LINK_LIBRARIES) + + if (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + get_target_property(_curl_location_debug CURL::libcurl IMPORTED_IMPLIB_DEBUG) + get_target_property(_curl_location_release CURL::libcurl IMPORTED_IMPLIB_RELEASE) + endif() + + if(NOT _curl_location_debug AND NOT _curl_location_release) + get_target_property(_curl_location_debug CURL::libcurl IMPORTED_LOCATION_DEBUG) + get_target_property(_curl_location_release CURL::libcurl IMPORTED_LOCATION_RELEASE) + endif() + + if(NOT _curl_link_libraries) + set(_curl_link_libraries) + endif() + + set(CURL_INCLUDE_DIRS "${_curl_include_dirs}") + set(CURL_LIBRARY_DEBUG "${_curl_location_debug}") + set(CURL_LIBRARY_RELEASE "${_curl_location_release}") + + #For builds which rely on CURL_LIBRAR(Y/IES) + include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake) + select_library_configurations(CURL) + + set(CURL_LIBRARIES ${CURL_LIBRARY} ${_curl_link_libraries}) + set(CURL_VERSION_STRING "${CURL_VERSION}") + + set(_curl_include_dirs) + set(_curl_link_libraries) + set(_curl_location_debug) + set(_curl_location_release) +endif() diff --git a/ports/curl/vcpkg.json b/ports/curl/vcpkg.json new file mode 100644 index 00000000000..7059f6d4749 --- /dev/null +++ b/ports/curl/vcpkg.json @@ -0,0 +1,143 @@ +{ + "name": "curl", + "version": "7.74.0", + "port-version": 8, + "description": "A library for transferring data with URLs", + "homepage": "https://github.com/curl/curl", + "dependencies": [ + "zlib" + ], + "default-features": [ + "non-http", + "ssl" + ], + "features": { + "brotli": { + "description": "brotli support (brotli)", + "dependencies": [ + "brotli" + ] + }, + "c-ares": { + "description": "c-ares support", + "dependencies": [ + "c-ares" + ] + }, + "http2": { + "description": "HTTP2 support", + "dependencies": [ + { + "name": "curl", + "default-features": false, + "features": [ + "ssl" + ] + }, + "nghttp2" + ] + }, + "idn2": { + "description": "idn2 support (libidn2)", + "dependencies": [ + "libidn2" + ] + }, + "mbedtls": { + "description": "SSL support (mbedTLS)", + "dependencies": [ + "mbedtls" + ] + }, + "non-http": { + "description": "Enables protocols beyond HTTP/HTTPS/HTTP2" + }, + "openssl": { + "description": "SSL support (OpenSSL)", + "dependencies": [ + "openssl" + ] + }, + "schannel": { + "description": "SSL support (Secure Channel)", + "dependencies": [ + { + "name": "curl", + "default-features": false, + "features": [ + "sspi" + ] + } + ] + }, + "sectransp": { + "description": "SSL support (sectransp)" + }, + "ssh": { + "description": "SSH support via libssh2", + "dependencies": [ + { + "name": "curl", + "default-features": false, + "features": [ + "non-http" + ] + }, + { + "name": "curl", + "default-features": false, + "features": [ + "openssl" + ] + }, + "libssh2" + ] + }, + "ssl": { + "description": "Default SSL backend", + "dependencies": [ + { + "name": "curl", + "default-features": false, + "features": [ + "sectransp" + ], + "platform": "osx" + }, + { + "name": "curl", + "default-features": false, + "features": [ + "winssl" + ], + "platform": "(windows & !uwp) | mingw" + }, + { + "name": "curl", + "default-features": false, + "features": [ + "openssl" + ], + "platform": "(uwp | !windows) & !osx & !mingw" + } + ] + }, + "sspi": { + "description": "SSPI support" + }, + "tool": { + "description": "Builds curl executable" + }, + "winssl": { + "description": "Legacy name for schannel", + "dependencies": [ + { + "name": "curl", + "features": [ + "schannel" + ] + } + ] + } + } +} diff --git a/ports/fmt/fix-format-conflict.patch b/ports/fmt/fix-format-conflict.patch new file mode 100644 index 00000000000..0a2ac6a57a2 --- /dev/null +++ b/ports/fmt/fix-format-conflict.patch @@ -0,0 +1,15 @@ +diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h +index f44df01c..59cc4559 100644 +--- a/include/fmt/format-inl.h ++++ b/include/fmt/format-inl.h +@@ -62,8 +62,8 @@ FMT_FUNC void format_error_code(detail::buffer& out, int error_code, + error_code_size += detail::to_unsigned(detail::count_digits(abs_value)); + auto it = buffer_appender(out); + if (message.size() <= inline_buffer_size - error_code_size) +- format_to(it, FMT_STRING("{}{}"), message, SEP); +- format_to(it, FMT_STRING("{}{}"), ERROR_STR, error_code); ++ fmt::format_to(it, FMT_STRING("{}{}"), message, SEP); ++ fmt::format_to(it, FMT_STRING("{}{}"), ERROR_STR, error_code); + FMT_ASSERT(out.size() <= inline_buffer_size, ""); + } + diff --git a/ports/fmt/fix-write-batch.patch b/ports/fmt/fix-write-batch.patch new file mode 100644 index 00000000000..7c17d603772 --- /dev/null +++ b/ports/fmt/fix-write-batch.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f21cf45..691a632 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -157,7 +157,7 @@ if (MASTER_PROJECT AND CMAKE_GENERATOR MATCHES "Visual Studio") + join(netfxpath + "C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\" + ".NETFramework\\v4.0") +- file(WRITE run-msbuild.bat " ++ file(WRITE ${CMAKE_BINARY_DIR}/run-msbuild.bat " + ${MSBUILD_SETUP} + ${CMAKE_MAKE_PROGRAM} -p:FrameworkPathOverride=\"${netfxpath}\" %*") + endif () diff --git a/ports/fmt/portfile.cmake b/ports/fmt/portfile.cmake new file mode 100644 index 00000000000..f5f819a01a9 --- /dev/null +++ b/ports/fmt/portfile.cmake @@ -0,0 +1,66 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO fmtlib/fmt + REF 9.1.0 + SHA512 a18442042722dd48e20714ec034a12fcc0576c9af7be5188586970e2edf47529825bdc99af366b1d5891630c8dbf6f63bfa9f012e77ab3d3ed80d1a118e3b2be + HEAD_REF master + PATCHES + fix-write-batch.patch + fix-format-conflict.patch +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DFMT_CMAKE_DIR=share/fmt + -DFMT_TEST=OFF + -DFMT_DOC=OFF +) + +vcpkg_cmake_install() +file(INSTALL "${SOURCE_PATH}/LICENSE.rst" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + if(VCPKG_TARGET_IS_WINDOWS) + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/fmtd.dll") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin") + file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/fmtd.dll" "${CURRENT_PACKAGES_DIR}/debug/bin/fmtd.dll") + endif() + endif() + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/fmt.dll") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin") + file(RENAME "${CURRENT_PACKAGES_DIR}/lib/fmt.dll" "${CURRENT_PACKAGES_DIR}/bin/fmt.dll") + endif() + endif() + endif() + + vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/fmt/core.h + "defined(FMT_SHARED)" + "1" + ) +endif() +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_cmake_config_fixup() +vcpkg_fixup_pkgconfig() + +if(VCPKG_TARGET_IS_WINDOWS) + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets-debug.cmake + "lib/fmtd.dll" + "bin/fmtd.dll" + ) + endif() + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets-release.cmake + "lib/fmt.dll" + "bin/fmt.dll" + ) + endif() +endif() +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +# Handle post-build CMake instructions +vcpkg_copy_pdbs() +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/ports/fmt/usage b/ports/fmt/usage new file mode 100644 index 00000000000..e5a9d704806 --- /dev/null +++ b/ports/fmt/usage @@ -0,0 +1,8 @@ +The package fmt provides CMake targets: + + find_package(fmt CONFIG REQUIRED) + target_link_libraries(main PRIVATE fmt::fmt) + + # Or use the header-only version + find_package(fmt CONFIG REQUIRED) + target_link_libraries(main PRIVATE fmt::fmt-header-only) diff --git a/ports/fmt/vcpkg.json b/ports/fmt/vcpkg.json new file mode 100644 index 00000000000..a768a4e960d --- /dev/null +++ b/ports/fmt/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "fmt", + "version": "9.1.0", + "port-version": 1, + "description": "Formatting library for C++. It can be used as a safe alternative to printf or as a fast alternative to IOStreams.", + "homepage": "https://github.com/fmtlib/fmt", + "license": "MIT", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/ports/google-cloud-cpp/portfile.cmake b/ports/google-cloud-cpp/portfile.cmake new file mode 100644 index 00000000000..835941a84f5 --- /dev/null +++ b/ports/google-cloud-cpp/portfile.cmake @@ -0,0 +1,77 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO googleapis/google-cloud-cpp + REF v2.6.0 + SHA512 13a3ca1ecc6e0839b3e6a7a84638270ffb0a5e013b86a5b23d58c96717e5e245c79ef13128caabe68ed646ba5db82c44436ce62a3a8960bea5a37655be515673 + HEAD_REF main + PATCHES + support_absl_cxx17.patch +) + +vcpkg_add_to_path(PREPEND "${CURRENT_HOST_INSTALLED_DIR}/tools/grpc") + +set(GOOGLE_CLOUD_CPP_ENABLE "${FEATURES}") +list(REMOVE_ITEM GOOGLE_CLOUD_CPP_ENABLE "core") +# This feature does not exist, but allows us to simplify the vcpkg.json file. +list(REMOVE_ITEM GOOGLE_CLOUD_CPP_ENABLE "grpc-common") +list(REMOVE_ITEM GOOGLE_CLOUD_CPP_ENABLE "googleapis") +# google-cloud-cpp uses dialogflow_cx and dialogflow_es. Underscores +# are invalid in `vcpkg` features, we use dashes (`-`) as a separator +# for the `vcpkg` feature name, and convert it here to something that +# `google-cloud-cpp` would like. +if ("dialogflow-cx" IN_LIST FEATURES) + list(REMOVE_ITEM GOOGLE_CLOUD_CPP_ENABLE "dialogflow-cx") + list(APPEND GOOGLE_CLOUD_CPP_ENABLE "dialogflow_cx") +endif () +if ("dialogflow-es" IN_LIST FEATURES) + list(REMOVE_ITEM GOOGLE_CLOUD_CPP_ENABLE "dialogflow-es") + list(APPEND GOOGLE_CLOUD_CPP_ENABLE "dialogflow_es") +endif () + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + DISABLE_PARALLEL_CONFIGURE + OPTIONS + "-DGOOGLE_CLOUD_CPP_ENABLE=${GOOGLE_CLOUD_CPP_ENABLE}" + -DGOOGLE_CLOUD_CPP_ENABLE_MACOS_OPENSSL_CHECK=OFF + -DGOOGLE_CLOUD_CPP_ENABLE_WERROR=OFF + -DGOOGLE_CLOUD_CPP_ENABLE_CCACHE=OFF + -DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES=OFF + -DBUILD_TESTING=OFF +) + +vcpkg_cmake_install() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +foreach(feature IN LISTS FEATURES) + set(config_path "lib/cmake/google_cloud_cpp_${feature}") + # Most features get their own package in `google-cloud-cpp`. + # The exceptions are captured by this `if()` command, basically + # things like `core` and `experimental-storage-grpc` are skipped. + if(NOT IS_DIRECTORY "${CURRENT_PACKAGES_DIR}/${config_path}") + continue() + endif() + vcpkg_cmake_config_fixup(PACKAGE_NAME "google_cloud_cpp_${feature}" + CONFIG_PATH "${config_path}" + DO_NOT_DELETE_PARENT_CONFIG_PATH) +endforeach() +# These packages are automatically installed depending on what features are +# enabled. +foreach(suffix common googleapis grpc_utils rest_internal dialogflow_cx dialogflow_es) + set(config_path "lib/cmake/google_cloud_cpp_${suffix}") + if(NOT IS_DIRECTORY "${CURRENT_PACKAGES_DIR}/${config_path}") + continue() + endif() + vcpkg_cmake_config_fixup(PACKAGE_NAME "google_cloud_cpp_${suffix}" + CONFIG_PATH "${config_path}" + DO_NOT_DELETE_PARENT_CONFIG_PATH) +endforeach() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/cmake" + "${CURRENT_PACKAGES_DIR}/debug/lib/cmake" + "${CURRENT_PACKAGES_DIR}/debug/share") +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) + +vcpkg_copy_pdbs() diff --git a/ports/google-cloud-cpp/support_absl_cxx17.patch b/ports/google-cloud-cpp/support_absl_cxx17.patch new file mode 100644 index 00000000000..61de927ba56 --- /dev/null +++ b/ports/google-cloud-cpp/support_absl_cxx17.patch @@ -0,0 +1,32 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a0d07d1..18320b6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -43,6 +43,14 @@ if (APPLE AND NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) + endif () + ++find_package(absl CONFIG REQUIRED) ++ ++# Use CMAKE_CXX_STANDARD=17 if ABSL_USE_CXX17 is set ++if (ABSL_USE_CXX17) ++ message(STATUS "Found absl uses CXX17, enable CXX17 feature.") ++ set(CMAKE_CXX_STANDARD 17) ++endif () ++ + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3) + message( +diff --git a/google/cloud/internal/port_platform.h b/google/cloud/internal/port_platform.h +index b61eb48..327278f 100644 +--- a/google/cloud/internal/port_platform.h ++++ b/google/cloud/internal/port_platform.h +@@ -49,6 +49,8 @@ + // Abort compilation if the compiler does not support C++14. + #if GOOGLE_CLOUD_CPP_CPP_VERSION < 201402L + # error "C++14 or newer is required" ++#elif defined(ABSL_USE_CXX17) && GOOGLE_CLOUD_CPP_CPP_VERSION < 201703L ++# error "Compiled to use Abseil with C++17 support, but using with C++ < C++17" + #endif // GOOGLE_CLOUD_CPP_CPP_VERSION < 201402L + + // Abort the build if the version of the compiler is too old. This simplifies diff --git a/ports/google-cloud-cpp/vcpkg.json b/ports/google-cloud-cpp/vcpkg.json new file mode 100644 index 00000000000..a7b3fb327e5 --- /dev/null +++ b/ports/google-cloud-cpp/vcpkg.json @@ -0,0 +1,1216 @@ +{ + "name": "google-cloud-cpp", + "version": "2.6.0", + "description": "C++ Client Libraries for Google Cloud Platform APIs.", + "homepage": "https://github.com/googleapis/google-cloud-cpp", + "license": "Apache-2.0", + "supports": "!uwp", + "dependencies": [ + "abseil", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + "bigquery", + "bigtable", + "iam", + "pubsub", + "spanner", + "storage" + ], + "features": { + "accessapproval": { + "description": "Access Approval API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "accesscontextmanager": { + "description": "Access Context Manager API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "apigateway": { + "description": "API Gateway API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "apigeeconnect": { + "description": "Apigee Connect API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "appengine": { + "description": "App Engine Admin API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "artifactregistry": { + "description": "Artifact Registry API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "asset": { + "description": "Cloud Asset API C++ Client Library", + "supports": "!windows", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "accesscontextmanager", + "grpc-common", + "osconfig" + ] + } + ] + }, + "assuredworkloads": { + "description": "Assured Workloads API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "automl": { + "description": "Cloud AutoML API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "baremetalsolution": { + "description": "Bare Metal Solution API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "batch": { + "description": "Batch API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "beyondcorp": { + "description": "BeyondCorp API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "bigquery": { + "description": "The Google Cloud BigQuery C++ client library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "bigtable": { + "description": "The Google Cloud Bigtable C++ client library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "billing": { + "description": "Cloud Billing Budget API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "binaryauthorization": { + "description": "Binary Authorization API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grafeas", + "grpc-common" + ] + } + ] + }, + "certificatemanager": { + "description": "Certificate Manager API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "channel": { + "description": "Cloud Channel API C++ Client Library", + "supports": "!windows", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "cloudbuild": { + "description": "Cloud Build API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "composer": { + "description": "Cloud Composer C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "connectors": { + "description": "Connectors API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "contactcenterinsights": { + "description": "Contact Center AI Insights API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "container": { + "description": "Kubernetes Engine API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "containeranalysis": { + "description": "Container Analysis API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grafeas", + "grpc-common" + ] + } + ] + }, + "datacatalog": { + "description": "Google Cloud Data Catalog API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "datamigration": { + "description": "Database Migration API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "dataplex": { + "description": "Cloud Dataplex API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "dataproc": { + "description": "Cloud Dataproc API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "datastream": { + "description": "Datastream API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "debugger": { + "description": "Stackdriver Debugger API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "deploy": { + "description": "Google Cloud Deploy API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "dialogflow-cx": { + "description": "Cloud Dialogflow CX API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "dialogflow-es": { + "description": "Cloud Dialogflow ES API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "dlp": { + "description": "Cloud Data Loss Prevention (DLP) API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "documentai": { + "description": "Cloud Document AI API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "edgecontainer": { + "description": "Distributed Cloud Edge Container API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "eventarc": { + "description": "Eventarc API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "experimental-storage-grpc": { + "description": "The GCS+gRPC plugin", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common", + "storage" + ] + } + ] + }, + "filestore": { + "description": "Cloud Filestore API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "functions": { + "description": "Cloud Functions API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "gameservices": { + "description": "Game Services API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "gkehub": { + "description": "GKE Hub C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "grafeas": { + "description": "Protocol buffers implementing the 'Grafeas API' (metadata about software artifacts)", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "grpc-common": { + "description": "Dependencies used by all gRPC-based libraries", + "dependencies": [ + "grpc", + { + "name": "grpc", + "host": true + }, + "protobuf", + { + "name": "protobuf", + "host": true + } + ] + }, + "iam": { + "description": "The Google Cloud IAM C++ client library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "iap": { + "description": "Cloud Identity-Aware Proxy API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "ids": { + "description": "Cloud IDS API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "iot": { + "description": "Cloud IoT API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "kms": { + "description": "Cloud Key Management Service (KMS) API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "language": { + "description": "Cloud Natural Language API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "logging": { + "description": "Google Cloud Logging C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "managedidentities": { + "description": "Managed Service for Microsoft Active Directory API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "memcache": { + "description": "Cloud Memorystore for Memcached API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "monitoring": { + "description": "Cloud Monitoring API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "networkconnectivity": { + "description": "Network Connectivity API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "networkmanagement": { + "description": "Network Management API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "notebooks": { + "description": "Notebooks API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "optimization": { + "description": "Cloud Optimization API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "orgpolicy": { + "description": "Organization Policy API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "osconfig": { + "description": "Cloud OS Config API C++ Client library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "oslogin": { + "description": "Cloud OS Login API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "policytroubleshooter": { + "description": "Policy Troubleshooter API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "privateca": { + "description": "Certificate Authority API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "profiler": { + "description": "Cloud Profiler API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "pubsub": { + "description": "The Google Cloud Bigtable C++ client library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "recommender": { + "description": "Recommender C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "redis": { + "description": "Google Cloud Memorystore for Redis API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "resourcemanager": { + "description": "Cloud Resource Manager API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "resourcesettings": { + "description": "Resource Settings API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "retail": { + "description": "Retail API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "run": { + "description": "Cloud Run Admin API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "scheduler": { + "description": "Cloud Scheduler API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "secretmanager": { + "description": "The Google Cloud Secret Manager C++ client library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "securitycenter": { + "description": "Security Command Center API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "servicecontrol": { + "description": "Service Control API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "servicedirectory": { + "description": "Service Directory API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "servicemanagement": { + "description": "Service Management API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "serviceusage": { + "description": "Service Usage API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "shell": { + "description": "Cloud Shell API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "spanner": { + "description": "The Google Cloud Spanner C++ client library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "speech": { + "description": "The Google Cloud Speech-to-Text C++ client library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "storage": { + "description": "The Google Cloud Storage C++ client library", + "dependencies": [ + "crc32c", + { + "name": "curl", + "features": [ + "ssl" + ] + }, + "nlohmann-json" + ] + }, + "storagetransfer": { + "description": "Storage Transfer API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "talent": { + "description": "Cloud Talent Solution API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "tasks": { + "description": "The Google Cloud Tasks C++ client library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "texttospeech": { + "description": "Cloud Text-to-Speech API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "tpu": { + "description": "Cloud TPU API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "trace": { + "description": "Stackdriver Trace API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "translate": { + "description": "Cloud Translation API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "video": { + "description": "Video Services C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "videointelligence": { + "description": "Cloud Video Intelligence API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "vision": { + "description": "Cloud Vision API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "vmmigration": { + "description": "VM Migration API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "vmwareengine": { + "description": "VMware Engine API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "vpcaccess": { + "description": "Serverless VPC Access API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "webrisk": { + "description": "Web Risk API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "websecurityscanner": { + "description": "Web Security Scanner API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + }, + "workflows": { + "description": "Workflow Executions API C++ Client Library", + "dependencies": [ + { + "name": "google-cloud-cpp", + "default-features": false, + "features": [ + "grpc-common" + ] + } + ] + } + } +} diff --git a/ports/liblzma/add_support_ios.patch b/ports/liblzma/add_support_ios.patch new file mode 100644 index 00000000000..79741639b60 --- /dev/null +++ b/ports/liblzma/add_support_ios.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 52439b3..0b5e371 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -574,6 +574,7 @@ if(HAVE_GETOPT_LONG) + + install(TARGETS xzdec + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ++ BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}" + COMPONENT xzdec) + + if(UNIX) +@@ -701,6 +702,7 @@ if(NOT MSVC AND HAVE_GETOPT_LONG) + + install(TARGETS xz + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ++ BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}" + COMPONENT xz) + + if(UNIX) diff --git a/ports/liblzma/build-tools.patch b/ports/liblzma/build-tools.patch new file mode 100644 index 00000000000..759345ef23a --- /dev/null +++ b/ports/liblzma/build-tools.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 03b8301..820d08e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -584,6 +584,7 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/liblzma-config.cmake" + COMPONENT liblzma_Development) + + ++if(BUILD_TOOLS) + ############################################################################# + # getopt_long + ############################################################################# +@@ -793,6 +794,7 @@ if(NOT MSVC AND HAVE_GETOPT_LONG) + endforeach() + endif() + endif() ++endif() + + + ############################################################################# diff --git a/ports/liblzma/fix_config_include.patch b/ports/liblzma/fix_config_include.patch new file mode 100644 index 00000000000..91dc4c13ba5 --- /dev/null +++ b/ports/liblzma/fix_config_include.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 34c6aca00..7b3708ab2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -413,6 +413,7 @@ if(WIN32) + if(BUILD_SHARED_LIBS) + # Add the Windows resource file for liblzma.dll. + target_sources(liblzma PRIVATE src/liblzma/liblzma_w32res.rc) ++ target_include_directories(liblzma PRIVATE windows/vs2019) + + set_target_properties(liblzma PROPERTIES + LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/common/common_w32res.rc" diff --git a/ports/liblzma/portfile.cmake b/ports/liblzma/portfile.cmake new file mode 100644 index 00000000000..8631df28b0f --- /dev/null +++ b/ports/liblzma/portfile.cmake @@ -0,0 +1,84 @@ +vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION} +vcpkg_from_sourceforge( + OUT_SOURCE_PATH SOURCE_PATH + REPO lzmautils + FILENAME "xz-${VERSION}.tar.xz" + SHA512 f890ee5207799fbc7bb9ae031f444d39d82275b0e1b8cc7f01fdb9270050e38849bd1269db2a2f12fe87b5e23e03f9e809a5c3456d066c0a56e6f98d728553ea + PATCHES + fix_config_include.patch + win_output_name.patch # Fix output name on Windows. Autotool build does not generate lib prefixed libraries on windows. + add_support_ios.patch # add install bundle info for support ios + build-tools.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + tools BUILD_TOOLS +) + +if(VCPKG_TARGET_ARCHITECTURE STREQUAL "wasm32") + set(WASM_OPTIONS -DCMAKE_C_BYTE_ORDER=LITTLE_ENDIAN -DCMAKE_CXX_BYTE_ORDER=LITTLE_ENDIAN) +endif() + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} + ${WASM_OPTIONS} + -DBUILD_TESTING=OFF + -DCREATE_XZ_SYMLINKS=OFF + -DCREATE_LZMA_SYMLINKS=OFF + MAYBE_UNUSED_VARIABLES + CREATE_XZ_SYMLINKS + CREATE_LZMA_SYMLINKS +) +vcpkg_cmake_install() +vcpkg_copy_pdbs() + +set(exec_prefix "\${prefix}") +set(libdir "\${prefix}/lib") +set(includedir "\${prefix}/include") +set(PACKAGE_URL https://tukaani.org/xz/) +set(PACKAGE_VERSION 5.2.5) +if(NOT VCPKG_TARGET_IS_WINDOWS) + set(PTHREAD_CFLAGS -pthread) +endif() +set(prefix "${CURRENT_INSTALLED_DIR}") +configure_file("${SOURCE_PATH}/src/liblzma/liblzma.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/liblzma.pc" @ONLY) +if (NOT VCPKG_BUILD_TYPE) + set(prefix "${CURRENT_INSTALLED_DIR}/debug") + configure_file("${SOURCE_PATH}/src/liblzma/liblzma.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/liblzma.pc" @ONLY) +endif() +vcpkg_fixup_pkgconfig() + +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/liblzma) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/lzma.h" "defined(LZMA_API_STATIC)" "1") +else() + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/lzma.h" "defined(LZMA_API_STATIC)" "0") +endif() + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share" + "${CURRENT_PACKAGES_DIR}/share/man" +) + +set(TOOLS xz xzdec) +foreach(_tool IN LISTS TOOLS) + if(NOT EXISTS "${CURRENT_PACKAGES_DIR}/bin/${_tool}${VCPKG_TARGET_EXECUTABLE_SUFFIX}") + list(REMOVE_ITEM TOOLS ${_tool}) + endif() +endforeach() +if(TOOLS) + vcpkg_copy_tools(TOOL_NAMES ${TOOLS} AUTO_CLEAN) +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") +endif() + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/liblzma/usage b/ports/liblzma/usage new file mode 100644 index 00000000000..b1461c93fc0 --- /dev/null +++ b/ports/liblzma/usage @@ -0,0 +1,9 @@ +liblzma is compatible with built-in CMake targets: + + find_package(LibLZMA REQUIRED) + target_link_libraries(main PRIVATE LibLZMA::LibLZMA) + +liblzma provides CMake targets: + + find_package(liblzma CONFIG REQUIRED) + target_link_libraries(main PRIVATE liblzma::liblzma) diff --git a/ports/liblzma/vcpkg-cmake-wrapper.cmake b/ports/liblzma/vcpkg-cmake-wrapper.cmake new file mode 100644 index 00000000000..826cdba0650 --- /dev/null +++ b/ports/liblzma/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,64 @@ +cmake_policy(PUSH) +cmake_policy(SET CMP0012 NEW) +cmake_policy(SET CMP0057 NEW) +set(z_vcpkg_liblzma_fixup_needed 0) +if(NOT "CONFIG" IN_LIST ARGS AND NOT "NO_MODULE" IN_LIST ARGS AND NOT CMAKE_DISABLE_FIND_PACKAGE_LibLZMA) + get_filename_component(z_vcpkg_liblzma_prefix "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY) + get_filename_component(z_vcpkg_liblzma_prefix "${z_vcpkg_liblzma_prefix}" DIRECTORY) + find_path(LIBLZMA_INCLUDE_DIR NAMES lzma.h PATHS "${z_vcpkg_liblzma_prefix}/include" NO_DEFAULT_PATH) + # liblzma doesn't use a debug postfix, but FindLibLZMA.cmake expects it + find_library(LIBLZMA_LIBRARY_RELEASE NAMES lzma PATHS "${z_vcpkg_liblzma_prefix}/lib" NO_DEFAULT_PATH) + find_library(LIBLZMA_LIBRARY_DEBUG NAMES lzma PATHS "${z_vcpkg_liblzma_prefix}/debug/lib" NO_DEFAULT_PATH) + unset(z_vcpkg_liblzma_prefix) + if(CMAKE_VERSION VERSION_LESS 3.16) + # Older versions of FindLibLZMA.cmake need a single lib in LIBLZMA_LIBRARY. + set(z_vcpkg_liblzma_fixup_needed 1) + set(LIBLZMA_LIBRARY "${LIBLZMA_LIBRARY_RELEASE}" CACHE INTERNAL "") + elseif(NOT TARGET LibLZMA::LibLZMA) + set(z_vcpkg_liblzma_fixup_needed 1) + endif() + # Known values, and required. Skip expensive tests. + set(LIBLZMA_HAS_AUTO_DECODER 1 CACHE INTERNAL "") + set(LIBLZMA_HAS_EASY_ENCODER 1 CACHE INTERNAL "") + set(LIBLZMA_HAS_LZMA_PRESET 1 CACHE INTERNAL "") +endif() + +_find_package(${ARGS}) + +if(z_vcpkg_liblzma_fixup_needed) + include(SelectLibraryConfigurations) + select_library_configurations(LIBLZMA) + if(NOT TARGET LibLZMA::LibLZMA) + # Backfill LibLZMA::LibLZMA to versions of cmake before 3.14 + add_library(LibLZMA::LibLZMA UNKNOWN IMPORTED) + if(DEFINED LIBLZMA_INCLUDE_DIRS) + set_target_properties(LibLZMA::LibLZMA PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${LIBLZMA_INCLUDE_DIRS}") + endif() + set_property(TARGET LibLZMA::LibLZMA APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(LibLZMA::LibLZMA PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" + IMPORTED_LOCATION_RELEASE "${LIBLZMA_LIBRARY_RELEASE}") + if(EXISTS "${LIBLZMA_LIBRARY}") + set_target_properties(LibLZMA::LibLZMA PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${LIBLZMA_LIBRARY}") + endif() + endif() + if(LIBLZMA_LIBRARY_DEBUG) + # Backfill debug variant to versions of cmake before 3.16 + set_property(TARGET LibLZMA::LibLZMA APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(LibLZMA::LibLZMA PROPERTIES IMPORTED_LOCATION_DEBUG "${LIBLZMA_LIBRARY_DEBUG}") + endif() +endif() +if(LIBLZMA_LIBRARIES AND NOT "Threads::Threads" IN_LIST LIBLZMA_LIBRARIES) + set(THREADS_PREFER_PTHREAD_FLAG TRUE) + find_package(Threads) + list(APPEND LIBLZMA_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) + if(TARGET LibLZMA::LibLZMA) + set_property(TARGET LibLZMA::LibLZMA APPEND PROPERTY INTERFACE_LINK_LIBRARIES Threads::Threads) + endif() +endif() +unset(z_vcpkg_liblzma_fixup_needed) +cmake_policy(POP) diff --git a/ports/liblzma/vcpkg.json b/ports/liblzma/vcpkg.json new file mode 100644 index 00000000000..d0ac62bed49 --- /dev/null +++ b/ports/liblzma/vcpkg.json @@ -0,0 +1,24 @@ +{ + "name": "liblzma", + "version-semver": "5.4.1", + "port-version": 1, + "description": "Compression library with an API similar to that of zlib.", + "homepage": "https://tukaani.org/xz/", + "license": null, + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "tools": { + "description": "Build tools", + "supports": "!windows, mingw" + } + } +} diff --git a/ports/liblzma/win_output_name.patch b/ports/liblzma/win_output_name.patch new file mode 100644 index 00000000000..7011475de58 --- /dev/null +++ b/ports/liblzma/win_output_name.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e80b524..cddbccb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -462,8 +462,11 @@ set_target_properties(liblzma PROPERTIES + + # It's liblzma.so or liblzma.dll, not libliblzma.so or lzma.dll. + # Avoid the name lzma.dll because it would conflict with LZMA SDK. +- PREFIX "" ++ OUTPUT_NAME lzma + ) ++if(WIN32 AND NOT MINGW) ++ set_target_properties(liblzma PROPERTIES RUNTIME_OUTPUT_NAME liblzma) ++endif() + + # Create liblzma-config-version.cmake. We use this spelling instead of + # liblzmaConfig.cmake to make find_package work in case insensitive manner diff --git a/ports/libmagic/0001-Use-libtre.patch b/ports/libmagic/0001-Use-libtre.patch new file mode 100644 index 00000000000..a1080d5a070 --- /dev/null +++ b/ports/libmagic/0001-Use-libtre.patch @@ -0,0 +1,53 @@ +From e6e59f41c082be94c4fef007e276b1dffe7dc240 Mon Sep 17 00:00:00 2001 +From: Long Nguyen +Date: Sat, 8 May 2021 19:28:01 +0700 +Subject: [PATCH 01/14] Use libtre + +--- + configure.ac | 2 +- + src/Makefile.am | 2 +- + src/file.h | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 02eac8f..b05c334 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -185,7 +185,7 @@ if test "$enable_libseccomp" != "no"; then + AC_CHECK_LIB(seccomp, seccomp_init) + fi + if test "$MINGW" = 1; then +- AC_CHECK_LIB(gnurx,regexec,,AC_MSG_ERROR([libgnurx is required to build file(1) with MinGW])) ++ AC_SEARCH_LIBS(tre_regexec,tre,,AC_MSG_ERROR([libtre is required to build file(1) with MinGW])) + fi + + dnl See if we are cross-compiling +diff --git a/src/Makefile.am b/src/Makefile.am +index 3f67f2c..34781b9 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -13,7 +13,7 @@ libmagic_la_SOURCES = buffer.c magic.c apprentice.c softmagic.c ascmagic.c \ + file_opts.h elfclass.h mygetopt.h cdf.c cdf_time.c readcdf.c cdf.h + libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0 + if MINGW +-MINGWLIBS = -lgnurx -lshlwapi ++MINGWLIBS = -lshlwapi + else + MINGWLIBS = + endif +diff --git a/src/file.h b/src/file.h +index c548e97..299ac0c 100644 +--- a/src/file.h ++++ b/src/file.h +@@ -79,7 +79,7 @@ + #include /* Include that here, to make sure __P gets defined */ + #include + #include /* For open and flags */ +-#include ++#include + #include + #include + #ifndef WIN32 +-- +2.29.2.windows.2 + diff --git a/ports/libmagic/0002-Change-zlib-lib-name-to-match-CMake-output.patch b/ports/libmagic/0002-Change-zlib-lib-name-to-match-CMake-output.patch new file mode 100644 index 00000000000..5e070cc07fe --- /dev/null +++ b/ports/libmagic/0002-Change-zlib-lib-name-to-match-CMake-output.patch @@ -0,0 +1,39 @@ +From 2fa43ece9ec7564e1fbb9867bb5852b834643aa4 Mon Sep 17 00:00:00 2001 +From: Long Nguyen +Date: Sat, 8 May 2021 19:36:11 +0700 +Subject: [PATCH 02/14] Change zlib lib name to match CMake output + +--- + configure.ac | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/configure.ac b/configure.ac +index b05c334..dd4063c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -173,7 +173,7 @@ AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r + + dnl Checks for libraries + if test "$enable_zlib" != "no"; then +- AC_CHECK_LIB(z, gzopen) ++ AC_SEARCH_LIBS(gzopen, [z zlib zlibd], have_zlib = "yes", have_zlib = "no") + fi + if test "$enable_bzlib" != "no"; then + AC_CHECK_LIB(bz2, BZ2_bzCompressInit) +@@ -193,11 +193,11 @@ AM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes) + + dnl Final sanity checks + if test "$enable_zlib" = "yes"; then +- if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" != "yesyes"; then ++ if test "$ac_cv_header_zlib_h$have_zlib" != "yesyes"; then + AC_MSG_ERROR([zlib support requested but not found]) + fi + fi +-if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then ++if test "$ac_cv_header_zlib_h$have_zlib" = "yesyes"; then + AC_DEFINE([ZLIBSUPPORT], 1, [Enable zlib compression support]) + fi + if test "$enable_bzlib" = "yes"; then +-- +2.29.2.windows.2 + diff --git a/ports/libmagic/0003-Fix-WIN32-macro-checks.patch b/ports/libmagic/0003-Fix-WIN32-macro-checks.patch new file mode 100644 index 00000000000..eb0f7ebdaf5 --- /dev/null +++ b/ports/libmagic/0003-Fix-WIN32-macro-checks.patch @@ -0,0 +1,43 @@ +From 2fffeb273ea46c1e91536f3d660982de785c8d49 Mon Sep 17 00:00:00 2001 +From: Long Nguyen +Date: Sat, 8 May 2021 20:52:59 +0700 +Subject: [PATCH 03/14] Fix WIN32 macro checks + +--- + src/file.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/file.h b/src/file.h +index 299ac0c..2c365a6 100644 +--- a/src/file.h ++++ b/src/file.h +@@ -82,7 +82,7 @@ + #include + #include + #include +-#ifndef WIN32 ++#ifndef _WIN32 + #include + #endif + /* Do this here and now, because struct stat gets re-defined on solaris */ +@@ -95,7 +95,7 @@ + #define MAGIC "/etc/magic" + #endif + +-#if defined(__EMX__) || defined (WIN32) ++#if defined(__EMX__) || defined (_WIN32) + #define PATHSEP ';' + #else + #define PATHSEP ':' +@@ -103,7 +103,7 @@ + + #define private static + +-#if HAVE_VISIBILITY && !defined(WIN32) ++#if HAVE_VISIBILITY && !defined(_WIN32) + #define public __attribute__ ((__visibility__("default"))) + #ifndef protected + #define protected __attribute__ ((__visibility__("hidden"))) +-- +2.29.2.windows.2 + diff --git a/ports/libmagic/0004-Typedef-POSIX-types-on-Windows.patch b/ports/libmagic/0004-Typedef-POSIX-types-on-Windows.patch new file mode 100644 index 00000000000..a15298432ea --- /dev/null +++ b/ports/libmagic/0004-Typedef-POSIX-types-on-Windows.patch @@ -0,0 +1,29 @@ +From eb3dde2954dacd86ec7490540eb9b7e3530b917b Mon Sep 17 00:00:00 2001 +From: Long Nguyen +Date: Sat, 8 May 2021 20:12:55 +0700 +Subject: [PATCH 04/14] Typedef POSIX types on Windows + +--- + src/file.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/file.h b/src/file.h +index 2c365a6..0332506 100644 +--- a/src/file.h ++++ b/src/file.h +@@ -425,6 +425,12 @@ struct cont { + + #define MAGIC_SETS 2 + ++#ifdef _MSC_VER ++#include ++typedef int mode_t; ++typedef SSIZE_T ssize_t; ++#endif ++ + struct magic_set { + struct mlist *mlist[MAGIC_SETS]; /* list of regular entries */ + struct cont c; +-- +2.29.2.windows.2 + diff --git a/ports/libmagic/0005-Include-dirent.h-for-S_ISREG-and-S_ISDIR.patch b/ports/libmagic/0005-Include-dirent.h-for-S_ISREG-and-S_ISDIR.patch new file mode 100644 index 00000000000..76cbc1222c8 --- /dev/null +++ b/ports/libmagic/0005-Include-dirent.h-for-S_ISREG-and-S_ISDIR.patch @@ -0,0 +1,24 @@ +From a8f8fbfc2736419c65992cbf24de963c3b1f3107 Mon Sep 17 00:00:00 2001 +From: Long Nguyen +Date: Sat, 8 May 2021 22:07:55 +0700 +Subject: [PATCH 05/14] Include dirent.h for S_ISREG and S_ISDIR + +--- + src/file.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/file.h b/src/file.h +index 0332506..4aa9f60 100644 +--- a/src/file.h ++++ b/src/file.h +@@ -88,6 +88,7 @@ + /* Do this here and now, because struct stat gets re-defined on solaris */ + #include + #include ++#include + + #define ENABLE_CONDITIONALS + +-- +2.29.2.windows.2 + diff --git a/ports/libmagic/0006-Remove-Wrap-POSIX-headers.patch b/ports/libmagic/0006-Remove-Wrap-POSIX-headers.patch new file mode 100644 index 00000000000..56efac24815 --- /dev/null +++ b/ports/libmagic/0006-Remove-Wrap-POSIX-headers.patch @@ -0,0 +1,189 @@ +From b20c8e62851f3cb53083a3e7811518092f98dc26 Mon Sep 17 00:00:00 2001 +From: Long Nguyen +Date: Sat, 8 May 2021 22:47:32 +0700 +Subject: [PATCH 06/14] Remove/Wrap POSIX headers + +--- + src/buffer.c | 2 ++ + src/cdf.c | 2 ++ + src/dprintf.c | 2 ++ + src/file.c | 1 - + src/getline.c | 2 ++ + src/is_csv.c | 2 ++ + src/is_json.c | 2 ++ + src/magic.c | 2 ++ + src/memtest.c | 2 ++ + src/mygetopt.h | 2 ++ + src/pread.c | 2 ++ + src/readcdf.c | 2 ++ + 12 files changed, 22 insertions(+), 1 deletion(-) + +diff --git a/src/buffer.c b/src/buffer.c +index 227015a..f3d8efa 100644 +--- a/src/buffer.c ++++ b/src/buffer.c +@@ -31,7 +31,9 @@ FILE_RCSID("@(#)$File: buffer.c,v 1.8 2020/02/16 15:52:49 christos Exp $") + #endif /* lint */ + + #include "magic.h" ++#ifdef HAVE_UNISTD_H + #include ++#endif + #include + #include + #include +diff --git a/src/cdf.c b/src/cdf.c +index bb81d63..dc9ec56 100644 +--- a/src/cdf.c ++++ b/src/cdf.c +@@ -43,7 +43,9 @@ FILE_RCSID("@(#)$File: cdf.c,v 1.116 2019/08/26 14:31:39 christos Exp $") + #include + #endif + #include ++#ifdef HAVE_UNISTD_H + #include ++#endif + #include + #include + #include +diff --git a/src/dprintf.c b/src/dprintf.c +index 027a64f..873c547 100644 +--- a/src/dprintf.c ++++ b/src/dprintf.c +@@ -32,7 +32,9 @@ FILE_RCSID("@(#)$File: dprintf.c,v 1.2 2018/09/09 20:33:28 christos Exp $") + #endif /* lint */ + + #include ++#ifdef HAVE_UNISTD_H + #include ++#endif + #include + #include + +diff --git a/src/file.c b/src/file.c +index 87b9ab1..2889f8a 100644 +--- a/src/file.c ++++ b/src/file.c +@@ -38,7 +38,6 @@ FILE_RCSID("@(#)$File: file.c,v 1.189 2021/02/05 21:33:49 christos Exp $") + #include "magic.h" + + #include +-#include + #include + #ifdef RESTORE_TIME + # if (__COHERENT__ >= 0x420) +diff --git a/src/getline.c b/src/getline.c +index b00de01..c2d41ca 100644 +--- a/src/getline.c ++++ b/src/getline.c +@@ -33,7 +33,9 @@ + #if !HAVE_GETLINE + #include + #include ++#ifdef HAVE_UNISTD_H + #include ++#endif + #include + #include + +diff --git a/src/is_csv.c b/src/is_csv.c +index 937ab5f..2f704c5 100644 +--- a/src/is_csv.c ++++ b/src/is_csv.c +@@ -166,7 +166,9 @@ file_is_csv(struct magic_set *ms, const struct buffer *b, int looks_text) + #include + #include + #include ++#ifdef HAVE_UNISTD_H + #include ++#endif + #include + #include + #include +diff --git a/src/is_json.c b/src/is_json.c +index 0b12438..997a276 100644 +--- a/src/is_json.c ++++ b/src/is_json.c +@@ -436,7 +436,9 @@ file_is_json(struct magic_set *ms, const struct buffer *b) + #include + #include + #include ++#ifdef HAVE_UNISTD_H + #include ++#endif + #include + #include + #include +diff --git a/src/magic.c b/src/magic.c +index 81a0840..e9aeafa 100644 +--- a/src/magic.c ++++ b/src/magic.c +@@ -39,7 +39,9 @@ FILE_RCSID("@(#)$File: magic.c,v 1.114 2021/02/05 21:33:49 christos Exp $") + #include "magic.h" + + #include ++#ifdef HAVE_UNISTD_H + #include ++#endif + #include + #ifdef QUICK + #include +diff --git a/src/memtest.c b/src/memtest.c +index f9506f6..ea50242 100644 +--- a/src/memtest.c ++++ b/src/memtest.c +@@ -34,7 +34,9 @@ + #include + #include + #include ++#ifdef HAVE_UNISTD_H + #include ++#endif + #include + #include + +diff --git a/src/mygetopt.h b/src/mygetopt.h +index d766762..b8e044c 100644 +--- a/src/mygetopt.h ++++ b/src/mygetopt.h +@@ -39,7 +39,9 @@ + #ifndef _GETOPT_H_ + #define _GETOPT_H_ + ++#ifdef HAVE_UNISTD_H + #include ++#endif + + /* + * Gnu like getopt_long() and BSD4.4 getsubopt()/optreset extensions +diff --git a/src/pread.c b/src/pread.c +index 3ab52d1..fc48d84 100644 +--- a/src/pread.c ++++ b/src/pread.c +@@ -3,7 +3,9 @@ + FILE_RCSID("@(#)$File: pread.c,v 1.2 2013/04/02 16:23:07 christos Exp $") + #endif /* lint */ + #include ++#ifdef HAVE_UNISTD_H + #include ++#endif + + ssize_t + pread(int fd, void *buf, size_t len, off_t off) { +diff --git a/src/readcdf.c b/src/readcdf.c +index 7622c7b..977cb75 100644 +--- a/src/readcdf.c ++++ b/src/readcdf.c +@@ -31,7 +31,9 @@ FILE_RCSID("@(#)$File: readcdf.c,v 1.74 2019/09/11 15:46:30 christos Exp $") + + #include + #include ++#ifdef HAVE_UNISTD_H + #include ++#endif + #include + #include + #include +-- +2.29.2.windows.2 + diff --git a/ports/libmagic/0007-Substitute-unistd-macros-for-MSVC.patch b/ports/libmagic/0007-Substitute-unistd-macros-for-MSVC.patch new file mode 100644 index 00000000000..726fbde7e69 --- /dev/null +++ b/ports/libmagic/0007-Substitute-unistd-macros-for-MSVC.patch @@ -0,0 +1,30 @@ +From 1106d1523ed44bcbcca90fc1fe9fa9400777d8fe Mon Sep 17 00:00:00 2001 +From: Long Nguyen +Date: Sun, 9 May 2021 10:28:49 +0700 +Subject: [PATCH 07/14] Substitute unistd macros for MSVC + +--- + src/file.h | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/file.h b/src/file.h +index 4aa9f60..5da838c 100644 +--- a/src/file.h ++++ b/src/file.h +@@ -85,6 +85,13 @@ + #ifndef _WIN32 + #include + #endif ++#ifdef _MSC_VER ++#include ++#define R_OK 4 ++#define W_OK 2 ++#define X_OK R_OK ++#define F_OK 0 ++#endif + /* Do this here and now, because struct stat gets re-defined on solaris */ + #include + #include +-- +2.29.2.windows.2 + diff --git a/ports/libmagic/0008-Add-FILENO-defines.patch b/ports/libmagic/0008-Add-FILENO-defines.patch new file mode 100644 index 00000000000..dea50809267 --- /dev/null +++ b/ports/libmagic/0008-Add-FILENO-defines.patch @@ -0,0 +1,26 @@ +From e449e3fb47aee00f0d82782183cc7fd6b446d27b Mon Sep 17 00:00:00 2001 +From: Long Nguyen +Date: Sun, 9 May 2021 13:24:42 +0700 +Subject: [PATCH 08/14] Add FILENO defines + +--- + src/file.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/file.h b/src/file.h +index 5da838c..ccfe0da 100644 +--- a/src/file.h ++++ b/src/file.h +@@ -91,6 +91,9 @@ + #define W_OK 2 + #define X_OK R_OK + #define F_OK 0 ++#define STDIN_FILENO _fileno(stdin) ++#define STDOUT_FILENO _fileno(stdout) ++#define STDERR_FILENO _fileno(stderr) + #endif + /* Do this here and now, because struct stat gets re-defined on solaris */ + #include +-- +2.29.2.windows.2 + diff --git a/ports/libmagic/0009-No-fcntl-in-magic.c.patch b/ports/libmagic/0009-No-fcntl-in-magic.c.patch new file mode 100644 index 00000000000..47bf16165ef --- /dev/null +++ b/ports/libmagic/0009-No-fcntl-in-magic.c.patch @@ -0,0 +1,25 @@ +From 6d10bef865b69764f6e0ddd2b0f6a84e484cdb37 Mon Sep 17 00:00:00 2001 +From: Long Nguyen +Date: Sun, 9 May 2021 13:25:14 +0700 +Subject: [PATCH 09/14] No fcntl in magic.c + +--- + src/magic.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/magic.c b/src/magic.c +index e9aeafa..382bd96 100644 +--- a/src/magic.c ++++ b/src/magic.c +@@ -462,7 +462,7 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd) + rv = 0; + goto done; + } +-#if O_CLOEXEC == 0 ++#if O_CLOEXEC == 0 && !defined(_WIN32) + (void)fcntl(fd, F_SETFD, FD_CLOEXEC); + #endif + } +-- +2.29.2.windows.2 + diff --git a/ports/libmagic/0010-Properly-check-for-the-presence-of-bitmasks.patch b/ports/libmagic/0010-Properly-check-for-the-presence-of-bitmasks.patch new file mode 100644 index 00000000000..f0d8738e465 --- /dev/null +++ b/ports/libmagic/0010-Properly-check-for-the-presence-of-bitmasks.patch @@ -0,0 +1,118 @@ +From a6bc98ce25cd9d9dba896e93ed441ff162f6793b Mon Sep 17 00:00:00 2001 +From: Long Nguyen +Date: Sun, 9 May 2021 17:43:20 +0700 +Subject: [PATCH 10/14] Properly check for the presence of bitmasks + +--- + src/fsmagic.c | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/src/fsmagic.c b/src/fsmagic.c +index 5204f20..7244841 100644 +--- a/src/fsmagic.c ++++ b/src/fsmagic.c +@@ -66,7 +66,7 @@ FILE_RCSID("@(#)$File: fsmagic.c,v 1.81 2019/07/16 13:30:32 christos Exp $") + # define minor(dev) ((dev) & 0xff) + #endif + #undef HAVE_MAJOR +-#ifdef S_IFLNK ++#if S_IFLNK != 0 + private int + bad_link(struct magic_set *ms, int err, char *buf) + { +@@ -108,7 +108,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb) + int ret, did = 0; + int mime = ms->flags & MAGIC_MIME; + int silent = ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION); +-#ifdef S_IFLNK ++#if S_IFLNK != 0 + char buf[BUFSIZ+4]; + ssize_t nch; + struct stat tstatbuf; +@@ -122,7 +122,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb) + * Fstat is cheaper but fails for files you don't have read perms on. + * On 4.2BSD and similar systems, use lstat() to identify symlinks. + */ +-#ifdef S_IFLNK ++#if S_IFLNK != 0 + if ((ms->flags & MAGIC_SYMLINK) == 0) + ret = lstat(fn, sb); + else +@@ -171,17 +171,17 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb) + + ret = 1; + if (!mime && !silent) { +-#ifdef S_ISUID ++#if S_ISUID != 0 + if (sb->st_mode & S_ISUID) + if (file_printf(ms, "%ssetuid", COMMA) == -1) + return -1; + #endif +-#ifdef S_ISGID ++#if S_ISGID != 0 + if (sb->st_mode & S_ISGID) + if (file_printf(ms, "%ssetgid", COMMA) == -1) + return -1; + #endif +-#ifdef S_ISVTX ++#if S_ISVTX != 0 + if (sb->st_mode & S_ISVTX) + if (file_printf(ms, "%ssticky", COMMA) == -1) + return -1; +@@ -197,7 +197,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb) + } else if (file_printf(ms, "%sdirectory", COMMA) == -1) + return -1; + break; +-#ifdef S_IFCHR ++#if S_IFCHR != 0 + case S_IFCHR: + /* + * If -s has been specified, treat character special files +@@ -232,7 +232,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb) + } + break; + #endif +-#ifdef S_IFBLK ++#if S_IFBLK != 0 + case S_IFBLK: + /* + * If -s has been specified, treat block special files +@@ -268,7 +268,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb) + break; + #endif + /* TODO add code to handle V7 MUX and Blit MUX files */ +-#ifdef S_IFIFO ++#if S_IFIFO != 0 + case S_IFIFO: + if((ms->flags & MAGIC_DEVICES) != 0) + break; +@@ -280,7 +280,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb) + return -1; + break; + #endif +-#ifdef S_IFDOOR ++#if S_IFDOOR != 0 + case S_IFDOOR: + if (mime) { + if (handle_mime(ms, mime, "door") == -1) +@@ -290,7 +290,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb) + return -1; + break; + #endif +-#ifdef S_IFLNK ++#if S_IFLNK != 0 + case S_IFLNK: + if ((nch = readlink(fn, buf, BUFSIZ-1)) <= 0) { + if (ms->flags & MAGIC_ERROR) { +@@ -378,7 +378,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb) + } + break; + #endif +-#ifdef S_IFSOCK ++#if S_IFSOCK != 0 + #ifndef __COHERENT__ + case S_IFSOCK: + if (mime) { +-- +2.29.2.windows.2 + diff --git a/ports/libmagic/0011-Remove-pipe-related-functions-in-funcs.c.patch b/ports/libmagic/0011-Remove-pipe-related-functions-in-funcs.c.patch new file mode 100644 index 00000000000..ae2720ca361 --- /dev/null +++ b/ports/libmagic/0011-Remove-pipe-related-functions-in-funcs.c.patch @@ -0,0 +1,32 @@ +From 15b0f505ff9eefd41b74ffdd4230355e933263ca Mon Sep 17 00:00:00 2001 +From: Long Nguyen +Date: Sun, 9 May 2021 17:45:50 +0700 +Subject: [PATCH 11/14] Remove pipe related functions in funcs.c + +--- + src/funcs.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/funcs.c b/src/funcs.c +index b926625..b585486 100644 +--- a/src/funcs.c ++++ b/src/funcs.c +@@ -809,6 +809,7 @@ file_print_guid(char *str, size_t len, const uint64_t *guid) + g->data4[6], g->data4[7]); + } + ++#ifndef _WIN32 + protected int + file_pipe_closexec(int *fds) + { +@@ -827,6 +828,7 @@ protected int + file_clear_closexec(int fd) { + return fcntl(fd, F_SETFD, 0); + } ++#endif + + protected char * + file_strtrim(char *str) +-- +2.29.2.windows.2 + diff --git a/ports/libmagic/0012-Convert-MSYS2-paths-to-Windows-paths.patch b/ports/libmagic/0012-Convert-MSYS2-paths-to-Windows-paths.patch new file mode 100644 index 00000000000..728fe77539f --- /dev/null +++ b/ports/libmagic/0012-Convert-MSYS2-paths-to-Windows-paths.patch @@ -0,0 +1,24 @@ +From f0139ced57c1579450f3d09b6e3ae0159aae031b Mon Sep 17 00:00:00 2001 +From: Long Nguyen +Date: Mon, 10 May 2021 08:43:28 +0700 +Subject: [PATCH 12/14] Convert MSYS2 paths to Windows paths + +--- + src/Makefile.am | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/Makefile.am b/src/Makefile.am +index 34781b9..26f853f 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -1,4 +1,7 @@ + MAGIC = $(pkgdatadir)/magic ++if MINGW ++MAGIC != cygpath -m -a -l '$(MAGIC)' ++endif + lib_LTLIBRARIES = libmagic.la + nodist_include_HEADERS = magic.h + +-- +2.29.2.windows.2 + diff --git a/ports/libmagic/0013-Check-for-backslash-in-argv-0-on-Windows.patch b/ports/libmagic/0013-Check-for-backslash-in-argv-0-on-Windows.patch new file mode 100644 index 00000000000..77777fc61e8 --- /dev/null +++ b/ports/libmagic/0013-Check-for-backslash-in-argv-0-on-Windows.patch @@ -0,0 +1,42 @@ +From 3f10c7d31627b64b068b84ba72e706991f672560 Mon Sep 17 00:00:00 2001 +From: Long Nguyen +Date: Fri, 14 May 2021 08:14:05 +0700 +Subject: [PATCH 13/14] Check for backslash in argv[0] on Windows + +--- + magic/Makefile.am | 2 +- + src/file.c | 5 +++++ + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/magic/Makefile.am b/magic/Makefile.am +index 0eb5865..170bbab 100644 +--- a/magic/Makefile.am ++++ b/magic/Makefile.am +@@ -353,7 +353,7 @@ ${MAGIC}: $(EXTRA_DIST) $(FILE_COMPILE_DEP) + @(if expr "${FILE_COMPILE}" : '.*/.*' > /dev/null; then \ + echo "Using ${FILE_COMPILE} to generate ${MAGIC}" > /dev/null; \ + else \ +- v=$$(${FILE_COMPILE} --version | sed -e s/file-// -e q); \ ++ v=$$(${FILE_COMPILE} --version | sed -e s/file${EXEEXT}-// -e q); \ + if [ "$$v" != "${PACKAGE_VERSION}" ]; then \ + echo "Cannot use the installed version of file ($$v) to"; \ + echo "cross-compile file ${PACKAGE_VERSION}"; \ +diff --git a/src/file.c b/src/file.c +index 2889f8a..12a604b 100644 +--- a/src/file.c ++++ b/src/file.c +@@ -200,6 +200,11 @@ main(int argc, char *argv[]) + _wildcard(&argc, &argv); + #endif + ++#ifdef _WIN32 ++ if ((progname = strrchr(argv[0], '\\')) != NULL) ++ progname++; ++ else ++#endif + if ((progname = strrchr(argv[0], '/')) != NULL) + progname++; + else +-- +2.29.2.windows.2 + diff --git a/ports/libmagic/0014-Define-POSIX-macros-if-missing.patch b/ports/libmagic/0014-Define-POSIX-macros-if-missing.patch new file mode 100644 index 00000000000..09ac7a11926 --- /dev/null +++ b/ports/libmagic/0014-Define-POSIX-macros-if-missing.patch @@ -0,0 +1,38 @@ +From fa0e11f36bb0e322250e1e488ced9f2bf166874f Mon Sep 17 00:00:00 2001 +From: Long Nguyen +Date: Fri, 14 May 2021 18:11:39 +0700 +Subject: [PATCH 14/14] Define POSIX macros if missing + +--- + src/file.h | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/src/file.h b/src/file.h +index ccfe0da..98cd37b 100644 +--- a/src/file.h ++++ b/src/file.h +@@ -100,6 +100,21 @@ + #include + #include + ++#if !defined(S_IFBLK) ++#define S_IFBLK 0 ++#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK) ++#endif ++ ++#if !defined(S_IFLNK) ++#define S_IFLNK 0 ++#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) ++#endif ++ ++#if !defined(S_IFSOCK) ++#define S_IFSOCK 0 ++#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) ++#endif ++ + #define ENABLE_CONDITIONALS + + #ifndef MAGIC +-- +2.29.2.windows.2 + diff --git a/ports/libmagic/0015-MSYS2-Remove-ioctl-call.patch b/ports/libmagic/0015-MSYS2-Remove-ioctl-call.patch new file mode 100644 index 00000000000..da8ef79df29 --- /dev/null +++ b/ports/libmagic/0015-MSYS2-Remove-ioctl-call.patch @@ -0,0 +1,27 @@ +# From https://github.com/msys2/MINGW-packages/commit/3a51faadb8bacf06c7b7fd84b2ea80775d1a8b0d + +# this is an advanced patch to fix building v5.38 +# see for details +# this patch should be removed with the next version +diff --git a/src/compress.c b/src/compress.c +index 33ce2bc..f172eda 100644 +--- a/src/compress.c ++++ b/src/compress.c +@@ -378,7 +378,7 @@ + sread(int fd, void *buf, size_t n, int canbepipe __attribute__((__unused__))) + { + ssize_t rv; +-#ifdef FIONREAD ++#if defined(FIONREAD) && !defined(__MINGW32__) && !defined(WIN32) + int t = 0; + #endif + size_t rn = n; +@@ -386,7 +386,7 @@ + if (fd == STDIN_FILENO) + goto nocheck; + +-#ifdef FIONREAD ++#if defined(FIONREAD) && !defined(__MINGW32__) && !defined(WIN32) + if (canbepipe && (ioctl(fd, FIONREAD, &t) == -1 || t == 0)) { + #ifdef FD_ZERO + ssize_t cnt; diff --git a/ports/libmagic/portfile.cmake b/ports/libmagic/portfile.cmake new file mode 100644 index 00000000000..ed155792b7e --- /dev/null +++ b/ports/libmagic/portfile.cmake @@ -0,0 +1,71 @@ +if(VCPKG_TARGET_IS_WINDOWS) + set(PATCHES + "0001-Use-libtre.patch" + "0002-Change-zlib-lib-name-to-match-CMake-output.patch" + "0003-Fix-WIN32-macro-checks.patch" + "0004-Typedef-POSIX-types-on-Windows.patch" + "0005-Include-dirent.h-for-S_ISREG-and-S_ISDIR.patch" + "0006-Remove-Wrap-POSIX-headers.patch" + "0007-Substitute-unistd-macros-for-MSVC.patch" + "0008-Add-FILENO-defines.patch" + "0009-No-fcntl-in-magic.c.patch" + "0010-Properly-check-for-the-presence-of-bitmasks.patch" + "0011-Remove-pipe-related-functions-in-funcs.c.patch" + "0012-Convert-MSYS2-paths-to-Windows-paths.patch" + "0013-Check-for-backslash-in-argv-0-on-Windows.patch" + "0014-Define-POSIX-macros-if-missing.patch" + "0015-MSYS2-Remove-ioctl-call.patch" + ) +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO file/file + REF FILE5_40 + SHA512 d76bfe5326e1b40368e055c2e049a24b4ffdbd727371f4f3aa1dd3f53787d16b88550b3cc71ecf02151e2fb3e567eb2598e4707badab8c391eb71113c2dcc319 + HEAD_REF master + PATCHES ${PATCHES} +) + +if(VCPKG_TARGET_IS_WINDOWS) + set(VCPKG_C_FLAGS "${VCPKG_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS") + set(VCPKG_CXX_FLAGS "${VCPKG_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS") +endif() + +vcpkg_configure_make( + AUTOCONFIG + SOURCE_PATH "${SOURCE_PATH}" +) + +if(VCPKG_CROSSCOMPILING) + vcpkg_add_to_path(PREPEND "${CURRENT_HOST_INSTALLED_DIR}/tools/libmagic/bin") +elseif(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + set(EXTRA_ARGS "ADD_BIN_TO_PATH") +endif() + +vcpkg_install_make(${EXTRA_ARGS}) +vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin") +vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin") +vcpkg_fixup_pkgconfig() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") +endif() + +if(VCPKG_TARGET_IS_WINDOWS) + if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/share/misc") + file(COPY "${CURRENT_PACKAGES_DIR}/share/${PORT}/misc/magic.mgc" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/share/misc") + endif() + if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/share/misc") + file(COPY "${CURRENT_PACKAGES_DIR}/share/${PORT}/misc/magic.mgc" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/share/misc") + endif() +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/${PORT}/man5") + +# Handle copyright +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/libmagic/vcpkg.json b/ports/libmagic/vcpkg.json new file mode 100644 index 00000000000..9f63ac32231 --- /dev/null +++ b/ports/libmagic/vcpkg.json @@ -0,0 +1,25 @@ +{ + "name": "libmagic", + "version-string": "5.40", + "port-version": 1, + "description": "This library can be used to classify files according to magic number tests.", + "homepage": "https://github.com/file/file", + "dependencies": [ + { + "name": "dirent", + "platform": "windows" + }, + { + "name": "getopt", + "platform": "windows" + }, + { + "name": "libmagic", + "host": true + }, + { + "name": "tre", + "platform": "windows | mingw" + } + ] +} diff --git a/ports/libwebp/portfile.cmake b/ports/libwebp/portfile.cmake new file mode 100644 index 00000000000..2a45137bf6f --- /dev/null +++ b/ports/libwebp/portfile.cmake @@ -0,0 +1,35 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO webmproject/libwebp + REF "v1.2.3" + SHA512 27f86817350e6d0e215c449665046df8c63203344f9a2846770af292ce8fee486a72adfd5e1122aa67e7d2f3e3972cd8423da95fee7edf10c9848bcbda46264c + HEAD_REF master +) + +vcpkg_configure_cmake( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DWEBP_BUILD_ANIM_UTILS=OFF + -DWEBP_BUILD_CWEBP=OFF + -DWEBP_BUILD_DWEBP=OFF + -DWEBP_BUILD_GIF2WEBP=OFF + -DWEBP_BUILD_IMG2WEBP=OFF + -DWEBP_BUILD_VWEBP=OFF + -DWEBP_BUILD_WEBPINFO=OFF + -DWEBP_BUILD_WEBPMUX=OFF + -DWEBP_BUILD_EXTRAS=OFF + MAYBE_UNUSED_VARIABLES + CMAKE_DISABLE_FIND_PACKAGE_SDL + CMAKE_REQUIRE_FIND_PACKAGE_SDL +) + +vcpkg_install_cmake() +vcpkg_install_copyright(FILE_LIST ${SOURCE_PATH}/COPYING ${SOURCE_PATH}/PATENTS) + +vcpkg_fixup_pkgconfig() +vcpkg_cmake_config_fixup(PACKAGE_NAME WebP CONFIG_PATH share/WebP/cmake) +vcpkg_copy_pdbs() + + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") diff --git a/ports/libwebp/vcpkg.json b/ports/libwebp/vcpkg.json new file mode 100644 index 00000000000..ff1c17e598a --- /dev/null +++ b/ports/libwebp/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "libwebp", + "version": "1.2.3", + "description": "WebP codec: library to encode and decode images in WebP format", + "homepage": "https://github.com/webmproject/libwebp", + "license": "BSD-3-Clause", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/ports/lz4/0001-Fix-potential-memory-corruption-with-negative-memmov.patch b/ports/lz4/0001-Fix-potential-memory-corruption-with-negative-memmov.patch new file mode 100755 index 00000000000..d6f444810c0 --- /dev/null +++ b/ports/lz4/0001-Fix-potential-memory-corruption-with-negative-memmov.patch @@ -0,0 +1,26 @@ +From 8301a21773ef61656225e264f4f06ae14462bca7 Mon Sep 17 00:00:00 2001 +From: Jasper Lievisse Adriaanse +Date: Fri, 26 Feb 2021 15:21:20 +0100 +Subject: [PATCH 001/120] Fix potential memory corruption with negative + memmove() size + +--- + lib/lz4.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/lz4.c b/lib/lz4.c +index 5f524d0..c2f504e 100644 +--- a/lib/lz4.c ++++ b/lib/lz4.c +@@ -1749,7 +1749,7 @@ LZ4_decompress_generic( + const size_t dictSize /* note : = 0 if noDict */ + ) + { +- if (src == NULL) { return -1; } ++ if ((src == NULL) || (outputSize < 0)) { return -1; } + + { const BYTE* ip = (const BYTE*) src; + const BYTE* const iend = ip + srcSize; +-- +2.36.1 + diff --git a/ports/lz4/CMakeLists.txt b/ports/lz4/CMakeLists.txt new file mode 100644 index 00000000000..142a229006f --- /dev/null +++ b/ports/lz4/CMakeLists.txt @@ -0,0 +1,57 @@ +cmake_minimum_required(VERSION 3.0) +project(lz4 C) + +if(MSVC AND BUILD_SHARED_LIBS) + add_definitions(-DLZ4_DLL_EXPORT) +endif() +add_definitions(-DXXH_NAMESPACE=LZ4_) + +set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "Install prefix") +set(INSTALL_BIN_DIR "bin" CACHE PATH "Path where exe and dll will be installed") +set(INSTALL_LIB_DIR "lib" CACHE PATH "Path where lib will be installed") +set(INSTALL_INCLUDE_DIR "include" CACHE PATH "Path where headers will be installed") +set(INSTALL_CMAKE_DIR "share/lz4" CACHE PATH "Path where cmake configs will be installed") + +file(GLOB LZ4_HEADERS lib/*.h) + +add_library(lz4 + ${LZ4_HEADERS} + lib/lz4.c + lib/lz4frame.c + lib/lz4hc.c + lib/xxhash.c +) + +target_include_directories(lz4 PUBLIC $ $) +set_target_properties(lz4 PROPERTIES PUBLIC_HEADER ${LZ4_HEADERS}) + +install(TARGETS lz4 + EXPORT lz4Config + RUNTIME DESTINATION "${INSTALL_BIN_DIR}" + ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" + LIBRARY DESTINATION "${INSTALL_LIB_DIR}" + PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}" + PRIVATE_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}" + COMPONENT dev +) + +FILE(GLOB lz4h "${CMAKE_CURRENT_LIST_DIR}/lib/*.h") +list(REMOVE_ITEM lz4h "${CMAKE_CURRENT_LIST_DIR}/lib/xxhash.h") +INSTALL(FILES ${lz4h} DESTINATION "${INSTALL_INCLUDE_DIR}") + +install(EXPORT lz4Config + FILE lz4-config.cmake + NAMESPACE lz4:: + DESTINATION "${INSTALL_CMAKE_DIR}" +) + +# Export the package for use from the build-tree (this registers the build-tree with a global CMake-registry) +export(PACKAGE lz4) + +# Create pkgconfig module file +file(STRINGS "lib/lz4.h" LZ4_H REGEX "^#define LZ4_VERSION_(MAJOR|MINOR|RELEASE) ") +string(REGEX REPLACE "^.*MAJOR +([0-9]+).*MINOR +([0-9]+).*RELEASE +([0-9]+).*$" "\\1.\\2.\\3" VERSION "${LZ4_H}") +set(INCLUDEDIR [[${prefix}/include]]) +set(LIBDIR [[${prefix}/lib]]) +configure_file(lib/liblz4.pc.in lib/liblz4.pc) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/lib/liblz4.pc" DESTINATION "lib/pkgconfig") diff --git a/ports/lz4/portfile.cmake b/ports/lz4/portfile.cmake new file mode 100644 index 00000000000..a2e3b74f911 --- /dev/null +++ b/ports/lz4/portfile.cmake @@ -0,0 +1,42 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO lz4/lz4 + REF v1.9.3 + SHA512 c246b0bda881ee9399fa1be490fa39f43b291bb1d9db72dba8a85db1a50aad416a97e9b300eee3d2a4203c2bd88bda2762e81bc229c3aa409ad217eb306a454c + HEAD_REF dev + PATCHES + 0001-Fix-potential-memory-corruption-with-negative-memmov.patch +) + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS_DEBUG + -DCMAKE_DEBUG_POSTFIX=d +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(DLL_IMPORT "1 && defined(_MSC_VER)") +else() + set(DLL_IMPORT "0") +endif() +foreach(FILE lz4.h lz4frame.h) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/${FILE}" + "defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)" + "${DLL_IMPORT}" + ) +endforeach() + +vcpkg_cmake_config_fixup() +vcpkg_fixup_pkgconfig() +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/liblz4.pc" " -llz4" " -llz4d") +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +file(INSTALL "${SOURCE_PATH}/lib/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/lz4/vcpkg.json b/ports/lz4/vcpkg.json new file mode 100644 index 00000000000..597e902dd15 --- /dev/null +++ b/ports/lz4/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "lz4", + "version": "1.9.3", + "port-version": 4, + "description": "Lossless compression algorithm, providing compression speed at 400 MB/s per core.", + "homepage": "https://github.com/lz4/lz4", + "license": "BSD-2-Clause AND GPL-2.0-only", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/ports/nlohmann-json/portfile.cmake b/ports/nlohmann-json/portfile.cmake new file mode 100644 index 00000000000..947cba35728 --- /dev/null +++ b/ports/nlohmann-json/portfile.cmake @@ -0,0 +1,48 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO nlohmann/json + REF v3.11.2 + SHA512 70097c9bcd7a91254acbd41b8b68a6aaa371fc2dd7011f472917f69f1e2d2986155a0339dad791699d542e4a3be44dc49ae72ff73d0ee0ea4b34183296ce19a0 + HEAD_REF master +) + +if(NOT DEFINED nlohmann-json_IMPLICIT_CONVERSIONS) + set(nlohmann-json_IMPLICIT_CONVERSIONS ON) +endif() + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS +FEATURES + "diagnostics" JSON_Diagnostics +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS ${FEATURE_OPTIONS} + -DJSON_Install=ON + -DJSON_MultipleHeaders=ON + -DJSON_BuildTests=OFF + -DJSON_ImplicitConversions=${nlohmann-json_IMPLICIT_CONVERSIONS} +) +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(PACKAGE_NAME "nlohmann_json" CONFIG_PATH "share/cmake/nlohmann_json") +vcpkg_fixup_pkgconfig() + +vcpkg_replace_string( + "${CURRENT_PACKAGES_DIR}/share/nlohmann_json/nlohmann_jsonTargets.cmake" + "{_IMPORT_PREFIX}/nlohmann_json.natvis" + "{_IMPORT_PREFIX}/share/nlohmann_json/nlohmann_json.natvis" +) +if(EXISTS "${CURRENT_PACKAGES_DIR}/nlohmann_json.natvis") + file(RENAME + "${CURRENT_PACKAGES_DIR}/nlohmann_json.natvis" + "${CURRENT_PACKAGES_DIR}/share/nlohmann_json/nlohmann_json.natvis" + ) +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug") + +# Handle copyright +file(INSTALL "${SOURCE_PATH}/LICENSE.MIT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) + +# Handle usage +file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/ports/nlohmann-json/usage b/ports/nlohmann-json/usage new file mode 100644 index 00000000000..19c76d508d0 --- /dev/null +++ b/ports/nlohmann-json/usage @@ -0,0 +1,12 @@ +The package nlohmann-json provides CMake targets: + + find_package(nlohmann_json CONFIG REQUIRED) + target_link_libraries(main PRIVATE nlohmann_json::nlohmann_json) + +The package nlohmann-json can be configured to not provide implicit conversions via a custom triplet file: + + set(nlohmann-json_IMPLICIT_CONVERSIONS OFF) + +For more information, see the docs here: + + https://json.nlohmann.me/api/macros/json_use_implicit_conversions/ diff --git a/ports/nlohmann-json/vcpkg.json b/ports/nlohmann-json/vcpkg.json new file mode 100644 index 00000000000..cc65b9d204d --- /dev/null +++ b/ports/nlohmann-json/vcpkg.json @@ -0,0 +1,22 @@ +{ + "name": "nlohmann-json", + "version-semver": "3.11.2", + "description": "JSON for Modern C++", + "homepage": "https://github.com/nlohmann/json", + "license": "MIT", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "diagnostics": { + "description": "Build json_diagnostics" + } + } +} diff --git a/ports/openssl/install-pc-files.cmake b/ports/openssl/install-pc-files.cmake new file mode 100644 index 00000000000..04897faed78 --- /dev/null +++ b/ports/openssl/install-pc-files.cmake @@ -0,0 +1,32 @@ +function(install_pc_file name pc_data) + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + configure_file("${CMAKE_CURRENT_LIST_DIR}/openssl.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/${name}.pc" @ONLY) + endif() + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + configure_file("${CMAKE_CURRENT_LIST_DIR}/openssl.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/${name}.pc" @ONLY) + endif() +endfunction() + +install_pc_file(openssl [[ +Name: OpenSSL +Description: Secure Sockets Layer and cryptography libraries and tools +Requires: libssl libcrypto +]]) + +install_pc_file(libssl [[ +Name: OpenSSL-libssl +Description: Secure Sockets Layer and cryptography libraries +Libs: -L"${libdir}" -llibssl +Requires: libcrypto +Cflags: -I"${includedir}" +]]) + +install_pc_file(libcrypto [[ +Name: OpenSSL-libcrypto +Description: OpenSSL cryptography library +Libs: -L"${libdir}" -llibcrypto +Libs.private: -lcrypt32 -lws2_32 -ladvapi32 -luser32 +Cflags: -I"${includedir}" +]]) + +vcpkg_fixup_pkgconfig() diff --git a/ports/openssl/openssl.pc.in b/ports/openssl/openssl.pc.in new file mode 100644 index 00000000000..f7fa9d185f1 --- /dev/null +++ b/ports/openssl/openssl.pc.in @@ -0,0 +1,6 @@ +prefix=${pcfiledir}/../.. +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include +Version: @VERSION@ +@pc_data@ diff --git a/ports/openssl/portfile.cmake b/ports/openssl/portfile.cmake new file mode 100644 index 00000000000..58ae71d1abb --- /dev/null +++ b/ports/openssl/portfile.cmake @@ -0,0 +1,43 @@ +vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION} +if(EXISTS "${CURRENT_INSTALLED_DIR}/share/libressl/copyright" + OR EXISTS "${CURRENT_INSTALLED_DIR}/share/boringssl/copyright") + message(FATAL_ERROR "Can't build openssl if libressl/boringssl is installed. Please remove libressl/boringssl, and try install openssl again if you need it.") +endif() + +if (VCPKG_TARGET_IS_LINUX) + message(WARNING +[[openssl currently requires the following library from the system package manager: + linux-headers +It can be installed on alpine systems via apk add linux-headers.]] + ) +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO openssl/openssl + REF "openssl-${VERSION}" + SHA512 27dd3ef0c1827a74ec880d20232acb818c7d05e004ad7389c355e200a01e899f1b1ba5c34dcce44ecf7c8767c5e1bfbb2c795e3fa5461346087e7e3b95c8a51f + PATCHES + windows/install-layout.patch + windows/install-pdbs.patch +) + +vcpkg_find_acquire_program(PERL) +get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) +vcpkg_add_to_path("${PERL_EXE_PATH}") + +if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + include("${CMAKE_CURRENT_LIST_DIR}/windows/portfile.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/install-pc-files.cmake") +else() + include("${CMAKE_CURRENT_LIST_DIR}/unix/portfile.cmake") +endif() + +if (NOT "${VERSION}" MATCHES [[^([0-9]+)\.([0-9]+)\.([0-9]+)$]]) + message(FATAL_ERROR "Version regex did not match.") +endif() +set(OPENSSL_VERSION_MAJOR "${CMAKE_MATCH_1}") +set(OPENSSL_VERSION_MINOR "${CMAKE_MATCH_2}") +set(OPENSSL_VERSION_FIX "${CMAKE_MATCH_3}") +configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY) +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/ports/openssl/unix/CMakeLists.txt b/ports/openssl/unix/CMakeLists.txt new file mode 100644 index 00000000000..75c21805ace --- /dev/null +++ b/ports/openssl/unix/CMakeLists.txt @@ -0,0 +1,281 @@ +cmake_minimum_required(VERSION 3.9) +project(openssl C) + +if(NOT SOURCE_PATH) + message(FATAL_ERROR "Requires SOURCE_PATH") +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "Android" OR CMAKE_SYSTEM_NAME STREQUAL "Linux") + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + set(PLATFORM linux-x86_64) + else() + set(PLATFORM linux-generic32) + endif() +elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS") + if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64") + set(PLATFORM ios64-xcrun) + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm") + set(PLATFORM ios-xcrun) + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" OR + VCPKG_TARGET_ARCHITECTURE MATCHES "x64") + set(PLATFORM iossimulator-xcrun) + else() + message(FATAL_ERROR "Unknown iOS target architecture: ${VCPKG_TARGET_ARCHITECTURE}") + endif() + # disable that makes linkage error (e.g. require stderr usage) + list(APPEND DISABLES no-ui no-asm) +elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64") + set(PLATFORM darwin64-arm64-cc) + else() + set(PLATFORM darwin64-x86_64-cc) + endif() +elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + set(PLATFORM BSD-generic64) +elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") + set(PLATFORM BSD-generic64) +elseif(MINGW) + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + set(PLATFORM mingw64) + else() + set(PLATFORM mingw) + endif() +elseif(EMSCRIPTEN) + set(MAKE $ENV{EMSDK}/upstream/emscripten/emmake) + set(ENV{MAKE} $ENV{EMSDK}/upstream/emscripten/emmake) +else() + message(FATAL_ERROR "Unknown platform") +endif() + +get_filename_component(COMPILER_ROOT "${CMAKE_C_COMPILER}" DIRECTORY) + +message("CMAKE_C_COMPILER=${CMAKE_C_COMPILER}") +message("COMPILER_ROOT=${COMPILER_ROOT}") +message("CMAKE_SYSROOT=${CMAKE_SYSROOT}") +message("CMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}") +message("CMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}") +message("CMAKE_C_FLAGS=${CMAKE_C_FLAGS}") +message("CMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE}") +message("CMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG}") +message("CMAKE_INCLUDE_SYSTEM_FLAG_C=${CMAKE_INCLUDE_SYSTEM_FLAG_C}") +message("CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG=${CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG}") + +string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE) +set(CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BUILD_TYPE}}") +if(CMAKE_C_COMPILER_ID STREQUAL "Clang") + set(CFLAGS "${CFLAGS} -Wno-error=unused-command-line-argument") +endif() +if(CMAKE_C_COMPILER_TARGET AND CMAKE_C_COMPILE_OPTIONS_TARGET) + set(CFLAGS "${CFLAGS} ${CMAKE_C_COMPILE_OPTIONS_TARGET}${CMAKE_C_COMPILER_TARGET}") +endif() +if(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN AND CMAKE_C_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN) + set(CFLAGS "${CFLAGS} ${CMAKE_C_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN}${CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN}") +endif() +if(CMAKE_SYSROOT AND CMAKE_C_COMPILE_OPTIONS_SYSROOT) + set(CFLAGS "${CFLAGS} ${CMAKE_C_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}") +elseif(CMAKE_OSX_SYSROOT AND CMAKE_C_COMPILE_OPTIONS_SYSROOT) + set(CFLAGS "${CFLAGS} ${CMAKE_C_COMPILE_OPTIONS_SYSROOT}${CMAKE_OSX_SYSROOT}") +endif() +if (CMAKE_OSX_DEPLOYMENT_TARGET AND CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG) + set(CFLAGS "${CFLAGS} ${CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG}${CMAKE_OSX_DEPLOYMENT_TARGET}") +elseif((CMAKE_SYSTEM_NAME STREQUAL "Darwin") AND (VCPKG_TARGET_ARCHITECTURE MATCHES "arm64")) + set(CFLAGS "${CFLAGS} -mmacosx-version-min=11.0") +endif() + +string(REGEX REPLACE "^ " "" CFLAGS "${CFLAGS}") + +set(ENV{ANDROID_DEV} "${CMAKE_SYSROOT}/usr") + +if(NOT IOS) + set(ENV{CC} "${CMAKE_C_COMPILER}") +endif() + +message("ENV{ANDROID_DEV}=$ENV{ANDROID_DEV}") + +get_filename_component(SOURCE_PATH_NAME "${SOURCE_PATH}" NAME) +set(BUILDDIR "${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_PATH_NAME}") + +if(NOT EXISTS "${BUILDDIR}") + file(COPY ${SOURCE_PATH} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +endif() + +get_filename_component(MSYS_BIN_DIR "${MAKE}" DIRECTORY) + +if(BUILD_SHARED_LIBS) + set(SHARED shared) + file(STRINGS "${BUILDDIR}/VERSION.dat" SHLIB_VERSION + REGEX "^SHLIB_VERSION=.*") + string(REGEX REPLACE "^(SHLIB_VERSION=)(.*)$" "\\2" + SHLIB_VERSION "${SHLIB_VERSION}") + + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS") + set(LIB_EXT dylib) + set(LIB_EXTS ${SHLIB_VERSION}.${LIB_EXT}) + elseif(MINGW) + string(REPLACE "." "_" SHLIB_VERSION "${SHLIB_VERSION}") + set(BIN_EXT dll) + set(LIB_EXT dll.a) + else() + set(LIB_EXT so) + set(LIB_EXTS ${LIB_EXT}.${SHLIB_VERSION}) + endif() + list(APPEND BIN_EXTS ${BIN_EXT}) + list(APPEND LIB_EXTS ${LIB_EXT}) +else() + set(SHARED no-shared no-module) + set(LIB_EXTS a) +endif() +set(INSTALL_PKG_CONFIGS "${BUILDDIR}/openssl.pc") +foreach(lib ssl crypto) + foreach(ext ${LIB_EXTS}) + list(APPEND INSTALL_LIBS "${BUILDDIR}/lib${lib}.${ext}") + list(APPEND INSTALL_PKG_CONFIGS "${BUILDDIR}/lib${lib}.pc") + endforeach() + foreach(ext ${BIN_EXTS}) + # This might be wrong for targets which don't follow this naming scheme, but I'm not aware of any + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + list(APPEND INSTALL_BINS "${BUILDDIR}/lib${lib}-${SHLIB_VERSION}-x64.${ext}") + else() + list(APPEND INSTALL_BINS "${BUILDDIR}/lib${lib}-${SHLIB_VERSION}.${ext}") + endif() + endforeach() +endforeach() + +if(CMAKE_HOST_WIN32) + set(ENV_COMMAND set) + set(PATH_VAR ";%PATH%") +else() + set(ENV_COMMAND export) + set(PATH_VAR ":$ENV{PATH}") +endif() + +add_custom_command( + OUTPUT "${BUILDDIR}/Makefile" + COMMAND ${ENV_COMMAND} "PATH=${MSYS_BIN_DIR}${PATH_VAR}" + VERBATIM + WORKING_DIRECTORY "${BUILDDIR}" +) + +if(NOT IOS) + add_custom_command( + OUTPUT "${BUILDDIR}/Makefile" + COMMAND ${ENV_COMMAND} CC=${CMAKE_C_COMPILER} + COMMAND ${ENV_COMMAND} AR=${CMAKE_AR} + COMMAND ${ENV_COMMAND} LD=${CMAKE_LINKER} + COMMAND ${ENV_COMMAND} RANLIB=${CMAKE_RANLIB} + COMMAND ${ENV_COMMAND} MAKE=${MAKE} + COMMAND ${ENV_COMMAND} MAKEDEPPROG=${CMAKE_C_COMPILER} + COMMAND ${ENV_COMMAND} WINDRES=${CMAKE_RC_COMPILER} + VERBATIM + APPEND + ) + if(EMSCRIPTEN) + list(APPEND DISABLES + threads + no-engine + no-dso + no-asm + no-shared + no-sse2 + no-srtp + ) + else() + list(APPEND DISABLES + enable-static-engine + no-zlib + no-ssl2 + no-idea + no-cast + no-seed + no-md2 + no-tests) + endif() +endif() + +if(EMSCRIPTEN) + add_custom_command( + OUTPUT "${BUILDDIR}/Makefile" + COMMAND "$ENV{EMSDK}/upstream/emscripten/emconfigure" ./config + ${SHARED} + ${DISABLES} + "--prefix=${CMAKE_INSTALL_PREFIX}" + "--openssldir=/etc/ssl" + "--cross-compile-prefix=\"/\"" + VERBATIM + APPEND + ) + + add_custom_target(build_libs ALL + COMMAND ${ENV_COMMAND} "PATH=${MSYS_BIN_DIR}${PATH_VAR}" + COMMAND "${CMAKE_COMMAND}" -E touch "${BUILDDIR}/krb5.h" + COMMAND "${MAKE}" make build_libs + VERBATIM + WORKING_DIRECTORY "${BUILDDIR}" + DEPENDS "${BUILDDIR}/Makefile" + BYPRODUCTS ${INSTALL_LIBS} + ) +else() + add_custom_command( + OUTPUT "${BUILDDIR}/Makefile" + COMMAND "${PERL}" Configure + ${SHARED} + ${DISABLES} + ${PLATFORM} + "--prefix=${CMAKE_INSTALL_PREFIX}" + "--libdir=${CMAKE_INSTALL_PREFIX}/lib" + "--openssldir=/etc/ssl" + ${CFLAGS} + VERBATIM + APPEND + ) + + add_custom_target(build_libs ALL + COMMAND ${ENV_COMMAND} "PATH=${MSYS_BIN_DIR}${PATH_VAR}" + COMMAND "${CMAKE_COMMAND}" -E touch "${BUILDDIR}/krb5.h" + COMMAND "${MAKE}" -j ${VCPKG_CONCURRENCY} build_libs + VERBATIM + WORKING_DIRECTORY "${BUILDDIR}" + DEPENDS "${BUILDDIR}/Makefile" + BYPRODUCTS ${INSTALL_LIBS} + ) +endif() + +add_custom_command( + OUTPUT "${BUILDDIR}/Makefile" + COMMAND "${CMAKE_COMMAND}" "-DDIR=${BUILDDIR}" -P "${CMAKE_CURRENT_LIST_DIR}/remove-deps.cmake" + VERBATIM + APPEND +) + +if((CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS") AND BUILD_SHARED_LIBS) + if(DEFINED CMAKE_INSTALL_NAME_DIR) + set(ID_PREFIX "${CMAKE_INSTALL_NAME_DIR}") + else() + set(ID_PREFIX "@rpath") + endif() + + add_custom_command( + TARGET build_libs + COMMAND /usr/bin/install_name_tool -id "${ID_PREFIX}/libssl.${SHLIB_VERSION}.dylib" + "${BUILDDIR}/libssl.${SHLIB_VERSION}.dylib" + COMMAND /usr/bin/install_name_tool -id "${ID_PREFIX}/libcrypto.${SHLIB_VERSION}.dylib" + "${BUILDDIR}/libcrypto.${SHLIB_VERSION}.dylib" + COMMAND /usr/bin/install_name_tool -change "${CMAKE_INSTALL_PREFIX}/lib/libcrypto.${SHLIB_VERSION}.dylib" + "${ID_PREFIX}/libcrypto.${SHLIB_VERSION}.dylib" + "${BUILDDIR}/libssl.${SHLIB_VERSION}.dylib" + VERBATIM + ) +endif() + +install( + FILES ${INSTALL_LIBS} + DESTINATION lib +) +install( + FILES ${INSTALL_BINS} + DESTINATION bin +) +install( + FILES ${INSTALL_PKG_CONFIGS} + DESTINATION lib/pkgconfig +) diff --git a/ports/openssl/unix/portfile.cmake b/ports/openssl/unix/portfile.cmake new file mode 100644 index 00000000000..319b7e3905a --- /dev/null +++ b/ports/openssl/unix/portfile.cmake @@ -0,0 +1,32 @@ +if(CMAKE_HOST_WIN32) + vcpkg_acquire_msys(MSYS_ROOT PACKAGES make perl) + set(MAKE "${MSYS_ROOT}/usr/bin/make.exe") + set(PERL "${MSYS_ROOT}/usr/bin/perl.exe") +else() + find_program(MAKE make) + if(NOT MAKE) + message(FATAL_ERROR "Could not find make. Please install it through your package manager.") + endif() +endif() + +vcpkg_cmake_configure( + SOURCE_PATH "${CMAKE_CURRENT_LIST_DIR}" + OPTIONS + -DSOURCE_PATH=${SOURCE_PATH} + -DPERL=${PERL} + -DMAKE=${MAKE} + -DVCPKG_CONCURRENCY=${VCPKG_CONCURRENCY} +) + +vcpkg_cmake_install() +vcpkg_fixup_pkgconfig() + +file(GLOB HEADERS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*/include/openssl/*.h") +set(RESOLVED_HEADERS) +foreach(HEADER ${HEADERS}) + get_filename_component(X "${HEADER}" REALPATH) + list(APPEND RESOLVED_HEADERS "${X}") +endforeach() + +file(INSTALL ${RESOLVED_HEADERS} DESTINATION "${CURRENT_PACKAGES_DIR}/include/openssl") +file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/openssl/unix/remove-deps.cmake b/ports/openssl/unix/remove-deps.cmake new file mode 100644 index 00000000000..a57c70fe91e --- /dev/null +++ b/ports/openssl/unix/remove-deps.cmake @@ -0,0 +1,7 @@ +file(GLOB_RECURSE MAKEFILES ${DIR}/*/Makefile) +foreach(MAKEFILE ${MAKEFILES}) + message("removing deps from ${MAKEFILE}") + file(READ "${MAKEFILE}" _contents) + string(REGEX REPLACE "\n# DO NOT DELETE THIS LINE.*" "" _contents "${_contents}") + file(WRITE "${MAKEFILE}" "${_contents}") +endforeach() diff --git a/ports/openssl/usage b/ports/openssl/usage new file mode 100644 index 00000000000..f535cb6a401 --- /dev/null +++ b/ports/openssl/usage @@ -0,0 +1,4 @@ +The package openssl is compatible with built-in CMake targets: + + find_package(OpenSSL REQUIRED) + target_link_libraries(main PRIVATE OpenSSL::SSL OpenSSL::Crypto) diff --git a/ports/openssl/vcpkg-cmake-wrapper.cmake.in b/ports/openssl/vcpkg-cmake-wrapper.cmake.in new file mode 100644 index 00000000000..5008112c35c --- /dev/null +++ b/ports/openssl/vcpkg-cmake-wrapper.cmake.in @@ -0,0 +1,82 @@ +cmake_policy(PUSH) +cmake_policy(SET CMP0012 NEW) +cmake_policy(SET CMP0054 NEW) +cmake_policy(SET CMP0057 NEW) + +set(OPENSSL_VERSION_MAJOR @OPENSSL_VERSION_MAJOR@) +set(OPENSSL_VERSION_MINOR @OPENSSL_VERSION_MINOR@) +set(OPENSSL_VERSION_FIX @OPENSSL_VERSION_FIX@) + +if(OPENSSL_USE_STATIC_LIBS) + if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "dynamic") + message(WARNING "OPENSSL_USE_STATIC_LIBS is set, but vcpkg port openssl was built with dynamic linkage") + endif() + set(OPENSSL_USE_STATIC_LIBS_BAK "${OPENSSL_USE_STATIC_LIBS}") + set(OPENSSL_USE_STATIC_LIBS FALSE) +endif() + +if(DEFINED OPENSSL_ROOT_DIR) + set(OPENSSL_ROOT_DIR_BAK "${OPENSSL_ROOT_DIR}") +endif() +get_filename_component(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY) +get_filename_component(OPENSSL_ROOT_DIR "${OPENSSL_ROOT_DIR}" DIRECTORY) +find_path(OPENSSL_INCLUDE_DIR NAMES openssl/ssl.h PATH "${OPENSSL_ROOT_DIR}/include" NO_DEFAULT_PATH) +if(MSVC) + find_library(LIB_EAY_DEBUG NAMES libcrypto PATHS "${OPENSSL_ROOT_DIR}/debug/lib" NO_DEFAULT_PATH) + find_library(LIB_EAY_RELEASE NAMES libcrypto PATHS "${OPENSSL_ROOT_DIR}/lib" NO_DEFAULT_PATH) + find_library(SSL_EAY_DEBUG NAMES libssl PATHS "${OPENSSL_ROOT_DIR}/debug/lib" NO_DEFAULT_PATH) + find_library(SSL_EAY_RELEASE NAMES libssl PATHS "${OPENSSL_ROOT_DIR}/lib" NO_DEFAULT_PATH) +elseif(WIN32) + find_library(LIB_EAY NAMES libcrypto crypto NAMES_PER_DIR) + find_library(SSL_EAY NAMES libssl ssl NAMES_PER_DIR) +else() + find_library(OPENSSL_CRYPTO_LIBRARY NAMES crypto) + find_library(OPENSSL_SSL_LIBRARY NAMES ssl) +endif() + +_find_package(${ARGS}) + +unset(OPENSSL_ROOT_DIR) +if(DEFINED OPENSSL_ROOT_DIR_BAK) + set(OPENSSL_ROOT_DIR "${OPENSSL_ROOT_DIR_BAK}") + unset(OPENSSL_ROOT_DIR_BAK) +endif() + +if(DEFINED OPENSSL_USE_STATIC_LIBS_BAK) + set(OPENSSL_USE_STATIC_LIBS "${OPENSSL_USE_STATIC_LIBS_BAK}") + unset(OPENSSL_USE_STATIC_LIBS_BAK) +endif() + +if(OPENSSL_FOUND AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static") + if(WIN32) + list(APPEND OPENSSL_LIBRARIES crypt32 ws2_32) + if(TARGET OpenSSL::Crypto) + set_property(TARGET OpenSSL::Crypto APPEND PROPERTY INTERFACE_LINK_LIBRARIES "crypt32;ws2_32") + endif() + if(TARGET OpenSSL::SSL) + set_property(TARGET OpenSSL::SSL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "crypt32;ws2_32") + endif() + else() + find_library(OPENSSL_DL_LIBRARY NAMES dl) + if(OPENSSL_DL_LIBRARY) + list(APPEND OPENSSL_LIBRARIES "dl") + if(TARGET OpenSSL::Crypto) + set_property(TARGET OpenSSL::Crypto APPEND PROPERTY INTERFACE_LINK_LIBRARIES "dl") + endif() + endif() + + if("REQUIRED" IN_LIST ARGS) + find_package(Threads REQUIRED) + else() + find_package(Threads) + endif() + list(APPEND OPENSSL_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) + if(TARGET OpenSSL::Crypto) + set_property(TARGET OpenSSL::Crypto APPEND PROPERTY INTERFACE_LINK_LIBRARIES "Threads::Threads") + endif() + if(TARGET OpenSSL::SSL) + set_property(TARGET OpenSSL::SSL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "Threads::Threads") + endif() + endif() +endif() +cmake_policy(POP) diff --git a/ports/openssl/vcpkg.json b/ports/openssl/vcpkg.json new file mode 100644 index 00000000000..f3babade4cb --- /dev/null +++ b/ports/openssl/vcpkg.json @@ -0,0 +1,23 @@ +{ + "name": "openssl", + "version": "3.0.7", + "port-version": 2, + "description": "OpenSSL is an open source project that provides a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library.", + "homepage": "https://www.openssl.org", + "license": "Apache-2.0", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + { + "name": "vcpkg-cmake-get-vars", + "host": true, + "platform": "windows & !mingw" + } + ] +} diff --git a/ports/openssl/windows/install-layout.patch b/ports/openssl/windows/install-layout.patch new file mode 100644 index 00000000000..be9df768b38 --- /dev/null +++ b/ports/openssl/windows/install-layout.patch @@ -0,0 +1,13 @@ +diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl +index f71f3bf..116954f 100644 +--- a/Configurations/windows-makefile.tmpl ++++ b/Configurations/windows-makefile.tmpl +@@ -223,7 +223,7 @@ MODULESDIR_dev={- use File::Spec::Functions qw(:DEFAULT splitpath catpath); + splitpath($modulesprefix, 1); + our $modulesdir_dev = $modulesprefix_dev; + our $modulesdir_dir = +- catdir($modulesprefix_dir, "ossl-modules"); ++ catdir($modulesprefix_dir, "../bin"); + our $modulesdir = catpath($modulesdir_dev, $modulesdir_dir); + our $enginesdir_dev = $modulesprefix_dev; + our $enginesdir_dir = diff --git a/ports/openssl/windows/install-pdbs.patch b/ports/openssl/windows/install-pdbs.patch new file mode 100644 index 00000000000..379c525a4f4 --- /dev/null +++ b/ports/openssl/windows/install-pdbs.patch @@ -0,0 +1,44 @@ +diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl +index 5946c89..f71f3bf 100644 +--- a/Configurations/windows-makefile.tmpl ++++ b/Configurations/windows-makefile.tmpl +@@ -556,6 +556,7 @@ install_dev: install_runtime_libs + @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(libdir)" + @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_LIBS) "$(libdir)" + @if "$(SHLIBS)"=="" \ ++ @if "$(INSTALL_PDBS)"=="ON" \ + "$(PERL)" "$(SRCDIR)\util\copy.pl" ossl_static.pdb "$(libdir)" + + uninstall_dev: +@@ -569,6 +570,7 @@ install_engines: _install_modules_deps + @if not "$(INSTALL_ENGINES)"=="" \ + "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINES) "$(ENGINESDIR)" + @if not "$(INSTALL_ENGINES)"=="" \ ++ @if "$(INSTALL_PDBS)"=="ON" \ + "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINEPDBS) "$(ENGINESDIR)" + + uninstall_engines: +@@ -580,6 +582,7 @@ install_modules: _install_modules_deps + @if not "$(INSTALL_MODULES)"=="" \ + "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_MODULES) "$(MODULESDIR)" + @if not "$(INSTALL_MODULES)"=="" \ ++ @if "$(INSTALL_PDBS)"=="ON" \ + "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_MODULEPDBS) "$(MODULESDIR)" + + uninstall_modules: +@@ -593,6 +596,7 @@ install_runtime_libs: build_libs + @if not "$(SHLIBS)"=="" \ + "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBS) "$(INSTALLTOP)\bin" + @if not "$(SHLIBS)"=="" \ ++ @if "$(INSTALL_PDBS)"=="ON" \ + "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBPDBS) \ + "$(INSTALLTOP)\bin" + +@@ -605,6 +609,7 @@ install_programs: install_runtime_libs build_programs + "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMS) \ + "$(INSTALLTOP)\bin" + @if not "$(INSTALL_PROGRAMS)"=="" \ ++ @if "$(INSTALL_PDBS)"=="ON" \ + "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMPDBS) \ + "$(INSTALLTOP)\bin" + @if not "$(INSTALL_PROGRAMS)"=="" \ diff --git a/ports/openssl/windows/portfile.cmake b/ports/openssl/windows/portfile.cmake new file mode 100644 index 00000000000..cd1c31152e8 --- /dev/null +++ b/ports/openssl/windows/portfile.cmake @@ -0,0 +1,139 @@ +vcpkg_find_acquire_program(NASM) +get_filename_component(NASM_EXE_PATH "${NASM}" DIRECTORY) +vcpkg_add_to_path(PREPEND "${NASM_EXE_PATH}") + +vcpkg_list(SET CONFIGURE_OPTIONS + enable-static-engine + enable-capieng + no-ssl2 + no-ssl3 + no-weak-ssl-ciphers + no-tests +) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + vcpkg_list(APPEND CONFIGURE_OPTIONS shared) +else() + vcpkg_list(APPEND CONFIGURE_OPTIONS no-shared no-module) +endif() + +if(DEFINED OPENSSL_USE_NOPINSHARED) + vcpkg_list(APPEND CONFIGURE_OPTIONS no-pinshared) +endif() + +if(OPENSSL_NO_AUTOLOAD_CONFIG) + vcpkg_list(APPEND CONFIGURE_OPTIONS no-autoload-config) +endif() + +if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") + set(OPENSSL_ARCH VC-WIN32) +elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(OPENSSL_ARCH VC-WIN64A) +elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") + set(OPENSSL_ARCH VC-WIN32-ARM) +elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + set(OPENSSL_ARCH VC-WIN64-ARM) +else() + message(FATAL_ERROR "Unsupported target architecture: ${VCPKG_TARGET_ARCHITECTURE}") +endif() + +if(VCPKG_TARGET_IS_UWP) + vcpkg_list(APPEND CONFIGURE_OPTIONS + no-unit-test + no-asm + no-uplink + ) + string(APPEND OPENSSL_ARCH "-UWP") +endif() + +if(VCPKG_CONCURRENCY GREATER "1") + vcpkg_list(APPEND CONFIGURE_OPTIONS no-makedepend) +endif() + +cmake_path(NATIVE_PATH CURRENT_PACKAGES_DIR NORMALIZE install_dir_native) + +vcpkg_cmake_get_vars(cmake_vars_file) +include("${cmake_vars_file}") + +# Clang always uses /Z7; Patching /Zi /Fd out of openssl requires more work. +set(OPENSSL_BUILD_MAKES_PDBS ON) +if (VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES "Clang" OR VCPKG_LIBRARY_LINKAGE STREQUAL "static") + set(OPENSSL_BUILD_MAKES_PDBS OFF) +endif() + +cmake_path(NATIVE_PATH NASM NORMALIZE as) +cmake_path(NATIVE_PATH VCPKG_DETECTED_CMAKE_C_COMPILER NORMALIZE cc) +cmake_path(NATIVE_PATH VCPKG_DETECTED_CMAKE_AR NORMALIZE ar) +cmake_path(NATIVE_PATH VCPKG_DETECTED_CMAKE_LINKER NORMALIZE ld) + +vcpkg_build_nmake( + SOURCE_PATH "${SOURCE_PATH}" + PREFER_JOM + CL_LANGUAGE NONE + PRERUN_SHELL_RELEASE "${PERL}" Configure + ${CONFIGURE_OPTIONS} + ${OPENSSL_ARCH} + "--prefix=${install_dir_native}" + "--openssldir=${install_dir_native}" + "AS=${as}" + "CC=${cc}" + "CFLAGS=${VCPKG_COMBINED_C_FLAGS_RELEASE}" + "AR=${ar}" + "ARFLAGS=${VCPKG_COMBINED_STATIC_LINKER_FLAGS_RELEASE}" + "LD=${ld}" + "LDFLAGS=${VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE}" + PRERUN_SHELL_DEBUG "${PERL}" Configure + ${CONFIGURE_OPTIONS} + debug-${OPENSSL_ARCH} + "--prefix=${install_dir_native}\\debug" + "--openssldir=${install_dir_native}\\debug" + "AS=${as}" + "CC=${cc}" + "CFLAGS=${VCPKG_COMBINED_C_FLAGS_DEBUG}" + "AR=${ar}" + "ARFLAGS=${VCPKG_COMBINED_STATIC_LINKER_FLAGS_DEBUG}" + "LD=${ld}" + "LDFLAGS=${VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG}" + PROJECT_NAME "makefile" + TARGET install_dev install_modules + LOGFILE_ROOT install + OPTIONS + "INSTALL_PDBS=${OPENSSL_BUILD_MAKES_PDBS}" # install-pdbs.patch + OPTIONS_RELEASE + install_runtime install_ssldirs # extra targets +) + +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}") +file(RENAME "${CURRENT_PACKAGES_DIR}/openssl.cnf" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/openssl.cnf") +if(NOT VCPKG_TARGET_IS_UWP) + foreach(script IN ITEMS "bin/c_rehash.pl" "misc/CA.pl" "misc/tsget.pl") + file(COPY "${CURRENT_PACKAGES_DIR}/${script}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}") + file(REMOVE "${CURRENT_PACKAGES_DIR}/${script}" "${CURRENT_PACKAGES_DIR}/debug/${script}") + endforeach() + vcpkg_copy_tools(TOOL_NAMES openssl AUTO_CLEAN) +endif() + +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/certs" + "${CURRENT_PACKAGES_DIR}/misc" + "${CURRENT_PACKAGES_DIR}/private" + "${CURRENT_PACKAGES_DIR}/lib/engines-3" + "${CURRENT_PACKAGES_DIR}/debug/certs" + "${CURRENT_PACKAGES_DIR}/debug/misc" + "${CURRENT_PACKAGES_DIR}/debug/lib/engines-3" + "${CURRENT_PACKAGES_DIR}/debug/private" + "${CURRENT_PACKAGES_DIR}/debug/include" +) +file(REMOVE + "${CURRENT_PACKAGES_DIR}/ct_log_list.cnf" + "${CURRENT_PACKAGES_DIR}/ct_log_list.cnf.dist" + "${CURRENT_PACKAGES_DIR}/openssl.cnf.dist" + "${CURRENT_PACKAGES_DIR}/debug/ct_log_list.cnf" + "${CURRENT_PACKAGES_DIR}/debug/ct_log_list.cnf.dist" + "${CURRENT_PACKAGES_DIR}/debug/openssl.cnf" + "${CURRENT_PACKAGES_DIR}/debug/openssl.cnf.dist" +) + +file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/s2n/fix-cmake-target-path.patch b/ports/s2n/fix-cmake-target-path.patch new file mode 100644 index 00000000000..f83ac21e62b --- /dev/null +++ b/ports/s2n/fix-cmake-target-path.patch @@ -0,0 +1,28 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 132f414..c7cfb5f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -503,7 +503,7 @@ else() + endif() + + install(EXPORT "${PROJECT_NAME}-targets" +- DESTINATION "${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/cmake/${TARGET_DIR}" ++ DESTINATION "${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/cmake/" + NAMESPACE AWS:: + COMPONENT Development) + +diff --git a/cmake/s2n-config.cmake b/cmake/s2n-config.cmake +index 09d1c3a..4e76ed6 100644 +--- a/cmake/s2n-config.cmake ++++ b/cmake/s2n-config.cmake +@@ -8,9 +8,5 @@ endif() + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules") + find_dependency(LibCrypto) + +-if (BUILD_SHARED_LIBS) +- include(${CMAKE_CURRENT_LIST_DIR}/shared/@PROJECT_NAME@-targets.cmake) +-else() +- include(${CMAKE_CURRENT_LIST_DIR}/static/@PROJECT_NAME@-targets.cmake) +-endif() ++include(${CMAKE_CURRENT_LIST_DIR}/@CMAKE_PROJECT_NAME@-targets.cmake) + diff --git a/ports/s2n/portfile.cmake b/ports/s2n/portfile.cmake new file mode 100644 index 00000000000..4ad9e76ced9 --- /dev/null +++ b/ports/s2n/portfile.cmake @@ -0,0 +1,48 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO aws/s2n-tls + REF 36c3dc72ab1359cf721294e1258dfdc2962f3ffc # v1.3.5 + SHA512 2c9eed12e90e5fc987758635fec4a7418c20d25c724cfa391090b06bfcc4eb5925b4011d51a99e7c7ab80f535684ee3934ba4734b7966edd323bf88bc5953d7c + PATCHES + fix-cmake-target-path.patch + use-openssl-crypto.patch + remove-trycompile.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + tests BUILD_TESTING +) + +set(EXTRA_ARGS) +if(VCPKG_TARGET_ARCHITECTURE STREQUAL "wasm32") + set(EXTRA_ARGS "-DS2N_NO_PQ=TRUE") +endif() + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${EXTRA_ARGS} + ${FEATURE_OPTIONS} + -DUNSAFE_TREAT_WARNINGS_AS_ERRORS=OFF +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() +vcpkg_cmake_config_fixup(CONFIG_PATH lib/s2n/cmake) + +if(BUILD_TESTING) + message(STATUS Testing) + vcpkg_cmake_build(TARGET test LOGFILE_BASE test) +endif() + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/lib/s2n" + "${CURRENT_PACKAGES_DIR}/debug/share" + "${CURRENT_PACKAGES_DIR}/lib/s2n" + "${CURRENT_PACKAGES_DIR}/share/s2n/modules" +) + +# Handle copyright +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/s2n/remove-trycompile.patch b/ports/s2n/remove-trycompile.patch new file mode 100644 index 00000000000..bf5582e3939 --- /dev/null +++ b/ports/s2n/remove-trycompile.patch @@ -0,0 +1,36 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt (revision 86c857094a2d94fafce15a3d32abb4052e664c5c) ++++ b/CMakeLists.txt (date 1643340236796) +@@ -409,32 +409,6 @@ + endif() + endif() + +-# Determine if EVP_md5_sha1 is available in libcrypto +-try_compile( +- LIBCRYPTO_SUPPORTS_EVP_MD5_SHA1_HASH +- ${CMAKE_BINARY_DIR} +- SOURCES "${CMAKE_CURRENT_LIST_DIR}/tests/features/evp_md5_sha1.c" +- LINK_LIBRARIES crypto ${OS_LIBS} +- CMAKE_FLAGS +- "-DINCLUDE_DIRECTORIES=$" +-) +-if (LIBCRYPTO_SUPPORTS_EVP_MD5_SHA1_HASH) +- target_compile_options(${PROJECT_NAME} PUBLIC -DS2N_LIBCRYPTO_SUPPORTS_EVP_MD5_SHA1_HASH) +-endif() +- +-# Determine if EVP_MD_CTX_set_pkey_ctx is available in libcrypto +-try_compile( +- LIBCRYPTO_SUPPORTS_EVP_MD_CTX_SET_PKEY_CTX +- ${CMAKE_BINARY_DIR} +- SOURCES "${CMAKE_CURRENT_LIST_DIR}/tests/features/evp_md_ctx_set_pkey_ctx.c" +- LINK_LIBRARIES crypto ${OS_LIBS} +- CMAKE_FLAGS +- "-DINCLUDE_DIRECTORIES=$" +-) +-if (LIBCRYPTO_SUPPORTS_EVP_MD_CTX_SET_PKEY_CTX) +- target_compile_options(${PROJECT_NAME} PUBLIC -DS2N_LIBCRYPTO_SUPPORTS_EVP_MD_CTX_SET_PKEY_CTX) +-endif() +- + if (S2N_INTERN_LIBCRYPTO) + if (NOT LibCrypto_STATIC_LIBRARY) + message(FATAL_ERROR "libcrypto interning requires a static build of libcrypto.a to be available") diff --git a/ports/s2n/use-openssl-crypto.patch b/ports/s2n/use-openssl-crypto.patch new file mode 100644 index 00000000000..75c6885bc09 --- /dev/null +++ b/ports/s2n/use-openssl-crypto.patch @@ -0,0 +1,70 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index edbf248..2992a05 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -400,7 +400,7 @@ endif() + set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) + + if (SEARCH_LIBCRYPTO) +- find_package(LibCrypto REQUIRED) ++ find_package(OpenSSL COMPONENTS Crypto REQUIRED) + else() + if (TARGET crypto) + message(STATUS "S2N found target: crypto") +@@ -465,7 +465,7 @@ if (S2N_INTERN_LIBCRYPTO) + ) + endif() + else() +- target_link_libraries(${PROJECT_NAME} PUBLIC crypto) ++ target_link_libraries(${PROJECT_NAME} PUBLIC OpenSSL::Crypto) + endif() + + target_link_libraries(${PROJECT_NAME} PUBLIC ${OS_LIBS} m) +@@ -473,7 +473,7 @@ target_link_libraries(${PROJECT_NAME} PUBLIC ${OS_LIBS} m) + target_include_directories(${PROJECT_NAME} PUBLIC $) + target_include_directories(${PROJECT_NAME} PUBLIC $ $) + +-target_include_directories(${PROJECT_NAME} PRIVATE $) ++target_include_directories(${PROJECT_NAME} PRIVATE $) + + if (BUILD_TESTING) + enable_testing() +@@ -485,7 +485,7 @@ if (BUILD_TESTING) + target_include_directories(testss2n PUBLIC tests) + target_compile_options(testss2n PRIVATE -std=gnu99) + target_link_libraries(testss2n PUBLIC ${PROJECT_NAME}) +- target_include_directories(testss2n PUBLIC $) ++ target_include_directories(testss2n PUBLIC $) + + if (S2N_INTERN_LIBCRYPTO) + # if libcrypto was interned, rewrite libcrypto symbols so use of internal functions will link correctly +@@ -536,13 +536,13 @@ if (BUILD_TESTING) + + add_executable(s2nc "bin/s2nc.c" "bin/echo.c" "bin/https.c" "bin/common.c") + target_link_libraries(s2nc ${PROJECT_NAME}) +- target_include_directories(s2nc PRIVATE $) ++ target_include_directories(s2nc PRIVATE $) + target_include_directories(s2nc PRIVATE api) + target_compile_options(s2nc PRIVATE -std=gnu99 -D_POSIX_C_SOURCE=200112L) + + add_executable(s2nd "bin/s2nd.c" "bin/echo.c" "bin/https.c" "bin/common.c") + target_link_libraries(s2nd ${PROJECT_NAME}) +- target_include_directories(s2nd PRIVATE $) ++ target_include_directories(s2nd PRIVATE $) + target_include_directories(s2nd PRIVATE api) + target_compile_options(s2nd PRIVATE -std=gnu99 -D_POSIX_C_SOURCE=200112L) + +diff --git a/cmake/s2n-config.cmake b/cmake/s2n-config.cmake +index 4e76ed6..f714df0 100644 +--- a/cmake/s2n-config.cmake ++++ b/cmake/s2n-config.cmake +@@ -5,8 +5,7 @@ if (NOT MSVC) + find_package(Threads REQUIRED) + endif() + +-list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules") +-find_dependency(LibCrypto) ++find_dependency(OpenSSL COMPONENTS Crypto) + + include(${CMAKE_CURRENT_LIST_DIR}/@CMAKE_PROJECT_NAME@-targets.cmake) + diff --git a/ports/s2n/vcpkg.json b/ports/s2n/vcpkg.json new file mode 100644 index 00000000000..82642042941 --- /dev/null +++ b/ports/s2n/vcpkg.json @@ -0,0 +1,23 @@ +{ + "name": "s2n", + "version": "1.3.5", + "description": "C99 implementation of the TLS/SSL protocols.", + "homepage": "https://github.com/aws/s2n-tls", + "supports": "!uwp & !windows", + "dependencies": [ + "openssl", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "tests": { + "description": "Build and run the tests" + } + } +} diff --git a/ports/spdlog/fmt-header.patch b/ports/spdlog/fmt-header.patch new file mode 100644 index 00000000000..670d5a2f03e --- /dev/null +++ b/ports/spdlog/fmt-header.patch @@ -0,0 +1,13 @@ +diff --git a/bench/bench.cpp b/bench/bench.cpp +index 8a46837a6..ae47f047c 100644 +--- a/bench/bench.cpp ++++ b/bench/bench.cpp +@@ -15,7 +15,7 @@ + #if defined(SPDLOG_USE_STD_FORMAT) + # include + #elif defined(SPDLOG_FMT_EXTERNAL) +-# include ++# include + #else + # include "spdlog/fmt/bundled/format.h" + #endif diff --git a/ports/spdlog/portfile.cmake b/ports/spdlog/portfile.cmake new file mode 100644 index 00000000000..8d5cd5952d5 --- /dev/null +++ b/ports/spdlog/portfile.cmake @@ -0,0 +1,71 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO gabime/spdlog + REF v1.11.0 + SHA512 210f3135c7af3ec774ef9a5c77254ce172a44e2fa720bf590e1c9214782bf5c8140ff683403a85b585868bc308286fbdeb1c988e4ed1eb3c75975254ffe75412 + HEAD_REF v1.x + PATCHES + fmt-header.patch # https://github.com/gabime/spdlog/pull/2545 +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + benchmark SPDLOG_BUILD_BENCH + wchar SPDLOG_WCHAR_SUPPORT +) + +# SPDLOG_WCHAR_FILENAMES can only be configured in triplet file since it is an alternative (not additive) +if(NOT DEFINED SPDLOG_WCHAR_FILENAMES) + set(SPDLOG_WCHAR_FILENAMES OFF) +endif() +if(NOT VCPKG_TARGET_IS_WINDOWS) + if("wchar" IN_LIST FEATURES) + message(WARNING "Feature 'wchar' is only supported for Windows and has no effect on other platforms.") + elseif(SPDLOG_WCHAR_FILENAMES) + message(FATAL_ERROR "Build option 'SPDLOG_WCHAR_FILENAMES' is for Windows.") + endif() +endif() + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SPDLOG_BUILD_SHARED) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} + -DSPDLOG_FMT_EXTERNAL=ON + -DSPDLOG_INSTALL=ON + -DSPDLOG_BUILD_SHARED=${SPDLOG_BUILD_SHARED} + -DSPDLOG_WCHAR_FILENAMES=${SPDLOG_WCHAR_FILENAMES} + -DSPDLOG_BUILD_EXAMPLE=OFF +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/spdlog) +vcpkg_fixup_pkgconfig() +vcpkg_copy_pdbs() + +# use vcpkg-provided fmt library (see also option SPDLOG_FMT_EXTERNAL above) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/spdlog/fmt/bundled") + +# add support for integration other than cmake +vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/spdlog/tweakme.h + "// #define SPDLOG_FMT_EXTERNAL" + "#ifndef SPDLOG_FMT_EXTERNAL\n#define SPDLOG_FMT_EXTERNAL\n#endif" +) +if(SPDLOG_WCHAR_SUPPORT AND VCPKG_TARGET_IS_WINDOWS) + vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/spdlog/tweakme.h + "// #define SPDLOG_WCHAR_TO_UTF8_SUPPORT" + "#ifndef SPDLOG_WCHAR_TO_UTF8_SUPPORT\n#define SPDLOG_WCHAR_TO_UTF8_SUPPORT\n#endif" + ) +endif() +if(SPDLOG_WCHAR_FILENAMES) + vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/spdlog/tweakme.h + "// #define SPDLOG_WCHAR_FILENAMES" + "#ifndef SPDLOG_WCHAR_FILENAMES\n#define SPDLOG_WCHAR_FILENAMES\n#endif" + ) +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share") + +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/spdlog/vcpkg.json b/ports/spdlog/vcpkg.json new file mode 100644 index 00000000000..a88014f9ad0 --- /dev/null +++ b/ports/spdlog/vcpkg.json @@ -0,0 +1,30 @@ +{ + "name": "spdlog", + "version-semver": "1.11.0", + "description": "Very fast, header only, C++ logging library", + "homepage": "https://github.com/gabime/spdlog", + "license": "MIT", + "dependencies": [ + "fmt", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "benchmark": { + "description": "Use google benchmark", + "dependencies": [ + "benchmark" + ] + }, + "wchar": { + "description": "Build with wchar_t (Windows only)", + "supports": "windows" + } + } +} diff --git a/ports/vcpkg-cmake-config/copyright b/ports/vcpkg-cmake-config/copyright new file mode 100644 index 00000000000..2e4eac8264f --- /dev/null +++ b/ports/vcpkg-cmake-config/copyright @@ -0,0 +1,23 @@ +Copyright (c) Microsoft Corporation + +All rights reserved. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/ports/vcpkg-cmake-config/portfile.cmake b/ports/vcpkg-cmake-config/portfile.cmake new file mode 100644 index 00000000000..fc3dbafd518 --- /dev/null +++ b/ports/vcpkg-cmake-config/portfile.cmake @@ -0,0 +1,12 @@ +if(NOT TARGET_TRIPLET STREQUAL _HOST_TRIPLET) + # make FATAL_ERROR in CI when issue #16773 fixed + message(WARNING "vcpkg-cmake-config is a host-only port; please mark it as a host port in your dependencies.") +endif() + +file(INSTALL + "${CMAKE_CURRENT_LIST_DIR}/vcpkg_cmake_config_fixup.cmake" + "${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake" + "${CMAKE_CURRENT_LIST_DIR}/copyright" + DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") + +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/ports/vcpkg-cmake-config/vcpkg-port-config.cmake b/ports/vcpkg-cmake-config/vcpkg-port-config.cmake new file mode 100644 index 00000000000..980d411315c --- /dev/null +++ b/ports/vcpkg-cmake-config/vcpkg-port-config.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/vcpkg_cmake_config_fixup.cmake") diff --git a/ports/vcpkg-cmake-config/vcpkg.json b/ports/vcpkg-cmake-config/vcpkg.json new file mode 100644 index 00000000000..db965341a7e --- /dev/null +++ b/ports/vcpkg-cmake-config/vcpkg.json @@ -0,0 +1,7 @@ +{ + "name": "vcpkg-cmake-config", + "version-date": "2022-02-06", + "port-version": 1, + "documentation": "https://vcpkg.io/en/docs/README.html", + "license": "MIT" +} diff --git a/ports/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake b/ports/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake new file mode 100644 index 00000000000..368e5809ac2 --- /dev/null +++ b/ports/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake @@ -0,0 +1,258 @@ +include_guard(GLOBAL) + +function(vcpkg_cmake_config_fixup) + cmake_parse_arguments(PARSE_ARGV 0 "arg" "DO_NOT_DELETE_PARENT_CONFIG_PATH;NO_PREFIX_CORRECTION" "PACKAGE_NAME;CONFIG_PATH;TOOLS_PATH" "") + + if(DEFINED arg_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "vcpkg_cmake_config_fixup was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}") + endif() + if(NOT arg_PACKAGE_NAME) + set(arg_PACKAGE_NAME "${PORT}") + endif() + if(NOT arg_CONFIG_PATH) + set(arg_CONFIG_PATH "share/${arg_PACKAGE_NAME}") + endif() + if(NOT arg_TOOLS_PATH) + set(arg_TOOLS_PATH "tools/${PORT}") + endif() + set(target_path "share/${arg_PACKAGE_NAME}") + + string(REPLACE "." "\\." EXECUTABLE_SUFFIX "${VCPKG_TARGET_EXECUTABLE_SUFFIX}") + + set(debug_share "${CURRENT_PACKAGES_DIR}/debug/${target_path}") + set(release_share "${CURRENT_PACKAGES_DIR}/${target_path}") + + if(NOT arg_CONFIG_PATH STREQUAL "share/${arg_PACKAGE_NAME}") + if(arg_CONFIG_PATH STREQUAL "share") + set(arg_CONFIG_PATH z_vcpkg_share) + file(RENAME "${CURRENT_PACKAGES_DIR}/debug/share" "${CURRENT_PACKAGES_DIR}/debug/${arg_CONFIG_PATH}") + file(RENAME "${CURRENT_PACKAGES_DIR}/share" "${CURRENT_PACKAGES_DIR}/${arg_CONFIG_PATH}") + endif() + + set(debug_config "${CURRENT_PACKAGES_DIR}/debug/${arg_CONFIG_PATH}") + set(release_config "${CURRENT_PACKAGES_DIR}/${arg_CONFIG_PATH}") + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + if(NOT EXISTS "${debug_config}") + message(FATAL_ERROR "'${debug_config}' does not exist.") + endif() + + # This roundabout handling enables CONFIG_PATH = share + file(MAKE_DIRECTORY "${debug_share}") + file(GLOB files "${debug_config}/*") + file(COPY ${files} DESTINATION "${debug_share}") + file(REMOVE_RECURSE "${debug_config}") + endif() + + file(GLOB files "${release_config}/*") + file(COPY ${files} DESTINATION "${release_share}") + file(REMOVE_RECURSE "${release_config}") + + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + get_filename_component(debug_config_dir_name "${debug_config}" NAME) + string(TOLOWER "${debug_config_dir_name}" debug_config_dir_name) + if(debug_config_dir_name STREQUAL "cmake" AND NOT arg_DO_NOT_DELETE_PARENT_CONFIG_PATH) + file(REMOVE_RECURSE "${debug_config}") + else() + get_filename_component(debug_config_parent_dir "${debug_config}" DIRECTORY) + get_filename_component(debug_config_dir_name "${debug_config_parent_dir}" NAME) + string(TOLOWER "${debug_config_dir_name}" debug_config_dir_name) + if(debug_config_dir_name STREQUAL "cmake" AND NOT arg_DO_NOT_DELETE_PARENT_CONFIG_PATH) + file(REMOVE_RECURSE "${debug_config_parent_dir}") + endif() + endif() + endif() + + get_filename_component(release_config_dir_name "${release_config}" NAME) + string(TOLOWER "${release_config_dir_name}" release_config_dir_name) + if(release_config_dir_name STREQUAL "cmake" AND NOT arg_DO_NOT_DELETE_PARENT_CONFIG_PATH) + file(REMOVE_RECURSE "${release_config}") + else() + get_filename_component(release_config_parent_dir "${release_config}" DIRECTORY) + get_filename_component(release_config_dir_name "${release_config_parent_dir}" NAME) + string(TOLOWER "${release_config_dir_name}" release_config_dir_name) + if(release_config_dir_name STREQUAL "cmake" AND NOT arg_DO_NOT_DELETE_PARENT_CONFIG_PATH) + file(REMOVE_RECURSE "${release_config_parent_dir}") + endif() + endif() + endif() + + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + if(NOT EXISTS "${debug_share}") + message(FATAL_ERROR "'${debug_share}' does not exist.") + endif() + endif() + + file(GLOB_RECURSE release_targets + "${release_share}/*-release.cmake" + ) + foreach(release_target IN LISTS release_targets) + file(READ "${release_target}" contents) + string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${_IMPORT_PREFIX}" contents "${contents}") + string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \"]+${EXECUTABLE_SUFFIX})" "\${_IMPORT_PREFIX}/${arg_TOOLS_PATH}/\\1" contents "${contents}") + file(WRITE "${release_target}" "${contents}") + endforeach() + + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(GLOB_RECURSE debug_targets + "${debug_share}/*-debug.cmake" + ) + foreach(debug_target IN LISTS debug_targets) + file(RELATIVE_PATH debug_target_rel "${debug_share}" "${debug_target}") + + file(READ "${debug_target}" contents) + string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${_IMPORT_PREFIX}" contents "${contents}") + string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \";]+${EXECUTABLE_SUFFIX})" "\${_IMPORT_PREFIX}/${arg_TOOLS_PATH}/\\1" contents "${contents}") + string(REPLACE "\${_IMPORT_PREFIX}/lib" "\${_IMPORT_PREFIX}/debug/lib" contents "${contents}") + string(REPLACE "\${_IMPORT_PREFIX}/bin" "\${_IMPORT_PREFIX}/debug/bin" contents "${contents}") + file(WRITE "${release_share}/${debug_target_rel}" "${contents}") + + file(REMOVE "${debug_target}") + endforeach() + endif() + + #Fix ${_IMPORT_PREFIX} and absolute paths in cmake generated targets and configs; + #Since those can be renamed we have to check in every *.cmake, but only once. + file(GLOB_RECURSE main_cmakes "${release_share}/*.cmake") + if(NOT DEFINED Z_VCPKG_CMAKE_CONFIG_ALREADY_FIXED_UP) + vcpkg_list(SET Z_VCPKG_CMAKE_CONFIG_ALREADY_FIXED_UP) + endif() + foreach(already_fixed_up IN LISTS Z_VCPKG_CMAKE_CONFIG_ALREADY_FIXED_UP) + vcpkg_list(REMOVE_ITEM main_cmakes "${already_fixed_up}") + endforeach() + vcpkg_list(APPEND Z_VCPKG_CMAKE_CONFIG_ALREADY_FIXED_UP ${main_cmakes}) + set(Z_VCPKG_CMAKE_CONFIG_ALREADY_FIXED_UP "${Z_VCPKG_CMAKE_CONFIG_ALREADY_FIXED_UP}" CACHE INTERNAL "") + + foreach(main_cmake IN LISTS main_cmakes) + file(READ "${main_cmake}" contents) + # Note: I think the following comment is no longer true, since we now require the path to be `share/blah` + # however, I don't know it for sure. + # - nimazzuc + + #This correction is not correct for all cases. To make it correct for all cases it needs to consider + #original folder deepness to CURRENT_PACKAGES_DIR in comparison to the moved to folder deepness which + #is always at least (>=) 2, e.g. share/${PORT}. Currently the code assumes it is always 2 although + #this requirement is only true for the *Config.cmake. The targets are not required to be in the same + #folder as the *Config.cmake! + if(NOT arg_NO_PREFIX_CORRECTION) + string(REGEX REPLACE +[[get_filename_component\(_IMPORT_PREFIX "\${CMAKE_CURRENT_LIST_FILE}" PATH\)( +get_filename_component\(_IMPORT_PREFIX "\${_IMPORT_PREFIX}" PATH\))*]] +[[get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)]] + contents "${contents}") # see #1044 for details why this replacement is necessary. See #4782 why it must be a regex. + string(REGEX REPLACE +[[get_filename_component\(PACKAGE_PREFIX_DIR "\${CMAKE_CURRENT_LIST_DIR}/\.\./(\.\./)*" ABSOLUTE\)]] +[[get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../" ABSOLUTE)]] + contents "${contents}") + string(REGEX REPLACE +[[get_filename_component\(PACKAGE_PREFIX_DIR "\${CMAKE_CURRENT_LIST_DIR}/\.\.((\\|/)\.\.)*" ABSOLUTE\)]] +[[get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../" ABSOLUTE)]] + contents "${contents}") # This is a meson-related workaround, see https://github.com/mesonbuild/meson/issues/6955 + endif() + + # Merge release and debug configurations of target property INTERFACE_LINK_LIBRARIES. + string(REPLACE "${release_share}/" "${debug_share}/" debug_cmake "${main_cmake}") + if(DEFINED VCPKG_BUILD_TYPE) + # Skip. Warning: A release-only port in a dual-config installation + # may pull release dependencies into the debug configuration. + elseif(NOT contents MATCHES "INTERFACE_LINK_LIBRARIES") + # Skip. No relevant properties. + elseif(NOT contents MATCHES "# Generated CMake target import file\\.") + # Skip. No safe assumptions about a matching debug import file. + elseif(NOT EXISTS "${debug_cmake}") + message(SEND_ERROR "Did not find a debug import file matching '${main_cmake}'") + else() + file(READ "${debug_cmake}" debug_contents) + while(contents MATCHES "set_target_properties\\(([^ \$]*) PROPERTIES[^)]*\\)") + set(matched_command "${CMAKE_MATCH_0}") + string(REPLACE "+" "\\+" target "${CMAKE_MATCH_1}") + if(NOT debug_contents MATCHES "set_target_properties\\(${target} PROPERTIES[^)]*\\)") + message(SEND_ERROR "Did not find a debug configuration for target '${target}'.") + endif() + set(debug_command "${CMAKE_MATCH_0}") + string(REGEX MATCH " INTERFACE_LINK_LIBRARIES \"([^\"]*)\"" release_line "${matched_command}") + set(release_libs "${CMAKE_MATCH_1}") + string(REGEX MATCH " INTERFACE_LINK_LIBRARIES \"([^\"]*)\"" debug_line "${debug_command}") + set(debug_libs "${CMAKE_MATCH_1}") + z_vcpkg_cmake_config_fixup_merge(merged_libs release_libs debug_libs) + string(REPLACE "${release_line}" " INTERFACE_LINK_LIBRARIES \"${merged_libs}\"" updated_command "${matched_command}") + string(REPLACE "set_target_properties" "set_target_properties::done" updated_command "${updated_command}") # Prevend 2nd match + string(REPLACE "${matched_command}" "${updated_command}" contents "${contents}") + endwhile() + string(REPLACE "set_target_properties::done" "set_target_properties" contents "${contents}") # Restore original command + endif() + + #Fix absolute paths to installed dir with ones relative to ${CMAKE_CURRENT_LIST_DIR} + #This happens if vcpkg built libraries are directly linked to a target instead of using + #an imported target. + string(REPLACE "${CURRENT_INSTALLED_DIR}" [[${VCPKG_IMPORT_PREFIX}]] contents "${contents}") + file(TO_CMAKE_PATH "${CURRENT_PACKAGES_DIR}" cmake_current_packages_dir) + string(REPLACE "${cmake_current_packages_dir}" [[${VCPKG_IMPORT_PREFIX}]] contents "${contents}") + # If ${VCPKG_IMPORT_PREFIX} was actually used, inject a definition of it: + string(FIND "${contents}" [[${VCPKG_IMPORT_PREFIX}]] index) + if (NOT index STREQUAL "-1") + get_filename_component(main_cmake_dir "${main_cmake}" DIRECTORY) + # Calculate relative to be a sequence of "../" + file(RELATIVE_PATH relative "${main_cmake_dir}" "${cmake_current_packages_dir}") + string(PREPEND contents "get_filename_component(VCPKG_IMPORT_PREFIX \"\${CMAKE_CURRENT_LIST_DIR}\/${relative}\" ABSOLUTE)\n") + endif() + + file(WRITE "${main_cmake}" "${contents}") + endforeach() + + file(GLOB_RECURSE unused_files + "${debug_share}/*[Tt]argets.cmake" + "${debug_share}/*[Cc]onfig.cmake" + "${debug_share}/*[Cc]onfigVersion.cmake" + "${debug_share}/*[Cc]onfig-version.cmake" + ) + foreach(unused_file IN LISTS unused_files) + file(REMOVE "${unused_file}") + endforeach() + + # Remove /debug// if it's empty. + file(GLOB_RECURSE remaining_files "${debug_share}/*") + if(remaining_files STREQUAL "") + file(REMOVE_RECURSE "${debug_share}") + endif() + + # Remove /debug/share/ if it's empty. + file(GLOB_RECURSE remaining_files "${CURRENT_PACKAGES_DIR}/debug/share/*") + if(remaining_files STREQUAL "") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + endif() +endfunction() + +# Merges link interface library lists for release and debug +# into a single expression which use generator expression as necessary. +function(z_vcpkg_cmake_config_fixup_merge out_var release_var debug_var) + set(release_libs "VCPKG;${${release_var}}") + string(REGEX REPLACE ";optimized;([^;]*)" ";\\1" release_libs "${release_libs}") + string(REGEX REPLACE ";debug;([^;]*)" ";" release_libs "${release_libs}") + list(REMOVE_AT release_libs 0) + list(FILTER release_libs EXCLUDE REGEX [[^\\[$]<\\[$]:]]) + list(TRANSFORM release_libs REPLACE [[^\\[$]<\\[$]>:(.*)>$]] "\\1") + + set(debug_libs "VCPKG;${${debug_var}}") + string(REGEX REPLACE ";optimized;([^;]*)" ";" debug_libs "${debug_libs}") + string(REGEX REPLACE ";debug;([^;]*)" ";\\1" debug_libs "${debug_libs}") + list(REMOVE_AT debug_libs 0) + list(FILTER debug_libs EXCLUDE REGEX [[^\\[$]<\\[$]>:]]) + list(TRANSFORM debug_libs REPLACE [[^\\[$]<\\[$]:(.*)>$]] "\\1") + + set(merged_libs "") + foreach(release_lib debug_lib IN ZIP_LISTS release_libs debug_libs) + if(release_lib STREQUAL debug_lib) + list(APPEND merged_libs "${release_lib}") + else() + if(release_lib) + list(APPEND merged_libs "\\\$<\\\$>:${release_lib}>") + endif() + if(debug_lib) + list(APPEND merged_libs "\\\$<\\\$:${debug_lib}>") + endif() + endif() + endforeach() + set("${out_var}" "${merged_libs}" PARENT_SCOPE) +endfunction() diff --git a/ports/vcpkg-cmake/portfile.cmake b/ports/vcpkg-cmake/portfile.cmake new file mode 100644 index 00000000000..0b7dd502017 --- /dev/null +++ b/ports/vcpkg-cmake/portfile.cmake @@ -0,0 +1,14 @@ +if(VCPKG_CROSSCOMPILING) + # make FATAL_ERROR in CI when issue #16773 fixed + message(WARNING "vcpkg-cmake is a host-only port; please mark it as a host port in your dependencies.") +endif() + +file(INSTALL + "${CMAKE_CURRENT_LIST_DIR}/vcpkg_cmake_configure.cmake" + "${CMAKE_CURRENT_LIST_DIR}/vcpkg_cmake_build.cmake" + "${CMAKE_CURRENT_LIST_DIR}/vcpkg_cmake_install.cmake" + "${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake" + DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") + +file(INSTALL "${VCPKG_ROOT_DIR}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) +set(VCPKG_POLICY_CMAKE_HELPER_PORT enabled) diff --git a/ports/vcpkg-cmake/vcpkg-port-config.cmake b/ports/vcpkg-cmake/vcpkg-port-config.cmake new file mode 100644 index 00000000000..f2a973d4ebc --- /dev/null +++ b/ports/vcpkg-cmake/vcpkg-port-config.cmake @@ -0,0 +1,3 @@ +include("${CMAKE_CURRENT_LIST_DIR}/vcpkg_cmake_configure.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/vcpkg_cmake_build.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/vcpkg_cmake_install.cmake") diff --git a/ports/vcpkg-cmake/vcpkg.json b/ports/vcpkg-cmake/vcpkg.json new file mode 100644 index 00000000000..94363823474 --- /dev/null +++ b/ports/vcpkg-cmake/vcpkg.json @@ -0,0 +1,6 @@ +{ + "name": "vcpkg-cmake", + "version-date": "2022-10-30", + "documentation": "https://vcpkg.io/en/docs/maintainers/ports/vcpkg-cmake.html", + "license": "MIT" +} diff --git a/ports/vcpkg-cmake/vcpkg_cmake_build.cmake b/ports/vcpkg-cmake/vcpkg_cmake_build.cmake new file mode 100644 index 00000000000..47933b3fe9f --- /dev/null +++ b/ports/vcpkg-cmake/vcpkg_cmake_build.cmake @@ -0,0 +1,91 @@ +include_guard(GLOBAL) + +function(vcpkg_cmake_build) + cmake_parse_arguments(PARSE_ARGV 0 "arg" "DISABLE_PARALLEL;ADD_BIN_TO_PATH" "TARGET;LOGFILE_BASE" "") + + if(DEFINED arg_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "vcpkg_cmake_build was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}") + endif() + if(NOT DEFINED arg_LOGFILE_BASE) + set(arg_LOGFILE_BASE "build") + endif() + vcpkg_list(SET build_param) + vcpkg_list(SET parallel_param) + vcpkg_list(SET no_parallel_param) + + if("${Z_VCPKG_CMAKE_GENERATOR}" STREQUAL "Ninja") + vcpkg_list(SET build_param "-v") # verbose output + vcpkg_list(SET parallel_param "-j${VCPKG_CONCURRENCY}") + vcpkg_list(SET no_parallel_param "-j1") + elseif("${Z_VCPKG_CMAKE_GENERATOR}" MATCHES "^Visual Studio") + vcpkg_list(SET build_param + "/p:VCPkgLocalAppDataDisabled=true" + "/p:UseIntelMKL=No" + ) + vcpkg_list(SET parallel_param "/m") + elseif("${Z_VCPKG_CMAKE_GENERATOR}" STREQUAL "NMake Makefiles") + # No options are currently added for nmake builds + elseif(Z_VCPKG_CMAKE_GENERATOR STREQUAL "Unix Makefiles") + vcpkg_list(SET build_param "VERBOSE=1") + vcpkg_list(SET parallel_param "-j${VCPKG_CONCURRENCY}") + vcpkg_list(SET no_parallel_param "") + elseif(Z_VCPKG_CMAKE_GENERATOR STREQUAL "Xcode") + vcpkg_list(SET parallel_param -jobs "${VCPKG_CONCURRENCY}") + vcpkg_list(SET no_parallel_param -jobs 1) + else() + message(WARNING "Unrecognized GENERATOR setting from vcpkg_cmake_configure().") + endif() + + vcpkg_list(SET target_param) + if(arg_TARGET) + vcpkg_list(SET target_param "--target" "${arg_TARGET}") + endif() + + foreach(build_type IN ITEMS debug release) + if(NOT DEFINED VCPKG_BUILD_TYPE OR "${VCPKG_BUILD_TYPE}" STREQUAL "${build_type}") + if("${build_type}" STREQUAL "debug") + set(short_build_type "dbg") + set(config "Debug") + else() + set(short_build_type "rel") + set(config "Release") + endif() + + message(STATUS "Building ${TARGET_TRIPLET}-${short_build_type}") + + if(arg_ADD_BIN_TO_PATH) + vcpkg_backup_env_variables(VARS PATH) + if("${build_type}" STREQUAL "debug") + vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/debug/bin") + else() + vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/bin") + endif() + endif() + + if(arg_DISABLE_PARALLEL) + vcpkg_execute_build_process( + COMMAND + "${CMAKE_COMMAND}" --build . --config "${config}" ${target_param} + -- ${build_param} ${no_parallel_param} + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${short_build_type}" + LOGNAME "${arg_LOGFILE_BASE}-${TARGET_TRIPLET}-${short_build_type}" + ) + else() + vcpkg_execute_build_process( + COMMAND + "${CMAKE_COMMAND}" --build . --config "${config}" ${target_param} + -- ${build_param} ${parallel_param} + NO_PARALLEL_COMMAND + "${CMAKE_COMMAND}" --build . --config "${config}" ${target_param} + -- ${build_param} ${no_parallel_param} + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${short_build_type}" + LOGNAME "${arg_LOGFILE_BASE}-${TARGET_TRIPLET}-${short_build_type}" + ) + endif() + + if(arg_ADD_BIN_TO_PATH) + vcpkg_restore_env_variables(VARS PATH) + endif() + endif() + endforeach() +endfunction() diff --git a/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake b/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake new file mode 100644 index 00000000000..832bbf70079 --- /dev/null +++ b/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake @@ -0,0 +1,320 @@ +include_guard(GLOBAL) + +macro(z_vcpkg_cmake_configure_both_set_or_unset var1 var2) + if(DEFINED ${var1} AND NOT DEFINED ${var2}) + message(FATAL_ERROR "If ${var1} is set, then ${var2} must be set.") + elseif(NOT DEFINED ${var1} AND DEFINED ${var2}) + message(FATAL_ERROR "If ${var2} is set, then ${var1} must be set.") + endif() +endmacro() + +function(vcpkg_cmake_configure) + cmake_parse_arguments(PARSE_ARGV 0 "arg" + "PREFER_NINJA;DISABLE_PARALLEL_CONFIGURE;WINDOWS_USE_MSBUILD;NO_CHARSET_FLAG;Z_CMAKE_GET_VARS_USAGE" + "SOURCE_PATH;GENERATOR;LOGFILE_BASE" + "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE;MAYBE_UNUSED_VARIABLES" + ) + + if(NOT arg_Z_CMAKE_GET_VARS_USAGE AND DEFINED CACHE{Z_VCPKG_CMAKE_GENERATOR}) + message(WARNING "${CMAKE_CURRENT_FUNCTION} already called; this function should only be called once.") + endif() + if(arg_PREFER_NINJA) + message(WARNING "PREFER_NINJA has been deprecated in ${CMAKE_CURRENT_FUNCTION}. Please remove it from the portfile!") + endif() + + if(DEFINED arg_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}") + endif() + + if(NOT DEFINED arg_SOURCE_PATH) + message(FATAL_ERROR "SOURCE_PATH must be set") + endif() + if(NOT DEFINED arg_LOGFILE_BASE) + set(arg_LOGFILE_BASE "config-${TARGET_TRIPLET}") + endif() + + set(manually_specified_variables "") + + if(arg_Z_CMAKE_GET_VARS_USAGE) + set(configuring_message "Getting CMake variables for ${TARGET_TRIPLET}") + else() + set(configuring_message "Configuring ${TARGET_TRIPLET}") + + foreach(option IN LISTS arg_OPTIONS arg_OPTIONS_RELEASE arg_OPTIONS_DEBUG) + if("${option}" MATCHES "^-D([^:=]*)[:=]") + vcpkg_list(APPEND manually_specified_variables "${CMAKE_MATCH_1}") + endif() + endforeach() + vcpkg_list(REMOVE_DUPLICATES manually_specified_variables) + foreach(maybe_unused_var IN LISTS arg_MAYBE_UNUSED_VARIABLES) + vcpkg_list(REMOVE_ITEM manually_specified_variables "${maybe_unused_var}") + endforeach() + debug_message("manually specified variables: ${manually_specified_variables}") + endif() + + if(CMAKE_HOST_WIN32) + if(DEFINED ENV{PROCESSOR_ARCHITEW6432}) + set(host_architecture "$ENV{PROCESSOR_ARCHITEW6432}") + else() + set(host_architecture "$ENV{PROCESSOR_ARCHITECTURE}") + endif() + endif() + + set(ninja_host ON) # Ninja availability + if(host_architecture STREQUAL "x86" OR DEFINED ENV{VCPKG_FORCE_SYSTEM_BINARIES}) + # Prebuilt ninja binaries are only provided for x64 hosts + find_program(NINJA NAMES ninja ninja-build) + if(NOT NINJA) + set(ninja_host OFF) + set(arg_DISABLE_PARALLEL_CONFIGURE ON) + set(arg_WINDOWS_USE_MSBUILD ON) + endif() + endif() + + set(generator "") + set(architecture_options "") + if(arg_WINDOWS_USE_MSBUILD AND VCPKG_HOST_IS_WINDOWS AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + z_vcpkg_get_visual_studio_generator(OUT_GENERATOR generator OUT_ARCH arch) + vcpkg_list(APPEND architecture_options "-A${arch}") + if(DEFINED VCPKG_PLATFORM_TOOLSET) + vcpkg_list(APPEND arg_OPTIONS "-T${VCPKG_PLATFORM_TOOLSET}") + endif() + if(NOT generator) + message(FATAL_ERROR "Unable to determine appropriate Visual Studio generator for triplet ${TARGET_TRIPLET}: + ENV{VisualStudioVersion} : $ENV{VisualStudioVersion} + VCPKG_TARGET_ARCHITECTURE: ${VCPKG_TARGET_ARCHITECTURE}") + endif() + elseif(DEFINED arg_GENERATOR) + set(generator "${arg_GENERATOR}") + elseif(ninja_host) + set(generator "Ninja") + elseif(NOT VCPKG_HOST_IS_WINDOWS) + set(generator "Unix Makefiles") + endif() + + if(NOT generator) + if(NOT VCPKG_CMAKE_SYSTEM_NAME) + set(VCPKG_CMAKE_SYSTEM_NAME "Windows") + endif() + message(FATAL_ERROR "Unable to determine appropriate generator for: " + "${VCPKG_CMAKE_SYSTEM_NAME}-${VCPKG_TARGET_ARCHITECTURE}-${VCPKG_PLATFORM_TOOLSET}") + endif() + + if(generator STREQUAL "Ninja") + vcpkg_find_acquire_program(NINJA) + vcpkg_list(APPEND arg_OPTIONS "-DCMAKE_MAKE_PROGRAM=${NINJA}") + # If we use Ninja, it must be on PATH for CMake's ExternalProject, + # cf. https://gitlab.kitware.com/cmake/cmake/-/issues/23355. + get_filename_component(ninja_path "${NINJA}" DIRECTORY) + vcpkg_add_to_path("${ninja_path}") + endif() + + set(build_dir_release "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel") + set(build_dir_debug "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") + file(REMOVE_RECURSE + "${build_dir_release}" + "${build_dir_debug}") + file(MAKE_DIRECTORY "${build_dir_release}") + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(MAKE_DIRECTORY "${build_dir_debug}") + endif() + + if(DEFINED VCPKG_CMAKE_SYSTEM_NAME) + vcpkg_list(APPEND arg_OPTIONS "-DCMAKE_SYSTEM_NAME=${VCPKG_CMAKE_SYSTEM_NAME}") + if(VCPKG_TARGET_IS_UWP AND NOT DEFINED VCPKG_CMAKE_SYSTEM_VERSION) + set(VCPKG_CMAKE_SYSTEM_VERSION 10.0) + elseif(VCPKG_TARGET_IS_ANDROID AND NOT DEFINED VCPKG_CMAKE_SYSTEM_VERSION) + set(VCPKG_CMAKE_SYSTEM_VERSION 21) + endif() + endif() + + if(DEFINED VCPKG_CMAKE_SYSTEM_VERSION) + vcpkg_list(APPEND arg_OPTIONS "-DCMAKE_SYSTEM_VERSION=${VCPKG_CMAKE_SYSTEM_VERSION}") + endif() + + if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + vcpkg_list(APPEND arg_OPTIONS "-DBUILD_SHARED_LIBS=ON") + elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_list(APPEND arg_OPTIONS "-DBUILD_SHARED_LIBS=OFF") + else() + message(FATAL_ERROR + "Invalid setting for VCPKG_LIBRARY_LINKAGE: \"${VCPKG_LIBRARY_LINKAGE}\". " + "It must be \"static\" or \"dynamic\"") + endif() + + z_vcpkg_cmake_configure_both_set_or_unset(VCPKG_CXX_FLAGS_DEBUG VCPKG_C_FLAGS_DEBUG) + z_vcpkg_cmake_configure_both_set_or_unset(VCPKG_CXX_FLAGS_RELEASE VCPKG_C_FLAGS_RELEASE) + z_vcpkg_cmake_configure_both_set_or_unset(VCPKG_CXX_FLAGS VCPKG_C_FLAGS) + + set(VCPKG_SET_CHARSET_FLAG ON) + if(arg_NO_CHARSET_FLAG) + set(VCPKG_SET_CHARSET_FLAG OFF) + endif() + + if(NOT DEFINED VCPKG_CHAINLOAD_TOOLCHAIN_FILE) + z_vcpkg_select_default_vcpkg_chainload_toolchain() + endif() + + list(JOIN VCPKG_TARGET_ARCHITECTURE "\;" target_architecture_string) + vcpkg_list(APPEND arg_OPTIONS + "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" + "-DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET}" + "-DVCPKG_SET_CHARSET_FLAG=${VCPKG_SET_CHARSET_FLAG}" + "-DVCPKG_PLATFORM_TOOLSET=${VCPKG_PLATFORM_TOOLSET}" + "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" + "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" + "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" + "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" + "-DCMAKE_VERBOSE_MAKEFILE=ON" + "-DVCPKG_APPLOCAL_DEPS=OFF" + "-DCMAKE_TOOLCHAIN_FILE=${SCRIPTS}/buildsystems/vcpkg.cmake" + "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" + "-DVCPKG_CXX_FLAGS=${VCPKG_CXX_FLAGS}" + "-DVCPKG_CXX_FLAGS_RELEASE=${VCPKG_CXX_FLAGS_RELEASE}" + "-DVCPKG_CXX_FLAGS_DEBUG=${VCPKG_CXX_FLAGS_DEBUG}" + "-DVCPKG_C_FLAGS=${VCPKG_C_FLAGS}" + "-DVCPKG_C_FLAGS_RELEASE=${VCPKG_C_FLAGS_RELEASE}" + "-DVCPKG_C_FLAGS_DEBUG=${VCPKG_C_FLAGS_DEBUG}" + "-DVCPKG_CRT_LINKAGE=${VCPKG_CRT_LINKAGE}" + "-DVCPKG_LINKER_FLAGS=${VCPKG_LINKER_FLAGS}" + "-DVCPKG_LINKER_FLAGS_RELEASE=${VCPKG_LINKER_FLAGS_RELEASE}" + "-DVCPKG_LINKER_FLAGS_DEBUG=${VCPKG_LINKER_FLAGS_DEBUG}" + "-DVCPKG_TARGET_ARCHITECTURE=${target_architecture_string}" + "-DCMAKE_INSTALL_LIBDIR:STRING=lib" + "-DCMAKE_INSTALL_BINDIR:STRING=bin" + "-D_VCPKG_ROOT_DIR=${VCPKG_ROOT_DIR}" + "-D_VCPKG_INSTALLED_DIR=${_VCPKG_INSTALLED_DIR}" + "-DVCPKG_MANIFEST_INSTALL=OFF" + "-DFETCHCONTENT_FULLY_DISCONNECTED=ON" + ) + + # Sets configuration variables for macOS builds + foreach(config_var IN ITEMS INSTALL_NAME_DIR OSX_DEPLOYMENT_TARGET OSX_SYSROOT OSX_ARCHITECTURES) + if(DEFINED VCPKG_${config_var}) + vcpkg_list(APPEND arg_OPTIONS "-DCMAKE_${config_var}=${VCPKG_${config_var}}") + endif() + endforeach() + + # Allow overrides / additional configuration variables from triplets + if(DEFINED VCPKG_CMAKE_CONFIGURE_OPTIONS) + vcpkg_list(APPEND arg_OPTIONS ${VCPKG_CMAKE_CONFIGURE_OPTIONS}) + endif() + if(DEFINED VCPKG_CMAKE_CONFIGURE_OPTIONS_RELEASE) + vcpkg_list(APPEND arg_OPTIONS_RELEASE ${VCPKG_CMAKE_CONFIGURE_OPTIONS_RELEASE}) + endif() + if(DEFINED VCPKG_CMAKE_CONFIGURE_OPTIONS_DEBUG) + vcpkg_list(APPEND arg_OPTIONS_DEBUG ${VCPKG_CMAKE_CONFIGURE_OPTIONS_DEBUG}) + endif() + + vcpkg_list(SET rel_command + "${CMAKE_COMMAND}" "${arg_SOURCE_PATH}" + -G "${generator}" + ${architecture_options} + "-DCMAKE_BUILD_TYPE=Release" + "-DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}" + ${arg_OPTIONS} ${arg_OPTIONS_RELEASE}) + vcpkg_list(SET dbg_command + "${CMAKE_COMMAND}" "${arg_SOURCE_PATH}" + -G "${generator}" + ${architecture_options} + "-DCMAKE_BUILD_TYPE=Debug" + "-DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}/debug" + ${arg_OPTIONS} ${arg_OPTIONS_DEBUG}) + + if(NOT arg_DISABLE_PARALLEL_CONFIGURE) + vcpkg_list(APPEND arg_OPTIONS "-DCMAKE_DISABLE_SOURCE_CHANGES=ON") + + vcpkg_find_acquire_program(NINJA) + + #parallelize the configure step + set(ninja_configure_contents + "rule CreateProcess\n command = \$process\n\n" + ) + + if(NOT DEFINED VCPKG_BUILD_TYPE OR "${VCPKG_BUILD_TYPE}" STREQUAL "release") + z_vcpkg_configure_cmake_build_cmakecache(ninja_configure_contents ".." "rel") + endif() + if(NOT DEFINED VCPKG_BUILD_TYPE OR "${VCPKG_BUILD_TYPE}" STREQUAL "debug") + z_vcpkg_configure_cmake_build_cmakecache(ninja_configure_contents "../../${TARGET_TRIPLET}-dbg" "dbg") + endif() + + file(MAKE_DIRECTORY "${build_dir_release}/vcpkg-parallel-configure") + file(WRITE + "${build_dir_release}/vcpkg-parallel-configure/build.ninja" + "${ninja_configure_contents}") + + message(STATUS "${configuring_message}") + vcpkg_execute_required_process( + COMMAND "${NINJA}" -v + WORKING_DIRECTORY "${build_dir_release}/vcpkg-parallel-configure" + LOGNAME "${arg_LOGFILE_BASE}" + SAVE_LOG_FILES ../../${TARGET_TRIPLET}-dbg/CMakeCache.txt ../CMakeCache.txt + ) + + vcpkg_list(APPEND config_logs + "${CURRENT_BUILDTREES_DIR}/${arg_LOGFILE_BASE}-out.log" + "${CURRENT_BUILDTREES_DIR}/${arg_LOGFILE_BASE}-err.log") + else() + if(NOT DEFINED VCPKG_BUILD_TYPE OR "${VCPKG_BUILD_TYPE}" STREQUAL "debug") + message(STATUS "${configuring_message}-dbg") + vcpkg_execute_required_process( + COMMAND ${dbg_command} + WORKING_DIRECTORY "${build_dir_debug}" + LOGNAME "${arg_LOGFILE_BASE}-dbg" + SAVE_LOG_FILES CMakeCache.txt + ) + vcpkg_list(APPEND config_logs + "${CURRENT_BUILDTREES_DIR}/${arg_LOGFILE_BASE}-dbg-out.log" + "${CURRENT_BUILDTREES_DIR}/${arg_LOGFILE_BASE}-dbg-err.log") + endif() + + if(NOT DEFINED VCPKG_BUILD_TYPE OR "${VCPKG_BUILD_TYPE}" STREQUAL "release") + message(STATUS "${configuring_message}-rel") + vcpkg_execute_required_process( + COMMAND ${rel_command} + WORKING_DIRECTORY "${build_dir_release}" + LOGNAME "${arg_LOGFILE_BASE}-rel" + SAVE_LOG_FILES CMakeCache.txt + ) + vcpkg_list(APPEND config_logs + "${CURRENT_BUILDTREES_DIR}/${arg_LOGFILE_BASE}-rel-out.log" + "${CURRENT_BUILDTREES_DIR}/${arg_LOGFILE_BASE}-rel-err.log") + endif() + endif() + + set(all_unused_variables) + foreach(config_log IN LISTS config_logs) + if(NOT EXISTS "${config_log}") + continue() + endif() + file(READ "${config_log}" log_contents) + debug_message("Reading configure log ${config_log}...") + if(NOT log_contents MATCHES "Manually-specified variables were not used by the project:\n\n(( [^\n]*\n)*)") + continue() + endif() + string(STRIP "${CMAKE_MATCH_1}" unused_variables) # remove leading ` ` and trailing `\n` + string(REPLACE "\n " ";" unused_variables "${unused_variables}") + debug_message("unused variables: ${unused_variables}") + foreach(unused_variable IN LISTS unused_variables) + if(unused_variable IN_LIST manually_specified_variables) + debug_message("manually specified unused variable: ${unused_variable}") + vcpkg_list(APPEND all_unused_variables "${unused_variable}") + else() + debug_message("unused variable (not manually specified): ${unused_variable}") + endif() + endforeach() + endforeach() + + if(DEFINED all_unused_variables) + vcpkg_list(REMOVE_DUPLICATES all_unused_variables) + vcpkg_list(JOIN all_unused_variables "\n " all_unused_variables) + message(WARNING "The following variables are not used in CMakeLists.txt: + ${all_unused_variables} +Please recheck them and remove the unnecessary options from the `vcpkg_cmake_configure` call. +If these options should still be passed for whatever reason, please use the `MAYBE_UNUSED_VARIABLES` argument.") + endif() + + if(NOT arg_Z_CMAKE_GET_VARS_USAGE) + set(Z_VCPKG_CMAKE_GENERATOR "${generator}" CACHE INTERNAL "The generator which was used to configure CMake.") + endif() +endfunction() diff --git a/ports/vcpkg-cmake/vcpkg_cmake_install.cmake b/ports/vcpkg-cmake/vcpkg_cmake_install.cmake new file mode 100644 index 00000000000..2bd8b4ea75f --- /dev/null +++ b/ports/vcpkg-cmake/vcpkg_cmake_install.cmake @@ -0,0 +1,21 @@ +include_guard(GLOBAL) + +function(vcpkg_cmake_install) + cmake_parse_arguments(PARSE_ARGV 0 "arg" "DISABLE_PARALLEL;ADD_BIN_TO_PATH" "" "") + if(DEFINED arg_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "vcpkg_cmake_install was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}") + endif() + + set(args) + foreach(arg IN ITEMS DISABLE_PARALLEL ADD_BIN_TO_PATH) + if(arg_${arg}) + list(APPEND args "${arg}") + endif() + endforeach() + + vcpkg_cmake_build( + ${args} + LOGFILE_BASE install + TARGET install + ) +endfunction() diff --git a/ports/zlib/0001-Prevent-invalid-inclusions-when-HAVE_-is-set-to-0.patch b/ports/zlib/0001-Prevent-invalid-inclusions-when-HAVE_-is-set-to-0.patch new file mode 100644 index 00000000000..8fe2b2f5a66 --- /dev/null +++ b/ports/zlib/0001-Prevent-invalid-inclusions-when-HAVE_-is-set-to-0.patch @@ -0,0 +1,53 @@ +diff --git a/zconf.h.cmakein b/zconf.h.cmakein +index a7f24cc..a1b359b 100644 +--- a/zconf.h.cmakein ++++ b/zconf.h.cmakein +@@ -434,11 +434,19 @@ typedef uLong FAR uLongf; + #endif + + #ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ +-# define Z_HAVE_UNISTD_H ++# if ~(~HAVE_UNISTD_H + 0) == 0 && ~(~HAVE_UNISTD_H + 1) == 1 ++# define Z_HAVE_UNISTD_H ++# elif HAVE_UNISTD_H != 0 ++# define Z_HAVE_UNISTD_H ++# endif + #endif + + #ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ +-# define Z_HAVE_STDARG_H ++# if ~(~HAVE_STDARG_H + 0) == 0 && ~(~HAVE_STDARG_H + 1) == 1 ++# define Z_HAVE_STDARG_H ++# elif HAVE_STDARG_H != 0 ++# define Z_HAVE_STDARG_H ++# endif + #endif + + #ifdef STDC +diff --git a/zconf.h.in b/zconf.h.in +index 5e1d68a..32f53c8 100644 +--- a/zconf.h.in ++++ b/zconf.h.in +@@ -432,11 +432,19 @@ typedef uLong FAR uLongf; + #endif + + #ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ +-# define Z_HAVE_UNISTD_H ++# if ~(~HAVE_UNISTD_H + 0) == 0 && ~(~HAVE_UNISTD_H + 1) == 1 ++# define Z_HAVE_UNISTD_H ++# elif HAVE_UNISTD_H != 0 ++# define Z_HAVE_UNISTD_H ++# endif + #endif + + #ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ +-# define Z_HAVE_STDARG_H ++# if ~(~HAVE_STDARG_H + 0) == 0 && ~(~HAVE_STDARG_H + 1) == 1 ++# define Z_HAVE_STDARG_H ++# elif HAVE_STDARG_H != 0 ++# define Z_HAVE_STDARG_H ++# endif + #endif + + #ifdef STDC + diff --git a/ports/zlib/0002-skip-building-examples.patch b/ports/zlib/0002-skip-building-examples.patch new file mode 100644 index 00000000000..8183f2ab20b --- /dev/null +++ b/ports/zlib/0002-skip-building-examples.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b412dc7..f46c8e6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -194,6 +194,7 @@ endif() + # Example binaries + #============================================================================ + ++if (0) + add_executable(example test/example.c) + target_link_libraries(example zlib) + add_test(example example) +@@ -211,3 +212,4 @@ if(HAVE_OFF64_T) + target_link_libraries(minigzip64 zlib) + set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + endif() ++endif() diff --git a/ports/zlib/0003-build-static-or-shared-not-both.patch b/ports/zlib/0003-build-static-or-shared-not-both.patch new file mode 100644 index 00000000000..c9f2ecf1976 --- /dev/null +++ b/ports/zlib/0003-build-static-or-shared-not-both.patch @@ -0,0 +1,53 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f46c8e6..6fa5575 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -121,9 +121,11 @@ set(ZLIB_SRCS + ) + + if(NOT MINGW) ++ if(BUILD_SHARED_LIBS) + set(ZLIB_DLL_SRCS + win32/zlib1.rc # If present will override custom build rule below. + ) ++ endif() + endif() + + # parse the full version number from zlib.h and include in ZLIB_FULL_VERSION +@@ -144,13 +146,16 @@ if(MINGW) + -I ${CMAKE_CURRENT_BINARY_DIR} + -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj + -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) ++ if(BUILD_SHARED_LIBS) + set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) ++ endif() + endif(MINGW) + +-add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +-add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) ++add_library(zlib ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) ++if (BUILD_SHARED_LIBS) + set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) + set_target_properties(zlib PROPERTIES SOVERSION 1) ++endif() + + if(NOT CYGWIN) + # This property causes shared libraries on Linux to have the full version +@@ -165,7 +170,7 @@ endif() + + if(UNIX) + # On unix-like platforms the library is almost always called libz +- set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) ++ set_target_properties(zlib PROPERTIES OUTPUT_NAME z) + if(NOT APPLE) + set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") + endif() +@@ -175,7 +180,7 @@ elseif(BUILD_SHARED_LIBS AND WIN32) + endif() + + if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) +- install(TARGETS zlib zlibstatic ++ install(TARGETS zlib + RUNTIME DESTINATION "${INSTALL_BIN_DIR}" + ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" + LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) diff --git a/ports/zlib/0004-android-and-mingw-fixes.patch b/ports/zlib/0004-android-and-mingw-fixes.patch new file mode 100644 index 00000000000..e93173f2461 --- /dev/null +++ b/ports/zlib/0004-android-and-mingw-fixes.patch @@ -0,0 +1,31 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6fa5575..7c345db 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -56,7 +56,7 @@ endif() + # + check_include_file(unistd.h Z_HAVE_UNISTD_H) + +-if(MSVC) ++if(WIN32) + set(CMAKE_DEBUG_POSTFIX "d") + add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) +@@ -133,7 +133,7 @@ file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) + string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" + "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) + +-if(MINGW) ++if(MINGW AND NOT ANDROID) + # This gets us DLL resource information when compiling on MinGW. + if(NOT CMAKE_RC_COMPILER) + set(CMAKE_RC_COMPILER windres.exe) +@@ -149,7 +149,7 @@ if(MINGW) + if(BUILD_SHARED_LIBS) + set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) + endif() +-endif(MINGW) ++endif(MINGW AND NOT ANDROID) + + add_library(zlib ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) + if (BUILD_SHARED_LIBS) diff --git a/ports/zlib/portfile.cmake b/ports/zlib/portfile.cmake new file mode 100644 index 00000000000..450cb2c1915 --- /dev/null +++ b/ports/zlib/portfile.cmake @@ -0,0 +1,53 @@ +# When this port is updated, the minizip port should be updated at the same time +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO madler/zlib + REF v1.2.13 + SHA512 44b834fbfb50cca229209b8dbe1f96b258f19a49f5df23b80970b716371d856a4adf525edb4c6e0e645b180ea949cb90f5365a1d896160f297f56794dd888659 + HEAD_REF master + PATCHES + 0001-Prevent-invalid-inclusions-when-HAVE_-is-set-to-0.patch + 0002-skip-building-examples.patch + 0003-build-static-or-shared-not-both.patch + 0004-android-and-mingw-fixes.patch +) + +# This is generated during the cmake build +file(REMOVE "${SOURCE_PATH}/zconf.h") + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DSKIP_INSTALL_FILES=ON + OPTIONS_DEBUG + -DSKIP_INSTALL_HEADERS=ON +) + +vcpkg_cmake_install() +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") + +# Install the pkgconfig file +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + if(VCPKG_TARGET_IS_WINDOWS) + vcpkg_replace_string("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/zlib.pc" "-lz" "-lzlib") + endif() + file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/zlib.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/lib/pkgconfig") +endif() +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + if(VCPKG_TARGET_IS_WINDOWS) + vcpkg_replace_string("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/zlib.pc" "-lz" "-lzlibd") + endif() + file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/zlib.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig") +endif() + +vcpkg_fixup_pkgconfig() +vcpkg_copy_pdbs() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/zconf.h" "ifdef ZLIB_DLL" "if 0") +else() + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/zconf.h" "ifdef ZLIB_DLL" "if 1") +endif() + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/zlib/usage b/ports/zlib/usage new file mode 100644 index 00000000000..39d8618221a --- /dev/null +++ b/ports/zlib/usage @@ -0,0 +1,4 @@ +The package zlib is compatible with built-in CMake targets: + + find_package(ZLIB REQUIRED) + target_link_libraries(main PRIVATE ZLIB::ZLIB) diff --git a/ports/zlib/vcpkg-cmake-wrapper.cmake b/ports/zlib/vcpkg-cmake-wrapper.cmake new file mode 100644 index 00000000000..8624b70867e --- /dev/null +++ b/ports/zlib/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,12 @@ +find_path(ZLIB_INCLUDE_DIR NAMES zlib.h PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include" NO_DEFAULT_PATH) +find_library(ZLIB_LIBRARY_RELEASE NAMES zlib z PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" NO_DEFAULT_PATH) +find_library(ZLIB_LIBRARY_DEBUG NAMES zlibd z PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" NO_DEFAULT_PATH) +if(NOT ZLIB_INCLUDE_DIR OR NOT (ZLIB_LIBRARY_RELEASE OR ZLIB_LIBRARY_DEBUG)) + message(FATAL_ERROR "Broken installation of vcpkg port zlib") +endif() +if(CMAKE_VERSION VERSION_LESS 3.4) + include(SelectLibraryConfigurations) + select_library_configurations(ZLIB) + unset(ZLIB_FOUND) +endif() +_find_package(${ARGS}) diff --git a/ports/zlib/vcpkg.json b/ports/zlib/vcpkg.json new file mode 100644 index 00000000000..7ef1f29d8ed --- /dev/null +++ b/ports/zlib/vcpkg.json @@ -0,0 +1,13 @@ +{ + "name": "zlib", + "version": "1.2.13", + "description": "A compression library", + "homepage": "https://www.zlib.net/", + "license": "Zlib", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/ports/zstd/install_pkgpc.patch b/ports/zstd/install_pkgpc.patch new file mode 100644 index 00000000000..a0582d98b21 --- /dev/null +++ b/ports/zstd/install_pkgpc.patch @@ -0,0 +1,13 @@ +diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt +index 5f75665..dabc9d5 100644 +--- a/build/cmake/lib/CMakeLists.txt ++++ b/build/cmake/lib/CMakeLists.txt +@@ -130,7 +130,7 @@ if (ZSTD_BUILD_STATIC) + OUTPUT_NAME ${STATIC_LIBRARY_BASE_NAME}) + endif () + +-if (UNIX OR MINGW) ++if (1) + # pkg-config + set(PREFIX "${CMAKE_INSTALL_PREFIX}") + set(EXEC_PREFIX "\${prefix}") diff --git a/ports/zstd/no-static-suffix.patch b/ports/zstd/no-static-suffix.patch new file mode 100644 index 00000000000..4e61f96b87d --- /dev/null +++ b/ports/zstd/no-static-suffix.patch @@ -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 () diff --git a/ports/zstd/portfile.cmake b/ports/zstd/portfile.cmake new file mode 100644 index 00000000000..6d7aa4df883 --- /dev/null +++ b/ports/zstd/portfile.cmake @@ -0,0 +1,55 @@ +vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION} +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO facebook/zstd + REF "v${VERSION}" + SHA512 e107508a41fca50845cc2494e64adaba93efb95a2fa486fc962510a8ba4b2180d93067cae9870f119e88e5e8b28a046bc2240b0b23cdd8933d1fb1a6a9668c1e + 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) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}/build/cmake" + OPTIONS + -DZSTD_BUILD_SHARED=${ZSTD_BUILD_SHARED} + -DZSTD_BUILD_STATIC=${ZSTD_BUILD_STATIC} + -DZSTD_LEGACY_SUPPORT=1 + -DZSTD_BUILD_PROGRAMS=0 + -DZSTD_BUILD_TESTS=0 + -DZSTD_BUILD_CONTRIB=0 + -DZSTD_MULTITHREAD_SUPPORT=1 +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/zstd) +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 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(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +vcpkg_install_copyright( + COMMENT "ZSTD is dual licensed under BSD and GPLv2." + FILE_LIST + "${SOURCE_PATH}/LICENSE" + "${SOURCE_PATH}/COPYING" +) diff --git a/ports/zstd/usage b/ports/zstd/usage new file mode 100644 index 00000000000..f01a2f5cfb7 --- /dev/null +++ b/ports/zstd/usage @@ -0,0 +1,4 @@ +The package zstd provides CMake targets: + + find_package(zstd CONFIG REQUIRED) + target_link_libraries(main PRIVATE $,zstd::libzstd_shared,zstd::libzstd_static>) diff --git a/ports/zstd/vcpkg.json b/ports/zstd/vcpkg.json new file mode 100644 index 00000000000..d683b33e7de --- /dev/null +++ b/ports/zstd/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "zstd", + "version": "1.5.2", + "port-version": 3, + "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", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/test/external/src/absl_library_targets.cmake b/test/external/src/absl_library_targets.cmake index d0bccef86fd..5115dd5127f 100644 --- a/test/external/src/absl_library_targets.cmake +++ b/test/external/src/absl_library_targets.cmake @@ -31,5 +31,141 @@ # update list as needed if changes in abseil require set(TILEDB_ABSL_LIBRARY_TARGETS - absl::atomic_hook absl::errno_saver absl::log_severity absl::raw_logging_internal absl::spinlock_wait absl::config absl::dynamic_annotations absl::core_headers absl::malloc_internal absl::base_internal absl::base absl::throw_delegate absl::pretty_function absl::endian absl::scoped_set_env absl::strerror absl::fast_type_id absl::algorithm absl::algorithm_container absl::cleanup_internal absl::cleanup absl::btree absl::compressed_tuple absl::fixed_array absl::inlined_vector_internal absl::inlined_vector absl::counting_allocator absl::flat_hash_map absl::flat_hash_set absl::node_hash_map absl::node_hash_set absl::container_memory absl::hash_function_defaults absl::hash_policy_traits absl::hashtablez_sampler absl::hashtable_debug absl::hashtable_debug_hooks absl::have_sse absl::node_hash_policy absl::raw_hash_map absl::container_common absl::raw_hash_set absl::layout absl::stacktrace absl::symbolize absl::examine_stack absl::failure_signal_handler absl::debugging_internal absl::demangle_internal absl::leak_check absl::leak_check_disable absl::debugging absl::flags_path_util absl::flags_program_name absl::flags_config absl::flags_marshalling absl::flags_commandlineflag_internal absl::flags_commandlineflag absl::flags_private_handle_accessor absl::flags_reflection absl::flags_internal absl::flags absl::flags_usage_internal absl::flags_usage absl::flags_parse absl::bind_front absl::function_ref absl::hash absl::city absl::low_level_hash absl::memory absl::type_traits absl::meta absl::bits absl::int128 absl::numeric absl::numeric_representation absl::sample_recorder absl::exponential_biased absl::periodic_sampler absl::random_random absl::random_bit_gen_ref absl::random_internal_mock_helpers absl::random_distributions absl::random_seed_gen_exception absl::random_seed_sequences absl::random_internal_traits absl::random_internal_distribution_caller absl::random_internal_fast_uniform_bits absl::random_internal_seed_material absl::random_internal_pool_urbg absl::random_internal_salted_seed_seq absl::random_internal_iostream_state_saver absl::random_internal_generate_real absl::random_internal_wide_multiply absl::random_internal_fastmath absl::random_internal_nonsecure_base absl::random_internal_pcg_engine absl::random_internal_randen_engine absl::random_internal_platform absl::random_internal_randen absl::random_internal_randen_slow absl::random_internal_randen_hwaes absl::random_internal_randen_hwaes_impl absl::random_internal_distribution_test_util absl::random_internal_uniform_helper absl::status absl::statusor absl::strings absl::strings_internal absl::str_format absl::str_format_internal absl::cord_internal absl::cordz_update_tracker absl::cordz_functions absl::cordz_statistics absl::cordz_handle absl::cordz_info absl::cordz_sample_token absl::cordz_update_scope absl::cord absl::graphcycles_internal absl::kernel_timeout_internal absl::synchronization absl::time absl::civil_time absl::time_zone absl::any absl::bad_any_cast absl::bad_any_cast_impl absl::span absl::optional absl::bad_optional_access absl::bad_variant_access absl::variant absl::compare absl::utility - ) + absl::algorithm + absl::algorithm_container + absl::any + absl::atomic_hook + absl::bad_any_cast + absl::bad_any_cast_impl + absl::bad_optional_access + absl::bad_variant_access + absl::base + absl::base_internal + absl::bind_front + absl::bits + absl::btree + absl::city + absl::civil_time + absl::cleanup + absl::cleanup_internal + absl::compare + absl::compressed_tuple + absl::config + absl::container_common + absl::container_memory + absl::cord + absl::cord_internal + absl::cordz_functions + absl::cordz_handle + absl::cordz_info + absl::cordz_sample_token + absl::cordz_statistics + absl::cordz_update_scope + absl::cordz_update_tracker + absl::core_headers + absl::counting_allocator + absl::debugging + absl::debugging_internal + absl::demangle_internal + absl::dynamic_annotations + absl::endian + absl::errno_saver + absl::examine_stack + absl::exponential_biased + absl::failure_signal_handler + absl::fast_type_id + absl::fixed_array + absl::flags + absl::flags_commandlineflag + absl::flags_commandlineflag_internal + absl::flags_config + absl::flags_internal + absl::flags_marshalling + absl::flags_parse + absl::flags_path_util + absl::flags_private_handle_accessor + absl::flags_program_name + absl::flags_reflection + absl::flags_usage + absl::flags_usage_internal + absl::flat_hash_map + absl::flat_hash_set + absl::function_ref + absl::graphcycles_internal + absl::hash + absl::hash_function_defaults + absl::hash_policy_traits + absl::hashtable_debug + absl::hashtable_debug_hooks + absl::hashtablez_sampler + absl::have_sse + absl::inlined_vector + absl::inlined_vector_internal + absl::int128 + absl::kernel_timeout_internal + absl::layout + absl::leak_check + absl::leak_check_disable + absl::log_severity + absl::low_level_hash + absl::malloc_internal + absl::memory + absl::meta + absl::node_hash_map + absl::node_hash_policy + absl::node_hash_set + absl::numeric + absl::numeric_representation + absl::optional + absl::periodic_sampler + absl::pretty_function + absl::random_bit_gen_ref + absl::random_distributions + absl::random_internal_distribution_caller + absl::random_internal_distribution_test_util + absl::random_internal_fast_uniform_bits + absl::random_internal_fastmath + absl::random_internal_generate_real + absl::random_internal_iostream_state_saver + absl::random_internal_mock_helpers + absl::random_internal_nonsecure_base + absl::random_internal_pcg_engine + absl::random_internal_platform + absl::random_internal_pool_urbg + absl::random_internal_randen + absl::random_internal_randen_engine + absl::random_internal_randen_hwaes + absl::random_internal_randen_hwaes_impl + absl::random_internal_randen_slow + absl::random_internal_salted_seed_seq + absl::random_internal_seed_material + absl::random_internal_traits + absl::random_internal_uniform_helper + absl::random_internal_wide_multiply + absl::random_random + absl::random_seed_gen_exception + absl::random_seed_sequences + absl::raw_hash_map + absl::raw_hash_set + absl::raw_logging_internal + absl::sample_recorder + absl::scoped_set_env + absl::span + absl::spinlock_wait + absl::stacktrace + absl::status + absl::statusor + absl::str_format + absl::str_format_internal + absl::strerror + absl::strings + absl::strings_internal + absl::symbolize + absl::synchronization + absl::throw_delegate + absl::time + absl::time_zone + absl::type_traits + absl::utility + absl::variant +) diff --git a/test/external/src/absl_link_test.cc b/test/external/src/absl_link_test.cc index 6bf3cb601a6..0b7818f82e0 100644 --- a/test/external/src/absl_link_test.cc +++ b/test/external/src/absl_link_test.cc @@ -28,9 +28,9 @@ * * @section DESCRIPTION * - * Tests for linkage to libraries of the targets found to be referenced by + * Tests for linkage to libraries of the targets found to be referenced by * gcssdk v1.22 at the time of creation of absl_link_test.cc. - * + * * Those targets were crudely identified by extracting from the following action: * ep_gcssdk\google>findstr /s absl:: *cmake* cloud\bigquery\CMakeLists.txt: PUBLIC absl::memory absl::strings google_cloud_cpp_grpc_utils @@ -77,23 +77,23 @@ cloud\testing_util\CMakeLists.txt: PUBLIC absl::symbolize absl::failure_s #include #include -#include // absl::str_format -#include // absl::function_ref -#include // absl::fixed_array -#include // absl::flat_hash_map -#include -#include // absl::function_ref -#include // absl::numeric -#include -#include -#include -#include // absl::optional -#include // absl::variant +#include // absl::function_ref +#include // absl::fixed_array +#include // absl::flat_hash_map +#include +#include // absl::function_ref +#include // absl::numeric +#include +#include // absl::str_format +#include +#include +#include // absl::optional +#include // absl::variant #if 0 // absl::symbolize, absl::failure_signal_handler both in testing_util, not // verifying these as we do not build gcs tests. -#include -#include +#include int main() { uint8_t buf[32]; diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json new file mode 100644 index 00000000000..ab5cc21edef --- /dev/null +++ b/vcpkg-configuration.json @@ -0,0 +1,3 @@ +{ + "overlay-ports": ["ports"] +} diff --git a/vcpkg.json b/vcpkg.json index e90de9aa9ca..a226dfdf4df 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -4,14 +4,36 @@ "builtin-baseline": "f14984af3738e69f197bf0e647a8dca12de92996", "dependencies": [ "bzip2", - "openssl", - "zstd", + "liblzma", + "libmagic", + "lz4", { - "name": "catch2", - "version>=": "3.1.0" - } + "name": "openssl", + "platform": "!windows" + }, + "spdlog", + "zlib", + "zstd" ], "features": { + "abseil": { + "description": "Enables building of abseil library and linkage test", + "dependencies": [ + { + "name": "abseil", + "version>=": "20211102.0" + } + ] + }, + "azure": { + "description": "Support Azure Storage", + "dependencies": [ + { + "name": "azure-storage-cpplite", + "version>=": "0.3.0" + } + ] + }, "gcs": { "description": "Support google cloud storage", "dependencies": [ @@ -22,6 +44,51 @@ "default-features": false } ] + }, + "serialization": { + "description": "Enable TileDB Cloud Support", + "dependencies": [ + { + "name": "capnproto", + "version>=": "0.8.0" + } + ] + }, + "s3": { + "description": "Support AWS S3 Storage", + "dependencies": [ + { + "name": "aws-sdk-cpp", + "version>=": "1.8.84", + "features": ["s3", "identity-management", "sts"], + "default-features": false + } + ] + }, + "tests": { + "description": "Build tiledb tests", + "dependencies": [ + "catch2" + ] + }, + "tools": { + "description": "Build tiledb command line tool", + "dependencies": [ + { + "name": "clipp", + "version>=": "1.2.3" + } + ] + }, + "webp": { + "description": "Support WebP compression", + "dependencies": [ + { + "name": "libwebp", + "version>=": "1.2.3" + } + ] + } } }