diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-10-19 19:56:52 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-10-19 19:56:52 -0700 |
| commit | c4ceadcc8882a2849a332de933f41cd8499a51dc (patch) | |
| tree | febfd75551a9c894ea3226cfed5bd8641d2aba1e | |
| parent | deee8c1743af2d851d48d42b7ac91558c8fefb5a (diff) | |
| parent | 976195245f6336632da22df5a5682dc824c6b48c (diff) | |
| download | vcpkg-c4ceadcc8882a2849a332de933f41cd8499a51dc.tar.gz vcpkg-c4ceadcc8882a2849a332de933f41cd8499a51dc.zip | |
Merge pull request #2005 from sipsorcery/port_secp256k1
Port for secp256k1 crypto library
| -rw-r--r-- | ports/secp256k1/CMakeLists.txt | 26 | ||||
| -rw-r--r-- | ports/secp256k1/CONTROL | 3 | ||||
| -rw-r--r-- | ports/secp256k1/libsecp256k1-config.h | 29 | ||||
| -rw-r--r-- | ports/secp256k1/portfile.cmake | 28 |
4 files changed, 86 insertions, 0 deletions
diff --git a/ports/secp256k1/CMakeLists.txt b/ports/secp256k1/CMakeLists.txt new file mode 100644 index 000000000..d439053bc --- /dev/null +++ b/ports/secp256k1/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.8) +project(secp256k1 C) + +option(INSTALL_HEADERS "Install header files" ON) + +add_definitions( + -DENABLE_MODULE_ECDH + -DENABLE_MODULE_RECOVERY + -DHAVE_CONFIG_H +) + +file(GLOB SOURCES src/secp256k1.c) +add_library(secp256k1 ${SOURCES}) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +install(TARGETS secp256k1 + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib +) + +if(INSTALL_HEADERS) + file(GLOB HEADERS include/secp256k1.h) + install(FILES ${HEADERS} DESTINATION include) +endif()
\ No newline at end of file diff --git a/ports/secp256k1/CONTROL b/ports/secp256k1/CONTROL new file mode 100644 index 000000000..181a4a7e6 --- /dev/null +++ b/ports/secp256k1/CONTROL @@ -0,0 +1,3 @@ +Source: secp256k1 +Version: 2017-19-10-0b7024185045a49a1a6a4c5615bf31c94f63d9c4 +Description: Optimized C library for EC operations on curve diff --git a/ports/secp256k1/libsecp256k1-config.h b/ports/secp256k1/libsecp256k1-config.h new file mode 100644 index 000000000..693d3ed25 --- /dev/null +++ b/ports/secp256k1/libsecp256k1-config.h @@ -0,0 +1,29 @@ +/********************************************************************** + * Copyright (c) 2013, 2014 Pieter Wuille * + * Distributed under the MIT software license, see the accompanying * + * file COPYING or http://www.opensource.org/licenses/mit-license.php.* + **********************************************************************/ + +#ifndef SECP256K1_BASIC_CONFIG_H +#define SECP256K1_BASIC_CONFIG_H + +#undef USE_ASM_X86_64 +#undef USE_ENDOMORPHISM +#undef USE_FIELD_10X26 +#undef USE_FIELD_5X52 +#undef USE_FIELD_INV_BUILTIN +#undef USE_FIELD_INV_NUM +#undef USE_NUM_GMP +#undef USE_NUM_NONE +#undef USE_SCALAR_4X64 +#undef USE_SCALAR_8X32 +#undef USE_SCALAR_INV_BUILTIN +#undef USE_SCALAR_INV_NUM + +#define USE_NUM_NONE 1 +#define USE_FIELD_INV_BUILTIN 1 +#define USE_SCALAR_INV_BUILTIN 1 +#define USE_FIELD_10X26 1 +#define USE_SCALAR_8X32 1 + +#endif /* SECP256K1_BASIC_CONFIG_H */ diff --git a/ports/secp256k1/portfile.cmake b/ports/secp256k1/portfile.cmake new file mode 100644 index 000000000..2012c4827 --- /dev/null +++ b/ports/secp256k1/portfile.cmake @@ -0,0 +1,28 @@ +include(vcpkg_common_functions) + +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + message(STATUS "Warning: Dynamic building not supported yet. Building static.") + set(VCPKG_LIBRARY_LINKAGE static) +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO "bitcoin-core/secp256k1" + REF "0b7024185045a49a1a6a4c5615bf31c94f63d9c4" + SHA512 54e0c446ae63105800dfaf23dc934734f196c91f275db0455e58a36926c29ecc51a13d9b1eb2e45bc86199120c3c472ec7b39086787a49ce388a4df462a870bc +) + +file(COPY ${CURRENT_PORT_DIR}/libsecp256k1-config.h DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS_DEBUG + -DINSTALL_HEADERS=OFF +) + +vcpkg_install_cmake() + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/secp256k1 RENAME copyright) |
