Gentoo Archives: gentoo-commits

From: Alessandro Barbieri <lssndrbarbieri@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:dev commit in: sci-mathematics/minisat+/, sci-mathematics/minisat+/files/
Date: Fri, 29 Apr 2022 01:48:04
Message-Id: 1651196878.1d6017d59522445fb112b9fc0d8bd8e379e81211.Alessandro-Barbieri@gentoo
1 commit: 1d6017d59522445fb112b9fc0d8bd8e379e81211
2 Author: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
3 AuthorDate: Thu Apr 28 14:39:38 2022 +0000
4 Commit: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
5 CommitDate: Fri Apr 29 01:47:58 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=1d6017d5
7
8 sci-mathematics/minisat+: new package, add 2007.01.05
9
10 Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com>
11
12 sci-mathematics/minisat+/Manifest | 1 +
13 .../files/minisat+-2007.01.05-exitcode.patch | 39 +++++++++
14 .../files/minisat+-2007.01.05-makefile.patch | 98 ++++++++++++++++++++++
15 .../files/minisat+-2007.01.05-script.patch | 17 ++++
16 .../files/minisat+-2007.01.05-spelling.patch | 16 ++++
17 sci-mathematics/minisat+/metadata.xml | 16 ++++
18 .../minisat+/minisat+-2007.01.05.ebuild | 50 +++++++++++
19 7 files changed, 237 insertions(+)
20
21 diff --git a/sci-mathematics/minisat+/Manifest b/sci-mathematics/minisat+/Manifest
22 new file mode 100644
23 index 000000000..bd6a3947f
24 --- /dev/null
25 +++ b/sci-mathematics/minisat+/Manifest
26 @@ -0,0 +1 @@
27 +DIST minisat+_2007-Jan-05.zip 920081 BLAKE2B 4b133a3c06ffe8539a26c7f39f4734d8115053df299bfcd002e97ea00a104abf326633120371560d71cf2700ed02be8891ef78c185f16b516da818269b1101c9 SHA512 deee0cce2882fad8c175c7ca061d7952a243d00119e8d7fcf9ed0260db874a2e5bb846cb9513aa43163735406aebf5cd8ac01000621e2db37da0dc5d5de3854d
28
29 diff --git a/sci-mathematics/minisat+/files/minisat+-2007.01.05-exitcode.patch b/sci-mathematics/minisat+/files/minisat+-2007.01.05-exitcode.patch
30 new file mode 100644
31 index 000000000..6321a1969
32 --- /dev/null
33 +++ b/sci-mathematics/minisat+/files/minisat+-2007.01.05-exitcode.patch
34 @@ -0,0 +1,39 @@
35 +Author: Niklas Sorensson <nik@××××××××.se> (extracted from upstream git)
36 +Approved: Ralf Treinen <treinen@××××××.org>
37 +Description: use exitcode to indicate error
38 +
39 +Index: minisat+/Main.C
40 +===================================================================
41 +--- minisat+.orig/Main.C 2011-05-24 20:48:23.000000000 +0200
42 ++++ minisat+/Main.C 2011-05-24 20:50:13.000000000 +0200
43 +@@ -261,7 +261,7 @@
44 + reportf("*** TERMINATED ***\n");
45 + outputResult(*pb_solver, false);
46 + SatELite::deleteTmpFiles();
47 +- _exit(pb_solver->best_goalvalue == Int_MAX ? 0 : 10); }
48 ++ _exit(0); }
49 +
50 +
51 + void printStats(BasicSolverStats& stats, double cpu_time)
52 +@@ -324,7 +324,7 @@
53 + reportf("_______________________________________________________________________________\n");
54 + }
55 +
56 +- exit(pb_solver->best_goalvalue == Int_MAX ? 20 : (pb_solver->goal == NULL || opt_command == cmd_FirstSolution) ? 10 : 30); // (faster than "return", which will invoke the destructor for 'PbSolver')
57 ++ exit(0); // (faster than "return", which will invoke the destructor for 'PbSolver')
58 + }
59 +
60 +
61 +Index: minisat+/PbParser.C
62 +===================================================================
63 +--- minisat+.orig/PbParser.C 2011-05-24 20:48:23.000000000 +0200
64 ++++ minisat+/PbParser.C 2011-05-24 20:50:13.000000000 +0200
65 +@@ -282,7 +282,7 @@
66 + xfree(msg);
67 + if (opt_satlive && !opt_try)
68 + printf("s UNKNOWN\n");
69 +- exit(opt_try ? 5 : 0);
70 ++ exit(5);
71 + }else
72 + throw msg;
73 + }
74
75 diff --git a/sci-mathematics/minisat+/files/minisat+-2007.01.05-makefile.patch b/sci-mathematics/minisat+/files/minisat+-2007.01.05-makefile.patch
76 new file mode 100644
77 index 000000000..ca3f43f93
78 --- /dev/null
79 +++ b/sci-mathematics/minisat+/files/minisat+-2007.01.05-makefile.patch
80 @@ -0,0 +1,98 @@
81 +--- a/Makefile
82 ++++ b/Makefile
83 +@@ -13,11 +13,8 @@
84 +
85 + EXEC = minisat+
86 +
87 +-CXX = g++
88 + #CXX = icpc
89 +-CFLAGS = -Wall -ffloat-store
90 +-CFLAGS += -IADTs -include Global.h -include Main.h -D_FILE_OFFSET_BITS=64
91 +-COPTIMIZE = -O3 #-fomit-frame-pointer # -falign-loops=4 -falign-functions=16 -foptimize-sibling-calls -finline-functions -fcse-follow-jumps -fcse-skip-blocks -frerun-cse-after-loop -frerun-loop-opt -fgcse
92 ++CXXFLAGS += -IADTs -include Global.h -include Main.h -D_FILE_OFFSET_BITS=64
93 +
94 +
95 + .PHONY : s p d r build clean depend
96 +@@ -26,22 +23,22 @@
97 + p: WAY=profile
98 + d: WAY=debug
99 + r: WAY=release
100 +-rs: WAY="release static / bignums"
101 +-rx: WAY="release static / 64-bit integers"
102 ++rs: WAY="release / bignums"
103 ++rx: WAY="release / 64-bit integers"
104 +
105 +-s: CFLAGS+=$(COPTIMIZE) -ggdb -D DEBUG
106 +-p: CFLAGS+=$(COPTIMIZE) -pg -ggdb -D DEBUG
107 +-d: CFLAGS+=-O0 -ggdb -D DEBUG
108 +-r: CFLAGS+=$(COPTIMIZE) -D NDEBUG
109 +-rs: CFLAGS+=$(COPTIMIZE) -D NDEBUG
110 +-rx: CFLAGS+=$(COPTIMIZE) -D NDEBUG -D NO_GMP
111 ++s: CXXFLAGS+=-ggdb -D DEBUG
112 ++p: CXXFLAGS+=-pg -ggdb -D DEBUG
113 ++d: CXXFLAGS+=-O0 -ggdb -D DEBUG
114 ++r: CXXFLAGS+=-D NDEBUG
115 ++rs: CXXFLAGS+=-D NDEBUG
116 ++rx: CXXFLAGS+=-D NDEBUG -D NO_GMP
117 +
118 + s: build $(EXEC)
119 + p: build $(EXEC)_profile
120 + d: build $(EXEC)_debug
121 + r: build $(EXEC)_release
122 +-rs: build $(EXEC)_bignum_static
123 +-rx: build $(EXEC)_64-bit_static
124 ++rs: build $(EXEC)_bignum
125 ++rx: build $(EXEC)_64-bit
126 +
127 + build:
128 + @echo Building $(EXEC) "("$(WAY)")"
129 +@@ -53,39 +50,39 @@
130 + ## Build rule
131 + %.o %.op %.od %.or %.ox: %.C
132 + @echo Compiling: $<
133 +- @$(CXX) $(CFLAGS) -c -o $@ $<
134 ++ @$(CXX) $(CXXFLAGS) -fPIC -c -o $@ $<
135 +
136 + ## Linking rules (standard/profile/debug/release)
137 + $(EXEC): $(COBJS)
138 + @echo Linking $(EXEC)
139 +- @$(CXX) $(COBJS) -lz -lgmp -ggdb -Wall -o $@
140 ++ @$(CXX) $(CXXFLAGS) $(LDFLAGS) -fPIE $(COBJS) -lz -lgmp -ggdb -Wall -o $@
141 +
142 + $(EXEC)_profile: $(PCOBJS)
143 + @echo Linking $@
144 +- @$(CXX) $(PCOBJS) -lz -lgmp -ggdb -Wall -pg -o $@
145 ++ @$(CXX) $(CXXFLAGS) $(LDFLAGS) -fPIE $(PCOBJS) -lz -lgmp -ggdb -Wall -pg -o $@
146 +
147 + $(EXEC)_debug: $(DCOBJS)
148 + @echo Linking $@
149 +- @$(CXX) $(DCOBJS) -lz -lgmp -ggdb -Wall -o $@
150 ++ @$(CXX) $(CXXFLAGS) $(LDFLAGS) -fPIE $(DCOBJS) -lz -lgmp -ggdb -Wall -o $@
151 +
152 + $(EXEC)_release: $(RCOBJS)
153 + @echo Linking $@
154 +- @$(CXX) $(RCOBJS) -lz -lgmp -Wall -o $@
155 ++ @$(CXX) $(CXXFLAGS) $(LDFLAGS) -fPIE $(RCOBJS) -lz -lgmp -Wall -o $@
156 +
157 +-$(EXEC)_bignum_static: $(RCOBJS)
158 ++$(EXEC)_bignum: $(RCOBJS)
159 + @echo Linking $@
160 +- @$(CXX) --static $(RCOBJS) -lz -lgmp -Wall -o $@
161 ++ @$(CXX) $(CXXFLAGS) $(LDFLAGS) -fPIE $(RCOBJS) -lz -lgmp -Wall -o $@
162 +
163 +-$(EXEC)_64-bit_static: $(R64COBJS)
164 ++$(EXEC)_64-bit: $(R64COBJS)
165 + @echo Linking $@
166 +- @$(CXX) --static $(R64COBJS) -lz -Wall -o $@
167 ++ @$(CXX) $(CXXFLAGS) $(LDFLAGS) -fPIE $(R64COBJS) -lz -Wall -o $@
168 +
169 +
170 + ## Make dependencies
171 + depend: depend.mak
172 + depend.mak: $(CSRCS) $(CHDRS)
173 + @echo Making dependencies...
174 +- @$(CXX) -MM $(CSRCS) $(CFLAGS) > depend.mak
175 ++ @$(CXX) -MM $(CSRCS) $(CXXFLAGS) > depend.mak
176 + @cp depend.mak /tmp/depend.mak.tmp
177 + @sed "s/o:/op:/" /tmp/depend.mak.tmp >> depend.mak
178 + @sed "s/o:/od:/" /tmp/depend.mak.tmp >> depend.mak
179
180 diff --git a/sci-mathematics/minisat+/files/minisat+-2007.01.05-script.patch b/sci-mathematics/minisat+/files/minisat+-2007.01.05-script.patch
181 new file mode 100644
182 index 000000000..38af57bc7
183 --- /dev/null
184 +++ b/sci-mathematics/minisat+/files/minisat+-2007.01.05-script.patch
185 @@ -0,0 +1,17 @@
186 +--- a/minisat+_script
187 ++++ b/minisat+_script
188 +@@ -6,12 +6,12 @@
189 + XDIR=`echo $0 | sed "s%\(.*\)/.*$%\1%"`
190 + fi
191 +
192 +-$XDIR/minisat+_64-bit_static -try "$@"
193 ++$XDIR/minisat+_64-bit -try "$@"
194 + EXIT=$?
195 +
196 + if [ $EXIT = 5 ]; then
197 + echo "c OK -- Running BigNum-version instead..."
198 +- $XDIR/minisat+_bignum_static* "$@"
199 ++ $XDIR/minisat+_bignum* "$@"
200 + EXIT=$?
201 + fi
202 + exit $EXIT
203
204 diff --git a/sci-mathematics/minisat+/files/minisat+-2007.01.05-spelling.patch b/sci-mathematics/minisat+/files/minisat+-2007.01.05-spelling.patch
205 new file mode 100644
206 index 000000000..51ebe70ec
207 --- /dev/null
208 +++ b/sci-mathematics/minisat+/files/minisat+-2007.01.05-spelling.patch
209 @@ -0,0 +1,16 @@
210 +Author: Ralf Treinen <treinen@××××××.org>
211 +Description: fix a spelling error in help text
212 +
213 +Index: minisat+/Main.C
214 +===================================================================
215 +--- minisat+.orig/Main.C 2011-05-24 20:59:49.000000000 +0200
216 ++++ minisat+/Main.C 2016-12-19 07:29:13.894553743 +0100
217 +@@ -79,7 +79,7 @@
218 + "\n"
219 + " -bdd-thres= Threshold for prefering BDDs in mixed mode. [def: %g]\n"
220 + " -sort-thres= Threshold for prefering sorters. Tried after BDDs. [def: %g]\n"
221 +- " -goal-bias= Bias goal function convertion towards sorters. [def: %g]\n"
222 ++ " -goal-bias= Bias goal function conversion towards sorters. [def: %g]\n"
223 + "\n"
224 + " -1 -first Don\'t minimize, just give first solution found\n"
225 + " -A -all Don\'t minimize, give all solutions\n"
226
227 diff --git a/sci-mathematics/minisat+/metadata.xml b/sci-mathematics/minisat+/metadata.xml
228 new file mode 100644
229 index 000000000..a3ac64a0d
230 --- /dev/null
231 +++ b/sci-mathematics/minisat+/metadata.xml
232 @@ -0,0 +1,16 @@
233 +<?xml version="1.0" encoding="UTF-8"?>
234 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
235 +<pkgmetadata>
236 + <maintainer type="person">
237 + <email>lssndrbarbieri@×××××.com</email>
238 + <name>Alessandro Barbieri</name>
239 + </maintainer>
240 + <use>
241 + <flag name="bignum">Build the bignum variant of minisat+</flag>
242 + </use>
243 + <longdescription lang="en">
244 +MiniSat+ is a two-week hack done to enable MiniSat to compete in the new categories of the SAT 2005 competition. Initially, we intended to support both Pseudo-Boolean constraints (i.e. linear constraints over boolean variables) and circuit based SAT input (as opposed to CNF). However, after we finished the conversion of PB-constraints to SAT, we ran out of steam and never finished the other part.
245 +However, the PB part is, arguably, the more interesting one. A number of generalizations of SAT solvers to PB solvers have been proposed (Pueblo, Galena, OPBDP and more), but we felt that the other approach — converting the problem to SAT — had not been invesigated adequately. Our hope was to provide a point of reference for the proper generalizations of SAT to PB, so that the merit of such an approach could be evaluated. Therefore MiniSat+ provides multiple ways of translating PB constraints to clauses.
246 +For the PB evaluation 2005, we provided a top-level heuristic to choose between the translation methods. To our surprise, MiniSat+ solved more problem than any of the other 6 dedicated PB solvers did, and also seemed to one of the few solvers not being visibly buggy (modulo giving the wrong exitcode for SATISFIABLE instances without an objective function).
247 + </longdescription>
248 +</pkgmetadata>
249
250 diff --git a/sci-mathematics/minisat+/minisat+-2007.01.05.ebuild b/sci-mathematics/minisat+/minisat+-2007.01.05.ebuild
251 new file mode 100644
252 index 000000000..b97a3b908
253 --- /dev/null
254 +++ b/sci-mathematics/minisat+/minisat+-2007.01.05.ebuild
255 @@ -0,0 +1,50 @@
256 +# Copyright 1999-2022 Gentoo Authors
257 +# Distributed under the terms of the GNU General Public License v2
258 +
259 +EAPI=8
260 +
261 +MYPV="${PV/.01./-Jan-}"
262 +MYP="${PN}_${MYPV}"
263 +
264 +inherit toolchain-funcs
265 +
266 +DESCRIPTION="solver for pseudo-Boolean constraints"
267 +HOMEPAGE="https://minisat.se/MiniSat+.html"
268 +SRC_URI="https://minisat.se/downloads/${MYP}.zip"
269 +S="${WORKDIR}/${PN}"
270 +
271 +LICENSE="MIT"
272 +SLOT="0"
273 +KEYWORDS="~amd64"
274 +IUSE="bignum"
275 +
276 +RDEPEND="
277 + bignum? ( dev-libs/gmp )
278 + sys-libs/zlib
279 +"
280 +DEPEND="${RDEPEND}"
281 +BDEPEND="app-arch/unzip"
282 +
283 +PATCHES=(
284 + "${FILESDIR}/${P}-makefile.patch"
285 + "${FILESDIR}/${P}-script.patch"
286 + "${FILESDIR}/${P}-exitcode.patch"
287 + "${FILESDIR}/${P}-spelling.patch"
288 +)
289 +
290 +src_compile() {
291 + tc-export CXX
292 + emake rx
293 + use bignum && emake rs
294 +}
295 +
296 +src_install() {
297 + dodoc -r Examples
298 + dobin minisat+_64-bit
299 + use bignum && dobin minisat+_bignum
300 + if use bignum; then
301 + dosym ./minisat+_bignum "${EPREFIX}/usr/bin/minisat+"
302 + else
303 + dosym ./minisat+_64-bit "${EPREFIX}/usr/bin/minisat+"
304 + fi
305 +}