Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-mathematics/msieve/files/, sci-mathematics/msieve/
Date: Sat, 29 Jan 2022 00:00:41
Message-Id: 1643414416.dad58a7d48705b0fca67da25cbe8636e960800fa.soap@gentoo
1 commit: dad58a7d48705b0fca67da25cbe8636e960800fa
2 Author: David Seifert <soap <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jan 29 00:00:16 2022 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Sat Jan 29 00:00:16 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dad58a7d
7
8 sci-mathematics/msieve: fix build system
9
10 Closes: https://bugs.gentoo.org/725592
11 Closes: https://bugs.gentoo.org/779589
12 Signed-off-by: David Seifert <soap <AT> gentoo.org>
13
14 .../msieve/files/msieve-1.51-reduce-printf.patch | 15 ++-
15 .../msieve/files/msieve-1.53-fix-version.patch | 4 -
16 .../msieve/files/msieve-1.53-makefile.patch | 108 +++++++++++++++++++++
17 sci-mathematics/msieve/msieve-1.53-r1.ebuild | 30 +++---
18 4 files changed, 128 insertions(+), 29 deletions(-)
19
20 diff --git a/sci-mathematics/msieve/files/msieve-1.51-reduce-printf.patch b/sci-mathematics/msieve/files/msieve-1.51-reduce-printf.patch
21 index 39892716716a..e3483b8d15bb 100644
22 --- a/sci-mathematics/msieve/files/msieve-1.51-reduce-printf.patch
23 +++ b/sci-mathematics/msieve/files/msieve-1.51-reduce-printf.patch
24 @@ -1,6 +1,5 @@
25 -diff -Naur msieve-1.50/common/minimize.c msieve-copy/common/minimize.c
26 ---- msieve-1.50/common/minimize.c 2011-07-04 23:32:33.000000000 +0800
27 -+++ msieve-copy/common/minimize.c 2012-11-26 23:09:22.889240528 +0800
28 +--- a/common/minimize.c
29 ++++ b/common/minimize.c
30 @@ -210,7 +210,7 @@
31 }
32 }
33 @@ -10,9 +9,8 @@ diff -Naur msieve-1.50/common/minimize.c msieve-copy/common/minimize.c
34 *min_out = x;
35 *status = 1;
36 return fx;
37 -diff -Naur msieve-1.50/gnfs/poly/stage2/optimize.c msieve-copy/gnfs/poly/stage2/optimize.c
38 ---- msieve-1.50/gnfs/poly/stage2/optimize.c 2011-10-15 23:03:39.000000000 +0800
39 -+++ msieve-copy/gnfs/poly/stage2/optimize.c 2012-11-26 23:14:36.243232414 +0800
40 +--- a/gnfs/poly/stage2/optimize.c
41 ++++ b/gnfs/poly/stage2/optimize.c
42 @@ -430,9 +430,9 @@
43 #if 0
44 printf("norm %.7e skew %lf\n", *pol_norm, best[SKEWNESS]);
45 @@ -25,9 +23,8 @@ diff -Naur msieve-1.50/gnfs/poly/stage2/optimize.c msieve-copy/gnfs/poly/stage2/
46 #endif
47 }
48
49 -diff -Naur msieve-1.50/gnfs/poly/stage2/stage2.c msieve-copy/gnfs/poly/stage2/stage2.c
50 ---- msieve-1.50/gnfs/poly/stage2/stage2.c 2011-10-09 09:32:49.000000000 +0800
51 -+++ msieve-copy/gnfs/poly/stage2/stage2.c 2012-11-26 23:14:30.894232552 +0800
52 +--- a/gnfs/poly/stage2/stage2.c
53 ++++ b/gnfs/poly/stage2/stage2.c
54 @@ -122,10 +122,10 @@
55 }
56
57
58 diff --git a/sci-mathematics/msieve/files/msieve-1.53-fix-version.patch b/sci-mathematics/msieve/files/msieve-1.53-fix-version.patch
59 index eb9a8d7ac2d0..c3ec73ac5987 100644
60 --- a/sci-mathematics/msieve/files/msieve-1.53-fix-version.patch
61 +++ b/sci-mathematics/msieve/files/msieve-1.53-fix-version.patch
62 @@ -1,5 +1,3 @@
63 -diff --git a/common/driver.c b/common/driver.c
64 -index ffecfa9..3e1da78 100644
65 --- a/common/driver.c
66 +++ b/common/driver.c
67 @@ -189,10 +189,9 @@ void msieve_run(msieve_obj *obj) {
68 @@ -15,8 +13,6 @@ index ffecfa9..3e1da78 100644
69 start_time = time(NULL);
70 if (obj->flags & MSIEVE_FLAG_LOG_TO_STDOUT) {
71 printf("%s", ctime(&start_time));
72 -diff --git a/demo.c b/demo.c
73 -index a882732..ec3e869 100644
74 --- a/demo.c
75 +++ b/demo.c
76 @@ -81,9 +81,8 @@ void get_random_seeds(uint32 *seed1, uint32 *seed2) {
77
78 diff --git a/sci-mathematics/msieve/files/msieve-1.53-makefile.patch b/sci-mathematics/msieve/files/msieve-1.53-makefile.patch
79 new file mode 100644
80 index 000000000000..2676cefff18b
81 --- /dev/null
82 +++ b/sci-mathematics/msieve/files/msieve-1.53-makefile.patch
83 @@ -0,0 +1,108 @@
84 +--- a/Makefile
85 ++++ b/Makefile
86 +@@ -18,10 +18,8 @@
87 +
88 + # gcc with basic optimization (-march flag could
89 + # get overridden by architecture-specific builds)
90 +-CC = gcc
91 +-WARN_FLAGS = -Wall -W
92 +-OPT_FLAGS = -O3 -fomit-frame-pointer -march=native \
93 +- -D_FILE_OFFSET_BITS=64 -DNDEBUG -D_LARGEFILE64_SOURCE
94 ++CFLAGS += -Wall -W
95 ++CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
96 +
97 + # use := instead of = so we only run the following once
98 + SVN_VERSION := $(shell svnversion .)
99 +@@ -29,15 +27,14 @@
100 + SVN_VERSION := unknown
101 + endif
102 +
103 +-CFLAGS = $(OPT_FLAGS) $(MACHINE_FLAGS) $(WARN_FLAGS) \
104 +- -DMSIEVE_SVN_VERSION="\"$(SVN_VERSION)\"" \
105 +- -I. -Iaprcl -Iinclude -Ignfs -Ignfs/poly -Ignfs/poly/stage1
106 ++CPPFLAGS += -DMSIEVE_SVN_VERSION="\"$(SVN_VERSION)\"" \
107 ++ -I. -Iaprcl -Iinclude -Ignfs -Ignfs/poly -Ignfs/poly/stage1
108 +
109 + # tweak the compile flags
110 +
111 + ifeq ($(ECM),1)
112 +- CFLAGS += -DHAVE_GMP_ECM
113 +- LIBS += -lecm
114 ++ CPPFLAGS += -DHAVE_GMP_ECM
115 ++ LIBS += -lecm -lgomp
116 + endif
117 + ifeq ($(WIN),1)
118 +
119 +@@ -61,22 +58,21 @@
120 + CUDA_ROOT = $(shell dirname $(NVCC))/../
121 + CUDA_LIBS = -lcuda
122 + endif
123 +- CFLAGS += -I"$(CUDA_ROOT)/include" -Icub -DHAVE_CUDA
124 ++ CPPFLAGS += -I"$(CUDA_ROOT)/include" -Icub -DHAVE_CUDA
125 + LIBS += $(CUDA_LIBS)
126 + endif
127 + ifeq ($(MPI),1)
128 +- CC = mpicc
129 +- CFLAGS += -DHAVE_MPI
130 ++ CPPFLAGS += -DHAVE_MPI
131 + endif
132 + ifeq ($(BOINC),1)
133 + # fill in as appropriate
134 + BOINC_INC_DIR = .
135 + BOINC_LIB_DIR = .
136 +- CFLAGS += -I$(BOINC_INC_DIR) -DHAVE_BOINC
137 ++ CPPFLAGS += -I$(BOINC_INC_DIR) -DHAVE_BOINC
138 + LIBS += -L$(BOINC_LIB_DIR) -lboinc_api -lboinc
139 + endif
140 + ifeq ($(NO_ZLIB),1)
141 +- CFLAGS += -DNO_ZLIB
142 ++ CPPFLAGS += -DNO_ZLIB
143 + else
144 + LIBS += -lz
145 + endif
146 +@@ -272,9 +268,9 @@
147 +
148 + all: $(COMMON_OBJS) $(QS_OBJS) $(NFS_OBJS) $(GPU_OBJS)
149 + rm -f libmsieve.a
150 +- ar r libmsieve.a $(COMMON_OBJS) $(QS_OBJS) $(NFS_OBJS)
151 +- ranlib libmsieve.a
152 +- $(CC) $(CFLAGS) demo.c -o msieve $(LDFLAGS) \
153 ++ $(AR) r libmsieve.a $(COMMON_OBJS) $(QS_OBJS) $(NFS_OBJS)
154 ++ $(RANLIB) libmsieve.a
155 ++ $(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) demo.c -o msieve \
156 + libmsieve.a $(LIBS)
157 +
158 + clean:
159 +@@ -287,27 +283,27 @@
160 + # common file build rules
161 +
162 + %.o: %.c $(COMMON_HDR)
163 +- $(CC) $(CFLAGS) -c -o $@ $<
164 ++ $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
165 +
166 + # QS build rules
167 +
168 + mpqs/sieve_core_generic_32k.qo: mpqs/sieve_core.c $(COMMON_HDR) $(QS_HDR)
169 +- $(CC) $(CFLAGS) -DBLOCK_KB=32 -DHAS_SSE2 \
170 ++ $(CC) $(CFLAGS) $(CPPFLAGS) -DBLOCK_KB=32 -DHAS_SSE2 \
171 + -DROUTINE_NAME=qs_core_sieve_generic_32k \
172 + -c -o $@ mpqs/sieve_core.c
173 +
174 + mpqs/sieve_core_generic_64k.qo: mpqs/sieve_core.c $(COMMON_HDR) $(QS_HDR)
175 +- $(CC) $(CFLAGS) -DBLOCK_KB=64 -DHAS_SSE2 \
176 ++ $(CC) $(CFLAGS) $(CPPFLAGS) -DBLOCK_KB=64 -DHAS_SSE2 \
177 + -DROUTINE_NAME=qs_core_sieve_generic_64k \
178 + -c -o $@ mpqs/sieve_core.c
179 +
180 + %.qo: %.c $(COMMON_HDR) $(QS_HDR)
181 +- $(CC) $(CFLAGS) -c -o $@ $<
182 ++ $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
183 +
184 + # NFS build rules
185 +
186 + %.no: %.c $(COMMON_HDR) $(NFS_HDR)
187 +- $(CC) $(CFLAGS) -Ignfs -c -o $@ $<
188 ++ $(CC) $(CFLAGS) $(CPPFLAGS) -Ignfs -c -o $@ $<
189 +
190 + # GPU build rules
191 +
192
193 diff --git a/sci-mathematics/msieve/msieve-1.53-r1.ebuild b/sci-mathematics/msieve/msieve-1.53-r1.ebuild
194 index 4cf9b2d6dce3..1f8a4593e738 100644
195 --- a/sci-mathematics/msieve/msieve-1.53-r1.ebuild
196 +++ b/sci-mathematics/msieve/msieve-1.53-r1.ebuild
197 @@ -1,7 +1,7 @@
198 -# Copyright 1999-2021 Gentoo Authors
199 +# Copyright 1999-2022 Gentoo Authors
200 # Distributed under the terms of the GNU General Public License v2
201
202 -EAPI=7
203 +EAPI=8
204
205 inherit toolchain-funcs
206
207 @@ -24,26 +24,24 @@ PATCHES=(
208 # TODO: Integrate ggnfs properly
209 "${FILESDIR}"/${PN}-1.51-reduce-printf.patch
210 "${FILESDIR}"/${PN}-1.53-fix-version.patch
211 + "${FILESDIR}"/${PN}-1.53-makefile.patch
212 )
213
214 -src_prepare() {
215 - default
216 +src_configure() {
217 + tc-export AR CC RANLIB
218
219 - sed -i -e 's/-march=k8//' Makefile || die
220 - sed -i -e 's/CC =/#CC =/' Makefile || die
221 - sed -i -e 's/CFLAGS =/CFLAGS +=/' Makefile || die
222 - sed -i -e 's/LIBS += -lecm/LIBS += -lecm -lgomp/' Makefile || die
223 + use ecm && export ECM=1
224 +
225 + if use mpi; then
226 + export MPI=1
227 + export CC=mpicc
228 + fi
229 +
230 + use zlib && export ZLIB=1
231 }
232
233 src_compile() {
234 - use ecm && export ECM=1
235 - use mpi && export MPI=1
236 - use zlib && export ZLIB=1
237 - emake \
238 - CC=$(tc-getCC) \
239 - AR=$(tc-getAR) \
240 - OPT_FLAGS="${CFLAGS}" \
241 - all
242 + emake all
243 }
244
245 src_install() {