[licensepp] Add new port (#11711)

* [licensepp] Add new port

* [cryptopp-pem] Update to a newer version that will make lincensepp happy

* Revert "[cryptopp-pem] Update to a newer version that will make lincensepp happy"

This reverts commit 726e3ce3d20bc6266bc7bf63cb35572fe297869f.

This version can not compile with cryptopp.

* [licensepp] Finish it

* [licensepp] Fix interface include directory

* [licensepp] Fixup cmake targets

* [licensepp] -O3 is not recognised by msvc

* [licensepp] Fix _iterator_debug_level value mismatch

* [licensepp] Update patch file

* [licensepp] Fail fast on UWP

* [licensepp] Simplify patch file

* [licensepp] Tabs -> Spaces
This commit is contained in:
myd7349 2020-06-11 16:00:07 +08:00 committed by GitHub
parent 1901067fc6
commit cb537a2aee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 132 additions and 1 deletions

View File

@ -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

View File

@ -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")

6
ports/licensepp/CONTROL Normal file
View File

@ -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

View File

@ -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
)

View File

@ -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 $<INSTALL_INTERFACE:include>)
target_link_libraries (licensepp-lib
${CRYPTOPP_LIBRARIES}
)

View File

@ -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)

View File

@ -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();
}

View File

@ -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