public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sci-libs/m4ri/files/, sci-libs/m4ri/
@ 2020-01-21  2:06 Michael Orlitzky
  0 siblings, 0 replies; only message in thread
From: Michael Orlitzky @ 2020-01-21  2:06 UTC (permalink / raw
  To: gentoo-commits

commit:     f93cd07ace09427aa0bde818251bc9c07b1b9136
Author:     François Bissey <frp.bissey <AT> gmail <DOT> com>
AuthorDate: Mon Jan 20 23:08:19 2020 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Tue Jan 21 01:58:57 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f93cd07a

sci-libs/m4ri: various upstreamed patches

Package-Manager: Portage-2.3.79, Repoman-2.3.16
Signed-off-by: François René Pierre Bissey <frp.bissey <AT> gmail.com>
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .../files/m4ri-20200115-libm_underlinking.patch    | 76 +++++++++++++++++++
 .../files/m4ri-20200115-memory_violation.patch     | 87 ++++++++++++++++++++++
 sci-libs/m4ri/m4ri-20200115.ebuild                 | 13 +++-
 3 files changed, 175 insertions(+), 1 deletion(-)

diff --git a/sci-libs/m4ri/files/m4ri-20200115-libm_underlinking.patch b/sci-libs/m4ri/files/m4ri-20200115-libm_underlinking.patch
new file mode 100644
index 00000000000..8d9d2738c08
--- /dev/null
+++ b/sci-libs/m4ri/files/m4ri-20200115-libm_underlinking.patch
@@ -0,0 +1,76 @@
+From be6c249e7838bd838174db5c2bb98bf63b026b83 Mon Sep 17 00:00:00 2001
+From: François Bissey <frp.bissey@gmail.com>
+Date: Tue, 21 Jan 2020 11:24:50 +1300
+Subject: [PATCH] Detect and use LIBM to link libm4ri in all cases.
+
+---
+ Makefile.am       | 2 +-
+ configure.ac      | 6 +++++-
+ m4ri.pc.in        | 2 +-
+ tests/Makefile.am | 2 +-
+ 4 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index e317d06..416d9f1 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -58,7 +58,7 @@ pkgconfigdir = $(libdir)/pkgconfig
+ pkgconfig_DATA = m4ri.pc
+ 
+ libm4ri_la_LDFLAGS = -release 0.0.$(RELEASE) -no-undefined
+-libm4ri_la_LIBADD = $(LIBPNG_LIBADD)
++libm4ri_la_LIBADD = $(LIBPNG_LIBADD) $(LIBM)
+ 
+ SUBDIRS = . tests
+ DIST_SUBDIRS = $(SUBDIRS) bench
+diff --git a/configure.ac b/configure.ac
+index 39de702..520154d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -15,7 +15,7 @@ AC_CONFIG_MACRO_DIR([m4])
+ dnl Compiling with per-target flags (test_elimination.c) requires AM_PROG_CC_C_O.
+ AM_PROG_CC_C_O
+ 
+-AC_PROG_LIBTOOL
++LT_INIT
+ 
+ AC_PROG_INSTALL
+ 
+@@ -26,6 +26,10 @@ if test "$ac_cv_prog_cc_c99" = "no"; then
+   AC_MSG_ERROR([C99 support is required but not found.])
+ fi
+ 
++# Find and set LIBM on the platform.
++LT_LIB_M
++AC_SUBST(LIBM)
++
+ # SSE2 support
+ AC_ARG_ENABLE([sse2],
+         AS_HELP_STRING([--disable-sse2], [don't use SSE2 instruction set.]),
+diff --git a/m4ri.pc.in b/m4ri.pc.in
+index 5044de7..07597bd 100644
+--- a/m4ri.pc.in
++++ b/m4ri.pc.in
+@@ -7,5 +7,5 @@ Name: M4RI
+ Description: Dense linear algebra over GF(2).
+ Version: @PACKAGE_VERSION@
+ Requires: @M4RI_USE_PNG_PC@
+-Libs: -L${libdir} -lm4ri @RAW_LIBPNG@ -lm
++Libs: -L${libdir} -lm4ri @RAW_LIBPNG@ @LIBM@
+ Cflags: -I${includedir} @SIMD_CFLAGS@ @OPENMP_CFLAGS@
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index c9839a2..069e360 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -15,7 +15,7 @@ DEFINES =
+ AM_CFLAGS = -I$(TOPSRCDIR) -I$(TOPBUILDDIR) -D_XOPEN_SOURCE=600 $(DEFINES) @OPENMP_CFLAGS@ @PAPI_CFLAGS@
+ 
+ STAGEDIR := $(realpath -s $(TOPBUILDDIR)/.libs)
+-AM_LDFLAGS = -L$(STAGEDIR) -Wl,-rpath,$(STAGEDIR) -lm4ri -lm @PAPI_LDFLAGS@ @PAPI_LIBS@ -no-install
++AM_LDFLAGS = -L$(STAGEDIR) -Wl,-rpath,$(STAGEDIR) -lm4ri $(LIBM) @PAPI_LDFLAGS@ @PAPI_LIBS@ -no-install
+ 
+ test_smallops_SOURCES = test_smallops.c testing.c testing.h
+ 
+-- 
+2.10.5
+

diff --git a/sci-libs/m4ri/files/m4ri-20200115-memory_violation.patch b/sci-libs/m4ri/files/m4ri-20200115-memory_violation.patch
new file mode 100644
index 00000000000..b74be3b4bf8
--- /dev/null
+++ b/sci-libs/m4ri/files/m4ri-20200115-memory_violation.patch
@@ -0,0 +1,87 @@
+From e2fb0dcb70a97972fa1576a528cb01458f57a85d Mon Sep 17 00:00:00 2001
+From: "Martin R. Albrecht" <martinralbrecht@googlemail.com>
+Date: Sun, 19 Jan 2020 17:44:57 -0800
+Subject: [PATCH] fix memory violation
+
+fixes #72
+---
+ m4ri/mzd.c        |  2 +-
+ tests/test_misc.c | 42 ++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 43 insertions(+), 1 deletion(-)
+
+diff --git a/m4ri/mzd.c b/m4ri/mzd.c
+index 861905c..922dc3c 100644
+--- a/m4ri/mzd.c
++++ b/m4ri/mzd.c
+@@ -1894,7 +1894,7 @@ mzd_t *mzd_submatrix(mzd_t *S, mzd_t const *M, rci_t const startrow, rci_t const
+   } else {
+     wi_t j;
+     for(rci_t i=0; i<nrows; i++) {
+-      for(j=0; j+m4ri_radix<=ncols; j+=m4ri_radix)
++      for(j=0; j+m4ri_radix<ncols; j+=m4ri_radix)
+         S->rows[i][j/m4ri_radix] = mzd_read_bits(M, startrow+i, startcol+j, m4ri_radix);
+       S->rows[i][j/m4ri_radix] &= ~S->high_bitmask;
+       S->rows[i][j/m4ri_radix] |= mzd_read_bits(M, startrow+i, startcol+j, ncols - j) & S->high_bitmask;
+diff --git a/tests/test_misc.c b/tests/test_misc.c
+index a9a9547..b1a2e32 100644
+--- a/tests/test_misc.c
++++ b/tests/test_misc.c
+@@ -76,6 +76,31 @@ int test_png(rci_t m, rci_t n) {
+   return ret;
+ }
+ 
++int test_submatrix(const rci_t m, const rci_t n, const rci_t lowr, const rci_t lowc, const rci_t highr, const rci_t highc) {
++  printf("submatrix: m: %4d, n: %4d, (%4d, %4d, %4d, %4d)", m, n, lowr, lowc, highr, highc);
++  assert(highr-lowr > 0);
++  assert(highc-lowc > 0);
++  mzd_t *M = mzd_init(m, n);
++  mzd_randomize(M);
++  mzd_t *S = mzd_init(highr-lowr, highc-lowc);
++  mzd_submatrix(S, M, lowr, lowc, highr, highc);
++  int ret = 0;
++  for(rci_t i=0; i<highr-lowr; i++) {
++    for(rci_t j=0; j<highc-lowc; j++) {
++      ret += (mzd_read_bit(M, lowr+i, lowc+j) ^ mzd_read_bit(S, i, j));
++    }
++  }
++
++  mzd_free(M);
++  mzd_free(S);
++
++  if(ret==0) {
++    printf(" ... passed\n");
++  } else {
++    printf(" ... FAILED\n");
++  }
++  return ret;
++}
+ 
+ int main(int argc, char *argv[]) {
+   int status = 0;
+@@ -99,6 +124,23 @@ int main(int argc, char *argv[]) {
+   status += test_png(126,12);
+   status += test_png(128,200);
+ 
++  status += test_submatrix(2, 127, 1, 1, 2, 127);
++  status += test_submatrix(2, 128, 1, 1, 2, 128);
++  status += test_submatrix(2, 129, 1, 1, 2, 129);
++  status += test_submatrix(2, 130, 1, 1, 2, 130);
++  status += test_submatrix(2, 131, 1, 1, 2, 131);
++
++  status += test_submatrix(2, 63, 1, 1, 1, 63);
++  status += test_submatrix(2, 64, 1, 1, 1, 64);
++  status += test_submatrix(2, 65, 1, 1, 1, 65);
++  status += test_submatrix(2, 66, 1, 1, 1, 66);
++  status += test_submatrix(2, 67, 1, 1, 1, 67);
++
++  status += test_submatrix(2, 127, 1, 63, 2, 127);
++  status += test_submatrix(2, 128, 1, 64, 2, 128);
++  status += test_submatrix(2, 129, 1, 65, 2, 129);
++  status += test_submatrix(2, 130, 1, 66, 2, 130);
++
+   if (!status) {
+     printf("All tests passed.\n");
+   } else {
+-- 
+2.10.5
+

diff --git a/sci-libs/m4ri/m4ri-20200115.ebuild b/sci-libs/m4ri/m4ri-20200115.ebuild
index 27891c4fab1..fd2b189cf38 100644
--- a/sci-libs/m4ri/m4ri-20200115.ebuild
+++ b/sci-libs/m4ri/m4ri-20200115.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-inherit flag-o-matic toolchain-funcs
+inherit autotools flag-o-matic toolchain-funcs
 
 DESCRIPTION="Method of four russian for inversion (M4RI)"
 HOMEPAGE="https://bitbucket.org/malb/m4ri"
@@ -22,10 +22,21 @@ RDEPEND="${DEPEND}"
 # didn't make it into the release tarball.
 DOCS=( AUTHORS )
 
+PATCHES=(
+	"${FILESDIR}"/${PN}-20200115-memory_violation.patch
+	"${FILESDIR}"/${PN}-20200115-libm_underlinking.patch
+)
+
 pkg_pretend() {
 	use openmp && tc-check-openmp
 }
 
+src_prepare() {
+	default
+
+	eautoreconf
+}
+
 src_configure() {
 	# when using openmp and -O0 the testsuite fails
 	# https://github.com/cschwan/sage-on-gentoo/issues/475


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-21  2:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-21  2:06 [gentoo-commits] repo/gentoo:master commit in: sci-libs/m4ri/files/, sci-libs/m4ri/ Michael Orlitzky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox