diff --git a/ports/cryptopp/CONTROL b/ports/cryptopp/CONTROL index 9c11e190644f4f..c70415dd101285 100644 --- a/ports/cryptopp/CONTROL +++ b/ports/cryptopp/CONTROL @@ -1,4 +1,7 @@ Source: cryptopp -Version: 8.2.0-1 +Version: 8.2.0-2 Homepage: https://github.com/weidai11/cryptopp Description: Crypto++ is a free C++ class library of cryptographic schemes. + +Feature: pem-pack +Description: Crypto++ with PEM pack diff --git a/ports/cryptopp/portfile.cmake b/ports/cryptopp/portfile.cmake index 36c74788485981..b88f2e321fbba9 100644 --- a/ports/cryptopp/portfile.cmake +++ b/ports/cryptopp/portfile.cmake @@ -24,6 +24,22 @@ vcpkg_from_github( file(COPY ${CMAKE_SOURCE_PATH}/cryptopp-config.cmake DESTINATION ${SOURCE_PATH}) file(COPY ${CMAKE_SOURCE_PATH}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +if("pem-pack" IN_LIST FEATURES) + vcpkg_from_github( + OUT_SOURCE_PATH PEM_PACK_SOURCE_PATH + REPO noloader/cryptopp-pem + REF 095f08ff2ef9bca7b81036a59f2395e4f08ce2e8 + SHA512 49912758a635faca1f49665ac9552b20576b46e0283aaabc19bb012bdc80586106452018e5088b9b46967717982ca6022ca968edc4cac96a7506d2b1a3e4bf13 + HEAD_REF master + ) + + file(GLOB PEM_PACK_FILES + ${PEM_PACK_SOURCE_PATH}/*.h + ${PEM_PACK_SOURCE_PATH}/*.cpp + ) + file(COPY ${PEM_PACK_FILES} DESTINATION ${SOURCE_PATH}) +endif() + # disable assembly on OSX and ARM Windows to fix broken build if (VCPKG_TARGET_IS_OSX) set(CRYPTOPP_DISABLE_ASM "ON") diff --git a/ports/licensepp/CONTROL b/ports/licensepp/CONTROL new file mode 100644 index 00000000000000..c21d13b4adda6c --- /dev/null +++ b/ports/licensepp/CONTROL @@ -0,0 +1,6 @@ +Source: licensepp +Version: 2020-05-19 +Description: Cross platform software licensing library +Build-Depends: cryptopp[pem-pack] +Supports: !uwp +Homepage: https://github.com/zuhd-org/licensepp diff --git a/ports/licensepp/FindCryptoPP.cmake b/ports/licensepp/FindCryptoPP.cmake new file mode 100644 index 00000000000000..c7e0f709c098b6 --- /dev/null +++ b/ports/licensepp/FindCryptoPP.cmake @@ -0,0 +1,27 @@ +find_path(CRYPTOPP_INCLUDE_DIRS NAMES cryptopp/cryptlib.h) + +get_filename_component(_prefix_path ${CRYPTOPP_INCLUDE_DIRS} PATH) + +find_library( + CRYPTOPP_LIBRARY_DEBUG + NAMES cryptopp-static cryptopp + PATHS ${_prefix_path}/debug/lib + NO_DEFAULT_PATH +) +find_library( + CRYPTOPP_LIBRARY_RELEASE + NAMES cryptopp-static cryptopp + PATHS ${_prefix_path}/lib + NO_DEFAULT_PATH +) + +unset(_prefix_path) + +include(SelectLibraryConfigurations) +select_library_configurations(CRYPTOPP) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + CryptoPP + REQUIRED_VARS CRYPTOPP_LIBRARIES CRYPTOPP_INCLUDE_DIRS +) diff --git a/ports/licensepp/fix-cmake.patch b/ports/licensepp/fix-cmake.patch new file mode 100644 index 00000000000000..f421b6d922bb6a --- /dev/null +++ b/ports/licensepp/fix-cmake.patch @@ -0,0 +1,25 @@ +diff --git "a/CMakeLists.txt" "b/CMakeLists.txt" +index b2c39d1..24a6866 100644 +--- "a/CMakeLists.txt" ++++ "b/CMakeLists.txt" +@@ -35,10 +35,8 @@ if (APPLE) + endif() + endif() + +-if(MSVC) +- list (APPEND CMAKE_CXX_FLAGS " -std=c++11 -O3 ") +-else() +- list (APPEND CMAKE_CXX_FLAGS " -std=c++11 -O3 -Wall -Werror ") ++if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -Wall -Werror") + endif() + + # Check for cryptopp (static) +@@ -73,6 +71,7 @@ endif() + set_target_properties (licensepp-lib PROPERTIES + VERSION ${LICENSEPP_SOVERSION} + ) ++target_include_directories (licensepp-lib PUBLIC $) + target_link_libraries (licensepp-lib + ${CRYPTOPP_LIBRARIES} + ) diff --git a/ports/licensepp/portfile.cmake b/ports/licensepp/portfile.cmake new file mode 100644 index 00000000000000..171b26fcc3f587 --- /dev/null +++ b/ports/licensepp/portfile.cmake @@ -0,0 +1,39 @@ +vcpkg_fail_port_install(ON_TARGET "UWP") + +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO amrayn/licensepp + REF 0b6d669c0b323be004f73d8c811d38158ce8c0c7 + SHA512 2161575815d8ff49110d7c2823662ba30d9f1ca2eb6be6dad1ee0807fb3fa9f28483839a133c9d380035254df7c452f8d6fa7f17fd4f29acd8b9bfbbda059291 + HEAD_REF master + PATCHES + # TODO: + # In this commit, https://github.com/noloader/cryptopp-pem/commit/0cfa60820ec1d5e8ac4d77a0a8786ee43e9a2400 + # the parameter orders have been changed. + # But we can not update pem-pack to this version or newer because it + # won't compile with the current version of cryptopp in `vcpkg`. + # Remove this patch in the future. + use-old-pem-pack.patch + # TODO: Remove this patch if https://github.com/amrayn/licensepp/pull/33 was merged. + fix-cmake.patch +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindCryptoPP.cmake DESTINATION ${SOURCE_PATH}/cmake) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -Dtest=OFF + -Dtravis=OFF +) + +vcpkg_install_cmake() + +vcpkg_fixup_cmake_targets(CONFIG_PATH share/${PORT}/cmake) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/licensepp/use-old-pem-pack.patch b/ports/licensepp/use-old-pem-pack.patch new file mode 100644 index 00000000000000..d7c05edaeb9d94 --- /dev/null +++ b/ports/licensepp/use-old-pem-pack.patch @@ -0,0 +1,13 @@ +diff --git a/src/external/Ripe.cc b/src/external/Ripe.cc +index 6ff9561..a1d1eec 100644 +--- a/src/external/Ripe.cc ++++ b/src/external/Ripe.cc +@@ -227,7 +227,7 @@ Ripe::KeyPair Ripe::generateRSAKeyPair(unsigned int length, const std::string& s + if (secret.empty()) { + PEM_Save(snk, privateKey); + } else { +- PEM_Save(snk, privateKey, rng, PRIVATE_RSA_ALGORITHM, secret.data(), secret.size()); ++ PEM_Save(snk, rng, privateKey, PRIVATE_RSA_ALGORITHM, secret.data(), secret.size()); + } + snk.MessageEnd(); + } diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index df31d14896496d..8d271fddd764cd 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -989,6 +989,8 @@ libxslt:x64-uwp=fail libyuv:arm-uwp=fail libyuv:x64-uwp=fail libzippp:x64-linux=ignore +licensepp:arm-uwp=fail +licensepp:x64-uwp=fail linenoise-ng:arm-uwp=fail linenoise-ng:x64-uwp=fail live555:arm64-windows=fail