1 |
commit: f93cd07ace09427aa0bde818251bc9c07b1b9136 |
2 |
Author: François Bissey <frp.bissey <AT> gmail <DOT> com> |
3 |
AuthorDate: Mon Jan 20 23:08:19 2020 +0000 |
4 |
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jan 21 01:58:57 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f93cd07a |
7 |
|
8 |
sci-libs/m4ri: various upstreamed patches |
9 |
|
10 |
Package-Manager: Portage-2.3.79, Repoman-2.3.16 |
11 |
Signed-off-by: François René Pierre Bissey <frp.bissey <AT> gmail.com> |
12 |
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org> |
13 |
|
14 |
.../files/m4ri-20200115-libm_underlinking.patch | 76 +++++++++++++++++++ |
15 |
.../files/m4ri-20200115-memory_violation.patch | 87 ++++++++++++++++++++++ |
16 |
sci-libs/m4ri/m4ri-20200115.ebuild | 13 +++- |
17 |
3 files changed, 175 insertions(+), 1 deletion(-) |
18 |
|
19 |
diff --git a/sci-libs/m4ri/files/m4ri-20200115-libm_underlinking.patch b/sci-libs/m4ri/files/m4ri-20200115-libm_underlinking.patch |
20 |
new file mode 100644 |
21 |
index 00000000000..8d9d2738c08 |
22 |
--- /dev/null |
23 |
+++ b/sci-libs/m4ri/files/m4ri-20200115-libm_underlinking.patch |
24 |
@@ -0,0 +1,76 @@ |
25 |
+From be6c249e7838bd838174db5c2bb98bf63b026b83 Mon Sep 17 00:00:00 2001 |
26 |
+From: François Bissey <frp.bissey@×××××.com> |
27 |
+Date: Tue, 21 Jan 2020 11:24:50 +1300 |
28 |
+Subject: [PATCH] Detect and use LIBM to link libm4ri in all cases. |
29 |
+ |
30 |
+--- |
31 |
+ Makefile.am | 2 +- |
32 |
+ configure.ac | 6 +++++- |
33 |
+ m4ri.pc.in | 2 +- |
34 |
+ tests/Makefile.am | 2 +- |
35 |
+ 4 files changed, 8 insertions(+), 4 deletions(-) |
36 |
+ |
37 |
+diff --git a/Makefile.am b/Makefile.am |
38 |
+index e317d06..416d9f1 100644 |
39 |
+--- a/Makefile.am |
40 |
++++ b/Makefile.am |
41 |
+@@ -58,7 +58,7 @@ pkgconfigdir = $(libdir)/pkgconfig |
42 |
+ pkgconfig_DATA = m4ri.pc |
43 |
+ |
44 |
+ libm4ri_la_LDFLAGS = -release 0.0.$(RELEASE) -no-undefined |
45 |
+-libm4ri_la_LIBADD = $(LIBPNG_LIBADD) |
46 |
++libm4ri_la_LIBADD = $(LIBPNG_LIBADD) $(LIBM) |
47 |
+ |
48 |
+ SUBDIRS = . tests |
49 |
+ DIST_SUBDIRS = $(SUBDIRS) bench |
50 |
+diff --git a/configure.ac b/configure.ac |
51 |
+index 39de702..520154d 100644 |
52 |
+--- a/configure.ac |
53 |
++++ b/configure.ac |
54 |
+@@ -15,7 +15,7 @@ AC_CONFIG_MACRO_DIR([m4]) |
55 |
+ dnl Compiling with per-target flags (test_elimination.c) requires AM_PROG_CC_C_O. |
56 |
+ AM_PROG_CC_C_O |
57 |
+ |
58 |
+-AC_PROG_LIBTOOL |
59 |
++LT_INIT |
60 |
+ |
61 |
+ AC_PROG_INSTALL |
62 |
+ |
63 |
+@@ -26,6 +26,10 @@ if test "$ac_cv_prog_cc_c99" = "no"; then |
64 |
+ AC_MSG_ERROR([C99 support is required but not found.]) |
65 |
+ fi |
66 |
+ |
67 |
++# Find and set LIBM on the platform. |
68 |
++LT_LIB_M |
69 |
++AC_SUBST(LIBM) |
70 |
++ |
71 |
+ # SSE2 support |
72 |
+ AC_ARG_ENABLE([sse2], |
73 |
+ AS_HELP_STRING([--disable-sse2], [don't use SSE2 instruction set.]), |
74 |
+diff --git a/m4ri.pc.in b/m4ri.pc.in |
75 |
+index 5044de7..07597bd 100644 |
76 |
+--- a/m4ri.pc.in |
77 |
++++ b/m4ri.pc.in |
78 |
+@@ -7,5 +7,5 @@ Name: M4RI |
79 |
+ Description: Dense linear algebra over GF(2). |
80 |
+ Version: @PACKAGE_VERSION@ |
81 |
+ Requires: @M4RI_USE_PNG_PC@ |
82 |
+-Libs: -L${libdir} -lm4ri @RAW_LIBPNG@ -lm |
83 |
++Libs: -L${libdir} -lm4ri @RAW_LIBPNG@ @LIBM@ |
84 |
+ Cflags: -I${includedir} @SIMD_CFLAGS@ @OPENMP_CFLAGS@ |
85 |
+diff --git a/tests/Makefile.am b/tests/Makefile.am |
86 |
+index c9839a2..069e360 100644 |
87 |
+--- a/tests/Makefile.am |
88 |
++++ b/tests/Makefile.am |
89 |
+@@ -15,7 +15,7 @@ DEFINES = |
90 |
+ AM_CFLAGS = -I$(TOPSRCDIR) -I$(TOPBUILDDIR) -D_XOPEN_SOURCE=600 $(DEFINES) @OPENMP_CFLAGS@ @PAPI_CFLAGS@ |
91 |
+ |
92 |
+ STAGEDIR := $(realpath -s $(TOPBUILDDIR)/.libs) |
93 |
+-AM_LDFLAGS = -L$(STAGEDIR) -Wl,-rpath,$(STAGEDIR) -lm4ri -lm @PAPI_LDFLAGS@ @PAPI_LIBS@ -no-install |
94 |
++AM_LDFLAGS = -L$(STAGEDIR) -Wl,-rpath,$(STAGEDIR) -lm4ri $(LIBM) @PAPI_LDFLAGS@ @PAPI_LIBS@ -no-install |
95 |
+ |
96 |
+ test_smallops_SOURCES = test_smallops.c testing.c testing.h |
97 |
+ |
98 |
+-- |
99 |
+2.10.5 |
100 |
+ |
101 |
|
102 |
diff --git a/sci-libs/m4ri/files/m4ri-20200115-memory_violation.patch b/sci-libs/m4ri/files/m4ri-20200115-memory_violation.patch |
103 |
new file mode 100644 |
104 |
index 00000000000..b74be3b4bf8 |
105 |
--- /dev/null |
106 |
+++ b/sci-libs/m4ri/files/m4ri-20200115-memory_violation.patch |
107 |
@@ -0,0 +1,87 @@ |
108 |
+From e2fb0dcb70a97972fa1576a528cb01458f57a85d Mon Sep 17 00:00:00 2001 |
109 |
+From: "Martin R. Albrecht" <martinralbrecht@××××××××××.com> |
110 |
+Date: Sun, 19 Jan 2020 17:44:57 -0800 |
111 |
+Subject: [PATCH] fix memory violation |
112 |
+ |
113 |
+fixes #72 |
114 |
+--- |
115 |
+ m4ri/mzd.c | 2 +- |
116 |
+ tests/test_misc.c | 42 ++++++++++++++++++++++++++++++++++++++++++ |
117 |
+ 2 files changed, 43 insertions(+), 1 deletion(-) |
118 |
+ |
119 |
+diff --git a/m4ri/mzd.c b/m4ri/mzd.c |
120 |
+index 861905c..922dc3c 100644 |
121 |
+--- a/m4ri/mzd.c |
122 |
++++ b/m4ri/mzd.c |
123 |
+@@ -1894,7 +1894,7 @@ mzd_t *mzd_submatrix(mzd_t *S, mzd_t const *M, rci_t const startrow, rci_t const |
124 |
+ } else { |
125 |
+ wi_t j; |
126 |
+ for(rci_t i=0; i<nrows; i++) { |
127 |
+- for(j=0; j+m4ri_radix<=ncols; j+=m4ri_radix) |
128 |
++ for(j=0; j+m4ri_radix<ncols; j+=m4ri_radix) |
129 |
+ S->rows[i][j/m4ri_radix] = mzd_read_bits(M, startrow+i, startcol+j, m4ri_radix); |
130 |
+ S->rows[i][j/m4ri_radix] &= ~S->high_bitmask; |
131 |
+ S->rows[i][j/m4ri_radix] |= mzd_read_bits(M, startrow+i, startcol+j, ncols - j) & S->high_bitmask; |
132 |
+diff --git a/tests/test_misc.c b/tests/test_misc.c |
133 |
+index a9a9547..b1a2e32 100644 |
134 |
+--- a/tests/test_misc.c |
135 |
++++ b/tests/test_misc.c |
136 |
+@@ -76,6 +76,31 @@ int test_png(rci_t m, rci_t n) { |
137 |
+ return ret; |
138 |
+ } |
139 |
+ |
140 |
++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) { |
141 |
++ printf("submatrix: m: %4d, n: %4d, (%4d, %4d, %4d, %4d)", m, n, lowr, lowc, highr, highc); |
142 |
++ assert(highr-lowr > 0); |
143 |
++ assert(highc-lowc > 0); |
144 |
++ mzd_t *M = mzd_init(m, n); |
145 |
++ mzd_randomize(M); |
146 |
++ mzd_t *S = mzd_init(highr-lowr, highc-lowc); |
147 |
++ mzd_submatrix(S, M, lowr, lowc, highr, highc); |
148 |
++ int ret = 0; |
149 |
++ for(rci_t i=0; i<highr-lowr; i++) { |
150 |
++ for(rci_t j=0; j<highc-lowc; j++) { |
151 |
++ ret += (mzd_read_bit(M, lowr+i, lowc+j) ^ mzd_read_bit(S, i, j)); |
152 |
++ } |
153 |
++ } |
154 |
++ |
155 |
++ mzd_free(M); |
156 |
++ mzd_free(S); |
157 |
++ |
158 |
++ if(ret==0) { |
159 |
++ printf(" ... passed\n"); |
160 |
++ } else { |
161 |
++ printf(" ... FAILED\n"); |
162 |
++ } |
163 |
++ return ret; |
164 |
++} |
165 |
+ |
166 |
+ int main(int argc, char *argv[]) { |
167 |
+ int status = 0; |
168 |
+@@ -99,6 +124,23 @@ int main(int argc, char *argv[]) { |
169 |
+ status += test_png(126,12); |
170 |
+ status += test_png(128,200); |
171 |
+ |
172 |
++ status += test_submatrix(2, 127, 1, 1, 2, 127); |
173 |
++ status += test_submatrix(2, 128, 1, 1, 2, 128); |
174 |
++ status += test_submatrix(2, 129, 1, 1, 2, 129); |
175 |
++ status += test_submatrix(2, 130, 1, 1, 2, 130); |
176 |
++ status += test_submatrix(2, 131, 1, 1, 2, 131); |
177 |
++ |
178 |
++ status += test_submatrix(2, 63, 1, 1, 1, 63); |
179 |
++ status += test_submatrix(2, 64, 1, 1, 1, 64); |
180 |
++ status += test_submatrix(2, 65, 1, 1, 1, 65); |
181 |
++ status += test_submatrix(2, 66, 1, 1, 1, 66); |
182 |
++ status += test_submatrix(2, 67, 1, 1, 1, 67); |
183 |
++ |
184 |
++ status += test_submatrix(2, 127, 1, 63, 2, 127); |
185 |
++ status += test_submatrix(2, 128, 1, 64, 2, 128); |
186 |
++ status += test_submatrix(2, 129, 1, 65, 2, 129); |
187 |
++ status += test_submatrix(2, 130, 1, 66, 2, 130); |
188 |
++ |
189 |
+ if (!status) { |
190 |
+ printf("All tests passed.\n"); |
191 |
+ } else { |
192 |
+-- |
193 |
+2.10.5 |
194 |
+ |
195 |
|
196 |
diff --git a/sci-libs/m4ri/m4ri-20200115.ebuild b/sci-libs/m4ri/m4ri-20200115.ebuild |
197 |
index 27891c4fab1..fd2b189cf38 100644 |
198 |
--- a/sci-libs/m4ri/m4ri-20200115.ebuild |
199 |
+++ b/sci-libs/m4ri/m4ri-20200115.ebuild |
200 |
@@ -3,7 +3,7 @@ |
201 |
|
202 |
EAPI=7 |
203 |
|
204 |
-inherit flag-o-matic toolchain-funcs |
205 |
+inherit autotools flag-o-matic toolchain-funcs |
206 |
|
207 |
DESCRIPTION="Method of four russian for inversion (M4RI)" |
208 |
HOMEPAGE="https://bitbucket.org/malb/m4ri" |
209 |
@@ -22,10 +22,21 @@ RDEPEND="${DEPEND}" |
210 |
# didn't make it into the release tarball. |
211 |
DOCS=( AUTHORS ) |
212 |
|
213 |
+PATCHES=( |
214 |
+ "${FILESDIR}"/${PN}-20200115-memory_violation.patch |
215 |
+ "${FILESDIR}"/${PN}-20200115-libm_underlinking.patch |
216 |
+) |
217 |
+ |
218 |
pkg_pretend() { |
219 |
use openmp && tc-check-openmp |
220 |
} |
221 |
|
222 |
+src_prepare() { |
223 |
+ default |
224 |
+ |
225 |
+ eautoreconf |
226 |
+} |
227 |
+ |
228 |
src_configure() { |
229 |
# when using openmp and -O0 the testsuite fails |
230 |
# https://github.com/cschwan/sage-on-gentoo/issues/475 |