1 |
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
6 |
inherit autotools
|
7 |
7 |
|
8 |
8 |
MyPN=secp256k1
|
9 |
9 |
DESCRIPTION="Optimized C library for EC operations on curve secp256k1"
|
10 |
10 |
HOMEPAGE="https://github.com/bitcoin-core/secp256k1"
|
11 |
|
COMMITHASH="3967d96bf184519eb98b766af665b4d4b072563e"
|
12 |
|
SRC_URI="https://github.com/bitcoin-core/${MyPN}/archive/${COMMITHASH}.tar.gz -> ${PN}-v${PV}.tgz"
|
|
11 |
SRC_URI="https://github.com/bitcoin-core/secp256k1/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
13 |
12 |
|
14 |
13 |
LICENSE="MIT"
|
15 |
|
SLOT="0"
|
16 |
|
KEYWORDS="amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 x86 ~amd64-linux ~x86-linux"
|
17 |
|
IUSE="+asm ecdh +experimental +extrakeys gmp lowmem +recovery +schnorr test test-openssl valgrind"
|
|
14 |
SLOT="0/2" # subslot is "$((_LIB_VERSION_CURRENT-_LIB_VERSION_AGE))" from configure.ac
|
|
15 |
KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
|
|
16 |
IUSE="+asm +ecdh experimental +extrakeys lowmem +recovery +schnorr test valgrind"
|
18 |
17 |
RESTRICT="!test? ( test )"
|
19 |
18 |
|
20 |
19 |
REQUIRED_USE="
|
21 |
20 |
asm? ( || ( amd64 arm ) arm? ( experimental ) )
|
22 |
|
extrakeys? ( experimental )
|
23 |
|
schnorr? ( experimental extrakeys )
|
24 |
|
test-openssl? ( test )
|
|
21 |
schnorr? ( extrakeys )
|
25 |
22 |
"
|
26 |
|
RDEPEND="
|
27 |
|
gmp? ( dev-libs/gmp:0= )
|
28 |
|
"
|
29 |
|
DEPEND="${RDEPEND}
|
|
23 |
BDEPEND="
|
|
24 |
sys-devel/autoconf-archive
|
30 |
25 |
virtual/pkgconfig
|
31 |
|
test-openssl? ( dev-libs/openssl:0 )
|
32 |
26 |
valgrind? ( dev-util/valgrind )
|
33 |
27 |
"
|
34 |
28 |
|
35 |
|
S="${WORKDIR}/${MyPN}-${COMMITHASH}"
|
|
29 |
PATCHES=(
|
|
30 |
"${FILESDIR}/0.2.0-fix-cross-compile.patch"
|
|
31 |
)
|
|
32 |
|
|
33 |
S="${WORKDIR}/${MyPN}-${PV}"
|
36 |
34 |
|
37 |
35 |
src_prepare() {
|
38 |
36 |
default
|
39 |
37 |
eautoreconf
|
|
38 |
|
|
39 |
# Generate during build
|
|
40 |
rm -f src/precomputed_ecmult.c src/precomputed_ecmult_gen.c || die
|
40 |
41 |
}
|
41 |
42 |
|
42 |
43 |
src_configure() {
|
43 |
|
local asm_opt
|
|
44 |
local myeconfargs=(
|
|
45 |
--disable-benchmark
|
|
46 |
$(use_enable experimental)
|
|
47 |
$(use_enable test tests)
|
|
48 |
$(use_enable test exhaustive-tests)
|
|
49 |
$(use_enable {,module-}ecdh)
|
|
50 |
$(use_enable {,module-}extrakeys)
|
|
51 |
$(use_enable {,module-}recovery)
|
|
52 |
$(use_enable schnorr module-schnorrsig)
|
|
53 |
$(usev lowmem '--with-ecmult-window=4 --with-ecmult-gen-precision=2')
|
|
54 |
$(use_with valgrind)
|
|
55 |
)
|
44 |
56 |
if use asm; then
|
45 |
57 |
if use arm; then
|
46 |
|
asm_opt=arm
|
|
58 |
myeconfargs+=( --with-asm=arm )
|
47 |
59 |
else
|
48 |
|
asm_opt=auto
|
|
60 |
myeconfargs+=( --with-asm=auto )
|
49 |
61 |
fi
|
50 |
62 |
else
|
51 |
|
asm_opt=no
|
|
63 |
myeconfargs+=( --with-asm=no )
|
52 |
64 |
fi
|
53 |
|
econf \
|
54 |
|
--disable-benchmark \
|
55 |
|
$(use_enable experimental) \
|
56 |
|
$(use_enable test tests) \
|
57 |
|
$(use_enable test exhaustive-tests) \
|
58 |
|
$(use_enable test-openssl openssl-tests) \
|
59 |
|
$(use_enable ecdh module-ecdh) \
|
60 |
|
$(use_enable extrakeys module-extrakeys) \
|
61 |
|
--with-asm=${asm_opt} \
|
62 |
|
--with-bignum=$(usex gmp gmp no) \
|
63 |
|
$(use_enable recovery module-recovery) \
|
64 |
|
$(use_enable schnorr module-schnorrsig) \
|
65 |
|
$(usex lowmem '--with-ecmult-window=4 --with-ecmult-gen-precision=2' '') \
|
66 |
|
$(use_with valgrind) \
|
67 |
|
--disable-static
|
|
65 |
|
|
66 |
econf "${myeconfargs[@]}"
|
68 |
67 |
}
|
69 |
68 |
|
70 |
69 |
src_install() {
|
71 |
70 |
default
|
72 |
|
find "${D}" -name '*.la' -delete || die
|
|
71 |
find "${ED}" -name '*.la' -delete || die
|
73 |
72 |
}
|