From 40c1a2305cd94c4b00e8104586ac52b49ba17956 Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Wed, 6 Mar 2019 16:16:52 -0500 Subject: [PATCH] [cppfs] Add new port (#5571) * [cppfs] Add new port * [cppfs] Remove explicit libcrypto dependency * [cppfs] Use vcpkg targets * [cppfs] Don't use local find modules * [cppfs] Disable arm64 and uwp * [cppfs] Make portfile indentation consistent --- ports/cppfs/CONTROL | 7 +++++ ports/cppfs/LibCrypto-fix.patch | 53 +++++++++++++++++++++++++++++++++ ports/cppfs/portfile.cmake | 47 +++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 ports/cppfs/CONTROL create mode 100644 ports/cppfs/LibCrypto-fix.patch create mode 100644 ports/cppfs/portfile.cmake diff --git a/ports/cppfs/CONTROL b/ports/cppfs/CONTROL new file mode 100644 index 0000000000..30ec75f008 --- /dev/null +++ b/ports/cppfs/CONTROL @@ -0,0 +1,7 @@ +Source: cppfs +Version: 1.2.0 +Description: Cross-platform C++ file system library supporting multiple backends + +Feature: ssh +Description: SSH backend for cppfs +Build-Depends: libssh2,openssl,zlib diff --git a/ports/cppfs/LibCrypto-fix.patch b/ports/cppfs/LibCrypto-fix.patch new file mode 100644 index 0000000000..144d2aabe7 --- /dev/null +++ b/ports/cppfs/LibCrypto-fix.patch @@ -0,0 +1,53 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ea9fd15..af63d1e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -7,7 +7,7 @@ + cmake_minimum_required(VERSION 3.0 FATAL_ERROR) + + # Include cmake modules +-list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") ++# list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + + include(GenerateExportHeader) + +diff --git a/source/cppfs/CMakeLists.txt b/source/cppfs/CMakeLists.txt +index aa37eda..d29176a 100644 +--- a/source/cppfs/CMakeLists.txt ++++ b/source/cppfs/CMakeLists.txt +@@ -4,18 +4,18 @@ + # + + find_package(LibSSH2) +-find_package(LibCrypto) ++# find_package(LibCrypto) + find_package(ZLIB) + find_package(OpenSSL) + +-if (LibSSH2_FOUND AND LibCrypto_FOUND AND ZLIB_FOUND AND OpenSSL_FOUND) ++if (LibSSH2_FOUND AND ZLIB_FOUND AND OpenSSL_FOUND) + set(SSH_DEPS_MET TRUE) + else() + set(SSH_DEPS_MET FALSE) + endif() + + if (OPTION_BUILD_SSH_BACKEND AND NOT SSH_DEPS_MET) +- message(FATAL_ERROR "Requested to build ssh module but not all dependencies are found! LibSSH2: ${LibSSH2_FOUND}, LibCrypto: ${LibCrypto_FOUND}, ZLIB: ${ZLIB_FOUND}, OpenSSL: ${OpenSSL_FOUND}") ++ message(FATAL_ERROR "Requested to build ssh module but not all dependencies are found! LibSSH2: ${LibSSH2_FOUND}, ZLIB: ${ZLIB_FOUND}, OpenSSL: ${OpenSSL_FOUND}") + endif() + + +@@ -207,10 +207,9 @@ target_link_libraries(${target} + if (OPTION_BUILD_SSH_BACKEND) + target_link_libraries(${target} + PRIVATE +- ${OPENSSL_LIBRARIES} +- ${LIBSSH2_LIBRARY} +- ${LIBCRYPTO_LIBRARY} +- ${ZLIB_LIBRARY} ++ Libssh2::libssh2 ++ OpenSSL::SSL OpenSSL::Crypto ++ ZLIB::ZLIB + ) + + if("${CMAKE_SYSTEM_NAME}" MATCHES "Windows") diff --git a/ports/cppfs/portfile.cmake b/ports/cppfs/portfile.cmake new file mode 100644 index 0000000000..9716b6bbe3 --- /dev/null +++ b/ports/cppfs/portfile.cmake @@ -0,0 +1,47 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO cginternals/cppfs + REF v1.2.0 + SHA512 2e831978dd87bd40d14e5b6f5089f3a962481d41959bfd62db543339d05e306315a1167c3bc06b372517357cc314f7d06ac19605f9a2d5b4edddc9a1f3fa8d03 + HEAD_REF master + PATCHES + LibCrypto-fix.patch +) + +if(${TARGET_TRIPLET} MATCHES "uwp") + message(FATAL_ERROR "cppfs does not support uwp") +endif() + +set(SHARED_LIBS Off) +if(${VCPKG_LIBRARY_LINKAGE} STREQUAL "dynamic") + set(SHARED_LIBS On) +endif() + +set(SSH_BACKEND OFF) +if("ssh" IN_LIST FEATURES) + set(SSH_BACKEND ON) + if("${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "arm64") + message(FATAL_ERROR "SSH backend of cppfs does not support arm64.") + endif() +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DOPTION_BUILD_SSH_BACKEND=${SSH_BACKEND} + -DOPTION_BUILD_TESTS=Off + -DBUILD_SHARED_LIBS=${SHARED_LIBS} + -DOPTION_FORCE_SYSTEM_DIR_INSTALL=On +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/cppfs RENAME copyright) + +vcpkg_test_cmake(PACKAGE_NAME cppfs)