Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/sqlite/files/, dev-db/sqlite/
Date: Mon, 09 Mar 2020 19:29:52
Message-Id: 1583781999.4dba26dd6e87214be75e1b3f4fe260ac6e073a73.floppym@gentoo
1 commit: 4dba26dd6e87214be75e1b3f4fe260ac6e073a73
2 Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
3 AuthorDate: Mon Mar 9 16:27:11 2020 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Mon Mar 9 19:26:39 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4dba26dd
7
8 dev-db/sqlite: Version bump (3.31.1).
9
10 Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache.Org>
11 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
12
13 dev-db/sqlite/Manifest | 3 +
14 .../files/sqlite-3.31.0-full_archive-build.patch | 466 +++++++++++++++++++++
15 .../sqlite-3.31.1-full_archive-architectures.patch | 72 ++++
16 ...lite-3.31.1-nonfull_archive-architectures.patch | 20 +
17 dev-db/sqlite/sqlite-3.31.1.ebuild | 390 +++++++++++++++++
18 5 files changed, 951 insertions(+)
19
20 diff --git a/dev-db/sqlite/Manifest b/dev-db/sqlite/Manifest
21 index 5ab8f5737dd..af34cd48900 100644
22 --- a/dev-db/sqlite/Manifest
23 +++ b/dev-db/sqlite/Manifest
24 @@ -1,6 +1,9 @@
25 DIST sqlite-autoconf-3290000.tar.gz 2833613 BLAKE2B b68a4f9bfe90653f5ce9dbf94b44cecc843fbb639883a7be9dd40150749f8d2eca0c231b215137d2f8da78d33356d72640a943ba06516c6d7c10ebd04cae4766 SHA512 85dcaa72cc2476c628e801d4ce46cf10ed8997f56cb0334062df5553f18c29d607883a1049bf75258204f2f53a29a02a01f014dcca383b05dfac1e2123778024
26 DIST sqlite-autoconf-3300100.tar.gz 2848951 BLAKE2B 3a541a2b07ebbaf7ddca4693b71765e2ecd11974dd64b4a7a19eaee4eea8a17a6004c69f3b2163213fe7568480152709745e029107711813d4bdd41052763cd1 SHA512 9ec0283c417fb0323b0e43550af2a49e9a63988e4212c27ea62cc9da3534caa6faf5bdc7e051b6772c4ce61560a433b3d3288b68e05e9ba8495f61a3bcebda3e
27 +DIST sqlite-autoconf-3310100.tar.gz 2887243 BLAKE2B ef5d40b6e6c59a51ae95368eb9f6a938188813f89d5328ea1c1180ef35f124c14b3e83b0832ae5c2fa24cc2df352f1b0ea5f20b64d0762d50a700d9895f9a12e SHA512 d85250ba5f78f0c918880f663741709aba662192f04888b2324a0df17affdf5b8540e8428c6c7315119806e7adad758ea281c9b403c0ad94ac6a9bd1b93fd617
28 DIST sqlite-doc-3290000.zip 9415641 BLAKE2B 97fef1f01d3e7730e5220541ad9ccdf9f8538aa43939c0f513919c8505b3a4f4b4c89eb2e04fddae80b7eeed440eb0f06f7cfd93cd56f0539bd6fdd5f47e1ff7 SHA512 ca856cf250e395d9c7e9817337adb5a16b1d96a20548a4010f5137188d35bb9d49a4a6da47bf2a696deffa68d2976dbb35a036adce19b8320e0e286876ac094f
29 DIST sqlite-doc-3300100.zip 9485342 BLAKE2B bf5e3909a327c773106d4990b3e3be5dd63db2dbc1a7f8a7c1bd16f39bec83a6b2a98c4c56ded3b58f4087dcdcc934e542db36e142bf338a411ed7115d67d6b3 SHA512 373e843015307071443a0db5fb930f9120718f6118cc2e21b506fdc8535fbe6996e9889e8b5809ffb91257addfe778bdf3412a81e11f6bced2c5e0330337d00d
30 +DIST sqlite-doc-3310100.zip 9600405 BLAKE2B 324fb7a0a38bc56476e41504c14996e9d5d83ac659403991515413d49f5ee3aad064ccece25f52b6041ef26bf23f320a9be1b6b02c5fbe96c36372107f54fc2e SHA512 5572e2c2dac30c014ef9cd60a620b7a7bb610f91a47e2890c0641540d39b9d5ce0e914ee697583130317633918b7827e2612a7cbc024f5bd6aa22ad28a78b56b
31 DIST sqlite-src-3290000.zip 12557725 BLAKE2B b1aeb80734a2cb7d45c6f2e278bad2996b56ecaf792a8f26322bf50aeaa430eea267f23edb1721bb80ecb6e0c8e14c7a5d8f26178d056fd23efb52f496cc03e1 SHA512 575398fbe20c6471ee2abcbde170b8d48efbb3cb2716a65f42f05c52429a45d14e8046e50c59bbf75bfe2d8f151c34abd50b440c50af571f19e19f3290b230df
32 DIST sqlite-src-3300100.zip 12648162 BLAKE2B bb239bac9115c74778de0347b4f4e24a82f149f55fe7dea8b89eb859bfe4cf6f6c2f065f5e1741c40624bb88ecd395140064a41d475a1c64a0188990fd6248e7 SHA512 f40236d0bb25f3ea01a1192dace3b6732fb671fbdabb7cfa8d0cc2b99d21aef00ae380999fdee904501cb03304644cddfb2506951f36a2f6a83693f311c3c11d
33 +DIST sqlite-src-3310100.zip 12510166 BLAKE2B a856695e8552b8b4dcb28452fdbd48305fdb9072f9d6587f4b1f4445daf386e920eb936dcb50fdfe41a49f84b26a7c5fedcffea5acf3ba3fa935c36695d4b8ee SHA512 af92a00877bcd90372d6f83a27fea12b4fe8d1155b223a6bccbccc31bb8e3d2269cd9e68f329bc55f70d1068ccbf220ff5abccea6f593fd7a3a4bdd732d1cdbe
34
35 diff --git a/dev-db/sqlite/files/sqlite-3.31.0-full_archive-build.patch b/dev-db/sqlite/files/sqlite-3.31.0-full_archive-build.patch
36 new file mode 100644
37 index 00000000000..9ff44c0fe7c
38 --- /dev/null
39 +++ b/dev-db/sqlite/files/sqlite-3.31.0-full_archive-build.patch
40 @@ -0,0 +1,466 @@
41 +Move some code to libsqlite3.so to avoid duplication.
42 +Link executables against libsqlite3.so.
43 +Increase timeout for fuzzcheck.
44 +Fix building with dlopen() not available.
45 +
46 +--- /Makefile.in
47 ++++ /Makefile.in
48 +@@ -311,6 +311,9 @@
49 + # Source code for extensions
50 + #
51 + SRC += \
52 ++ $(TOP)/ext/expert/sqlite3expert.c \
53 ++ $(TOP)/ext/expert/sqlite3expert.h
54 ++SRC += \
55 + $(TOP)/ext/fts1/fts1.c \
56 + $(TOP)/ext/fts1/fts1.h \
57 + $(TOP)/ext/fts1/fts1_hash.c \
58 +@@ -363,8 +366,12 @@
59 + $(TOP)/ext/rbu/sqlite3rbu.h \
60 + $(TOP)/ext/rbu/sqlite3rbu.c
61 + SRC += \
62 ++ $(TOP)/ext/misc/appendvfs.c \
63 ++ $(TOP)/ext/misc/dbdata.c \
64 + $(TOP)/ext/misc/json1.c \
65 +- $(TOP)/ext/misc/stmt.c
66 ++ $(TOP)/ext/misc/sqlar.c \
67 ++ $(TOP)/ext/misc/stmt.c \
68 ++ $(TOP)/ext/misc/zipfile.c
69 +
70 + # Generated source code files
71 + #
72 +@@ -435,7 +442,6 @@
73 + # Statically linked extensions
74 + #
75 + TESTSRC += \
76 +- $(TOP)/ext/expert/sqlite3expert.c \
77 + $(TOP)/ext/expert/test_expert.c \
78 + $(TOP)/ext/misc/amatch.c \
79 + $(TOP)/ext/misc/carray.c \
80 +@@ -461,7 +467,6 @@
81 + $(TOP)/ext/misc/totype.c \
82 + $(TOP)/ext/misc/unionvtab.c \
83 + $(TOP)/ext/misc/wholenumber.c \
84 +- $(TOP)/ext/misc/zipfile.c \
85 + $(TOP)/ext/userauth/userauth.c
86 +
87 + # Source code to the library files needed by the test fixture
88 +@@ -639,25 +644,25 @@
89 +
90 + libtclsqlite3.la: tclsqlite.lo libsqlite3.la
91 + $(LTLINK) -no-undefined -o $@ tclsqlite.lo \
92 +- libsqlite3.la @TCL_STUB_LIB_SPEC@ $(TLIBS) \
93 ++ libsqlite3.la @TCL_STUB_LIB_SPEC@ \
94 + -rpath "$(TCLLIBDIR)" \
95 + -version-info "8:6:8" \
96 + -avoid-version
97 +
98 +-sqlite3$(TEXE): shell.c sqlite3.c
99 +- $(LTLINK) $(READLINE_FLAGS) $(SHELL_OPT) -o $@ \
100 +- shell.c sqlite3.c \
101 +- $(LIBREADLINE) $(TLIBS) -rpath "$(libdir)"
102 ++sqlite3$(TEXE): shell.c libsqlite3.la
103 ++ $(LTLINK) $(READLINE_FLAGS) -o $@ \
104 ++ shell.c libsqlite3.la \
105 ++ $(LIBREADLINE)
106 +
107 +-sqldiff$(TEXE): $(TOP)/tool/sqldiff.c sqlite3.lo sqlite3.h
108 +- $(LTLINK) -o $@ $(TOP)/tool/sqldiff.c sqlite3.lo $(TLIBS)
109 ++sqldiff$(TEXE): $(TOP)/tool/sqldiff.c libsqlite3.la
110 ++ $(LTLINK) -o $@ $(TOP)/tool/sqldiff.c libsqlite3.la
111 +
112 +-dbhash$(TEXE): $(TOP)/tool/dbhash.c sqlite3.lo sqlite3.h
113 +- $(LTLINK) -o $@ $(TOP)/tool/dbhash.c sqlite3.lo $(TLIBS)
114 ++dbhash$(TEXE): $(TOP)/tool/dbhash.c libsqlite3.la
115 ++ $(LTLINK) -o $@ $(TOP)/tool/dbhash.c libsqlite3.la
116 +
117 +-scrub$(TEXE): $(TOP)/ext/misc/scrub.c sqlite3.lo
118 ++scrub$(TEXE): $(TOP)/ext/misc/scrub.c libsqlite3.la
119 + $(LTLINK) -o $@ -I. -DSCRUB_STANDALONE \
120 +- $(TOP)/ext/misc/scrub.c sqlite3.lo $(TLIBS)
121 ++ $(TOP)/ext/misc/scrub.c libsqlite3.la
122 +
123 + srcck1$(BEXE): $(TOP)/tool/srcck1.c
124 + $(BCC) -o srcck1$(BEXE) $(TOP)/tool/srcck1.c
125 +@@ -767,7 +772,7 @@
126 + # Rule to build the amalgamation
127 + #
128 + sqlite3.lo: sqlite3.c
129 +- $(LTCOMPILE) $(TEMP_STORE) -c sqlite3.c
130 ++ $(LTCOMPILE) $(SHELL_OPT) $(TEMP_STORE) -c sqlite3.c
131 +
132 + # Rules to build the LEMON compiler generator
133 + #
134 +@@ -1064,14 +1069,9 @@
135 + # Source files that go into making shell.c
136 + SHELL_SRC = \
137 + $(TOP)/src/shell.c.in \
138 +- $(TOP)/ext/misc/appendvfs.c \
139 + $(TOP)/ext/misc/shathree.c \
140 + $(TOP)/ext/misc/fileio.c \
141 + $(TOP)/ext/misc/completion.c \
142 +- $(TOP)/ext/misc/sqlar.c \
143 +- $(TOP)/ext/expert/sqlite3expert.c \
144 +- $(TOP)/ext/expert/sqlite3expert.h \
145 +- $(TOP)/ext/misc/zipfile.c \
146 + $(TOP)/ext/misc/memtrace.c \
147 + $(TOP)/src/test_windirent.c
148 +
149 +@@ -1239,11 +1239,11 @@
150 +
151 + # Fuzz testing
152 + fuzztest: fuzzcheck$(TEXE) $(FUZZDATA) sessionfuzz$(TEXE) $(TOP)/test/sessionfuzz-data1.db
153 +- ./fuzzcheck$(TEXE) $(FUZZDATA)
154 ++ ./fuzzcheck$(TEXE) --timeout 3600 $(FUZZDATA)
155 + ./sessionfuzz$(TEXE) run $(TOP)/test/sessionfuzz-data1.db
156 +
157 + valgrindfuzz: fuzzcheck$(TEXT) $(FUZZDATA) sessionfuzz$(TEXE) $(TOP)/test/sessionfuzz-data1.db
158 +- valgrind ./fuzzcheck$(TEXE) --cell-size-check --limit-mem 10M --timeout 600 $(FUZZDATA)
159 ++ valgrind ./fuzzcheck$(TEXE) --cell-size-check --limit-mem 10M --timeout 3600 $(FUZZDATA)
160 + valgrind ./sessionfuzz$(TEXE) run $(TOP)/test/sessionfuzz-data1.db
161 +
162 + # The veryquick.test TCL tests.
163 +@@ -1274,24 +1274,23 @@
164 + smoketest: $(TESTPROGS) fuzzcheck$(TEXE)
165 + ./testfixture$(TEXE) $(TOP)/test/main.test $(TESTOPTS)
166 +
167 +-sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in
168 ++sqlite3_analyzer.c: $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in
169 + $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in >sqlite3_analyzer.c
170 +
171 +-sqlite3_analyzer$(TEXE): sqlite3_analyzer.c
172 +- $(LTLINK) sqlite3_analyzer.c -o $@ $(LIBTCL) $(TLIBS)
173 ++sqlite3_analyzer$(TEXE): sqlite3_analyzer.c libsqlite3.la
174 ++ $(LTLINK) sqlite3_analyzer.c -o $@ libsqlite3.la $(LIBTCL)
175 +
176 +-sqltclsh.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl $(TOP)/ext/misc/appendvfs.c $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in
177 ++sqltclsh.c: $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in
178 + $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in >sqltclsh.c
179 +
180 +-sqltclsh$(TEXE): sqltclsh.c
181 +- $(LTLINK) sqltclsh.c -o $@ $(LIBTCL) $(TLIBS)
182 ++sqltclsh$(TEXE): sqltclsh.c libsqlite3.la
183 ++ $(LTLINK) sqltclsh.c -o $@ libsqlite3.la $(LIBTCL)
184 +
185 +-sqlite3_expert$(TEXE): $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c $(TOP)/ext/expert/expert.c sqlite3.c
186 +- $(LTLINK) $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c $(TOP)/ext/expert/expert.c sqlite3.c -o sqlite3_expert $(TLIBS)
187 ++sqlite3_expert$(TEXE): $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/expert.c libsqlite3.la
188 ++ $(LTLINK) $(TOP)/ext/expert/expert.c -o sqlite3_expert libsqlite3.la
189 +
190 + CHECKER_DEPS =\
191 + $(TOP)/tool/mkccode.tcl \
192 +- sqlite3.c \
193 + $(TOP)/src/tclsqlite.c \
194 + $(TOP)/ext/repair/sqlite3_checker.tcl \
195 + $(TOP)/ext/repair/checkindex.c \
196 +@@ -1302,36 +1301,36 @@
197 + sqlite3_checker.c: $(CHECKER_DEPS)
198 + $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/ext/repair/sqlite3_checker.c.in >$@
199 +
200 +-sqlite3_checker$(TEXE): sqlite3_checker.c
201 +- $(LTLINK) sqlite3_checker.c -o $@ $(LIBTCL) $(TLIBS)
202 ++sqlite3_checker$(TEXE): sqlite3_checker.c libsqlite3.la
203 ++ $(LTLINK) sqlite3_checker.c -o $@ libsqlite3.la $(LIBTCL)
204 +
205 +-dbdump$(TEXE): $(TOP)/ext/misc/dbdump.c sqlite3.lo
206 ++dbdump$(TEXE): $(TOP)/ext/misc/dbdump.c libsqlite3.la
207 + $(LTLINK) -DDBDUMP_STANDALONE -o $@ \
208 +- $(TOP)/ext/misc/dbdump.c sqlite3.lo $(TLIBS)
209 ++ $(TOP)/ext/misc/dbdump.c libsqlite3.la
210 +
211 +-dbtotxt$(TEXE): $(TOP)/tool/dbtotxt.c
212 +- $(LTLINK)-o $@ $(TOP)/tool/dbtotxt.c
213 ++dbtotxt$(TEXE): $(TOP)/tool/dbtotxt.c
214 ++ $(LTLINK) -o $@ $(TOP)/tool/dbtotxt.c
215 +
216 +-showdb$(TEXE): $(TOP)/tool/showdb.c sqlite3.lo
217 +- $(LTLINK) -o $@ $(TOP)/tool/showdb.c sqlite3.lo $(TLIBS)
218 ++showdb$(TEXE): $(TOP)/tool/showdb.c libsqlite3.la
219 ++ $(LTLINK) -o $@ $(TOP)/tool/showdb.c libsqlite3.la
220 +
221 +-showstat4$(TEXE): $(TOP)/tool/showstat4.c sqlite3.lo
222 +- $(LTLINK) -o $@ $(TOP)/tool/showstat4.c sqlite3.lo $(TLIBS)
223 ++showstat4$(TEXE): $(TOP)/tool/showstat4.c libsqlite3.la
224 ++ $(LTLINK) -o $@ $(TOP)/tool/showstat4.c libsqlite3.la
225 +
226 +-showjournal$(TEXE): $(TOP)/tool/showjournal.c sqlite3.lo
227 +- $(LTLINK) -o $@ $(TOP)/tool/showjournal.c sqlite3.lo $(TLIBS)
228 ++showjournal$(TEXE): $(TOP)/tool/showjournal.c
229 ++ $(LTLINK) -o $@ $(TOP)/tool/showjournal.c
230 +
231 +-showwal$(TEXE): $(TOP)/tool/showwal.c sqlite3.lo
232 +- $(LTLINK) -o $@ $(TOP)/tool/showwal.c sqlite3.lo $(TLIBS)
233 ++showwal$(TEXE): $(TOP)/tool/showwal.c
234 ++ $(LTLINK) -o $@ $(TOP)/tool/showwal.c
235 +
236 + showshm$(TEXE): $(TOP)/tool/showshm.c
237 + $(LTLINK) -o $@ $(TOP)/tool/showshm.c
238 +
239 +-index_usage$(TEXE): $(TOP)/tool/index_usage.c sqlite3.lo
240 +- $(LTLINK) $(SHELL_OPT) -o $@ $(TOP)/tool/index_usage.c sqlite3.lo $(TLIBS)
241 ++index_usage$(TEXE): $(TOP)/tool/index_usage.c libsqlite3.la
242 ++ $(LTLINK) -o $@ $(TOP)/tool/index_usage.c libsqlite3.la
243 +
244 +-changeset$(TEXE): $(TOP)/ext/session/changeset.c sqlite3.lo
245 +- $(LTLINK) -o $@ $(TOP)/ext/session/changeset.c sqlite3.lo $(TLIBS)
246 ++changeset$(TEXE): $(TOP)/ext/session/changeset.c libsqlite3.la
247 ++ $(LTLINK) -o $@ $(TOP)/ext/session/changeset.c libsqlite3.la
248 +
249 + changesetfuzz$(TEXE): $(TOP)/ext/session/changesetfuzz.c sqlite3.lo
250 + $(LTLINK) -o $@ $(TOP)/ext/session/changesetfuzz.c sqlite3.lo $(TLIBS)
251 +@@ -1356,11 +1355,11 @@
252 + kvtest$(TEXE): $(TOP)/test/kvtest.c sqlite3.c
253 + $(LTLINK) $(KV_OPT) -o $@ $(TOP)/test/kvtest.c sqlite3.c $(TLIBS)
254 +
255 +-rbu$(EXE): $(TOP)/ext/rbu/rbu.c $(TOP)/ext/rbu/sqlite3rbu.c sqlite3.lo
256 +- $(LTLINK) -I. -o $@ $(TOP)/ext/rbu/rbu.c sqlite3.lo $(TLIBS)
257 ++rbu$(EXE): $(TOP)/ext/rbu/rbu.c libsqlite3.la
258 ++ $(LTLINK) -I. -o $@ $(TOP)/ext/rbu/rbu.c libsqlite3.la
259 +
260 +-loadfts$(EXE): $(TOP)/tool/loadfts.c libsqlite3.la
261 +- $(LTLINK) $(TOP)/tool/loadfts.c libsqlite3.la -o $@ $(TLIBS)
262 ++loadfts$(EXE): $(TOP)/tool/loadfts.c libsqlite3.la
263 ++ $(LTLINK) $(TOP)/tool/loadfts.c libsqlite3.la -o $@
264 +
265 + # This target will fail if the SQLite amalgamation contains any exported
266 + # symbols that do not begin with "sqlite3_". It is run as part of the
267 +--- /configure.ac
268 ++++ /configure.ac
269 +@@ -587,6 +587,9 @@
270 + if test "${enable_load_extension}" = "yes" ; then
271 + OPT_FEATURE_FLAGS=""
272 + AC_SEARCH_LIBS(dlopen, dl)
273 ++ if test "${ac_cv_search_dlopen}" = "no" ; then
274 ++ OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
275 ++ fi
276 + else
277 + OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
278 + fi
279 +--- /ext/misc/sqlar.c
280 ++++ /ext/misc/sqlar.c
281 +@@ -14,6 +14,8 @@
282 + ** for working with sqlar archives and used by the shell tool's built-in
283 + ** sqlar support.
284 + */
285 ++#ifdef SQLITE_HAVE_ZLIB
286 ++
287 + #include "sqlite3ext.h"
288 + SQLITE_EXTENSION_INIT1
289 + #include <zlib.h>
290 +@@ -121,3 +123,5 @@
291 + }
292 + return rc;
293 + }
294 ++
295 ++#endif /* SQLITE_HAVE_ZLIB */
296 +--- /ext/misc/zipfile.c
297 ++++ /ext/misc/zipfile.c
298 +@@ -24,6 +24,8 @@
299 + ** * No support for zip64 extensions
300 + ** * Only the "inflate/deflate" (zlib) compression method is supported
301 + */
302 ++#ifdef SQLITE_HAVE_ZLIB
303 ++
304 + #include "sqlite3ext.h"
305 + SQLITE_EXTENSION_INIT1
306 + #include <stdio.h>
307 +@@ -2186,3 +2188,5 @@
308 + (void)pzErrMsg; /* Unused parameter */
309 + return zipfileRegister(db);
310 + }
311 ++
312 ++#endif /* SQLITE_HAVE_ZLIB */
313 +--- /ext/repair/sqlite3_checker.c.in
314 ++++ /ext/repair/sqlite3_checker.c.in
315 +@@ -2,6 +2,7 @@
316 + ** Read an SQLite database file and analyze its space utilization. Generate
317 + ** text on standard output.
318 + */
319 ++#define SQLITE_CORE 1
320 + #define TCLSH_INIT_PROC sqlite3_checker_init_proc
321 + #define SQLITE_ENABLE_DBPAGE_VTAB 1
322 + #define SQLITE_ENABLE_JSON1 1
323 +@@ -14,7 +15,7 @@
324 + #define SQLITE_OMIT_SHARED_CACHE 1
325 + #define SQLITE_DEFAULT_MEMSTATUS 0
326 + #define SQLITE_MAX_EXPR_DEPTH 0
327 +-INCLUDE sqlite3.c
328 ++#include "sqlite3.h"
329 + INCLUDE $ROOT/src/tclsqlite.c
330 + INCLUDE $ROOT/ext/misc/btreeinfo.c
331 + INCLUDE $ROOT/ext/repair/checkindex.c
332 +--- /src/shell.c.in
333 ++++ /src/shell.c.in
334 +@@ -61,6 +61,7 @@
335 + #include <stdio.h>
336 + #include <assert.h>
337 + #include "sqlite3.h"
338 ++#include "ext/expert/sqlite3expert.h"
339 + typedef sqlite3_int64 i64;
340 + typedef sqlite3_uint64 u64;
341 + typedef unsigned char u8;
342 +@@ -127,6 +128,10 @@
343 + # define SHELL_USE_LOCAL_GETLINE 1
344 + #endif
345 +
346 ++#ifdef SQLITE_HAVE_ZLIB
347 ++#include <zlib.h>
348 ++#endif
349 ++
350 +
351 + #if defined(_WIN32) || defined(WIN32)
352 + # include <io.h>
353 +@@ -939,18 +944,7 @@
354 + INCLUDE ../ext/misc/shathree.c
355 + INCLUDE ../ext/misc/fileio.c
356 + INCLUDE ../ext/misc/completion.c
357 +-INCLUDE ../ext/misc/appendvfs.c
358 + INCLUDE ../ext/misc/memtrace.c
359 +-#ifdef SQLITE_HAVE_ZLIB
360 +-INCLUDE ../ext/misc/zipfile.c
361 +-INCLUDE ../ext/misc/sqlar.c
362 +-#endif
363 +-INCLUDE ../ext/expert/sqlite3expert.h
364 +-INCLUDE ../ext/expert/sqlite3expert.c
365 +-
366 +-#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
367 +-INCLUDE ../ext/misc/dbdata.c
368 +-#endif
369 +
370 + #if defined(SQLITE_ENABLE_SESSION)
371 + /*
372 +@@ -4173,10 +4167,13 @@
373 + sqlite3_shathree_init(p->db, 0, 0);
374 + sqlite3_completion_init(p->db, 0, 0);
375 + #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
376 ++ extern int sqlite3_dbdata_init(sqlite3 *, char **, const sqlite3_api_routines *);
377 + sqlite3_dbdata_init(p->db, 0, 0);
378 + #endif
379 + #ifdef SQLITE_HAVE_ZLIB
380 ++ extern int sqlite3_zipfile_init(sqlite3 *, char **, const sqlite3_api_routines *);
381 + sqlite3_zipfile_init(p->db, 0, 0);
382 ++ extern int sqlite3_sqlar_init(sqlite3 *, char **, const sqlite3_api_routines *);
383 + sqlite3_sqlar_init(p->db, 0, 0);
384 + #endif
385 + sqlite3_create_function(p->db, "shell_add_schema", 3, SQLITE_UTF8, 0,
386 +@@ -6176,6 +6173,7 @@
387 + goto end_ar_command;
388 + }
389 + sqlite3_fileio_init(cmd.db, 0, 0);
390 ++ extern int sqlite3_sqlar_init(sqlite3 *, char **, const sqlite3_api_routines *);
391 + sqlite3_sqlar_init(cmd.db, 0, 0);
392 + sqlite3_create_function(cmd.db, "shell_putsnl", 1, SQLITE_UTF8, cmd.p,
393 + shellPutsFunc, 0, 0);
394 +@@ -10354,6 +10352,7 @@
395 + #endif
396 + }
397 + data.out = stdout;
398 ++ extern int sqlite3_appendvfs_init(sqlite3 *, char **, const sqlite3_api_routines *);
399 + sqlite3_appendvfs_init(0,0,0);
400 +
401 + /* Go ahead and open the database file if it already exists. If the
402 +--- /test/sessionfuzz.c
403 ++++ /test/sessionfuzz.c
404 +@@ -700,42 +700,6 @@
405 + #include <assert.h>
406 + #include "zlib.h"
407 +
408 +-/*
409 +-** Implementation of the "sqlar_uncompress(X,SZ)" SQL function
410 +-**
411 +-** Parameter SZ is interpreted as an integer. If it is less than or
412 +-** equal to zero, then this function returns a copy of X. Or, if
413 +-** SZ is equal to the size of X when interpreted as a blob, also
414 +-** return a copy of X. Otherwise, decompress blob X using zlib
415 +-** utility function uncompress() and return the results (another
416 +-** blob).
417 +-*/
418 +-static void sqlarUncompressFunc(
419 +- sqlite3_context *context,
420 +- int argc,
421 +- sqlite3_value **argv
422 +-){
423 +- uLong nData;
424 +- uLongf sz;
425 +-
426 +- assert( argc==2 );
427 +- sz = sqlite3_value_int(argv[1]);
428 +-
429 +- if( sz<=0 || sz==(nData = sqlite3_value_bytes(argv[0])) ){
430 +- sqlite3_result_value(context, argv[0]);
431 +- }else{
432 +- const Bytef *pData= sqlite3_value_blob(argv[0]);
433 +- Bytef *pOut = sqlite3_malloc(sz);
434 +- if( Z_OK!=uncompress(pOut, &sz, pData, nData) ){
435 +- sqlite3_result_error(context, "error in uncompress()", -1);
436 +- }else{
437 +- sqlite3_result_blob(context, pOut, sz, SQLITE_TRANSIENT);
438 +- }
439 +- sqlite3_free(pOut);
440 +- }
441 +-}
442 +-
443 +-
444 + /* Run a chunk of SQL. If any errors happen, print an error message
445 + ** and exit.
446 + */
447 +--- /tool/mksqlite3c.tcl
448 ++++ /tool/mksqlite3c.tcl
449 +@@ -117,6 +117,7 @@
450 + rtree.h
451 + sqlite3session.h
452 + sqlite3.h
453 ++ sqlite3expert.h
454 + sqlite3ext.h
455 + sqlite3rbu.h
456 + sqliteicu.h
457 +@@ -403,6 +404,11 @@
458 + sqlite3session.c
459 + fts5.c
460 + stmt.c
461 ++ appendvfs.c
462 ++ dbdata.c
463 ++ sqlar.c
464 ++ sqlite3expert.c
465 ++ zipfile.c
466 + } {
467 + copy_file tsrc/$file
468 + }
469 +--- /tool/sqlite3_analyzer.c.in
470 ++++ /tool/sqlite3_analyzer.c.in
471 +@@ -14,9 +14,6 @@
472 + #define SQLITE_DEFAULT_MEMSTATUS 0
473 + #define SQLITE_MAX_EXPR_DEPTH 0
474 + #define SQLITE_OMIT_LOAD_EXTENSION 1
475 +-#ifndef USE_EXTERNAL_SQLITE
476 +-INCLUDE sqlite3.c
477 +-#endif
478 + INCLUDE $ROOT/src/tclsqlite.c
479 +
480 + const char *sqlite3_analyzer_init_proc(Tcl_Interp *interp){
481 +--- /tool/sqltclsh.c.in
482 ++++ /tool/sqltclsh.c.in
483 +@@ -27,19 +27,17 @@
484 + #define SQLITE_OMIT_SHARED_CACHE 1
485 + #define SQLITE_DEFAULT_MEMSTATUS 0
486 + #define SQLITE_MAX_EXPR_DEPTH 0
487 +-INCLUDE sqlite3.c
488 +-INCLUDE $ROOT/ext/misc/appendvfs.c
489 +-#ifdef SQLITE_HAVE_ZLIB
490 +-INCLUDE $ROOT/ext/misc/zipfile.c
491 +-INCLUDE $ROOT/ext/misc/sqlar.c
492 +-#endif
493 ++#include "sqlite3.h"
494 + INCLUDE $ROOT/src/tclsqlite.c
495 +
496 + const char *sqlite3_tclapp_init_proc(Tcl_Interp *interp){
497 + (void)interp;
498 ++ extern int sqlite3_appendvfs_init(sqlite3 *,char **, const sqlite3_api_routines *);
499 + sqlite3_appendvfs_init(0,0,0);
500 + #ifdef SQLITE_HAVE_ZLIB
501 ++ extern int sqlite3_sqlar_init(sqlite3 *, char **, const sqlite3_api_routines *);
502 + sqlite3_auto_extension((void(*)(void))sqlite3_sqlar_init);
503 ++ extern int sqlite3_zipfile_init(sqlite3 *, char **, const sqlite3_api_routines *);
504 + sqlite3_auto_extension((void(*)(void))sqlite3_zipfile_init);
505 + #endif
506 +
507
508 diff --git a/dev-db/sqlite/files/sqlite-3.31.1-full_archive-architectures.patch b/dev-db/sqlite/files/sqlite-3.31.1-full_archive-architectures.patch
509 new file mode 100644
510 index 00000000000..a0cf7514d0f
511 --- /dev/null
512 +++ b/dev-db/sqlite/files/sqlite-3.31.1-full_archive-architectures.patch
513 @@ -0,0 +1,72 @@
514 +https://sqlite.org/cgi/src/info/04885763c4cd00cb
515 +https://sqlite.org/cgi/src/info/b20503aaf5b6595a
516 +
517 +--- /ext/fts5/test/fts5matchinfo.test
518 ++++ /ext/fts5/test/fts5matchinfo.test
519 +@@ -500,14 +500,18 @@
520 + INSERT INTO t1 VALUES('c', 'd');
521 + }
522 +
523 ++if {$tcl_platform(byteOrder)=="littleEndian"} {
524 ++ set res {X'02000000'}
525 ++} else {
526 ++ set res {X'00000002'}
527 ++}
528 + do_execsql_test 15.1 {
529 + SELECT quote(matchinfo(t1, 'n')) FROM t1 LIMIT 1;
530 +-} {X'02000000'}
531 +-
532 ++} $res
533 + do_execsql_test 15.2 {
534 + DELETE FROM t1_content WHERE rowid=1;
535 + SELECT quote(matchinfo(t1, 'n')) FROM t1 LIMIT 1;
536 +-} {X'02000000'}
537 ++} $res
538 +
539 + fts5_aux_test_functions db
540 + do_execsql_test 15.3 {
541 +@@ -517,4 +521,3 @@
542 + }
543 +
544 + finish_test
545 +-
546 +--- /src/insert.c
547 ++++ /src/insert.c
548 +@@ -2170,12 +2170,14 @@
549 + x = *sqlite3VdbeGetOp(v, addrConflictCk);
550 + if( x.opcode!=OP_IdxRowid ){
551 + int p2; /* New P2 value for copied conflict check opcode */
552 ++ const char *zP4;
553 + if( sqlite3OpcodeProperty[x.opcode]&OPFLG_JUMP ){
554 + p2 = lblRecheckOk;
555 + }else{
556 + p2 = x.p2;
557 + }
558 +- sqlite3VdbeAddOp4(v, x.opcode, x.p1, p2, x.p3, x.p4.z, x.p4type);
559 ++ zP4 = x.p4type==P4_INT32 ? SQLITE_INT_TO_PTR(x.p4.i) : x.p4.z;
560 ++ sqlite3VdbeAddOp4(v, x.opcode, x.p1, p2, x.p3, zP4, x.p4type);
561 + sqlite3VdbeChangeP5(v, x.p5);
562 + VdbeCoverageIf(v, p2!=x.p2);
563 + }
564 +--- /test/fts4aa.test
565 ++++ /test/fts4aa.test
566 +@@ -229,13 +229,18 @@
567 + # 2019-11-18 https://bugs.chromium.org/p/chromium/issues/detail?id=1025467
568 + db close
569 + sqlite3 db :memory:
570 ++if {$tcl_platform(byteOrder)=="littleEndian"} {
571 ++ set res {X'0200000000000000000000000E0000000E00000001000000010000000100000001000000'}
572 ++} else {
573 ++ set res {X'0000000200000000000000000000000E0000000E00000001000000010000000100000001'}
574 ++}
575 + do_execsql_test fts4aa-6.10 {
576 + CREATE VIRTUAL TABLE f USING fts4();
577 + INSERT INTO f_segdir VALUES (77,91,0,0,'255 77',x'0001308000004d5c4ddddddd4d4d7b4d4d4d614d8019ff4d05000001204d4d2e4d6e4d4d4d4b4d6c4d004d4d4d4d4d4d3d000000004d5d4d4d645d4d004d4d4d4d4d4d4d4d4d454d6910004d05ffff054d646c4d004d5d4d4d4d4d3d000000004d4d4d4d4d4d4d4d4d4d4d69624d4d4d04004d4d4d4d4d604d4ce1404d554d45');
578 + INSERT INTO f_segdir VALUES (77,108,0,0,'255 77',x'0001310000fa64004d4d4d3c5d4d654d4d4d614d8000ff4d05000001204d4d2e4d6e4d4d4dff4d4d4d4d4d4d00104d4d4d4d000000004d4d4d0400311d4d4d4d4d4d4d4d4d4d684d6910004d05ffff054d4d6c4d004d4d4d4d4d4d3d000000004d4d4d4d644d4d4d4d4d4d69624d4d4d03ed4d4d4d4d4d604d4ce1404d550080');
579 + INSERT INTO f_stat VALUES (0,x'80808080100000000064004d4d4d3c4d4d654d4d4d614d8000ff4df6ff1a00204d4d2e4d6e4d4d4d104d4d4d4d4d4d00104d4d4d4d4d4d69574d4d4d000031044d4d4d3e4d4d4c4d05004d6910');
580 + SELECT quote(matchinfo(f,'pnax')) from f where f match '0 1';
581 +-} {X'0200000000000000000000000E0000000E00000001000000010000000100000001000000'}
582 ++} $res
583 +
584 + # 2019-11-18 Detect infinite loop in fts3SelectLeaf()
585 + db close
586
587 diff --git a/dev-db/sqlite/files/sqlite-3.31.1-nonfull_archive-architectures.patch b/dev-db/sqlite/files/sqlite-3.31.1-nonfull_archive-architectures.patch
588 new file mode 100644
589 index 00000000000..79f6f07e0ef
590 --- /dev/null
591 +++ b/dev-db/sqlite/files/sqlite-3.31.1-nonfull_archive-architectures.patch
592 @@ -0,0 +1,20 @@
593 +https://sqlite.org/cgi/src/info/04885763c4cd00cb
594 +
595 +--- /sqlite3.c
596 ++++ /sqlite3.c
597 +@@ -121302,12 +121302,14 @@
598 + x = *sqlite3VdbeGetOp(v, addrConflictCk);
599 + if( x.opcode!=OP_IdxRowid ){
600 + int p2; /* New P2 value for copied conflict check opcode */
601 ++ const char *zP4;
602 + if( sqlite3OpcodeProperty[x.opcode]&OPFLG_JUMP ){
603 + p2 = lblRecheckOk;
604 + }else{
605 + p2 = x.p2;
606 + }
607 +- sqlite3VdbeAddOp4(v, x.opcode, x.p1, p2, x.p3, x.p4.z, x.p4type);
608 ++ zP4 = x.p4type==P4_INT32 ? SQLITE_INT_TO_PTR(x.p4.i) : x.p4.z;
609 ++ sqlite3VdbeAddOp4(v, x.opcode, x.p1, p2, x.p3, zP4, x.p4type);
610 + sqlite3VdbeChangeP5(v, x.p5);
611 + VdbeCoverageIf(v, p2!=x.p2);
612 + }
613
614 diff --git a/dev-db/sqlite/sqlite-3.31.1.ebuild b/dev-db/sqlite/sqlite-3.31.1.ebuild
615 new file mode 100644
616 index 00000000000..13c2752f2c9
617 --- /dev/null
618 +++ b/dev-db/sqlite/sqlite-3.31.1.ebuild
619 @@ -0,0 +1,390 @@
620 +# Copyright 1999-2020 Gentoo Authors
621 +# Distributed under the terms of the GNU General Public License v2
622 +
623 +EAPI="7"
624 +
625 +inherit autotools flag-o-matic multilib-minimal toolchain-funcs
626 +
627 +if [[ "${PV}" != "9999" ]]; then
628 + SRC_PV="$(printf "%u%02u%02u%02u" $(ver_rs 1- " "))"
629 + DOC_PV="${SRC_PV}"
630 + # DOC_PV="$(printf "%u%02u%02u00" $(ver_rs 1-3 " "))"
631 +fi
632 +
633 +DESCRIPTION="SQL database engine"
634 +HOMEPAGE="https://sqlite.org/"
635 +if [[ "${PV}" == "9999" ]]; then
636 + SRC_URI=""
637 +else
638 + SRC_URI="doc? ( https://sqlite.org/2020/${PN}-doc-${DOC_PV}.zip )
639 + tcl? ( https://sqlite.org/2020/${PN}-src-${SRC_PV}.zip )
640 + test? ( https://sqlite.org/2020/${PN}-src-${SRC_PV}.zip )
641 + tools? ( https://sqlite.org/2020/${PN}-src-${SRC_PV}.zip )
642 + !tcl? ( !test? ( !tools? ( https://sqlite.org/2020/${PN}-autoconf-${SRC_PV}.tar.gz ) ) )"
643 +fi
644 +
645 +LICENSE="public-domain"
646 +SLOT="3"
647 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
648 +IUSE="debug doc icu +readline secure-delete static-libs tcl test tools"
649 +if [[ "${PV}" == "9999" ]]; then
650 + PROPERTIES="live"
651 +fi
652 +RESTRICT="!test? ( test )"
653 +
654 +if [[ "${PV}" == "9999" ]]; then
655 + BDEPEND=">=dev-lang/tcl-8.6:0
656 + dev-vcs/fossil"
657 +else
658 + BDEPEND="doc? ( app-arch/unzip )
659 + tcl? (
660 + app-arch/unzip
661 + >=dev-lang/tcl-8.6:0
662 + )
663 + test? (
664 + app-arch/unzip
665 + >=dev-lang/tcl-8.6:0
666 + )
667 + tools? (
668 + app-arch/unzip
669 + >=dev-lang/tcl-8.6:0
670 + )"
671 +fi
672 +RDEPEND="sys-libs/zlib:0=[${MULTILIB_USEDEP}]
673 + icu? ( dev-libs/icu:0=[${MULTILIB_USEDEP}] )
674 + readline? ( sys-libs/readline:0=[${MULTILIB_USEDEP}] )
675 + tcl? ( dev-lang/tcl:0=[${MULTILIB_USEDEP}] )
676 + tools? ( dev-lang/tcl:0=[${MULTILIB_USEDEP}] )"
677 +DEPEND="${RDEPEND}
678 + test? ( >=dev-lang/tcl-8.6:0[${MULTILIB_USEDEP}] )"
679 +
680 +full_archive() {
681 + [[ "${PV}" == "9999" ]] || use tcl || use test || use tools
682 +}
683 +
684 +pkg_setup() {
685 + if [[ "${PV}" == "9999" ]]; then
686 + S="${WORKDIR}/${PN}"
687 + else
688 + if full_archive; then
689 + S="${WORKDIR}/${PN}-src-${SRC_PV}"
690 + else
691 + S="${WORKDIR}/${PN}-autoconf-${SRC_PV}"
692 + fi
693 + fi
694 +}
695 +
696 +src_unpack() {
697 + if [[ "${PV}" == "9999" ]]; then
698 + local distdir="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}"
699 + addwrite "${distdir}"
700 + mkdir -p "${distdir}/fossil-src/${PN}" || die
701 +
702 + mkdir "${WORKDIR}/${PN}" || die
703 + pushd "${WORKDIR}/${PN}" > /dev/null || die
704 + if [[ ! -f "${distdir}/fossil-src/${PN}/sqlite.fossil" ]]; then
705 + einfo fossil clone --verbose https://sqlite.org/src sqlite.fossil
706 + fossil clone --verbose https://sqlite.org/src sqlite.fossil || die
707 + echo
708 + else
709 + cp -p "${distdir}/fossil-src/${PN}/sqlite.fossil" . || die
710 + einfo fossil pull --repository sqlite.fossil --verbose https://sqlite.org/src
711 + fossil pull --repository sqlite.fossil --verbose https://sqlite.org/src || die
712 + echo
713 + fi
714 + cp -p sqlite.fossil "${distdir}/fossil-src/${PN}" || die
715 + einfo fossil open --quiet sqlite.fossil
716 + fossil open --quiet sqlite.fossil || die
717 + echo
718 + popd > /dev/null || die
719 +
720 + if use doc; then
721 + mkdir "${WORKDIR}/${PN}-doc" || die
722 + pushd "${WORKDIR}/${PN}-doc" > /dev/null || die
723 + if [[ ! -f "${distdir}/fossil-src/${PN}/sqlite-doc.fossil" ]]; then
724 + einfo fossil clone --verbose https://sqlite.org/docsrc sqlite-doc.fossil
725 + fossil clone --verbose https://sqlite.org/docsrc sqlite-doc.fossil || die
726 + echo
727 + else
728 + cp -p "${distdir}/fossil-src/${PN}/sqlite-doc.fossil" . || die
729 + einfo fossil pull --repository sqlite-doc.fossil --verbose https://sqlite.org/docsrc
730 + fossil pull --repository sqlite-doc.fossil --verbose https://sqlite.org/docsrc || die
731 + echo
732 + fi
733 + cp -p sqlite-doc.fossil "${distdir}/fossil-src/${PN}" || die
734 + einfo fossil open --quiet sqlite-doc.fossil
735 + fossil open --quiet sqlite-doc.fossil || die
736 + echo
737 + popd > /dev/null || die
738 + fi
739 + else
740 + default
741 + fi
742 +}
743 +
744 +src_prepare() {
745 + if full_archive; then
746 + eapply "${FILESDIR}/${PN}-3.31.0-full_archive-build.patch"
747 + eapply "${FILESDIR}/${PN}-3.31.1-full_archive-architectures.patch"
748 +
749 + eapply_user
750 +
751 + # Fix AC_CHECK_FUNCS.
752 + # https://mailinglists.sqlite.org/cgi-bin/mailman/private/sqlite-dev/2016-March/002762.html
753 + sed -e "s/AC_CHECK_FUNCS(.*)/AC_CHECK_FUNCS([fdatasync fullfsync gmtime_r isnan localtime_r localtime_s malloc_usable_size posix_fallocate pread pread64 pwrite pwrite64 strchrnul usleep utime])/" -i configure.ac || die "sed failed"
754 + else
755 + eapply "${FILESDIR}/${PN}-3.25.0-nonfull_archive-build.patch"
756 + eapply "${FILESDIR}/${PN}-3.31.1-nonfull_archive-architectures.patch"
757 +
758 + eapply_user
759 +
760 + # Fix AC_CHECK_FUNCS.
761 + # https://mailinglists.sqlite.org/cgi-bin/mailman/private/sqlite-dev/2016-March/002762.html
762 + sed \
763 + -e "s/AC_CHECK_FUNCS(\[fdatasync.*/AC_CHECK_FUNCS([fdatasync fullfsync gmtime_r isnan localtime_r localtime_s malloc_usable_size posix_fallocate pread pread64 pwrite pwrite64 strchrnul usleep utime])/" \
764 + -e "/AC_CHECK_FUNCS(posix_fallocate)/d" \
765 + -i configure.ac || die "sed failed"
766 + fi
767 +
768 + eautoreconf
769 +
770 + multilib_copy_sources
771 +}
772 +
773 +multilib_src_configure() {
774 + local -x CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}"
775 + local options=()
776 +
777 + options+=(
778 + --enable-$(full_archive && echo load-extension || echo dynamic-extensions)
779 + --enable-threadsafe
780 + )
781 + if ! full_archive; then
782 + options+=(--disable-static-shell)
783 + fi
784 +
785 + # Support detection of misuse of SQLite API.
786 + # https://sqlite.org/compile.html#enable_api_armor
787 + append-cppflags -DSQLITE_ENABLE_API_ARMOR
788 +
789 + # Support column metadata functions.
790 + # https://sqlite.org/c3ref/column_database_name.html
791 + append-cppflags -DSQLITE_ENABLE_COLUMN_METADATA
792 +
793 + # Support sqlite_dbpage virtual table.
794 + # https://sqlite.org/compile.html#enable_dbpage_vtab
795 + append-cppflags -DSQLITE_ENABLE_DBPAGE_VTAB
796 +
797 + # Support dbstat virtual table.
798 + # https://sqlite.org/dbstat.html
799 + append-cppflags -DSQLITE_ENABLE_DBSTAT_VTAB
800 +
801 + # Support sqlite3_serialize() and sqlite3_deserialize() functions.
802 + # https://sqlite.org/compile.html#enable_deserialize
803 + # https://sqlite.org/c3ref/serialize.html
804 + # https://sqlite.org/c3ref/deserialize.html
805 + append-cppflags -DSQLITE_ENABLE_DESERIALIZE
806 +
807 + # Support comments in output of EXPLAIN.
808 + # https://sqlite.org/compile.html#enable_explain_comments
809 + append-cppflags -DSQLITE_ENABLE_EXPLAIN_COMMENTS
810 +
811 + # Support Full-Text Search versions 3, 4 and 5.
812 + # https://sqlite.org/fts3.html
813 + # https://sqlite.org/fts5.html
814 + append-cppflags -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4
815 + options+=(--enable-fts5)
816 +
817 + # Support hidden columns.
818 + append-cppflags -DSQLITE_ENABLE_HIDDEN_COLUMNS
819 +
820 + # Support JSON1 extension.
821 + # https://sqlite.org/json1.html
822 + append-cppflags -DSQLITE_ENABLE_JSON1
823 +
824 + # Support memsys5 memory allocator.
825 + # https://sqlite.org/malloc.html#memsys5
826 + append-cppflags -DSQLITE_ENABLE_MEMSYS5
827 +
828 + # Support sqlite3_normalized_sql() function.
829 + # https://sqlite.org/c3ref/expanded_sql.html
830 + append-cppflags -DSQLITE_ENABLE_NORMALIZE
831 +
832 + # Support sqlite_offset() function.
833 + # https://sqlite.org/lang_corefunc.html#sqlite_offset
834 + append-cppflags -DSQLITE_ENABLE_OFFSET_SQL_FUNC
835 +
836 + # Support pre-update hook functions.
837 + # https://sqlite.org/c3ref/preupdate_count.html
838 + append-cppflags -DSQLITE_ENABLE_PREUPDATE_HOOK
839 +
840 + # Support Resumable Bulk Update extension.
841 + # https://sqlite.org/rbu.html
842 + append-cppflags -DSQLITE_ENABLE_RBU
843 +
844 + # Support R*Trees.
845 + # https://sqlite.org/rtree.html
846 + # https://sqlite.org/geopoly.html
847 + append-cppflags -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY
848 +
849 + # Support scan status functions.
850 + # https://sqlite.org/c3ref/stmt_scanstatus.html
851 + # https://sqlite.org/c3ref/stmt_scanstatus_reset.html
852 + append-cppflags -DSQLITE_ENABLE_STMT_SCANSTATUS
853 +
854 + # Support sqlite_stmt virtual table.
855 + # https://sqlite.org/stmt.html
856 + append-cppflags -DSQLITE_ENABLE_STMTVTAB
857 +
858 + # Support Session extension.
859 + # https://sqlite.org/sessionintro.html
860 + options+=(--enable-session)
861 +
862 + # Support unknown() function.
863 + # https://sqlite.org/compile.html#enable_unknown_sql_function
864 + append-cppflags -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
865 +
866 + # Support unlock notification.
867 + # https://sqlite.org/unlock_notify.html
868 + append-cppflags -DSQLITE_ENABLE_UNLOCK_NOTIFY
869 +
870 + # Support LIMIT and ORDER BY clauses on DELETE and UPDATE statements.
871 + # https://sqlite.org/compile.html#enable_update_delete_limit
872 + append-cppflags -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT
873 +
874 + # Support soundex() function.
875 + # https://sqlite.org/lang_corefunc.html#soundex
876 + append-cppflags -DSQLITE_SOUNDEX
877 +
878 + # Support URI filenames.
879 + # https://sqlite.org/uri.html
880 + append-cppflags -DSQLITE_USE_URI
881 +
882 + # debug USE flag.
883 + if full_archive; then
884 + options+=($(use_enable debug))
885 + else
886 + if use debug; then
887 + append-cppflags -DSQLITE_DEBUG
888 + else
889 + append-cppflags -DNDEBUG
890 + fi
891 + fi
892 +
893 + # icu USE flag.
894 + if use icu; then
895 + # Support ICU extension.
896 + # https://sqlite.org/compile.html#enable_icu
897 + append-cppflags -DSQLITE_ENABLE_ICU
898 + if full_archive; then
899 + sed -e "s/^TLIBS = @LIBS@/& -licui18n -licuuc/" -i Makefile.in || die "sed failed"
900 + else
901 + sed -e "s/^LIBS = @LIBS@/& -licui18n -licuuc/" -i Makefile.in || die "sed failed"
902 + fi
903 + fi
904 +
905 + # readline USE flag.
906 + options+=(
907 + --disable-editline
908 + $(use_enable readline)
909 + )
910 + if full_archive && use readline; then
911 + options+=(--with-readline-inc="-I${EPREFIX}/usr/include/readline")
912 + fi
913 +
914 + # secure-delete USE flag.
915 + if use secure-delete; then
916 + # Enable secure_delete pragma by default.
917 + # https://sqlite.org/pragma.html#pragma_secure_delete
918 + append-cppflags -DSQLITE_SECURE_DELETE
919 + fi
920 +
921 + # static-libs USE flag.
922 + options+=($(use_enable static-libs static))
923 +
924 + # tcl, test, tools USE flags.
925 + if full_archive; then
926 + options+=(--enable-tcl)
927 + fi
928 +
929 + if [[ "${CHOST}" == *-mint* ]]; then
930 + append-cppflags -DSQLITE_OMIT_WAL
931 + fi
932 +
933 + if [[ "${ABI}" == "x86" ]]; then
934 + if $(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P -dM - < /dev/null 2> /dev/null | grep -q "^#define __SSE__ 1$"; then
935 + append-cflags -mfpmath=sse
936 + else
937 + append-cflags -ffloat-store
938 + fi
939 + fi
940 +
941 + econf "${options[@]}"
942 +}
943 +
944 +multilib_src_compile() {
945 + emake HAVE_TCL="$(usex tcl 1 "")" TCLLIBDIR="${EPREFIX}/usr/$(get_libdir)/${P}"
946 +
947 + if use tools && multilib_is_native_abi; then
948 + emake changeset dbdump dbhash dbtotxt index_usage rbu scrub showdb showjournal showshm showstat4 showwal sqldiff sqlite3_analyzer sqlite3_checker sqlite3_expert sqltclsh
949 + fi
950 +}
951 +
952 +multilib_src_test() {
953 + if [[ "${EUID}" -eq 0 ]]; then
954 + ewarn "Skipping tests due to root permissions"
955 + return
956 + fi
957 +
958 + local -x SQLITE_HISTORY="${T}/sqlite_history_${ABI}"
959 +
960 + emake HAVE_TCL="$(usex tcl 1 "")" $(use debug && echo fulltest || echo test)
961 +}
962 +
963 +multilib_src_install() {
964 + emake DESTDIR="${D}" HAVE_TCL="$(usex tcl 1 "")" TCLLIBDIR="${EPREFIX}/usr/$(get_libdir)/${P}" install
965 +
966 + if use tools && multilib_is_native_abi; then
967 + install_tool() {
968 + if [[ -f ".libs/${1}" ]]; then
969 + newbin ".libs/${1}" "${2}"
970 + else
971 + newbin "${1}" "${2}"
972 + fi
973 + }
974 +
975 + install_tool changeset sqlite3-changeset
976 + install_tool dbdump sqlite3-db-dump
977 + install_tool dbhash sqlite3-db-hash
978 + install_tool dbtotxt sqlite3-db-to-txt
979 + install_tool index_usage sqlite3-index-usage
980 + install_tool rbu sqlite3-rbu
981 + install_tool scrub sqlite3-scrub
982 + install_tool showdb sqlite3-show-db
983 + install_tool showjournal sqlite3-show-journal
984 + install_tool showshm sqlite3-show-shm
985 + install_tool showstat4 sqlite3-show-stat4
986 + install_tool showwal sqlite3-show-wal
987 + install_tool sqldiff sqlite3-diff
988 + install_tool sqlite3_analyzer sqlite3-analyzer
989 + install_tool sqlite3_checker sqlite3-checker
990 + install_tool sqlite3_expert sqlite3-expert
991 + install_tool sqltclsh sqlite3-tclsh
992 +
993 + unset -f install_tool
994 + fi
995 +}
996 +
997 +multilib_src_install_all() {
998 + find "${D}" -name "*.la" -type f -delete || die
999 +
1000 + doman sqlite3.1
1001 +
1002 + if use doc; then
1003 + rm "${WORKDIR}/${PN}-doc-${DOC_PV}/"*.{db,txt} || die
1004 + (
1005 + docinto html
1006 + dodoc -r "${WORKDIR}/${PN}-doc-${DOC_PV}/"*
1007 + )
1008 + fi
1009 +}