aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Karatarakis <alex@karatarakis.com>2016-10-25 13:53:12 -0700
committerGitHub <noreply@github.com>2016-10-25 13:53:12 -0700
commitdcc843154aa1c2db93257913efdf00258670d750 (patch)
treee057cd5d1cd67b36242b6e912f8aed74966a0c8c
parent4d961946170bdb7129ac85c0913ac5b508ac7a2b (diff)
parentb9495bab4ba42fda7c4957fc646ea13ab6d98c74 (diff)
downloadvcpkg-dcc843154aa1c2db93257913efdf00258670d750.tar.gz
vcpkg-dcc843154aa1c2db93257913efdf00258670d750.zip
Merge pull request #214 from codeandroid/add-cryptopp
Add Crypto++ port
-rw-r--r--ports/cryptopp/CONTROL3
-rw-r--r--ports/cryptopp/portfile.cmake42
2 files changed, 45 insertions, 0 deletions
diff --git a/ports/cryptopp/CONTROL b/ports/cryptopp/CONTROL
new file mode 100644
index 000000000..2a38d8910
--- /dev/null
+++ b/ports/cryptopp/CONTROL
@@ -0,0 +1,3 @@
+Source: cryptopp
+Version: 5.6.5
+Description: Crypto++ is a free C++ class library of cryptographic schemes.
diff --git a/ports/cryptopp/portfile.cmake b/ports/cryptopp/portfile.cmake
new file mode 100644
index 000000000..e80c541b7
--- /dev/null
+++ b/ports/cryptopp/portfile.cmake
@@ -0,0 +1,42 @@
+include(${CMAKE_TRIPLET_FILE})
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/cryptopp-CRYPTOPP_5_6_5)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/weidai11/cryptopp/archive/CRYPTOPP_5_6_5.zip"
+ FILENAME "CRYPTOPP_5_6_5.zip"
+ SHA512 abca8089e2d587f59c503d2d6412b3128d061784349c735f3ee46be1cb9e3d0d0fed9a9173765fa033eb2dc744e03810de45b8cc2f8ca1672a36e4123648ea44
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+# Dynamic linking should be avoided for Crypto++ to reduce the attack surface,
+# so generate a static lib for both dynamic and static vcpkg targets.
+# See also:
+# https://www.cryptopp.com/wiki/Visual_Studio#Dynamic_Runtime_Linking
+# https://www.cryptopp.com/wiki/Visual_Studio#The_DLL
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DBUILD_SHARED=OFF
+ -DBUILD_STATIC=ON
+ -DBUILD_TESTING=OFF
+ -DBUILD_DOCUMENTATION=OFF
+)
+
+vcpkg_install_cmake()
+
+# There is no way to suppress installation of the headers and resource files in debug build.
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
+
+# Remove executables
+file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/cryptest.exe)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/cryptest.exe)
+
+# Remove other files not required in package
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/License.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/cryptopp)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/cryptopp/License.txt ${CURRENT_PACKAGES_DIR}/share/cryptopp/copyright)