Skip to content

Commit cb537a2

Browse files
authored
[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 726e3ce. 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
1 parent 1901067 commit cb537a2

File tree

8 files changed

+132
-1
lines changed

8 files changed

+132
-1
lines changed

ports/cryptopp/CONTROL

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
Source: cryptopp
2-
Version: 8.2.0-1
2+
Version: 8.2.0-2
33
Homepage: https://github.com/weidai11/cryptopp
44
Description: Crypto++ is a free C++ class library of cryptographic schemes.
5+
6+
Feature: pem-pack
7+
Description: Crypto++ with PEM pack

ports/cryptopp/portfile.cmake

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,22 @@ vcpkg_from_github(
2424
file(COPY ${CMAKE_SOURCE_PATH}/cryptopp-config.cmake DESTINATION ${SOURCE_PATH})
2525
file(COPY ${CMAKE_SOURCE_PATH}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
2626

27+
if("pem-pack" IN_LIST FEATURES)
28+
vcpkg_from_github(
29+
OUT_SOURCE_PATH PEM_PACK_SOURCE_PATH
30+
REPO noloader/cryptopp-pem
31+
REF 095f08ff2ef9bca7b81036a59f2395e4f08ce2e8
32+
SHA512 49912758a635faca1f49665ac9552b20576b46e0283aaabc19bb012bdc80586106452018e5088b9b46967717982ca6022ca968edc4cac96a7506d2b1a3e4bf13
33+
HEAD_REF master
34+
)
35+
36+
file(GLOB PEM_PACK_FILES
37+
${PEM_PACK_SOURCE_PATH}/*.h
38+
${PEM_PACK_SOURCE_PATH}/*.cpp
39+
)
40+
file(COPY ${PEM_PACK_FILES} DESTINATION ${SOURCE_PATH})
41+
endif()
42+
2743
# disable assembly on OSX and ARM Windows to fix broken build
2844
if (VCPKG_TARGET_IS_OSX)
2945
set(CRYPTOPP_DISABLE_ASM "ON")

ports/licensepp/CONTROL

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Source: licensepp
2+
Version: 2020-05-19
3+
Description: Cross platform software licensing library
4+
Build-Depends: cryptopp[pem-pack]
5+
Supports: !uwp
6+
Homepage: https://github.com/zuhd-org/licensepp

ports/licensepp/FindCryptoPP.cmake

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
find_path(CRYPTOPP_INCLUDE_DIRS NAMES cryptopp/cryptlib.h)
2+
3+
get_filename_component(_prefix_path ${CRYPTOPP_INCLUDE_DIRS} PATH)
4+
5+
find_library(
6+
CRYPTOPP_LIBRARY_DEBUG
7+
NAMES cryptopp-static cryptopp
8+
PATHS ${_prefix_path}/debug/lib
9+
NO_DEFAULT_PATH
10+
)
11+
find_library(
12+
CRYPTOPP_LIBRARY_RELEASE
13+
NAMES cryptopp-static cryptopp
14+
PATHS ${_prefix_path}/lib
15+
NO_DEFAULT_PATH
16+
)
17+
18+
unset(_prefix_path)
19+
20+
include(SelectLibraryConfigurations)
21+
select_library_configurations(CRYPTOPP)
22+
23+
include(FindPackageHandleStandardArgs)
24+
find_package_handle_standard_args(
25+
CryptoPP
26+
REQUIRED_VARS CRYPTOPP_LIBRARIES CRYPTOPP_INCLUDE_DIRS
27+
)

ports/licensepp/fix-cmake.patch

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
diff --git "a/CMakeLists.txt" "b/CMakeLists.txt"
2+
index b2c39d1..24a6866 100644
3+
--- "a/CMakeLists.txt"
4+
+++ "b/CMakeLists.txt"
5+
@@ -35,10 +35,8 @@ if (APPLE)
6+
endif()
7+
endif()
8+
9+
-if(MSVC)
10+
- list (APPEND CMAKE_CXX_FLAGS " -std=c++11 -O3 ")
11+
-else()
12+
- list (APPEND CMAKE_CXX_FLAGS " -std=c++11 -O3 -Wall -Werror ")
13+
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
14+
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -Wall -Werror")
15+
endif()
16+
17+
# Check for cryptopp (static)
18+
@@ -73,6 +71,7 @@ endif()
19+
set_target_properties (licensepp-lib PROPERTIES
20+
VERSION ${LICENSEPP_SOVERSION}
21+
)
22+
+target_include_directories (licensepp-lib PUBLIC $<INSTALL_INTERFACE:include>)
23+
target_link_libraries (licensepp-lib
24+
${CRYPTOPP_LIBRARIES}
25+
)

ports/licensepp/portfile.cmake

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
vcpkg_fail_port_install(ON_TARGET "UWP")
2+
3+
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
4+
5+
vcpkg_from_github(
6+
OUT_SOURCE_PATH SOURCE_PATH
7+
REPO amrayn/licensepp
8+
REF 0b6d669c0b323be004f73d8c811d38158ce8c0c7
9+
SHA512 2161575815d8ff49110d7c2823662ba30d9f1ca2eb6be6dad1ee0807fb3fa9f28483839a133c9d380035254df7c452f8d6fa7f17fd4f29acd8b9bfbbda059291
10+
HEAD_REF master
11+
PATCHES
12+
# TODO:
13+
# In this commit, https://github.com/noloader/cryptopp-pem/commit/0cfa60820ec1d5e8ac4d77a0a8786ee43e9a2400
14+
# the parameter orders have been changed.
15+
# But we can not update pem-pack to this version or newer because it
16+
# won't compile with the current version of cryptopp in `vcpkg`.
17+
# Remove this patch in the future.
18+
use-old-pem-pack.patch
19+
# TODO: Remove this patch if https://github.com/amrayn/licensepp/pull/33 was merged.
20+
fix-cmake.patch
21+
)
22+
23+
file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindCryptoPP.cmake DESTINATION ${SOURCE_PATH}/cmake)
24+
25+
vcpkg_configure_cmake(
26+
SOURCE_PATH ${SOURCE_PATH}
27+
PREFER_NINJA
28+
OPTIONS
29+
-Dtest=OFF
30+
-Dtravis=OFF
31+
)
32+
33+
vcpkg_install_cmake()
34+
35+
vcpkg_fixup_cmake_targets(CONFIG_PATH share/${PORT}/cmake)
36+
37+
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
38+
39+
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/src/external/Ripe.cc b/src/external/Ripe.cc
2+
index 6ff9561..a1d1eec 100644
3+
--- a/src/external/Ripe.cc
4+
+++ b/src/external/Ripe.cc
5+
@@ -227,7 +227,7 @@ Ripe::KeyPair Ripe::generateRSAKeyPair(unsigned int length, const std::string& s
6+
if (secret.empty()) {
7+
PEM_Save(snk, privateKey);
8+
} else {
9+
- PEM_Save(snk, privateKey, rng, PRIVATE_RSA_ALGORITHM, secret.data(), secret.size());
10+
+ PEM_Save(snk, rng, privateKey, PRIVATE_RSA_ALGORITHM, secret.data(), secret.size());
11+
}
12+
snk.MessageEnd();
13+
}

scripts/ci.baseline.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,8 @@ libxslt:x64-uwp=fail
989989
libyuv:arm-uwp=fail
990990
libyuv:x64-uwp=fail
991991
libzippp:x64-linux=ignore
992+
licensepp:arm-uwp=fail
993+
licensepp:x64-uwp=fail
992994
linenoise-ng:arm-uwp=fail
993995
linenoise-ng:x64-uwp=fail
994996
live555:arm64-windows=fail

0 commit comments

Comments
 (0)