Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/libtomcrypt/
Date: Wed, 11 May 2022 01:20:22
Message-Id: 1652231995.19f1abf39264849e318e821adf4c825acc7421f0.sam@gentoo
1 commit: 19f1abf39264849e318e821adf4c825acc7421f0
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 11 01:19:55 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Wed May 11 01:19:55 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=19f1abf3
7
8 dev-libs/libtomcrypt: fix EPREFIX usage
9
10 Closes: https://bugs.gentoo.org/843632
11 Thanks-to: François-Xavier Carton <fx.carton91 <AT> gmail.com>
12 Signed-off-by: Sam James <sam <AT> gentoo.org>
13
14 dev-libs/libtomcrypt/libtomcrypt-1.18.2-r4.ebuild | 114 ++++++++++++++++++++++
15 1 file changed, 114 insertions(+)
16
17 diff --git a/dev-libs/libtomcrypt/libtomcrypt-1.18.2-r4.ebuild b/dev-libs/libtomcrypt/libtomcrypt-1.18.2-r4.ebuild
18 new file mode 100644
19 index 000000000000..8fa4c04203ff
20 --- /dev/null
21 +++ b/dev-libs/libtomcrypt/libtomcrypt-1.18.2-r4.ebuild
22 @@ -0,0 +1,114 @@
23 +# Copyright 1999-2022 Gentoo Authors
24 +# Distributed under the terms of the GNU General Public License v2
25 +
26 +EAPI=7
27 +
28 +inherit toolchain-funcs
29 +
30 +DESCRIPTION="LibTomCrypt is a comprehensive, modular and portable cryptographic toolkit"
31 +HOMEPAGE="https://www.libtom.net/LibTomCrypt/ https://github.com/libtom/libtomcrypt"
32 +SRC_URI="
33 + https://github.com/libtom/${PN}/releases/download/v${PV}/crypt-${PV}.tar.xz
34 + -> ${P}.tar.xz"
35 +
36 +LICENSE="|| ( WTFPL-2 public-domain )"
37 +# Current SONAME is 1
38 +# Please bump when the ABI changes upstream
39 +# Helpful site:
40 +# https://abi-laboratory.pro/index.php?view=timeline&l=libtomcrypt
41 +SLOT="0/1"
42 +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
43 +IUSE="+gmp +libtommath tomsfastmath"
44 +
45 +# Enforce at least one math provider
46 +# bug #772935
47 +REQUIRED_USE="|| ( gmp libtommath tomsfastmath )"
48 +
49 +BDEPEND="
50 + sys-devel/libtool
51 + virtual/pkgconfig
52 +"
53 +DEPEND="
54 + gmp? ( dev-libs/gmp:= )
55 + libtommath? ( dev-libs/libtommath:= )
56 + tomsfastmath? ( dev-libs/tomsfastmath:= )
57 +"
58 +RDEPEND="${DEPEND}"
59 +
60 +PATCHES=(
61 + "${FILESDIR}"/${P}-slibtool.patch
62 +)
63 +
64 +mymake() {
65 + # Standard boilerplate
66 + # Upstream use homebrewed makefiles
67 + # Best to use same args for all, for consistency,
68 + # in case behaviour changes (v possible).
69 + local enabled_features=()
70 + local extra_libs=()
71 +
72 + # Build support as appropriate for consumers (MPI)
73 + if use gmp; then
74 + enabled_features+=( -DGMP_DESC=1 )
75 + extra_libs+=( -lgmp )
76 + fi
77 + if use libtommath; then
78 + enabled_features+=( -DLTM_DESC=1 )
79 + extra_libs+=( -ltommath )
80 + fi
81 + if use tomsfastmath; then
82 + enabled_features+=( -DTFM_DESC=1 )
83 + extra_libs+=( -ltfm )
84 + fi
85 +
86 + # For the test and example binaries, we have to choose
87 + # which MPI we want to use.
88 + # For now (see src_test), arbitrarily choose:
89 + # gmp > libtommath > tomsfastmath > none
90 + if use gmp ; then
91 + enabled_features+=( -DUSE_GMP=1 )
92 + elif use libtommath ; then
93 + enabled_features+=( -DUSE_LTM=1 )
94 + elif use tomsfastmath ; then
95 + enabled_features+=( -DUSE_TFM=1 )
96 + fi
97 +
98 + # IGNORE_SPEED=1 is needed to respect CFLAGS
99 + EXTRALIBS="${extra_libs[*]}" emake \
100 + CFLAGS="${CFLAGS} ${enabled_features[*]}" \
101 + CC="$(tc-getCC)" \
102 + AR="$(tc-getAR)" \
103 + RANLIB="$(tc-getRANLIB)" \
104 + LIBPATH="${EPREFIX}/usr/$(get_libdir)" \
105 + INCPATH="${EPREFIX}/usr/include" \
106 + IGNORE_SPEED=1 \
107 + PREFIX="${EPREFIX}/usr" \
108 + "${@}"
109 +}
110 +
111 +src_compile() {
112 + # Replace hard-coded libdir=${exec_prefix}/lib.
113 + sed -i -e "/libdir=/s:/lib:/$(get_libdir):" libtomcrypt.pc.in || die
114 +
115 + mymake -f makefile.shared library
116 +}
117 +
118 +src_test() {
119 + # libtomcrypt can build with several MPI providers
120 + # but the tests can only be built with one at a time.
121 + # When the next release (> 1.18.2) containing
122 + # 1) https://github.com/libtom/libtomcrypt/commit/a65cfb8dbe4
123 + # 2) https://github.com/libtom/libtomcrypt/commit/fdc6cd20137
124 + # is made, we can run tests for each provider.
125 + mymake test
126 + ./test || die "Running tests failed"
127 +}
128 +
129 +src_install() {
130 + mymake -f makefile.shared \
131 + DATAPATH="${EPREFIX}/usr/share/doc/${PF}" \
132 + DESTDIR="${D}" \
133 + install install_docs
134 +
135 + find "${ED}" '(' -name '*.la' -o -name '*.a' ')' -delete || die
136 +}