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