mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-14 05:53:22 +08:00
[secp256k1] Update secp256k1 from 2017 to 2022 (#25398)
* Update secp256k1 from 2017 to 2022, that added Schnorr Signature on last year. - Edit CMakeList.txt to target precomputed library. - Edit libsecp256k1-config.h to undef and define VARS compilation. - Edit portfile.cmake to download new sources from repository, commit reference 44c2452fd387f7ca604ab42d73746e7d3a44d8a2 (bitcoin-core/secp256k1) - Edit vcpkg.json to new version portfile * Update secp256k1 from 2017 to 2022, that added Schnorr Signature on last year >> vcpkg x-add-version secp256k1 - Update secp256k1.json version - Update baseline.json version * Update ports/secp256k1/portfile.cmake Added JonLiu1993 suggestion. Put PREFER_NINJA to secp256k1/portfile.cmake Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> * Update ports/secp256k1/vcpkg.json Added JonLiu1993 suggestion. Put dependencies to secp256k1/vcpkg.json Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> * Update port-version, REQUIRED to "x-add-version" >> vcpkg x-add-version secp256k1 * Update port file to secp256k1 identation * Update vcpkg.json identation >> vcpkg format-manifest ports/secp256k1/vcpkg.json * Update x-add-version command vcpkg x-add-version secp256k1 * [secp256k1 ]Update secp256k1 from 2017 to 2022 * update version * Add license * update version * Update, add features * version * fix * version * clean port version * version Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> Co-authored-by: Jonliu1993 <13720414433@163.com> Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
This commit is contained in:
parent
8b62d95a81
commit
1782b7edf2
@ -2,34 +2,84 @@ cmake_minimum_required(VERSION 3.8)
|
||||
project(secp256k1 C)
|
||||
|
||||
option(INSTALL_HEADERS "Install header files" ON)
|
||||
option(BUILD_TOOLS "Build tools" OFF)
|
||||
option(BUILD_EXAMPLES "Build examples" OFF)
|
||||
|
||||
add_definitions(
|
||||
-DENABLE_MODULE_ECDH
|
||||
-DENABLE_MODULE_RECOVERY
|
||||
-DHAVE_CONFIG_H
|
||||
-DENABLE_MODULE_EXTRAKEYS
|
||||
-DENABLE_MODULE_SCHNORRSIG
|
||||
)
|
||||
|
||||
file(GLOB SOURCES src/secp256k1.c)
|
||||
add_library(secp256k1 ${SOURCES})
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
target_include_directories(secp256k1 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include;${CMAKE_CURRENT_SOURCE_DIR}/src> $<INSTALL_INTERFACE:include>)
|
||||
|
||||
target_include_directories(secp256k1 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:include>)
|
||||
file(GLOB SOURCES_PRECOMP src/precomputed_ecmult.c src/precomputed_ecmult_gen.c)
|
||||
add_library(secp256k1_precomputed ${SOURCES_PRECOMP})
|
||||
|
||||
target_include_directories(secp256k1_precomputed PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
|
||||
|
||||
if (BUILD_TOOLS)
|
||||
add_executable(bench src/bench.c)
|
||||
target_link_libraries(bench PRIVATE secp256k1 secp256k1_precomputed)
|
||||
|
||||
add_executable(bench_internal src/bench_internal.c)
|
||||
target_link_libraries(bench_internal PRIVATE secp256k1_precomputed)
|
||||
|
||||
add_executable(bench_ecmult src/bench_ecmult.c)
|
||||
target_link_libraries(bench_ecmult PRIVATE secp256k1_precomputed)
|
||||
|
||||
install(TARGETS bench bench_internal bench_ecmult RUNTIME DESTINATION bin)
|
||||
endif()
|
||||
|
||||
if (BUILD_EXAMPLES)
|
||||
add_executable(ecdsa_example examples/ecdsa.c)
|
||||
target_include_directories(ecdsa_example PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
target_link_libraries(ecdsa_example PRIVATE secp256k1 secp256k1_precomputed)
|
||||
if (WIN32)
|
||||
target_link_libraries(ecdsa_example PRIVATE Bcrypt)
|
||||
endif()
|
||||
|
||||
add_executable(ecdh_example examples/ecdh.c)
|
||||
target_include_directories(ecdh_example PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
target_link_libraries(ecdh_example PRIVATE secp256k1 secp256k1_precomputed)
|
||||
if (WIN32)
|
||||
target_link_libraries(ecdh_example PRIVATE Bcrypt)
|
||||
endif()
|
||||
|
||||
add_executable(schnorr_example examples/schnorr.c)
|
||||
target_include_directories(schnorr_example PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
target_link_libraries(schnorr_example PRIVATE secp256k1 secp256k1_precomputed)
|
||||
if (WIN32)
|
||||
target_link_libraries(schnorr_example PRIVATE Bcrypt)
|
||||
endif()
|
||||
|
||||
install(TARGETS ecdsa_example ecdh_example schnorr_example RUNTIME DESTINATION bin)
|
||||
endif()
|
||||
|
||||
if(INSTALL_HEADERS)
|
||||
file(GLOB HEADERS include/*.h)
|
||||
install(FILES ${HEADERS} DESTINATION include)
|
||||
endif()
|
||||
|
||||
install(TARGETS secp256k1 EXPORT unofficial-secp256k1-targets
|
||||
install(TARGETS secp256k1 EXPORT unofficial-secp256k1-config
|
||||
RUNTIME DESTINATION bin
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
)
|
||||
|
||||
install(TARGETS secp256k1_precomputed EXPORT unofficial-secp256k1-config
|
||||
RUNTIME DESTINATION bin
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
)
|
||||
|
||||
install(
|
||||
EXPORT unofficial-secp256k1-targets
|
||||
FILE unofficial-secp256k1-targets.cmake
|
||||
EXPORT unofficial-secp256k1-config
|
||||
FILE unofficial-secp256k1-config.cmake
|
||||
NAMESPACE unofficial::
|
||||
DESTINATION share/unofficial-secp256k1
|
||||
)
|
||||
)
|
||||
|
@ -1,29 +0,0 @@
|
||||
/**********************************************************************
|
||||
* 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 */
|
@ -2,24 +2,45 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO "bitcoin-core/secp256k1"
|
||||
REF "0b7024185045a49a1a6a4c5615bf31c94f63d9c4"
|
||||
SHA512 54e0c446ae63105800dfaf23dc934734f196c91f275db0455e58a36926c29ecc51a13d9b1eb2e45bc86199120c3c472ec7b39086787a49ce388a4df462a870bc
|
||||
REPO bitcoin-core/secp256k1
|
||||
REF 3efeb9da21368c02cad58435b2ccdf6eb4b359c3
|
||||
SHA512 6d792943f9277a1b4c36dad62389cb38e0b93efb570b6af6c41afdb936d10ca30d4c2e4e743fc0f113d1f9785891d1e9d1fe224d7b8abd4197a9f5febf0febd6
|
||||
)
|
||||
|
||||
file(COPY ${CURRENT_PORT_DIR}/libsecp256k1-config.h DESTINATION ${SOURCE_PATH})
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt 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
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
FEATURES
|
||||
tools BUILD_TOOLS
|
||||
examples BUILD_EXAMPLES
|
||||
)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
${FEATURE_OPTIONS}
|
||||
OPTIONS_DEBUG
|
||||
-DINSTALL_HEADERS=OFF
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-${PORT} TARGET_PATH share/unofficial-${PORT})
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH "share/unofficial-${PORT}" PACKAGE_NAME unofficial-${PORT})
|
||||
|
||||
if (BUILD_TOOLS OR BUILD_EXAMPLES)
|
||||
set(SECP256K1_TOOLS "")
|
||||
if (BUILD_TOOLS)
|
||||
list(APPEND SECP256K1_TOOLS bench bench_internal bench_ecmult)
|
||||
endif()
|
||||
|
||||
if (BUILD_EXAMPLES)
|
||||
list(APPEND SECP256K1_TOOLS ecdsa_example ecdh_example schnorr_example)
|
||||
endif()
|
||||
|
||||
vcpkg_copy_tools(TOOL_NAMES ${SECP256K1_TOOLS} AUTO_CLEAN)
|
||||
endif()
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/secp256k1-config.cmake ${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}/unofficial-secp256k1-config.cmake @ONLY)
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||
|
||||
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||
|
@ -1 +0,0 @@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/unofficial-secp256k1-targets.cmake")
|
@ -1,7 +1,25 @@
|
||||
{
|
||||
"name": "secp256k1",
|
||||
"version-string": "2017-19-10",
|
||||
"port-version": 4,
|
||||
"version-date": "2022-07-11",
|
||||
"description": "Optimized C library for EC operations on curve",
|
||||
"homepage": "https://github.com/bitcoin-core/secp256k1"
|
||||
"homepage": "https://github.com/bitcoin-core/secp256k1",
|
||||
"license": "MIT",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
],
|
||||
"features": {
|
||||
"examples": {
|
||||
"description": "Build examples"
|
||||
},
|
||||
"tools": {
|
||||
"description": "Build tools"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6505,8 +6505,8 @@
|
||||
"port-version": 3
|
||||
},
|
||||
"secp256k1": {
|
||||
"baseline": "2017-19-10",
|
||||
"port-version": 4
|
||||
"baseline": "2022-07-11",
|
||||
"port-version": 0
|
||||
},
|
||||
"selene": {
|
||||
"baseline": "0.3.1",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "31de2b5d2286595ff7771a30dee3c68d04e78082",
|
||||
"version-date": "2022-07-11",
|
||||
"port-version": 0
|
||||
},
|
||||
{
|
||||
"git-tree": "a0ba39af9284d60d41166c4f546975e9f2b2d9df",
|
||||
"version-string": "2017-19-10",
|
||||
|
Loading…
x
Reference in New Issue
Block a user