From 517686ae1b6c4e1f5190c2709380207cc8eb64a4 Mon Sep 17 00:00:00 2001 From: David Seifert Date: Sat, 11 Mar 2017 17:34:52 +0100 Subject: sci-mathematics/prng: Fix static-libs building * Also fix C99 inline semantics properly Package-Manager: Portage-2.3.4, Repoman-2.3.2 --- .../prng-3.0.2-fix-c99-inline-semantics.patch | 146 +++++++++++++++++++++ sci-mathematics/prng/files/prng-3.0.2-shared.patch | 15 +-- sci-mathematics/prng/prng-3.0.2-r1.ebuild | 33 ----- sci-mathematics/prng/prng-3.0.2-r2.ebuild | 42 ++++++ 4 files changed, 194 insertions(+), 42 deletions(-) create mode 100644 sci-mathematics/prng/files/prng-3.0.2-fix-c99-inline-semantics.patch delete mode 100644 sci-mathematics/prng/prng-3.0.2-r1.ebuild create mode 100644 sci-mathematics/prng/prng-3.0.2-r2.ebuild (limited to 'sci-mathematics/prng') diff --git a/sci-mathematics/prng/files/prng-3.0.2-fix-c99-inline-semantics.patch b/sci-mathematics/prng/files/prng-3.0.2-fix-c99-inline-semantics.patch new file mode 100644 index 000000000000..c84a288d47dd --- /dev/null +++ b/sci-mathematics/prng/files/prng-3.0.2-fix-c99-inline-semantics.patch @@ -0,0 +1,146 @@ +Use portable 'static inline' semantics that work in GNU89 and C99 +See also: http://www.greenend.org.uk/rjk/tech/inline.html + +--- a/src/dicg.c ++++ b/src/dicg.c +@@ -441,7 +441,7 @@ + * Algorithm by Karin Schaber and Otmar Lendl. + * + */ +-inline prng_num prng_dicg_multiply(int k,prng_num c, prng_num d) ++prng_num prng_dicg_multiply(int k,prng_num c, prng_num d) + { + int i; + struct mtable *t; +--- a/src/external.c ++++ b/src/external.c +@@ -139,7 +139,7 @@ + * gen: Pointer to a struct prng. + * + */ +-inline prng_num prng_tt800_get_next_int(struct prng *gen) ++prng_num prng_tt800_get_next_int(struct prng *gen) + { + unsigned int y; + struct tt800_state *g; +--- a/src/icg.c ++++ b/src/icg.c +@@ -110,7 +110,7 @@ + * gen: Pointer to a struct prng. + * + */ +-inline prng_num prng_icg_get_next_int(struct prng *gen) ++prng_num prng_icg_get_next_int(struct prng *gen) + { + s_prng_num inv, current, prod; + +--- a/src/lcg.c ++++ b/src/lcg.c +@@ -111,7 +111,7 @@ + * gen: Pointer to a struct prng. + * + */ +-inline prng_num prng_lcg_get_next_int(struct prng *gen) ++prng_num prng_lcg_get_next_int(struct prng *gen) + { + s_prng_num ax, current; + +--- a/src/meicg.c ++++ b/src/meicg.c +@@ -106,7 +106,7 @@ + * gen: Pointer to a struct prng. + * + */ +-inline prng_num prng_meicg_get_next_int(struct prng *gen) ++prng_num prng_meicg_get_next_int(struct prng *gen) + { + s_prng_num an, sum, inv, n; + +--- a/src/mt19937.c ++++ b/src/mt19937.c +@@ -172,7 +172,7 @@ + * gen: Pointer to a struct prng. + * + */ +-inline prng_num prng_mt19937_get_next_int(struct prng *gen) ++prng_num prng_mt19937_get_next_int(struct prng *gen) + { + #define MT gen->data.mt19937_data.mt + #define MTI gen->data.mt19937_data.mti +--- a/src/prng.h ++++ b/src/prng.h +@@ -406,7 +406,7 @@ + /* INLINE fnk def. for mult_mod, I don't know if this works for non-GCC */ + + #ifdef __GNUC__ +-extern __inline__ prng_num mult_mod(prng_num s,struct mult_mod_struct *mm) ++static inline prng_num mult_mod(prng_num s,struct mult_mod_struct *mm) + { + s_prng_num s_tmp; + +--- a/src/qcg.c ++++ b/src/qcg.c +@@ -107,7 +107,7 @@ + * gen: Pointer to a struct prng. + * + */ +-inline prng_num prng_qcg_get_next_int(struct prng *gen) ++prng_num prng_qcg_get_next_int(struct prng *gen) + { + s_prng_num current, sum, square, q_term, l_term; + +--- a/src/support.c ++++ b/src/support.c +@@ -449,52 +449,6 @@ + } + } + +-#ifndef __cplusplus +-/* +- * Modular Multiplication. Uses the precalculated values from mult_mod_setup. +- * +- * +- * Input: +- * s An prng_num. +- * mm pointer to a struct mult_mod_struct initialized +- * by mult_mod_setup. +- * +- * Output: +- * (mm->a*s) mod mm->p +- * +- */ +-prng_num mult_mod(prng_num s,struct mult_mod_struct *mm) +-{ +-s_prng_num s_tmp; +- +-switch(mm->algorithm) +- { +- case PRNG_MM_ZERO: return(0); +- break; +- case PRNG_MM_ONE: return(s); +- break; +- case PRNG_MM_SIMPLE: return((s * mm->a) % mm->p ); +- break; +- case PRNG_MM_SCHRAGE: +- s_tmp = mm->a * ( s % mm->q ) - +- mm->r * ( s / mm->q ); +- if (s_tmp < 0) s_tmp += mm->p; +- return(s_tmp); +- break; +- case PRNG_MM_DECOMP: return(mult_mod_generic(s,mm->a,mm->p)); +- break; +-#ifdef HAVE_LONGLONG +- case PRNG_MM_LL: return(mult_mod_ll(s,mm->a,mm->p)); +- break; +-#endif +- case PRNG_MM_POW2: return((s*mm->a) & mm->mask); +- break; +- } +-/* not reached */ +-return(0); +-} +-#endif +- + + /* + * Modular Multiplication: Decomposition method (from L'Ecuyer & Cote) diff --git a/sci-mathematics/prng/files/prng-3.0.2-shared.patch b/sci-mathematics/prng/files/prng-3.0.2-shared.patch index 109e74faa3bb..cee8de060fae 100644 --- a/sci-mathematics/prng/files/prng-3.0.2-shared.patch +++ b/sci-mathematics/prng/files/prng-3.0.2-shared.patch @@ -1,6 +1,5 @@ -diff -Nur prng-3.0.2.orig/configure.ac prng-3.0.2/configure.ac ---- prng-3.0.2.orig/configure.ac 2010-10-16 18:47:52.000000000 +0100 -+++ prng-3.0.2/configure.ac 2010-10-16 18:49:16.000000000 +0100 +--- a/configure.ac ++++ b/configure.ac @@ -23,6 +23,7 @@ AC_PROG_RANLIB AC_PROG_INSTALL @@ -21,9 +20,8 @@ diff -Nur prng-3.0.2.orig/configure.ac prng-3.0.2/configure.ac AC_CONFIG_FILES([\ Makefile \ -diff -Nur prng-3.0.2.orig/examples/Makefile.am prng-3.0.2/examples/Makefile.am ---- prng-3.0.2.orig/examples/Makefile.am 2010-10-16 18:47:52.000000000 +0100 -+++ prng-3.0.2/examples/Makefile.am 2010-10-16 18:48:08.000000000 +0100 +--- a/examples/Makefile.am ++++ b/examples/Makefile.am @@ -1,11 +1,11 @@ ## Process this file with automake to produce Makefile.in # $Id$ @@ -38,9 +36,8 @@ diff -Nur prng-3.0.2.orig/examples/Makefile.am prng-3.0.2/examples/Makefile.am # clean backup files CLEANFILES = *~ -diff -Nur prng-3.0.2.orig/src/Makefile.am prng-3.0.2/src/Makefile.am ---- prng-3.0.2.orig/src/Makefile.am 2010-10-16 18:47:52.000000000 +0100 -+++ prng-3.0.2/src/Makefile.am 2010-10-16 18:48:08.000000000 +0100 +--- a/src/Makefile.am ++++ b/src/Makefile.am @@ -3,9 +3,9 @@ INCLUDES = diff --git a/sci-mathematics/prng/prng-3.0.2-r1.ebuild b/sci-mathematics/prng/prng-3.0.2-r1.ebuild deleted file mode 100644 index b7ff16db417f..000000000000 --- a/sci-mathematics/prng/prng-3.0.2-r1.ebuild +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 1999-2016 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 - -inherit autotools flag-o-matic - -DESCRIPTION="Pseudo-Random Number Generator library" -HOMEPAGE="http://statmath.wu.ac.at/prng/" -SRC_URI="${HOMEPAGE}${P}.tar.gz" - -LICENSE="GPL-2" -SLOT=0 -KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" -IUSE="doc examples static-libs" - -PATCHES=( "${FILESDIR}/${P}-shared.patch" ) - -src_prepare() { - append-cflags -std=gnu89 - default - eautoreconf -} - -src_install() { - default - use doc && dodoc doc/${PN}.pdf - if use examples; then - rm examples/Makefile* || die - insinto /usr/share/doc/${PF} - doins -r examples - fi -} diff --git a/sci-mathematics/prng/prng-3.0.2-r2.ebuild b/sci-mathematics/prng/prng-3.0.2-r2.ebuild new file mode 100644 index 000000000000..5eba1b129050 --- /dev/null +++ b/sci-mathematics/prng/prng-3.0.2-r2.ebuild @@ -0,0 +1,42 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit autotools + +DESCRIPTION="Pseudo-Random Number Generator library" +HOMEPAGE="http://statmath.wu.ac.at/prng/" +SRC_URI="${HOMEPAGE}${P}.tar.gz" + +LICENSE="GPL-2" +SLOT=0 +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" +IUSE="doc examples static-libs" + +PATCHES=( + "${FILESDIR}"/${PN}-3.0.2-shared.patch + "${FILESDIR}"/${PN}-3.0.2-fix-c99-inline-semantics.patch +) + +src_prepare() { + default + eautoreconf +} + +src_configure() { + econf $(use_enable static-libs static) +} + +src_install() { + default + use doc && dodoc doc/${PN}.pdf + if use examples; then + rm examples/Makefile* || die + dodoc -r examples + docompress -x /usr/share/doc/${PF}/examples + fi + if ! use static-libs; then + find "${D}" -name '*.la' -delete || die + fi +} -- cgit v1.2.3-65-gdbad