summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2020-12-20 05:45:27 +0000
committerMichał Górny <mgorny@gentoo.org>2020-12-20 12:35:45 +0100
commitfb94282713e3a94fb240088227bf0f3b982a438b (patch)
tree695d9055dc1e8458c3df1006650049ccdd7b5b4a /dev-libs/tomsfastmath
parentdev-libs/crypto++: adopt package (diff)
downloadgentoo-fb94282713e3a94fb240088227bf0f3b982a438b.tar.gz
gentoo-fb94282713e3a94fb240088227bf0f3b982a438b.tar.bz2
gentoo-fb94282713e3a94fb240088227bf0f3b982a438b.zip
dev-libs/tomsfastmath: compatibility patch for (incoming) libtomcrypt
In a yet unreleased version of tomsfastmath, this patch was added to export a needed symbol which libtomcrypt makes use of. Include it so that libtomcrypt can be built against tomsfastmath if desired. Signed-off-by: Sam James <sam@gentoo.org> Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-libs/tomsfastmath')
-rw-r--r--dev-libs/tomsfastmath/files/tomsfastmath-0.13.1-export-fp_isprime_ex.patch13
-rw-r--r--dev-libs/tomsfastmath/tomsfastmath-0.13.1-r1.ebuild69
2 files changed, 82 insertions, 0 deletions
diff --git a/dev-libs/tomsfastmath/files/tomsfastmath-0.13.1-export-fp_isprime_ex.patch b/dev-libs/tomsfastmath/files/tomsfastmath-0.13.1-export-fp_isprime_ex.patch
new file mode 100644
index 00000000000..627bf4b2f4d
--- /dev/null
+++ b/dev-libs/tomsfastmath/files/tomsfastmath-0.13.1-export-fp_isprime_ex.patch
@@ -0,0 +1,13 @@
+Needed because libtomcrypt expects this symbol to be available
+https://github.com/libtom/tomsfastmath/commit/81530c207da8b3a43867da14df7d79d2cdf96978.patch
+--- a/libtfm.symbols
++++ b/libtfm.symbols
+@@ -16,6 +16,7 @@ fp_gcd
+ fp_ident
+ fp_invmod
+ fp_isprime
++fp_isprime_ex
+ fp_lcm
+ fp_lshd
+ fp_mod
+
diff --git a/dev-libs/tomsfastmath/tomsfastmath-0.13.1-r1.ebuild b/dev-libs/tomsfastmath/tomsfastmath-0.13.1-r1.ebuild
new file mode 100644
index 00000000000..738e6706e8c
--- /dev/null
+++ b/dev-libs/tomsfastmath/tomsfastmath-0.13.1-r1.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs
+
+DESCRIPTION="Fast public domain large integer arithmetic library"
+HOMEPAGE="https://www.libtom.net/TomsFastMath/
+ https://github.com/libtom/tomsfastmath"
+SRC_URI="https://github.com/libtom/tomsfastmath/releases/download/v${PV}/tfm-${PV}.tar.xz"
+LICENSE="Unlicense"
+
+# Current SONAME is 1
+# Please bump when the ABI changes upstream
+# Helpful site:
+# https://abi-laboratory.pro/index.php?view=timeline&l=tomsfastmath
+SLOT="0/1"
+
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+
+PATCHES=(
+ "${FILESDIR}/${P}-makefile-fix.patch"
+ "${FILESDIR}/${PN}-0.13.1-export-fp_isprime_ex.patch"
+)
+
+_emake() {
+ # Standard boilerplate
+ # Upstream use homebrewed makefiles
+ # Best to use same args for all, for consistency,
+ # in case behaviour changes (v possible).
+ emake \
+ CC="$(tc-getCC)" \
+ AR="$(tc-getAR)" \
+ RANLIB="$(tc-getRANLIB)" \
+ DESTDIR="${ED}" \
+ LIBPATH="/usr/$(get_libdir)" \
+ IGNORE_SPEED=1 \
+ "$@"
+}
+
+src_compile() {
+ _emake -f makefile.shared
+}
+
+src_test() {
+ _emake test_standalone stest rsatest
+
+ # We choose to be verbose during the test process
+ # because the output is quite repetitive with no
+ # clear demarcation b/t tests
+ local tests=( "test" "stest" "rsatest" )
+
+ local test
+ for test in "${tests[@]}"; do
+ einfo "Running test (${test})"
+ ./${test} || die "Test (${test}) failed"
+ einfo "Completed test (${test})"
+ done
+}
+
+src_install() {
+ _emake -f makefile.shared install
+
+ # Remove unnecessary .la files
+ find "${ED}" -name '*.la' -delete || die
+ # Same for static libs
+ find "${ED}" -name "*.a" -delete || die
+}