Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[licensepp] Add new port #11711

Merged
merged 15 commits into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ports/cryptopp/CONTROL
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions ports/cryptopp/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 6 additions & 0 deletions ports/licensepp/CONTROL
Original file line number Diff line number Diff line change
@@ -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
27 changes: 27 additions & 0 deletions ports/licensepp/FindCryptoPP.cmake
Original file line number Diff line number Diff line change
@@ -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
)
25 changes: 25 additions & 0 deletions ports/licensepp/fix-cmake.patch
Original file line number Diff line number Diff line change
@@ -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}
)
39 changes: 39 additions & 0 deletions ports/licensepp/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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)
13 changes: 13 additions & 0 deletions ports/licensepp/use-old-pem-pack.patch
Original file line number Diff line number Diff line change
@@ -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();
}
2 changes: 2 additions & 0 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down