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

[Libtomcrypt, libtommath] new ports #10960

Merged
merged 16 commits into from
Apr 27, 2020
Merged
Show file tree
Hide file tree
Changes from 10 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: 5 additions & 0 deletions ports/libtomcrypt/CONTROL
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Source: libtomcrypt
Version: 1.18.2
Description: LibTomCrypt is a fairly comprehensive, modular and portable cryptographic toolkit that provides developers with a vast array of well known published block ciphers, one-way hash functions, chaining modes, pseudo-random number generators, public key cryptography and a plethora of other routines.
Homepage: https://www.libtom.net/LibTomCrypt/
Build-Depends: libtommath
83 changes: 83 additions & 0 deletions ports/libtomcrypt/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libtom/libtomcrypt
REF v1.18.2
SHA512 53accb4f92077ff1c52102bece270e77c497e599c392aa0bf4dbc173b6789e7e4f1012d8b5f257c438764197cb7bac8ba409a9d4e3a70e69bec5863b9495329e
HEAD_REF master
)

if(VCPKG_TARGET_IS_WINDOWS)
# Make sure we start from a clean slate
vcpkg_execute_build_process(
COMMAND nmake -f ${SOURCE_PATH}/makefile.msvc clean
WORKING_DIRECTORY ${SOURCE_PATH}
)

#Debug Build
vcpkg_execute_build_process(
COMMAND nmake -f ${SOURCE_PATH}/makefile.msvc CFLAGS="/MTd /DUSE_LTM /DLTM_DESC /I${CURRENT_PACKAGES_DIR}/.."
WORKING_DIRECTORY ${SOURCE_PATH}
)

file(INSTALL
${SOURCE_PATH}/tomcrypt.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/Debug/lib/
)

# Clean up necessary to rebuild without debug symbols
vcpkg_execute_build_process(
COMMAND nmake -f ${SOURCE_PATH}/makefile.msvc clean
WORKING_DIRECTORY ${SOURCE_PATH}
)

#Release Build
vcpkg_execute_build_process(
COMMAND nmake -f ${SOURCE_PATH}/makefile.msvc CFLAGS="/Ox /DUSE_LTM /DLTM_DESC /I${CURRENT_PACKAGES_DIR}/.."
WORKING_DIRECTORY ${SOURCE_PATH}
)

file(INSTALL
${SOURCE_PATH}/tomcrypt.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/lib/
)

file(INSTALL
${SOURCE_PATH}/src/headers/
DESTINATION ${CURRENT_PACKAGES_DIR}/include
)
else()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(MAKE_FILE "makefile.shared")
else()
set(MAKE_FILE "makefile")
endif()

vcpkg_execute_build_process(
COMMAND make -f ${MAKE_FILE} clean
WORKING_DIRECTORY ${SOURCE_PATH}
)

vcpkg_execute_build_process(
COMMAND make -j4 -f ${MAKE_FILE} PREFIX=${CURRENT_PACKAGES_DIR}/Debug LTC_DEBUG=1 CFLAGS="-DUSE_LTM -DLTM_DESC " install
WORKING_DIRECTORY ${SOURCE_PATH}
)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/Debug/include")

vcpkg_execute_build_process(
COMMAND make -f ${MAKE_FILE} clean
WORKING_DIRECTORY ${SOURCE_PATH}
)

vcpkg_execute_build_process(
COMMAND make -j4 -f ${MAKE_FILE} PREFIX=${CURRENT_PACKAGES_DIR} CFLAGS="-DUSE_LTM -DLTM_DESC " install
WORKING_DIRECTORY ${SOURCE_PATH}
)

endif()

#Copy license
file(
INSTALL
${SOURCE_PATH}/LICENSE
DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright
)
4 changes: 4 additions & 0 deletions ports/libtommath/CONTROL
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Source: libtommath
Version: 1.2.0
Description: LibTomMath is a free open source portable number theoretic multiple-precision integer library written entirely in C.
Homepage: https://www.libtom.net/LibTomMath/
80 changes: 80 additions & 0 deletions ports/libtommath/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libtom/libtommath
REF v1.2.0
SHA512 500bce4467d6cdb0b014e6c66d3b994a8d63b51475db6c3cd77c15c8368fbab4e3b5c458fcd5b35838b74c457a33c15b42d2356964f5ef2a0bd31fd544735c9a
HEAD_REF master
)

if(VCPKG_TARGET_IS_WINDOWS)
# Make sure we start from a clean slate
vcpkg_execute_build_process(
COMMAND nmake -f ${SOURCE_PATH}/makefile.msvc clean
WORKING_DIRECTORY ${SOURCE_PATH}
)

#Debug Build
vcpkg_execute_build_process(
COMMAND nmake -f ${SOURCE_PATH}/makefile.msvc CFLAGS="/MTd"
WORKING_DIRECTORY ${SOURCE_PATH}/
)

file(INSTALL
${SOURCE_PATH}/tommath.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/Debug/lib
)

# Clean up necessary to rebuild without debug symbols
vcpkg_execute_build_process(
COMMAND nmake -f ${SOURCE_PATH}/makefile.msvc clean
WORKING_DIRECTORY ${SOURCE_PATH}
)

vcpkg_execute_build_process(
COMMAND nmake -f ${SOURCE_PATH}/makefile.msvc
WORKING_DIRECTORY ${SOURCE_PATH}/
)

file(INSTALL
${SOURCE_PATH}/tommath.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/lib
)

file(INSTALL
${SOURCE_PATH}/tommath.h
DESTINATION ${CURRENT_PACKAGES_DIR}/include
)
else()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(MAKE_FILE "makefile.shared")
else()
set(MAKE_FILE "makefile")
endif()

vcpkg_execute_build_process(
COMMAND make -f ${MAKE_FILE} clean
WORKING_DIRECTORY ${SOURCE_PATH}
)

vcpkg_execute_build_process(
COMMAND make -j4 -f ${MAKE_FILE} PREFIX=${CURRENT_PACKAGES_DIR}/Debug COMPILE_DEBUG=1 install
WORKING_DIRECTORY ${SOURCE_PATH}
)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/Debug/include")

vcpkg_execute_build_process(
COMMAND make -f ${MAKE_FILE} clean
WORKING_DIRECTORY ${SOURCE_PATH}
)

vcpkg_execute_build_process(
COMMAND make -j4 -f ${MAKE_FILE} PREFIX=${CURRENT_PACKAGES_DIR} install
WORKING_DIRECTORY ${SOURCE_PATH}
)
endif()

file(INSTALL
${SOURCE_PATH}/LICENSE
DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright
)
3 changes: 3 additions & 0 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,9 @@ libstk:arm-uwp=fail
libstk:x64-uwp=fail
libtins:arm-uwp=fail
libtins:x64-uwp=fail
libtomcrypt:arm64-windows=fail
libtomcrypt:arm-uwp=fail
libtomcrypt:x64-windows-static=fail
libtorrent:arm-uwp=fail
libtorrent:x64-uwp=fail
libudis86:arm-uwp=fail
Expand Down