Skip to content

Commit d24e0a5

Browse files
bthomeemathbunnyru
andauthored
Add secp256k1 recipe (#24)
Co-authored-by: Ayaz Salikhov <asalikhov@ripple.com> Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
1 parent 939700e commit d24e0a5

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed

.github/workflows/export.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
conan export ed25519/all --version=2015.03
3939
conan export grpc/all --version=1.72.0
4040
conan export m4/all --version=1.4.19
41+
conan export secp256k1/all --version=0.7.0
4142
conan export snappy/all --version=1.1.10
4243
conan export soci/all --version=4.0.3
4344
conan export wasm-xrplf/all --version=2.4.1-xrplf
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
sources:
2+
"0.7.0":
3+
url: https://github.com/bitcoin-core/secp256k1/archive/refs/tags/v0.7.0.tar.gz
4+
sha256: 073d19064f3600014750d6949b31a0c957aa7b98920fb4aaa495be07e8e7cd00

recipes/secp256k1/all/conanfile.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
from conan import ConanFile, tools
2+
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
3+
from conan.tools.files import get
4+
5+
required_conan_version = ">=2.0.0"
6+
7+
8+
class SecpConan(ConanFile):
9+
name = "secp256k1"
10+
description = "High-performance high-assurance C library for digital signatures and other cryptographic primitives on the secp256k1 elliptic curve."
11+
url = "https://github.com/bitcoin-core/secp256k1.git"
12+
package_type = "library"
13+
settings = "os", "arch", "compiler", "build_type"
14+
options = {"shared": [True, False], "fPIC": [True, False]}
15+
default_options = {"shared": False, "fPIC": True}
16+
17+
def config_options(self):
18+
if self.settings.os == "Windows":
19+
del self.options.fPIC
20+
21+
def layout(self):
22+
cmake_layout(self, src_folder="src")
23+
24+
def source(self):
25+
get(self, **self.conan_data["sources"][self.version], strip_root=True)
26+
27+
def generate(self):
28+
tc = CMakeToolchain(self)
29+
# Disable all tests and benchmarks.
30+
tc.variables["SECP256K1_INSTALL"] = True
31+
tc.variables["SECP256K1_BUILD_BENCHMARK"] = False
32+
tc.variables["SECP256K1_BUILD_TESTS"] = False
33+
tc.variables["SECP256K1_BUILD_EXHAUSTIVE_TESTS"] = False
34+
tc.variables["SECP256K1_BUILD_CTIME_TESTS"] = False
35+
tc.variables["SECP256K1_BUILD_EXAMPLES"] = False
36+
tc.generate()
37+
38+
def build(self):
39+
cmake = CMake(self)
40+
cmake.verbose = True
41+
cmake.configure()
42+
cmake.build()
43+
44+
def package(self):
45+
cmake = CMake(self)
46+
cmake.verbose = True
47+
cmake.install()
48+
49+
def package_info(self):
50+
self.cpp_info.libs = ["secp256k1"]
51+
self.cpp_info.set_property("cmake_file_name", "secp256k1")
52+
self.cpp_info.set_property("cmake_target_name", "secp256k1::secp256k1")

recipes/secp256k1/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
versions:
2+
"0.7.0":
3+
folder: all

0 commit comments

Comments
 (0)