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/, dev-db/sqlite/files/
Date: Sun, 27 Dec 2020 18:39:19
Message-Id: 1609094348.406a76d5dacf834cbaca4939650f65849a5c6220.floppym@gentoo
1 commit: 406a76d5dacf834cbaca4939650f65849a5c6220
2 Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
3 AuthorDate: Fri Dec 18 00:00:00 2020 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Sun Dec 27 18:39:08 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=406a76d5
7
8 dev-db/sqlite: Version bump (3.34.0).
9
10 Closes: https://bugs.gentoo.org/658912
11 Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache.Org>
12 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
13
14 dev-db/sqlite/Manifest | 2 +
15 dev-db/sqlite/files/sqlite-3.34.0-build_1.1.patch | 375 ++++++++++++++++
16 dev-db/sqlite/files/sqlite-3.34.0-build_1.2.patch | 500 ++++++++++++++++++++++
17 dev-db/sqlite/files/sqlite-3.34.0-build_2.1.patch | 291 +++++++++++++
18 dev-db/sqlite/files/sqlite-3.34.0-build_2.2.patch | 441 +++++++++++++++++++
19 dev-db/sqlite/sqlite-3.34.0.ebuild | 427 ++++++++++++++++++
20 6 files changed, 2036 insertions(+)
21
22 diff --git a/dev-db/sqlite/Manifest b/dev-db/sqlite/Manifest
23 index e9654e2a638..87df89ad6bb 100644
24 --- a/dev-db/sqlite/Manifest
25 +++ b/dev-db/sqlite/Manifest
26 @@ -1,4 +1,6 @@
27 DIST sqlite-doc-3320300.zip 9772933 BLAKE2B efd72c18d0398c103e3f9c4cfeb03e7794fd69691b1bcea95b74a0c5d8af22aa13abc84ce8dc5864b5f4cb79be239433933b4daca34d1adfcc6f31ce2cde66bf SHA512 af9dca970b4c03c058d7d1cd55a3d11fa4b112dccac942b8660d82a7e9ba2956963fcb429eedfdc85915637c102e1f904ace98c8e0455c4120422bbd9f2f3cd0
28 DIST sqlite-doc-3330000.zip 9834159 BLAKE2B f67155a8ce8e46c2fbc0a4e35722d1fcad86e905a15230adc70732cee267b6b2002c7499883b938129aaa908b99634e4214360e9d1dbdae333b09060de24530e SHA512 14a3cccb4ff6af57738990eeadd37a1b827f89c9c1b16201c62ca5bb9301d39223d48677b9c269ce332210e5c9ae3f42aa0f9de7d79b38acb9809c732d038368
29 +DIST sqlite-doc-3340000.zip 10069888 BLAKE2B 343df62bc8b75d57dffe69c779cceb856d9e94a5b2a77c3a972761eedd8b4b0f5f8849102ec271652c3aa4039df75d7f2e503fd04b0547be03e024fdfbd894ac SHA512 1bdf20030e656ec4ce38a264c8ef7a95c9f2731cd7d756a44b35b6c68827e8aba92018007139ee09d1c27b34bcd72bff1a201dc3f30aa13e96120af5d58e835e
30 DIST sqlite-src-3320300.zip 12461750 BLAKE2B 59cce74d284191cfc69ac09b6014701ddd2b7b3d7ebaad5da4ad71cc200e70285b3b201ff174819aa8dde5f610589d7947f547450334f0f17149014078316185 SHA512 7e027c7163a760fb9b6dbfd2e4ccffb39d4972280583fb0d7f8390017101dfed3b12a36653b3130a548ae4d04c6abb11c0a1921b6f09c54c6ae1e72fbdcb2fd4
31 DIST sqlite-src-3330000.zip 12591089 BLAKE2B 14888bca229683e97c4666f8efb535be5bd3e322de0089f0175ba15e038016be3a3cc00b5bfa8c111538116914cf6d8439839ca5d1e20339b184e547ddf260a4 SHA512 3260e3e03ee2f6a4ff2bc4ea4bada5a1497afeca33878c155a8005824970c6c1eb8a2db58eb3023cab084af475fadb81d1c3c9892ae92c07f884881e6602e173
32 +DIST sqlite-src-3340000.zip 12623425 BLAKE2B 548293cf0166407727cd068804eb5e1ce62f654533c88a87b71a6ff62da37eb2af21b89b8d63ee677777ca917e0d685ddcf9b8d5c3c8b2a2b787d71da8e5a161 SHA512 520fbca59da02452e2861a140bde891aedfc8254eafaa6894e8d845369d60d6a921595a411efb2611c0f7b0cadd69a713dcdaaeaad1e4254e9fd9a6efde07f91
33
34 diff --git a/dev-db/sqlite/files/sqlite-3.34.0-build_1.1.patch b/dev-db/sqlite/files/sqlite-3.34.0-build_1.1.patch
35 new file mode 100644
36 index 00000000000..762f1359b9f
37 --- /dev/null
38 +++ b/dev-db/sqlite/files/sqlite-3.34.0-build_1.1.patch
39 @@ -0,0 +1,375 @@
40 +Add initialization functions for internal usage in libsqlite3.so.
41 +
42 +SQLite revision: a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b
43 +
44 +--- /ext/misc/amatch.c
45 ++++ /ext/misc/amatch.c
46 +@@ -1480,9 +1480,18 @@
47 +
48 + #endif /* SQLITE_OMIT_VIRTUALTABLE */
49 +
50 ++int sqlite3AmatchInit(sqlite3 *db){
51 ++ int rc = SQLITE_OK;
52 ++#ifndef SQLITE_OMIT_VIRTUALTABLE
53 ++ rc = sqlite3_create_module(db, "approximate_match", &amatchModule, 0);
54 ++#endif /* SQLITE_OMIT_VIRTUALTABLE */
55 ++ return rc;
56 ++}
57 ++
58 + /*
59 + ** Register the amatch virtual table
60 + */
61 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
62 + #ifdef _WIN32
63 + __declspec(dllexport)
64 + #endif
65 +@@ -1491,11 +1500,8 @@
66 + char **pzErrMsg,
67 + const sqlite3_api_routines *pApi
68 + ){
69 +- int rc = SQLITE_OK;
70 + SQLITE_EXTENSION_INIT2(pApi);
71 + (void)pzErrMsg; /* Not used */
72 +-#ifndef SQLITE_OMIT_VIRTUALTABLE
73 +- rc = sqlite3_create_module(db, "approximate_match", &amatchModule, 0);
74 +-#endif /* SQLITE_OMIT_VIRTUALTABLE */
75 +- return rc;
76 ++ return sqlite3AmatchInit(db);
77 + }
78 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
79 +--- /ext/misc/carray.c
80 ++++ /ext/misc/carray.c
81 +@@ -498,16 +498,8 @@
82 +
83 + #endif /* SQLITE_OMIT_VIRTUALTABLE */
84 +
85 +-#ifdef _WIN32
86 +-__declspec(dllexport)
87 +-#endif
88 +-int sqlite3_carray_init(
89 +- sqlite3 *db,
90 +- char **pzErrMsg,
91 +- const sqlite3_api_routines *pApi
92 +-){
93 ++int sqlite3CarrayInit(sqlite3 *db){
94 + int rc = SQLITE_OK;
95 +- SQLITE_EXTENSION_INIT2(pApi);
96 + #ifndef SQLITE_OMIT_VIRTUALTABLE
97 + rc = sqlite3_create_module(db, "carray", &carrayModule, 0);
98 + #ifdef SQLITE_TEST
99 +@@ -519,3 +511,18 @@
100 + #endif /* SQLITE_OMIT_VIRTUALTABLE */
101 + return rc;
102 + }
103 ++
104 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
105 ++#ifdef _WIN32
106 ++__declspec(dllexport)
107 ++#endif
108 ++int sqlite3_carray_init(
109 ++ sqlite3 *db,
110 ++ char **pzErrMsg,
111 ++ const sqlite3_api_routines *pApi
112 ++){
113 ++ SQLITE_EXTENSION_INIT2(pApi);
114 ++ (void)pzErrMsg; /* Unused parameter */
115 ++ return sqlite3CarrayInit(db);
116 ++}
117 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
118 +--- /ext/misc/completion.c
119 ++++ /ext/misc/completion.c
120 +@@ -483,12 +483,13 @@
121 + return rc;
122 + }
123 +
124 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
125 + #ifdef _WIN32
126 + __declspec(dllexport)
127 + #endif
128 + int sqlite3_completion_init(
129 +- sqlite3 *db,
130 +- char **pzErrMsg,
131 ++ sqlite3 *db,
132 ++ char **pzErrMsg,
133 + const sqlite3_api_routines *pApi
134 + ){
135 + int rc = SQLITE_OK;
136 +@@ -499,3 +500,4 @@
137 + #endif
138 + return rc;
139 + }
140 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
141 +--- /ext/misc/csv.c
142 ++++ /ext/misc/csv.c
143 +@@ -928,6 +928,22 @@
144 + #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */
145 +
146 +
147 ++int sqlite3CsvInit(sqlite3 *db){
148 ++#ifndef SQLITE_OMIT_VIRTUALTABLE
149 ++ int rc;
150 ++ rc = sqlite3_create_module(db, "csv", &CsvModule, 0);
151 ++#ifdef SQLITE_TEST
152 ++ if( rc==SQLITE_OK ){
153 ++ rc = sqlite3_create_module(db, "csv_wr", &CsvModuleFauxWrite, 0);
154 ++ }
155 ++#endif
156 ++ return rc;
157 ++#else
158 ++ return SQLITE_OK;
159 ++#endif
160 ++}
161 ++
162 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
163 + #ifdef _WIN32
164 + __declspec(dllexport)
165 + #endif
166 +@@ -941,17 +957,8 @@
167 + char **pzErrMsg,
168 + const sqlite3_api_routines *pApi
169 + ){
170 +-#ifndef SQLITE_OMIT_VIRTUALTABLE
171 +- int rc;
172 + SQLITE_EXTENSION_INIT2(pApi);
173 +- rc = sqlite3_create_module(db, "csv", &CsvModule, 0);
174 +-#ifdef SQLITE_TEST
175 +- if( rc==SQLITE_OK ){
176 +- rc = sqlite3_create_module(db, "csv_wr", &CsvModuleFauxWrite, 0);
177 +- }
178 +-#endif
179 +- return rc;
180 +-#else
181 +- return SQLITE_OK;
182 +-#endif
183 ++ (void)pzErrMsg; /* Unused parameter */
184 ++ return sqlite3CsvInit(db);
185 + }
186 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
187 +--- /ext/misc/dbdata.c
188 ++++ /ext/misc/dbdata.c
189 +@@ -803,7 +803,7 @@
190 + /*
191 + ** Invoke this routine to register the "sqlite_dbdata" virtual table module
192 + */
193 +-static int sqlite3DbdataRegister(sqlite3 *db){
194 ++int sqlite3DbdataRegister(sqlite3 *db){
195 + static sqlite3_module dbdata_module = {
196 + 0, /* iVersion */
197 + 0, /* xCreate */
198 +@@ -838,6 +838,7 @@
199 + return rc;
200 + }
201 +
202 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
203 + #ifdef _WIN32
204 + __declspec(dllexport)
205 + #endif
206 +@@ -849,3 +850,4 @@
207 + SQLITE_EXTENSION_INIT2(pApi);
208 + return sqlite3DbdataRegister(db);
209 + }
210 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
211 +--- /ext/misc/decimal.c
212 ++++ /ext/misc/decimal.c
213 +@@ -590,14 +590,7 @@
214 + decimal_free(pB);
215 + }
216 +
217 +-#ifdef _WIN32
218 +-__declspec(dllexport)
219 +-#endif
220 +-int sqlite3_decimal_init(
221 +- sqlite3 *db,
222 +- char **pzErrMsg,
223 +- const sqlite3_api_routines *pApi
224 +-){
225 ++int sqlite3DecimalInit(sqlite3 *db){
226 + int rc = SQLITE_OK;
227 + static const struct {
228 + const char *zFuncName;
229 +@@ -611,10 +604,6 @@
230 + { "decimal_mul", 2, decimalMulFunc },
231 + };
232 + unsigned int i;
233 +- (void)pzErrMsg; /* Unused parameter */
234 +-
235 +- SQLITE_EXTENSION_INIT2(pApi);
236 +-
237 + for(i=0; i<sizeof(aFunc)/sizeof(aFunc[0]) && rc==SQLITE_OK; i++){
238 + rc = sqlite3_create_function(db, aFunc[i].zFuncName, aFunc[i].nArg,
239 + SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
240 +@@ -632,3 +621,20 @@
241 + }
242 + return rc;
243 + }
244 ++
245 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
246 ++#ifdef _WIN32
247 ++__declspec(dllexport)
248 ++#endif
249 ++int sqlite3_decimal_init(
250 ++ sqlite3 *db,
251 ++ char **pzErrMsg,
252 ++ const sqlite3_api_routines *pApi
253 ++){
254 ++ (void)pzErrMsg; /* Unused parameter */
255 ++
256 ++ SQLITE_EXTENSION_INIT2(pApi);
257 ++
258 ++ return sqlite3DecimalInit(db);
259 ++}
260 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
261 +--- /ext/misc/eval.c
262 ++++ /ext/misc/eval.c
263 +@@ -102,6 +102,20 @@
264 + }
265 +
266 +
267 ++int sqlite3EvalInit(sqlite3 *db){
268 ++ int rc = SQLITE_OK;
269 ++ rc = sqlite3_create_function(db, "eval", 1,
270 ++ SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
271 ++ sqlEvalFunc, 0, 0);
272 ++ if( rc==SQLITE_OK ){
273 ++ rc = sqlite3_create_function(db, "eval", 2,
274 ++ SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
275 ++ sqlEvalFunc, 0, 0);
276 ++ }
277 ++ return rc;
278 ++}
279 ++
280 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
281 + #ifdef _WIN32
282 + __declspec(dllexport)
283 + #endif
284 +@@ -110,16 +124,8 @@
285 + char **pzErrMsg,
286 + const sqlite3_api_routines *pApi
287 + ){
288 +- int rc = SQLITE_OK;
289 + SQLITE_EXTENSION_INIT2(pApi);
290 + (void)pzErrMsg; /* Unused parameter */
291 +- rc = sqlite3_create_function(db, "eval", 1,
292 +- SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
293 +- sqlEvalFunc, 0, 0);
294 +- if( rc==SQLITE_OK ){
295 +- rc = sqlite3_create_function(db, "eval", 2,
296 +- SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
297 +- sqlEvalFunc, 0, 0);
298 +- }
299 +- return rc;
300 ++ return sqlite3EvalInit(db);
301 + }
302 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
303 +--- /ext/misc/fileio.c
304 ++++ /ext/misc/fileio.c
305 +@@ -340,7 +340,7 @@
306 + ** This function does the work for the writefile() UDF. Refer to
307 + ** header comments at the top of this file for details.
308 + */
309 +-static int writeFile(
310 ++static int writeFileContents(
311 + sqlite3_context *pCtx, /* Context to return bytes written in */
312 + const char *zFile, /* File to write */
313 + sqlite3_value *pData, /* Data to write */
314 +@@ -480,10 +480,10 @@
315 + mtime = sqlite3_value_int64(argv[3]);
316 + }
317 +
318 +- res = writeFile(context, zFile, argv[1], mode, mtime);
319 ++ res = writeFileContents(context, zFile, argv[1], mode, mtime);
320 + if( res==1 && errno==ENOENT ){
321 + if( makeDirectory(zFile)==SQLITE_OK ){
322 +- res = writeFile(context, zFile, argv[1], mode, mtime);
323 ++ res = writeFileContents(context, zFile, argv[1], mode, mtime);
324 + }
325 + }
326 +
327 +@@ -970,18 +970,9 @@
328 + # define fsdirRegister(x) SQLITE_OK
329 + #endif
330 +
331 +-#ifdef _WIN32
332 +-__declspec(dllexport)
333 +-#endif
334 +-int sqlite3_fileio_init(
335 +- sqlite3 *db,
336 +- char **pzErrMsg,
337 +- const sqlite3_api_routines *pApi
338 +-){
339 ++int sqlite3FileioInit(sqlite3 *db){
340 + int rc = SQLITE_OK;
341 +- SQLITE_EXTENSION_INIT2(pApi);
342 +- (void)pzErrMsg; /* Unused parameter */
343 +- rc = sqlite3_create_function(db, "readfile", 1,
344 ++ rc = sqlite3_create_function(db, "readfile", 1,
345 + SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
346 + readfileFunc, 0, 0);
347 + if( rc==SQLITE_OK ){
348 +@@ -998,3 +989,18 @@
349 + }
350 + return rc;
351 + }
352 ++
353 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
354 ++#ifdef _WIN32
355 ++__declspec(dllexport)
356 ++#endif
357 ++int sqlite3_fileio_init(
358 ++ sqlite3 *db,
359 ++ char **pzErrMsg,
360 ++ const sqlite3_api_routines *pApi
361 ++){
362 ++ SQLITE_EXTENSION_INIT2(pApi);
363 ++ (void)pzErrMsg; /* Unused parameter */
364 ++ return sqlite3FileioInit(db);
365 ++}
366 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
367 +--- /ext/misc/ieee754.c
368 ++++ /ext/misc/ieee754.c
369 +@@ -245,14 +245,7 @@
370 + }
371 +
372 +
373 +-#ifdef _WIN32
374 +-__declspec(dllexport)
375 +-#endif
376 +-int sqlite3_ieee_init(
377 +- sqlite3 *db,
378 +- char **pzErrMsg,
379 +- const sqlite3_api_routines *pApi
380 +-){
381 ++int sqlite3IeeeInit(sqlite3 *db){
382 + static const struct {
383 + char *zFName;
384 + int nArg;
385 +@@ -269,13 +262,26 @@
386 + };
387 + unsigned int i;
388 + int rc = SQLITE_OK;
389 +- SQLITE_EXTENSION_INIT2(pApi);
390 +- (void)pzErrMsg; /* Unused parameter */
391 + for(i=0; i<sizeof(aFunc)/sizeof(aFunc[0]) && rc==SQLITE_OK; i++){
392 +- rc = sqlite3_create_function(db, aFunc[i].zFName, aFunc[i].nArg,
393 ++ rc = sqlite3_create_function(db, aFunc[i].zFName, aFunc[i].nArg,
394 + SQLITE_UTF8|SQLITE_INNOCUOUS,
395 + (void*)&aFunc[i].iAux,
396 + aFunc[i].xFunc, 0, 0);
397 + }
398 + return rc;
399 + }
400 ++
401 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
402 ++#ifdef _WIN32
403 ++__declspec(dllexport)
404 ++#endif
405 ++int sqlite3_ieee_init(
406 ++ sqlite3 *db,
407 ++ char **pzErrMsg,
408 ++ const sqlite3_api_routines *pApi
409 ++){
410 ++ SQLITE_EXTENSION_INIT2(pApi);
411 ++ (void)pzErrMsg; /* Unused parameter */
412 ++ return sqlite3IeeeInit(db);
413 ++}
414 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
415
416 diff --git a/dev-db/sqlite/files/sqlite-3.34.0-build_1.2.patch b/dev-db/sqlite/files/sqlite-3.34.0-build_1.2.patch
417 new file mode 100644
418 index 00000000000..7fb5d28e4ba
419 --- /dev/null
420 +++ b/dev-db/sqlite/files/sqlite-3.34.0-build_1.2.patch
421 @@ -0,0 +1,500 @@
422 +Add initialization functions for internal usage in libsqlite3.so.
423 +
424 +SQLite revision: a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b
425 +
426 +--- /ext/misc/nextchar.c
427 ++++ /ext/misc/nextchar.c
428 +@@ -286,17 +286,8 @@
429 + sqlite3_free(c.aResult);
430 + }
431 +
432 +-#ifdef _WIN32
433 +-__declspec(dllexport)
434 +-#endif
435 +-int sqlite3_nextchar_init(
436 +- sqlite3 *db,
437 +- char **pzErrMsg,
438 +- const sqlite3_api_routines *pApi
439 +-){
440 ++int sqlite3NextcharInit(sqlite3 *db){
441 + int rc = SQLITE_OK;
442 +- SQLITE_EXTENSION_INIT2(pApi);
443 +- (void)pzErrMsg; /* Unused parameter */
444 + rc = sqlite3_create_function(db, "next_char", 3,
445 + SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
446 + nextCharFunc, 0, 0);
447 +@@ -312,3 +303,18 @@
448 + }
449 + return rc;
450 + }
451 ++
452 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
453 ++#ifdef _WIN32
454 ++__declspec(dllexport)
455 ++#endif
456 ++int sqlite3_nextchar_init(
457 ++ sqlite3 *db,
458 ++ char **pzErrMsg,
459 ++ const sqlite3_api_routines *pApi
460 ++){
461 ++ SQLITE_EXTENSION_INIT2(pApi);
462 ++ (void)pzErrMsg; /* Unused parameter */
463 ++ return sqlite3NextcharInit(db);
464 ++}
465 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
466 +--- /ext/misc/percentile.c
467 ++++ /ext/misc/percentile.c
468 +@@ -202,6 +202,15 @@
469 + }
470 +
471 +
472 ++int sqlite3PercentileInit(sqlite3 *db){
473 ++ int rc = SQLITE_OK;
474 ++ rc = sqlite3_create_function(db, "percentile", 2,
475 ++ SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
476 ++ 0, percentStep, percentFinal);
477 ++ return rc;
478 ++}
479 ++
480 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
481 + #ifdef _WIN32
482 + __declspec(dllexport)
483 + #endif
484 +@@ -210,11 +219,8 @@
485 + char **pzErrMsg,
486 + const sqlite3_api_routines *pApi
487 + ){
488 +- int rc = SQLITE_OK;
489 + SQLITE_EXTENSION_INIT2(pApi);
490 + (void)pzErrMsg; /* Unused parameter */
491 +- rc = sqlite3_create_function(db, "percentile", 2,
492 +- SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
493 +- 0, percentStep, percentFinal);
494 +- return rc;
495 ++ return sqlite3PercentileInit(db);
496 + }
497 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
498 +--- /ext/misc/regexp.c
499 ++++ /ext/misc/regexp.c
500 +@@ -740,10 +740,18 @@
501 + }
502 + }
503 +
504 ++int sqlite3RegexpInit(sqlite3 *db){
505 ++ int rc = SQLITE_OK;
506 ++ rc = sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8|SQLITE_INNOCUOUS,
507 ++ 0, re_sql_func, 0, 0);
508 ++ return rc;
509 ++}
510 ++
511 + /*
512 + ** Invoke this routine to register the regexp() function with the
513 + ** SQLite database connection.
514 + */
515 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
516 + #ifdef _WIN32
517 + __declspec(dllexport)
518 + #endif
519 +@@ -752,9 +760,8 @@
520 + char **pzErrMsg,
521 + const sqlite3_api_routines *pApi
522 + ){
523 +- int rc = SQLITE_OK;
524 + SQLITE_EXTENSION_INIT2(pApi);
525 +- rc = sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8|SQLITE_INNOCUOUS,
526 +- 0, re_sql_func, 0, 0);
527 +- return rc;
528 ++ (void)pzErrMsg; /* Unused parameter */
529 ++ return sqlite3RegexpInit(db);
530 + }
531 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
532 +--- /ext/misc/series.c
533 ++++ /ext/misc/series.c
534 +@@ -413,6 +413,15 @@
535 +
536 + #endif /* SQLITE_OMIT_VIRTUALTABLE */
537 +
538 ++int sqlite3SeriesInit(sqlite3 *db){
539 ++ int rc = SQLITE_OK;
540 ++#ifndef SQLITE_OMIT_VIRTUALTABLE
541 ++ rc = sqlite3_create_module(db, "generate_series", &seriesModule, 0);
542 ++#endif
543 ++ return rc;
544 ++}
545 ++
546 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
547 + #ifdef _WIN32
548 + __declspec(dllexport)
549 + #endif
550 +@@ -421,7 +430,6 @@
551 + char **pzErrMsg,
552 + const sqlite3_api_routines *pApi
553 + ){
554 +- int rc = SQLITE_OK;
555 + SQLITE_EXTENSION_INIT2(pApi);
556 + #ifndef SQLITE_OMIT_VIRTUALTABLE
557 + if( sqlite3_libversion_number()<3008012 ){
558 +@@ -429,7 +437,7 @@
559 + "generate_series() requires SQLite 3.8.12 or later");
560 + return SQLITE_ERROR;
561 + }
562 +- rc = sqlite3_create_module(db, "generate_series", &seriesModule, 0);
563 + #endif
564 +- return rc;
565 ++ return sqlite3SeriesInit(db);
566 + }
567 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
568 +--- /ext/misc/sha1.c
569 ++++ /ext/misc/sha1.c
570 +@@ -175,7 +175,7 @@
571 + }
572 +
573 + /* Compute a string using sqlite3_vsnprintf() and hash it */
574 +-static void hash_step_vformat(
575 ++static void sha1_hash_step_vformat(
576 + SHA1Context *p, /* Add content to this context */
577 + const char *zFormat,
578 + ...
579 +@@ -306,7 +306,7 @@
580 + nCol = sqlite3_column_count(pStmt);
581 + z = sqlite3_sql(pStmt);
582 + n = (int)strlen(z);
583 +- hash_step_vformat(&cx,"S%d:",n);
584 ++ sha1_hash_step_vformat(&cx,"S%d:",n);
585 + hash_step(&cx,(unsigned char*)z,n);
586 +
587 + /* Compute a hash over the result of the query */
588 +@@ -349,14 +349,14 @@
589 + case SQLITE_TEXT: {
590 + int n2 = sqlite3_column_bytes(pStmt, i);
591 + const unsigned char *z2 = sqlite3_column_text(pStmt, i);
592 +- hash_step_vformat(&cx,"T%d:",n2);
593 ++ sha1_hash_step_vformat(&cx,"T%d:",n2);
594 + hash_step(&cx, z2, n2);
595 + break;
596 + }
597 + case SQLITE_BLOB: {
598 + int n2 = sqlite3_column_bytes(pStmt, i);
599 + const unsigned char *z2 = sqlite3_column_blob(pStmt, i);
600 +- hash_step_vformat(&cx,"B%d:",n2);
601 ++ sha1_hash_step_vformat(&cx,"B%d:",n2);
602 + hash_step(&cx, z2, n2);
603 + break;
604 + }
605 +@@ -370,6 +370,20 @@
606 + }
607 +
608 +
609 ++int sqlite3ShaInit(sqlite3 *db){
610 ++ int rc = SQLITE_OK;
611 ++ rc = sqlite3_create_function(db, "sha1", 1,
612 ++ SQLITE_UTF8 | SQLITE_INNOCUOUS | SQLITE_DETERMINISTIC,
613 ++ 0, sha1Func, 0, 0);
614 ++ if( rc==SQLITE_OK ){
615 ++ rc = sqlite3_create_function(db, "sha1_query", 1,
616 ++ SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
617 ++ sha1QueryFunc, 0, 0);
618 ++ }
619 ++ return rc;
620 ++}
621 ++
622 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
623 + #ifdef _WIN32
624 + __declspec(dllexport)
625 + #endif
626 +@@ -378,16 +392,8 @@
627 + char **pzErrMsg,
628 + const sqlite3_api_routines *pApi
629 + ){
630 +- int rc = SQLITE_OK;
631 + SQLITE_EXTENSION_INIT2(pApi);
632 + (void)pzErrMsg; /* Unused parameter */
633 +- rc = sqlite3_create_function(db, "sha1", 1,
634 +- SQLITE_UTF8 | SQLITE_INNOCUOUS | SQLITE_DETERMINISTIC,
635 +- 0, sha1Func, 0, 0);
636 +- if( rc==SQLITE_OK ){
637 +- rc = sqlite3_create_function(db, "sha1_query", 1,
638 +- SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
639 +- sha1QueryFunc, 0, 0);
640 +- }
641 +- return rc;
642 ++ return sqlite3ShaInit(db);
643 + }
644 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
645 +--- /ext/misc/shathree.c
646 ++++ /ext/misc/shathree.c
647 +@@ -527,7 +527,7 @@
648 + /* Compute a string using sqlite3_vsnprintf() with a maximum length
649 + ** of 50 bytes and add it to the hash.
650 + */
651 +-static void hash_step_vformat(
652 ++static void sha3_hash_step_vformat(
653 + SHA3Context *p, /* Add content to this context */
654 + const char *zFormat,
655 + ...
656 +@@ -622,7 +622,7 @@
657 + nCol = sqlite3_column_count(pStmt);
658 + z = sqlite3_sql(pStmt);
659 + n = (int)strlen(z);
660 +- hash_step_vformat(&cx,"S%d:",n);
661 ++ sha3_hash_step_vformat(&cx,"S%d:",n);
662 + SHA3Update(&cx,(unsigned char*)z,n);
663 +
664 + /* Compute a hash over the result of the query */
665 +@@ -665,14 +665,14 @@
666 + case SQLITE_TEXT: {
667 + int n2 = sqlite3_column_bytes(pStmt, i);
668 + const unsigned char *z2 = sqlite3_column_text(pStmt, i);
669 +- hash_step_vformat(&cx,"T%d:",n2);
670 ++ sha3_hash_step_vformat(&cx,"T%d:",n2);
671 + SHA3Update(&cx, z2, n2);
672 + break;
673 + }
674 + case SQLITE_BLOB: {
675 + int n2 = sqlite3_column_bytes(pStmt, i);
676 + const unsigned char *z2 = sqlite3_column_blob(pStmt, i);
677 +- hash_step_vformat(&cx,"B%d:",n2);
678 ++ sha3_hash_step_vformat(&cx,"B%d:",n2);
679 + SHA3Update(&cx, z2, n2);
680 + break;
681 + }
682 +@@ -685,17 +685,8 @@
683 + }
684 +
685 +
686 +-#ifdef _WIN32
687 +-__declspec(dllexport)
688 +-#endif
689 +-int sqlite3_shathree_init(
690 +- sqlite3 *db,
691 +- char **pzErrMsg,
692 +- const sqlite3_api_routines *pApi
693 +-){
694 ++int sqlite3ShathreeInit(sqlite3 *db){
695 + int rc = SQLITE_OK;
696 +- SQLITE_EXTENSION_INIT2(pApi);
697 +- (void)pzErrMsg; /* Unused parameter */
698 + rc = sqlite3_create_function(db, "sha3", 1,
699 + SQLITE_UTF8 | SQLITE_INNOCUOUS | SQLITE_DETERMINISTIC,
700 + 0, sha3Func, 0, 0);
701 +@@ -716,3 +707,18 @@
702 + }
703 + return rc;
704 + }
705 ++
706 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
707 ++#ifdef _WIN32
708 ++__declspec(dllexport)
709 ++#endif
710 ++int sqlite3_shathree_init(
711 ++ sqlite3 *db,
712 ++ char **pzErrMsg,
713 ++ const sqlite3_api_routines *pApi
714 ++){
715 ++ SQLITE_EXTENSION_INIT2(pApi);
716 ++ (void)pzErrMsg; /* Unused parameter */
717 ++ return sqlite3ShathreeInit(db);
718 ++}
719 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
720 +--- /ext/misc/sqlar.c
721 ++++ /ext/misc/sqlar.c
722 +@@ -14,6 +14,8 @@
723 + ** for working with sqlar archives and used by the shell tool's built-in
724 + ** sqlar support.
725 + */
726 ++#ifdef SQLITE_HAVE_ZLIB
727 ++
728 + #include "sqlite3ext.h"
729 + SQLITE_EXTENSION_INIT1
730 + #include <zlib.h>
731 +@@ -101,6 +103,20 @@
732 + }
733 +
734 +
735 ++int sqlite3SqlarInit(sqlite3 *db){
736 ++ int rc = SQLITE_OK;
737 ++ rc = sqlite3_create_function(db, "sqlar_compress", 1,
738 ++ SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
739 ++ sqlarCompressFunc, 0, 0);
740 ++ if( rc==SQLITE_OK ){
741 ++ rc = sqlite3_create_function(db, "sqlar_uncompress", 2,
742 ++ SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
743 ++ sqlarUncompressFunc, 0, 0);
744 ++ }
745 ++ return rc;
746 ++}
747 ++
748 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
749 + #ifdef _WIN32
750 + __declspec(dllexport)
751 + #endif
752 +@@ -109,16 +125,10 @@
753 + char **pzErrMsg,
754 + const sqlite3_api_routines *pApi
755 + ){
756 +- int rc = SQLITE_OK;
757 + SQLITE_EXTENSION_INIT2(pApi);
758 + (void)pzErrMsg; /* Unused parameter */
759 +- rc = sqlite3_create_function(db, "sqlar_compress", 1,
760 +- SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
761 +- sqlarCompressFunc, 0, 0);
762 +- if( rc==SQLITE_OK ){
763 +- rc = sqlite3_create_function(db, "sqlar_uncompress", 2,
764 +- SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
765 +- sqlarUncompressFunc, 0, 0);
766 +- }
767 +- return rc;
768 ++ return sqlite3SqlarInit(db);
769 + }
770 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
771 ++
772 ++#endif /* SQLITE_HAVE_ZLIB */
773 +--- /ext/misc/totype.c
774 ++++ /ext/misc/totype.c
775 +@@ -491,17 +491,8 @@
776 + #pragma warning(default: 4748)
777 + #endif
778 +
779 +-#ifdef _WIN32
780 +-__declspec(dllexport)
781 +-#endif
782 +-int sqlite3_totype_init(
783 +- sqlite3 *db,
784 +- char **pzErrMsg,
785 +- const sqlite3_api_routines *pApi
786 +-){
787 ++int sqlite3TotypeInit(sqlite3 *db){
788 + int rc = SQLITE_OK;
789 +- SQLITE_EXTENSION_INIT2(pApi);
790 +- (void)pzErrMsg; /* Unused parameter */
791 + rc = sqlite3_create_function(db, "tointeger", 1,
792 + SQLITE_UTF8 | SQLITE_DETERMINISTIC | SQLITE_INNOCUOUS, 0,
793 + tointegerFunc, 0, 0);
794 +@@ -512,3 +503,18 @@
795 + }
796 + return rc;
797 + }
798 ++
799 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
800 ++#ifdef _WIN32
801 ++__declspec(dllexport)
802 ++#endif
803 ++int sqlite3_totype_init(
804 ++ sqlite3 *db,
805 ++ char **pzErrMsg,
806 ++ const sqlite3_api_routines *pApi
807 ++){
808 ++ SQLITE_EXTENSION_INIT2(pApi);
809 ++ (void)pzErrMsg; /* Unused parameter */
810 ++ return sqlite3TotypeInit(db);
811 ++}
812 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
813 +--- /ext/misc/uint.c
814 ++++ /ext/misc/uint.c
815 +@@ -78,6 +78,11 @@
816 + return (nKey1 - i) - (nKey2 - j);
817 + }
818 +
819 ++int sqlite3UintInit(sqlite3 *db){
820 ++ return sqlite3_create_collation(db, "UINT", SQLITE_UTF8, 0, uintCollFunc);
821 ++}
822 ++
823 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
824 + #ifdef _WIN32
825 + __declspec(dllexport)
826 + #endif
827 +@@ -88,5 +93,6 @@
828 + ){
829 + SQLITE_EXTENSION_INIT2(pApi);
830 + (void)pzErrMsg; /* Unused parameter */
831 +- return sqlite3_create_collation(db, "uint", SQLITE_UTF8, 0, uintCollFunc);
832 ++ return sqlite3UintInit(db);
833 + }
834 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
835 +--- /ext/misc/uuid.c
836 ++++ /ext/misc/uuid.c
837 +@@ -206,21 +206,12 @@
838 + sqlite3_result_blob(context, pBlob, 16, SQLITE_TRANSIENT);
839 + }
840 +
841 +-#ifdef _WIN32
842 +-__declspec(dllexport)
843 +-#endif
844 +-int sqlite3_uuid_init(
845 +- sqlite3 *db,
846 +- char **pzErrMsg,
847 +- const sqlite3_api_routines *pApi
848 +-){
849 ++int sqlite3UuidInit(sqlite3 *db){
850 + int rc = SQLITE_OK;
851 +- SQLITE_EXTENSION_INIT2(pApi);
852 +- (void)pzErrMsg; /* Unused parameter */
853 + rc = sqlite3_create_function(db, "uuid", 0, SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
854 + sqlite3UuidFunc, 0, 0);
855 + if( rc==SQLITE_OK ){
856 +- rc = sqlite3_create_function(db, "uuid_str", 1,
857 ++ rc = sqlite3_create_function(db, "uuid_str", 1,
858 + SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
859 + 0, sqlite3UuidStrFunc, 0, 0);
860 + }
861 +@@ -231,3 +222,18 @@
862 + }
863 + return rc;
864 + }
865 ++
866 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
867 ++#ifdef _WIN32
868 ++__declspec(dllexport)
869 ++#endif
870 ++int sqlite3_uuid_init(
871 ++ sqlite3 *db,
872 ++ char **pzErrMsg,
873 ++ const sqlite3_api_routines *pApi
874 ++){
875 ++ SQLITE_EXTENSION_INIT2(pApi);
876 ++ (void)pzErrMsg; /* Unused parameter */
877 ++ return sqlite3UuidInit(db);
878 ++}
879 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
880 +--- /ext/misc/zipfile.c
881 ++++ /ext/misc/zipfile.c
882 +@@ -24,6 +24,8 @@
883 + ** * No support for zip64 extensions
884 + ** * Only the "inflate/deflate" (zlib) compression method is supported
885 + */
886 ++#ifdef SQLITE_HAVE_ZLIB
887 ++
888 + #include "sqlite3ext.h"
889 + SQLITE_EXTENSION_INIT1
890 + #include <stdio.h>
891 +@@ -2139,7 +2141,7 @@
892 + /*
893 + ** Register the "zipfile" virtual table.
894 + */
895 +-static int zipfileRegister(sqlite3 *db){
896 ++int sqlite3ZipfileInit(sqlite3 *db){
897 + static sqlite3_module zipfileModule = {
898 + 1, /* iVersion */
899 + zipfileConnect, /* xCreate */
900 +@@ -2173,9 +2175,10 @@
901 + return rc;
902 + }
903 + #else /* SQLITE_OMIT_VIRTUALTABLE */
904 +-# define zipfileRegister(x) SQLITE_OK
905 ++# define sqlite3ZipfileInit(x) SQLITE_OK
906 + #endif
907 +
908 ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
909 + #ifdef _WIN32
910 + __declspec(dllexport)
911 + #endif
912 +@@ -2186,5 +2189,8 @@
913 + ){
914 + SQLITE_EXTENSION_INIT2(pApi);
915 + (void)pzErrMsg; /* Unused parameter */
916 +- return zipfileRegister(db);
917 ++ return sqlite3ZipfileInit(db);
918 + }
919 ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
920 ++
921 ++#endif /* SQLITE_HAVE_ZLIB */
922
923 diff --git a/dev-db/sqlite/files/sqlite-3.34.0-build_2.1.patch b/dev-db/sqlite/files/sqlite-3.34.0-build_2.1.patch
924 new file mode 100644
925 index 00000000000..16210a6bddc
926 --- /dev/null
927 +++ b/dev-db/sqlite/files/sqlite-3.34.0-build_2.1.patch
928 @@ -0,0 +1,291 @@
929 +Move some code to libsqlite3.so to avoid duplication.
930 +Link executables against libsqlite3.so.
931 +Increase timeout for fuzzcheck.
932 +Update list of optionally available functions.
933 +Fix building with dlopen() not available.
934 +
935 +SQLite revision: a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b
936 +
937 +--- /Makefile.in
938 ++++ /Makefile.in
939 +@@ -313,6 +313,9 @@
940 + # Source code for extensions
941 + #
942 + SRC += \
943 ++ $(TOP)/ext/expert/sqlite3expert.c \
944 ++ $(TOP)/ext/expert/sqlite3expert.h
945 ++SRC += \
946 + $(TOP)/ext/fts1/fts1.c \
947 + $(TOP)/ext/fts1/fts1.h \
948 + $(TOP)/ext/fts1/fts1_hash.c \
949 +@@ -365,8 +368,29 @@
950 + $(TOP)/ext/rbu/sqlite3rbu.h \
951 + $(TOP)/ext/rbu/sqlite3rbu.c
952 + SRC += \
953 ++ $(TOP)/ext/misc/amatch.c \
954 ++ $(TOP)/ext/misc/appendvfs.c \
955 ++ $(TOP)/ext/misc/carray.c \
956 ++ $(TOP)/ext/misc/completion.c \
957 ++ $(TOP)/ext/misc/csv.c \
958 ++ $(TOP)/ext/misc/dbdata.c \
959 ++ $(TOP)/ext/misc/decimal.c \
960 ++ $(TOP)/ext/misc/eval.c \
961 ++ $(TOP)/ext/misc/fileio.c \
962 ++ $(TOP)/ext/misc/ieee754.c \
963 + $(TOP)/ext/misc/json1.c \
964 +- $(TOP)/ext/misc/stmt.c
965 ++ $(TOP)/ext/misc/nextchar.c \
966 ++ $(TOP)/ext/misc/percentile.c \
967 ++ $(TOP)/ext/misc/regexp.c \
968 ++ $(TOP)/ext/misc/series.c \
969 ++ $(TOP)/ext/misc/sha1.c \
970 ++ $(TOP)/ext/misc/shathree.c \
971 ++ $(TOP)/ext/misc/sqlar.c \
972 ++ $(TOP)/ext/misc/stmt.c \
973 ++ $(TOP)/ext/misc/totype.c \
974 ++ $(TOP)/ext/misc/uint.c \
975 ++ $(TOP)/ext/misc/uuid.c \
976 ++ $(TOP)/ext/misc/zipfile.c
977 +
978 + # Generated source code files
979 + #
980 +@@ -437,35 +461,21 @@
981 + # Statically linked extensions
982 + #
983 + TESTSRC += \
984 +- $(TOP)/ext/expert/sqlite3expert.c \
985 + $(TOP)/ext/expert/test_expert.c \
986 +- $(TOP)/ext/misc/amatch.c \
987 +- $(TOP)/ext/misc/carray.c \
988 + $(TOP)/ext/misc/cksumvfs.c \
989 + $(TOP)/ext/misc/closure.c \
990 +- $(TOP)/ext/misc/csv.c \
991 +- $(TOP)/ext/misc/decimal.c \
992 +- $(TOP)/ext/misc/eval.c \
993 + $(TOP)/ext/misc/explain.c \
994 +- $(TOP)/ext/misc/fileio.c \
995 + $(TOP)/ext/misc/fuzzer.c \
996 + $(TOP)/ext/fts5/fts5_tcl.c \
997 + $(TOP)/ext/fts5/fts5_test_mi.c \
998 + $(TOP)/ext/fts5/fts5_test_tok.c \
999 +- $(TOP)/ext/misc/ieee754.c \
1000 + $(TOP)/ext/misc/mmapwarm.c \
1001 +- $(TOP)/ext/misc/nextchar.c \
1002 + $(TOP)/ext/misc/normalize.c \
1003 +- $(TOP)/ext/misc/percentile.c \
1004 + $(TOP)/ext/misc/prefixes.c \
1005 +- $(TOP)/ext/misc/regexp.c \
1006 + $(TOP)/ext/misc/remember.c \
1007 +- $(TOP)/ext/misc/series.c \
1008 + $(TOP)/ext/misc/spellfix.c \
1009 +- $(TOP)/ext/misc/totype.c \
1010 + $(TOP)/ext/misc/unionvtab.c \
1011 + $(TOP)/ext/misc/wholenumber.c \
1012 +- $(TOP)/ext/misc/zipfile.c \
1013 + $(TOP)/ext/userauth/userauth.c
1014 +
1015 + # Source code to the library files needed by the test fixture
1016 +@@ -647,25 +657,25 @@
1017 +
1018 + libtclsqlite3.la: tclsqlite.lo libsqlite3.la
1019 + $(LTLINK) -no-undefined -o $@ tclsqlite.lo \
1020 +- libsqlite3.la @TCL_STUB_LIB_SPEC@ $(TLIBS) \
1021 ++ libsqlite3.la @TCL_STUB_LIB_SPEC@ \
1022 + -rpath "$(TCLLIBDIR)" \
1023 + -version-info "8:6:8" \
1024 + -avoid-version
1025 +
1026 +-sqlite3$(TEXE): shell.c sqlite3.c
1027 +- $(LTLINK) $(READLINE_FLAGS) $(SHELL_OPT) -o $@ \
1028 +- shell.c sqlite3.c \
1029 +- $(LIBREADLINE) $(TLIBS) -rpath "$(libdir)"
1030 ++sqlite3$(TEXE): shell.c libsqlite3.la
1031 ++ $(LTLINK) $(READLINE_FLAGS) -o $@ \
1032 ++ shell.c libsqlite3.la \
1033 ++ $(LIBREADLINE)
1034 +
1035 +-sqldiff$(TEXE): $(TOP)/tool/sqldiff.c sqlite3.lo sqlite3.h
1036 +- $(LTLINK) -o $@ $(TOP)/tool/sqldiff.c sqlite3.lo $(TLIBS)
1037 ++sqldiff$(TEXE): $(TOP)/tool/sqldiff.c libsqlite3.la
1038 ++ $(LTLINK) -o $@ $(TOP)/tool/sqldiff.c libsqlite3.la
1039 +
1040 +-dbhash$(TEXE): $(TOP)/tool/dbhash.c sqlite3.lo sqlite3.h
1041 +- $(LTLINK) -o $@ $(TOP)/tool/dbhash.c sqlite3.lo $(TLIBS)
1042 ++dbhash$(TEXE): $(TOP)/tool/dbhash.c libsqlite3.la
1043 ++ $(LTLINK) -o $@ $(TOP)/tool/dbhash.c libsqlite3.la
1044 +
1045 +-scrub$(TEXE): $(TOP)/ext/misc/scrub.c sqlite3.lo
1046 ++scrub$(TEXE): $(TOP)/ext/misc/scrub.c libsqlite3.la
1047 + $(LTLINK) -o $@ -I. -DSCRUB_STANDALONE \
1048 +- $(TOP)/ext/misc/scrub.c sqlite3.lo $(TLIBS)
1049 ++ $(TOP)/ext/misc/scrub.c libsqlite3.la
1050 +
1051 + srcck1$(BEXE): $(TOP)/tool/srcck1.c
1052 + $(BCC) -o srcck1$(BEXE) $(TOP)/tool/srcck1.c
1053 +@@ -776,7 +786,7 @@
1054 + # Rule to build the amalgamation
1055 + #
1056 + sqlite3.lo: sqlite3.c
1057 +- $(LTCOMPILE) $(TEMP_STORE) -c sqlite3.c
1058 ++ $(LTCOMPILE) $(SHELL_OPT) $(TEMP_STORE) -c sqlite3.c
1059 +
1060 + # Rules to build the LEMON compiler generator
1061 + #
1062 +@@ -1082,18 +1092,6 @@
1063 + # Source files that go into making shell.c
1064 + SHELL_SRC = \
1065 + $(TOP)/src/shell.c.in \
1066 +- $(TOP)/ext/misc/appendvfs.c \
1067 +- $(TOP)/ext/misc/completion.c \
1068 +- $(TOP)/ext/misc/decimal.c \
1069 +- $(TOP)/ext/misc/fileio.c \
1070 +- $(TOP)/ext/misc/ieee754.c \
1071 +- $(TOP)/ext/misc/series.c \
1072 +- $(TOP)/ext/misc/shathree.c \
1073 +- $(TOP)/ext/misc/sqlar.c \
1074 +- $(TOP)/ext/misc/uint.c \
1075 +- $(TOP)/ext/expert/sqlite3expert.c \
1076 +- $(TOP)/ext/expert/sqlite3expert.h \
1077 +- $(TOP)/ext/misc/zipfile.c \
1078 + $(TOP)/ext/misc/memtrace.c \
1079 + $(TOP)/src/test_windirent.c
1080 +
1081 +@@ -1263,11 +1261,11 @@
1082 +
1083 + # Fuzz testing
1084 + fuzztest: fuzzcheck$(TEXE) $(FUZZDATA) sessionfuzz$(TEXE) $(TOP)/test/sessionfuzz-data1.db
1085 +- ./fuzzcheck$(TEXE) $(FUZZDATA)
1086 ++ ./fuzzcheck$(TEXE) --timeout 3600 $(FUZZDATA)
1087 + ./sessionfuzz$(TEXE) run $(TOP)/test/sessionfuzz-data1.db
1088 +
1089 + valgrindfuzz: fuzzcheck$(TEXT) $(FUZZDATA) sessionfuzz$(TEXE) $(TOP)/test/sessionfuzz-data1.db
1090 +- valgrind ./fuzzcheck$(TEXE) --cell-size-check --limit-mem 10M --timeout 600 $(FUZZDATA)
1091 ++ valgrind ./fuzzcheck$(TEXE) --cell-size-check --limit-mem 10M --timeout 3600 $(FUZZDATA)
1092 + valgrind ./sessionfuzz$(TEXE) run $(TOP)/test/sessionfuzz-data1.db
1093 +
1094 + # The veryquick.test TCL tests.
1095 +@@ -1301,24 +1299,23 @@
1096 + shelltest: $(TESTPROGS)
1097 + ./testfixture$(TEXT) $(TOP)/test/permutations.test shell
1098 +
1099 +-sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in
1100 ++sqlite3_analyzer.c: $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in
1101 + $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in >sqlite3_analyzer.c
1102 +
1103 +-sqlite3_analyzer$(TEXE): sqlite3_analyzer.c
1104 +- $(LTLINK) sqlite3_analyzer.c -o $@ $(LIBTCL) $(TLIBS)
1105 ++sqlite3_analyzer$(TEXE): sqlite3_analyzer.c libsqlite3.la
1106 ++ $(LTLINK) sqlite3_analyzer.c -o $@ libsqlite3.la $(LIBTCL)
1107 +
1108 +-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
1109 ++sqltclsh.c: $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in
1110 + $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in >sqltclsh.c
1111 +
1112 +-sqltclsh$(TEXE): sqltclsh.c
1113 +- $(LTLINK) sqltclsh.c -o $@ $(LIBTCL) $(TLIBS)
1114 ++sqltclsh$(TEXE): sqltclsh.c libsqlite3.la
1115 ++ $(LTLINK) sqltclsh.c -o $@ libsqlite3.la $(LIBTCL)
1116 +
1117 +-sqlite3_expert$(TEXE): $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c $(TOP)/ext/expert/expert.c sqlite3.c
1118 +- $(LTLINK) $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c $(TOP)/ext/expert/expert.c sqlite3.c -o sqlite3_expert $(TLIBS)
1119 ++sqlite3_expert$(TEXE): $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/expert.c libsqlite3.la
1120 ++ $(LTLINK) $(TOP)/ext/expert/expert.c -o sqlite3_expert libsqlite3.la
1121 +
1122 + CHECKER_DEPS =\
1123 + $(TOP)/tool/mkccode.tcl \
1124 +- sqlite3.c \
1125 + $(TOP)/src/tclsqlite.c \
1126 + $(TOP)/ext/repair/sqlite3_checker.tcl \
1127 + $(TOP)/ext/repair/checkindex.c \
1128 +@@ -1329,36 +1326,36 @@
1129 + sqlite3_checker.c: $(CHECKER_DEPS)
1130 + $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/ext/repair/sqlite3_checker.c.in >$@
1131 +
1132 +-sqlite3_checker$(TEXE): sqlite3_checker.c
1133 +- $(LTLINK) sqlite3_checker.c -o $@ $(LIBTCL) $(TLIBS)
1134 ++sqlite3_checker$(TEXE): sqlite3_checker.c libsqlite3.la
1135 ++ $(LTLINK) sqlite3_checker.c -o $@ libsqlite3.la $(LIBTCL)
1136 +
1137 +-dbdump$(TEXE): $(TOP)/ext/misc/dbdump.c sqlite3.lo
1138 ++dbdump$(TEXE): $(TOP)/ext/misc/dbdump.c libsqlite3.la
1139 + $(LTLINK) -DDBDUMP_STANDALONE -o $@ \
1140 +- $(TOP)/ext/misc/dbdump.c sqlite3.lo $(TLIBS)
1141 ++ $(TOP)/ext/misc/dbdump.c libsqlite3.la
1142 +
1143 +-dbtotxt$(TEXE): $(TOP)/tool/dbtotxt.c
1144 +- $(LTLINK)-o $@ $(TOP)/tool/dbtotxt.c
1145 ++dbtotxt$(TEXE): $(TOP)/tool/dbtotxt.c
1146 ++ $(LTLINK) -o $@ $(TOP)/tool/dbtotxt.c
1147 +
1148 +-showdb$(TEXE): $(TOP)/tool/showdb.c sqlite3.lo
1149 +- $(LTLINK) -o $@ $(TOP)/tool/showdb.c sqlite3.lo $(TLIBS)
1150 ++showdb$(TEXE): $(TOP)/tool/showdb.c libsqlite3.la
1151 ++ $(LTLINK) -o $@ $(TOP)/tool/showdb.c libsqlite3.la
1152 +
1153 +-showstat4$(TEXE): $(TOP)/tool/showstat4.c sqlite3.lo
1154 +- $(LTLINK) -o $@ $(TOP)/tool/showstat4.c sqlite3.lo $(TLIBS)
1155 ++showstat4$(TEXE): $(TOP)/tool/showstat4.c libsqlite3.la
1156 ++ $(LTLINK) -o $@ $(TOP)/tool/showstat4.c libsqlite3.la
1157 +
1158 +-showjournal$(TEXE): $(TOP)/tool/showjournal.c sqlite3.lo
1159 +- $(LTLINK) -o $@ $(TOP)/tool/showjournal.c sqlite3.lo $(TLIBS)
1160 ++showjournal$(TEXE): $(TOP)/tool/showjournal.c
1161 ++ $(LTLINK) -o $@ $(TOP)/tool/showjournal.c
1162 +
1163 +-showwal$(TEXE): $(TOP)/tool/showwal.c sqlite3.lo
1164 +- $(LTLINK) -o $@ $(TOP)/tool/showwal.c sqlite3.lo $(TLIBS)
1165 ++showwal$(TEXE): $(TOP)/tool/showwal.c
1166 ++ $(LTLINK) -o $@ $(TOP)/tool/showwal.c
1167 +
1168 + showshm$(TEXE): $(TOP)/tool/showshm.c
1169 + $(LTLINK) -o $@ $(TOP)/tool/showshm.c
1170 +
1171 +-index_usage$(TEXE): $(TOP)/tool/index_usage.c sqlite3.lo
1172 +- $(LTLINK) $(SHELL_OPT) -o $@ $(TOP)/tool/index_usage.c sqlite3.lo $(TLIBS)
1173 ++index_usage$(TEXE): $(TOP)/tool/index_usage.c libsqlite3.la
1174 ++ $(LTLINK) -o $@ $(TOP)/tool/index_usage.c libsqlite3.la
1175 +
1176 +-changeset$(TEXE): $(TOP)/ext/session/changeset.c sqlite3.lo
1177 +- $(LTLINK) -o $@ $(TOP)/ext/session/changeset.c sqlite3.lo $(TLIBS)
1178 ++changeset$(TEXE): $(TOP)/ext/session/changeset.c libsqlite3.la
1179 ++ $(LTLINK) -o $@ $(TOP)/ext/session/changeset.c libsqlite3.la
1180 +
1181 + changesetfuzz$(TEXE): $(TOP)/ext/session/changesetfuzz.c sqlite3.lo
1182 + $(LTLINK) -o $@ $(TOP)/ext/session/changesetfuzz.c sqlite3.lo $(TLIBS)
1183 +@@ -1383,11 +1380,11 @@
1184 + kvtest$(TEXE): $(TOP)/test/kvtest.c sqlite3.c
1185 + $(LTLINK) $(KV_OPT) -o $@ $(TOP)/test/kvtest.c sqlite3.c $(TLIBS)
1186 +
1187 +-rbu$(EXE): $(TOP)/ext/rbu/rbu.c $(TOP)/ext/rbu/sqlite3rbu.c sqlite3.lo
1188 +- $(LTLINK) -I. -o $@ $(TOP)/ext/rbu/rbu.c sqlite3.lo $(TLIBS)
1189 ++rbu$(EXE): $(TOP)/ext/rbu/rbu.c libsqlite3.la
1190 ++ $(LTLINK) -I. -o $@ $(TOP)/ext/rbu/rbu.c libsqlite3.la
1191 +
1192 +-loadfts$(EXE): $(TOP)/tool/loadfts.c libsqlite3.la
1193 +- $(LTLINK) $(TOP)/tool/loadfts.c libsqlite3.la -o $@ $(TLIBS)
1194 ++loadfts$(EXE): $(TOP)/tool/loadfts.c libsqlite3.la
1195 ++ $(LTLINK) $(TOP)/tool/loadfts.c libsqlite3.la -o $@
1196 +
1197 + # This target will fail if the SQLite amalgamation contains any exported
1198 + # symbols that do not begin with "sqlite3_". It is run as part of the
1199 +--- /configure.ac
1200 ++++ /configure.ac
1201 +@@ -108,7 +108,7 @@
1202 + #########
1203 + # Figure out whether or not we have these functions
1204 + #
1205 +-AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64])
1206 ++AC_CHECK_FUNCS([fdatasync fullfsync gmtime_r isnan localtime_r localtime_s malloc_usable_size posix_fallocate pread pread64 pwrite pwrite64 strchrnul usleep utime])
1207 +
1208 + #########
1209 + # By default, we use the amalgamation (this may be changed below...)
1210 +@@ -582,6 +582,9 @@
1211 + if test "${enable_load_extension}" = "yes" ; then
1212 + OPT_FEATURE_FLAGS=""
1213 + AC_SEARCH_LIBS(dlopen, dl)
1214 ++ if test "${ac_cv_search_dlopen}" = "no" ; then
1215 ++ OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
1216 ++ fi
1217 + else
1218 + OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
1219 + fi
1220
1221 diff --git a/dev-db/sqlite/files/sqlite-3.34.0-build_2.2.patch b/dev-db/sqlite/files/sqlite-3.34.0-build_2.2.patch
1222 new file mode 100644
1223 index 00000000000..1aa60a0b162
1224 --- /dev/null
1225 +++ b/dev-db/sqlite/files/sqlite-3.34.0-build_2.2.patch
1226 @@ -0,0 +1,441 @@
1227 +Move some code to libsqlite3.so to avoid duplication.
1228 +Initialize some extensions in libsqlite3.so.
1229 +Update test suite.
1230 +
1231 +SQLite revision: a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b
1232 +
1233 +--- /ext/repair/sqlite3_checker.c.in
1234 ++++ /ext/repair/sqlite3_checker.c.in
1235 +@@ -2,6 +2,7 @@
1236 + ** Read an SQLite database file and analyze its space utilization. Generate
1237 + ** text on standard output.
1238 + */
1239 ++#define SQLITE_CORE 1
1240 + #define TCLSH_INIT_PROC sqlite3_checker_init_proc
1241 + #define SQLITE_ENABLE_DBPAGE_VTAB 1
1242 + #define SQLITE_ENABLE_JSON1 1
1243 +@@ -14,7 +15,7 @@
1244 + #define SQLITE_OMIT_SHARED_CACHE 1
1245 + #define SQLITE_DEFAULT_MEMSTATUS 0
1246 + #define SQLITE_MAX_EXPR_DEPTH 0
1247 +-INCLUDE sqlite3.c
1248 ++#include "sqlite3.h"
1249 + INCLUDE $ROOT/src/tclsqlite.c
1250 + INCLUDE $ROOT/ext/misc/btreeinfo.c
1251 + INCLUDE $ROOT/ext/repair/checkindex.c
1252 +--- /src/main.c
1253 ++++ /src/main.c
1254 +@@ -50,12 +50,36 @@
1255 + #ifdef SQLITE_ENABLE_FTS5
1256 + int sqlite3Fts5Init(sqlite3*);
1257 + #endif
1258 ++#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
1259 ++int sqlite3DbdataRegister(sqlite3*);
1260 ++#endif
1261 + #ifdef SQLITE_ENABLE_JSON1
1262 + int sqlite3Json1Init(sqlite3*);
1263 + #endif
1264 + #ifdef SQLITE_ENABLE_STMTVTAB
1265 + int sqlite3StmtVtabInit(sqlite3*);
1266 + #endif
1267 ++int sqlite3AmatchInit(sqlite3*);
1268 ++int sqlite3CarrayInit(sqlite3*);
1269 ++int sqlite3CompletionVtabInit(sqlite3*);
1270 ++int sqlite3CsvInit(sqlite3*);
1271 ++int sqlite3DecimalInit(sqlite3*);
1272 ++int sqlite3EvalInit(sqlite3*);
1273 ++int sqlite3FileioInit(sqlite3*);
1274 ++int sqlite3IeeeInit(sqlite3*);
1275 ++int sqlite3NextcharInit(sqlite3*);
1276 ++int sqlite3PercentileInit(sqlite3*);
1277 ++int sqlite3RegexpInit(sqlite3*);
1278 ++int sqlite3SeriesInit(sqlite3*);
1279 ++int sqlite3ShaInit(sqlite3*);
1280 ++int sqlite3ShathreeInit(sqlite3*);
1281 ++int sqlite3TotypeInit(sqlite3*);
1282 ++int sqlite3UintInit(sqlite3*);
1283 ++int sqlite3UuidInit(sqlite3*);
1284 ++#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB)
1285 ++int sqlite3ZipfileInit(sqlite3*);
1286 ++int sqlite3SqlarInit(sqlite3*);
1287 ++#endif
1288 +
1289 + /*
1290 + ** An array of pointers to extension initializer functions for
1291 +@@ -83,6 +107,9 @@
1292 + #ifdef SQLITE_ENABLE_DBPAGE_VTAB
1293 + sqlite3DbpageRegister,
1294 + #endif
1295 ++#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
1296 ++ sqlite3DbdataRegister,
1297 ++#endif
1298 + #ifdef SQLITE_ENABLE_DBSTAT_VTAB
1299 + sqlite3DbstatRegister,
1300 + #endif
1301 +@@ -96,6 +123,27 @@
1302 + #ifdef SQLITE_ENABLE_BYTECODE_VTAB
1303 + sqlite3VdbeBytecodeVtabInit,
1304 + #endif
1305 ++ sqlite3AmatchInit,
1306 ++ sqlite3CarrayInit,
1307 ++ sqlite3CompletionVtabInit,
1308 ++ sqlite3CsvInit,
1309 ++ sqlite3DecimalInit,
1310 ++ sqlite3EvalInit,
1311 ++ sqlite3FileioInit,
1312 ++ sqlite3IeeeInit,
1313 ++ sqlite3NextcharInit,
1314 ++ sqlite3PercentileInit,
1315 ++ sqlite3RegexpInit,
1316 ++ sqlite3SeriesInit,
1317 ++ sqlite3ShaInit,
1318 ++ sqlite3ShathreeInit,
1319 ++ sqlite3TotypeInit,
1320 ++ sqlite3UintInit,
1321 ++ sqlite3UuidInit,
1322 ++#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB)
1323 ++ sqlite3ZipfileInit,
1324 ++ sqlite3SqlarInit,
1325 ++#endif
1326 + };
1327 +
1328 + #ifndef SQLITE_AMALGAMATION
1329 +--- /src/shell.c.in
1330 ++++ /src/shell.c.in
1331 +@@ -69,6 +69,7 @@
1332 + #include <stdio.h>
1333 + #include <assert.h>
1334 + #include "sqlite3.h"
1335 ++#include "ext/expert/sqlite3expert.h"
1336 + typedef sqlite3_int64 i64;
1337 + typedef sqlite3_uint64 u64;
1338 + typedef unsigned char u8;
1339 +@@ -135,6 +136,10 @@
1340 + # define SHELL_USE_LOCAL_GETLINE 1
1341 + #endif
1342 +
1343 ++#ifdef SQLITE_HAVE_ZLIB
1344 ++#include <zlib.h>
1345 ++#endif
1346 ++
1347 +
1348 + #if defined(_WIN32) || defined(WIN32)
1349 + # if SQLITE_OS_WINRT
1350 +@@ -1018,25 +1023,7 @@
1351 + INCLUDE test_windirent.c
1352 + #define dirent DIRENT
1353 + #endif
1354 +-INCLUDE ../ext/misc/shathree.c
1355 +-INCLUDE ../ext/misc/fileio.c
1356 +-INCLUDE ../ext/misc/completion.c
1357 +-INCLUDE ../ext/misc/appendvfs.c
1358 + INCLUDE ../ext/misc/memtrace.c
1359 +-INCLUDE ../ext/misc/uint.c
1360 +-INCLUDE ../ext/misc/decimal.c
1361 +-INCLUDE ../ext/misc/ieee754.c
1362 +-INCLUDE ../ext/misc/series.c
1363 +-#ifdef SQLITE_HAVE_ZLIB
1364 +-INCLUDE ../ext/misc/zipfile.c
1365 +-INCLUDE ../ext/misc/sqlar.c
1366 +-#endif
1367 +-INCLUDE ../ext/expert/sqlite3expert.h
1368 +-INCLUDE ../ext/expert/sqlite3expert.c
1369 +-
1370 +-#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
1371 +-INCLUDE ../ext/misc/dbdata.c
1372 +-#endif
1373 +
1374 + #if defined(SQLITE_ENABLE_SESSION)
1375 + /*
1376 +@@ -4608,20 +4595,6 @@
1377 + #ifndef SQLITE_OMIT_LOAD_EXTENSION
1378 + sqlite3_enable_load_extension(p->db, 1);
1379 + #endif
1380 +- sqlite3_fileio_init(p->db, 0, 0);
1381 +- sqlite3_shathree_init(p->db, 0, 0);
1382 +- sqlite3_completion_init(p->db, 0, 0);
1383 +- sqlite3_uint_init(p->db, 0, 0);
1384 +- sqlite3_decimal_init(p->db, 0, 0);
1385 +- sqlite3_ieee_init(p->db, 0, 0);
1386 +- sqlite3_series_init(p->db, 0, 0);
1387 +-#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
1388 +- sqlite3_dbdata_init(p->db, 0, 0);
1389 +-#endif
1390 +-#ifdef SQLITE_HAVE_ZLIB
1391 +- sqlite3_zipfile_init(p->db, 0, 0);
1392 +- sqlite3_sqlar_init(p->db, 0, 0);
1393 +-#endif
1394 + sqlite3_create_function(p->db, "shell_add_schema", 3, SQLITE_UTF8, 0,
1395 + shellAddSchemaName, 0, 0);
1396 + sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, 0,
1397 +@@ -6644,8 +6617,6 @@
1398 + );
1399 + goto end_ar_command;
1400 + }
1401 +- sqlite3_fileio_init(cmd.db, 0, 0);
1402 +- sqlite3_sqlar_init(cmd.db, 0, 0);
1403 + sqlite3_create_function(cmd.db, "shell_putsnl", 1, SQLITE_UTF8, cmd.p,
1404 + shellPutsFunc, 0, 0);
1405 +
1406 +@@ -11076,6 +11047,7 @@
1407 + #endif
1408 + }
1409 + data.out = stdout;
1410 ++ extern int sqlite3_appendvfs_init(sqlite3 *, char **, const sqlite3_api_routines *);
1411 + sqlite3_appendvfs_init(0,0,0);
1412 +
1413 + /* Go ahead and open the database file if it already exists. If the
1414 +--- /src/test_config.c
1415 ++++ /src/test_config.c
1416 +@@ -353,6 +353,8 @@
1417 + Tcl_SetVar2(interp, "sqlite_options", "datetime", "1", TCL_GLOBAL_ONLY);
1418 + #endif
1419 +
1420 ++ Tcl_SetVar2(interp, "sqlite_options", "decimal", "1", TCL_GLOBAL_ONLY);
1421 ++
1422 + #ifdef SQLITE_OMIT_DECLTYPE
1423 + Tcl_SetVar2(interp, "sqlite_options", "decltype", "0", TCL_GLOBAL_ONLY);
1424 + #else
1425 +@@ -540,6 +542,8 @@
1426 + Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY);
1427 + #endif
1428 +
1429 ++ Tcl_SetVar2(interp, "sqlite_options", "regexp", "1", TCL_GLOBAL_ONLY);
1430 ++
1431 + #ifdef SQLITE_OMIT_REINDEX
1432 + Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY);
1433 + #else
1434 +@@ -662,6 +666,8 @@
1435 + Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "1", TCL_GLOBAL_ONLY);
1436 + #endif
1437 +
1438 ++ Tcl_SetVar2(interp, "sqlite_options", "uint", "1", TCL_GLOBAL_ONLY);
1439 ++
1440 + #ifdef SQLITE_OMIT_UTF16
1441 + Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY);
1442 + #else
1443 +--- /test/e_expr.test
1444 ++++ /test/e_expr.test
1445 +@@ -1079,7 +1079,7 @@
1446 + #
1447 + # There is a regexp function if ICU is enabled though.
1448 + #
1449 +-ifcapable !icu {
1450 ++ifcapable !icu&&!regexp {
1451 + do_catchsql_test e_expr-18.1.1 {
1452 + SELECT regexp('abc', 'def')
1453 + } {1 {no such function: regexp}}
1454 +--- /test/icu.test
1455 ++++ /test/icu.test
1456 +@@ -41,7 +41,7 @@
1457 + #
1458 + test_expr icu-1.1 {i1='hello'} {i1 REGEXP 'hello'} 1
1459 + test_expr icu-1.2 {i1='hello'} {i1 REGEXP '.ello'} 1
1460 +- test_expr icu-1.3 {i1='hello'} {i1 REGEXP '.ell'} 0
1461 ++ test_expr icu-1.3 {i1='hello'} {i1 REGEXP '.ell$'} 0
1462 + test_expr icu-1.4 {i1='hello'} {i1 REGEXP '.ell.*'} 1
1463 + test_expr icu-1.5 {i1=NULL} {i1 REGEXP '.ell.*'} {}
1464 +
1465 +--- /test/pragma.test
1466 ++++ /test/pragma.test
1467 +@@ -1370,17 +1370,62 @@
1468 + } ;# ifcapable trigger
1469 +
1470 + ifcapable schema_pragmas {
1471 +- do_test pragma-11.1 {
1472 +- execsql2 {
1473 +- pragma collation_list;
1474 ++ ifcapable decimal {
1475 ++ ifcapable uint {
1476 ++ do_test pragma-11.1 {
1477 ++ execsql2 {
1478 ++ pragma collation_list;
1479 ++ }
1480 ++ } {seq 0 name UINT seq 1 name decimal seq 2 name RTRIM seq 3 name NOCASE seq 4 name BINARY}
1481 ++ do_test pragma-11.2 {
1482 ++ db collate New_Collation blah...
1483 ++ execsql {
1484 ++ pragma collation_list;
1485 ++ }
1486 ++ } {0 New_Collation 1 UINT 2 decimal 3 RTRIM 4 NOCASE 5 BINARY}
1487 + }
1488 +- } {seq 0 name RTRIM seq 1 name NOCASE seq 2 name BINARY}
1489 +- do_test pragma-11.2 {
1490 +- db collate New_Collation blah...
1491 +- execsql {
1492 +- pragma collation_list;
1493 ++ ifcapable !uint {
1494 ++ do_test pragma-11.1 {
1495 ++ execsql2 {
1496 ++ pragma collation_list;
1497 ++ }
1498 ++ } {seq 0 name decimal seq 1 name RTRIM seq 2 name NOCASE seq 3 name BINARY}
1499 ++ do_test pragma-11.2 {
1500 ++ db collate New_Collation blah...
1501 ++ execsql {
1502 ++ pragma collation_list;
1503 ++ }
1504 ++ } {0 New_Collation 1 decimal 2 RTRIM 3 NOCASE 4 BINARY}
1505 + }
1506 +- } {0 New_Collation 1 RTRIM 2 NOCASE 3 BINARY}
1507 ++ }
1508 ++ ifcapable !decimal {
1509 ++ ifcapable uint {
1510 ++ do_test pragma-11.1 {
1511 ++ execsql2 {
1512 ++ pragma collation_list;
1513 ++ }
1514 ++ } {seq 0 name UINT seq 1 name RTRIM seq 2 name NOCASE seq 3 name BINARY}
1515 ++ do_test pragma-11.2 {
1516 ++ db collate New_Collation blah...
1517 ++ execsql {
1518 ++ pragma collation_list;
1519 ++ }
1520 ++ } {0 New_Collation 1 UINT 2 RTRIM 3 NOCASE 4 BINARY}
1521 ++ }
1522 ++ ifcapable !uint {
1523 ++ do_test pragma-11.1 {
1524 ++ execsql2 {
1525 ++ pragma collation_list;
1526 ++ }
1527 ++ } {seq 0 name RTRIM seq 1 name NOCASE seq 2 name BINARY}
1528 ++ do_test pragma-11.2 {
1529 ++ db collate New_Collation blah...
1530 ++ execsql {
1531 ++ pragma collation_list;
1532 ++ }
1533 ++ } {0 New_Collation 1 RTRIM 2 NOCASE 3 BINARY}
1534 ++ }
1535 ++ }
1536 + }
1537 +
1538 + ifcapable schema_pragmas&&tempdb {
1539 +--- /test/sessionfuzz.c
1540 ++++ /test/sessionfuzz.c
1541 +@@ -698,49 +698,6 @@
1542 + #include <stdio.h>
1543 + #include <string.h>
1544 + #include <assert.h>
1545 +-#ifndef OMIT_ZLIB
1546 +-#include "zlib.h"
1547 +-#endif
1548 +-
1549 +-/*
1550 +-** Implementation of the "sqlar_uncompress(X,SZ)" SQL function
1551 +-**
1552 +-** Parameter SZ is interpreted as an integer. If it is less than or
1553 +-** equal to zero, then this function returns a copy of X. Or, if
1554 +-** SZ is equal to the size of X when interpreted as a blob, also
1555 +-** return a copy of X. Otherwise, decompress blob X using zlib
1556 +-** utility function uncompress() and return the results (another
1557 +-** blob).
1558 +-*/
1559 +-static void sqlarUncompressFunc(
1560 +- sqlite3_context *context,
1561 +- int argc,
1562 +- sqlite3_value **argv
1563 +-){
1564 +-#ifdef OMIT_ZLIB
1565 +- sqlite3_result_value(context, argv[0]);
1566 +-#else
1567 +- uLong nData;
1568 +- uLongf sz;
1569 +-
1570 +- assert( argc==2 );
1571 +- sz = sqlite3_value_int(argv[1]);
1572 +-
1573 +- if( sz<=0 || sz==(nData = sqlite3_value_bytes(argv[0])) ){
1574 +- sqlite3_result_value(context, argv[0]);
1575 +- }else{
1576 +- const Bytef *pData= sqlite3_value_blob(argv[0]);
1577 +- Bytef *pOut = sqlite3_malloc(sz);
1578 +- if( Z_OK!=uncompress(pOut, &sz, pData, nData) ){
1579 +- sqlite3_result_error(context, "error in uncompress()", -1);
1580 +- }else{
1581 +- sqlite3_result_blob(context, pOut, sz, SQLITE_TRANSIENT);
1582 +- }
1583 +- sqlite3_free(pOut);
1584 +- }
1585 +-#endif
1586 +-}
1587 +-
1588 +
1589 + /* Run a chunk of SQL. If any errors happen, print an error message
1590 + ** and exit.
1591 +--- /tool/mksqlite3c.tcl
1592 ++++ /tool/mksqlite3c.tcl
1593 +@@ -129,6 +129,7 @@
1594 + rtree.h
1595 + sqlite3session.h
1596 + sqlite3.h
1597 ++ sqlite3expert.h
1598 + sqlite3ext.h
1599 + sqlite3rbu.h
1600 + sqliteicu.h
1601 +@@ -416,6 +417,28 @@
1602 + sqlite3session.c
1603 + fts5.c
1604 + stmt.c
1605 ++ amatch.c
1606 ++ appendvfs.c
1607 ++ carray.c
1608 ++ completion.c
1609 ++ csv.c
1610 ++ dbdata.c
1611 ++ decimal.c
1612 ++ eval.c
1613 ++ fileio.c
1614 ++ ieee754.c
1615 ++ nextchar.c
1616 ++ percentile.c
1617 ++ regexp.c
1618 ++ series.c
1619 ++ sha1.c
1620 ++ shathree.c
1621 ++ sqlar.c
1622 ++ sqlite3expert.c
1623 ++ totype.c
1624 ++ uint.c
1625 ++ uuid.c
1626 ++ zipfile.c
1627 + } {
1628 + copy_file tsrc/$file
1629 + }
1630 +--- /tool/sqlite3_analyzer.c.in
1631 ++++ /tool/sqlite3_analyzer.c.in
1632 +@@ -14,9 +14,6 @@
1633 + #define SQLITE_DEFAULT_MEMSTATUS 0
1634 + #define SQLITE_MAX_EXPR_DEPTH 0
1635 + #define SQLITE_OMIT_LOAD_EXTENSION 1
1636 +-#ifndef USE_EXTERNAL_SQLITE
1637 +-INCLUDE sqlite3.c
1638 +-#endif
1639 + INCLUDE $ROOT/src/tclsqlite.c
1640 +
1641 + const char *sqlite3_analyzer_init_proc(Tcl_Interp *interp){
1642 +--- /tool/sqltclsh.c.in
1643 ++++ /tool/sqltclsh.c.in
1644 +@@ -27,21 +27,13 @@
1645 + #define SQLITE_OMIT_SHARED_CACHE 1
1646 + #define SQLITE_DEFAULT_MEMSTATUS 0
1647 + #define SQLITE_MAX_EXPR_DEPTH 0
1648 +-INCLUDE sqlite3.c
1649 +-INCLUDE $ROOT/ext/misc/appendvfs.c
1650 +-#ifdef SQLITE_HAVE_ZLIB
1651 +-INCLUDE $ROOT/ext/misc/zipfile.c
1652 +-INCLUDE $ROOT/ext/misc/sqlar.c
1653 +-#endif
1654 ++#include "sqlite3.h"
1655 + INCLUDE $ROOT/src/tclsqlite.c
1656 +
1657 + const char *sqlite3_tclapp_init_proc(Tcl_Interp *interp){
1658 + (void)interp;
1659 ++ extern int sqlite3_appendvfs_init(sqlite3 *,char **, const sqlite3_api_routines *);
1660 + sqlite3_appendvfs_init(0,0,0);
1661 +-#ifdef SQLITE_HAVE_ZLIB
1662 +- sqlite3_auto_extension((void(*)(void))sqlite3_sqlar_init);
1663 +- sqlite3_auto_extension((void(*)(void))sqlite3_zipfile_init);
1664 +-#endif
1665 +
1666 + return
1667 + BEGIN_STRING
1668
1669 diff --git a/dev-db/sqlite/sqlite-3.34.0.ebuild b/dev-db/sqlite/sqlite-3.34.0.ebuild
1670 new file mode 100644
1671 index 00000000000..93740884fe5
1672 --- /dev/null
1673 +++ b/dev-db/sqlite/sqlite-3.34.0.ebuild
1674 @@ -0,0 +1,427 @@
1675 +# Copyright 1999-2020 Gentoo Authors
1676 +# Distributed under the terms of the GNU General Public License v2
1677 +
1678 +EAPI="7"
1679 +
1680 +inherit autotools flag-o-matic multilib-minimal toolchain-funcs
1681 +
1682 +if [[ "${PV}" != "9999" ]]; then
1683 + SRC_PV="$(printf "%u%02u%02u%02u" $(ver_rs 1- " "))"
1684 + DOC_PV="${SRC_PV}"
1685 + # DOC_PV="$(printf "%u%02u%02u00" $(ver_rs 1-3 " "))"
1686 +fi
1687 +
1688 +DESCRIPTION="SQL database engine"
1689 +HOMEPAGE="https://sqlite.org/"
1690 +if [[ "${PV}" == "9999" ]]; then
1691 + SRC_URI=""
1692 +else
1693 + SRC_URI="https://sqlite.org/2020/${PN}-src-${SRC_PV}.zip
1694 + doc? ( https://sqlite.org/2020/${PN}-doc-${DOC_PV}.zip )"
1695 +fi
1696 +
1697 +LICENSE="public-domain"
1698 +SLOT="3"
1699 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~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"
1700 +IUSE="debug doc icu +readline secure-delete static-libs tcl test tools"
1701 +if [[ "${PV}" == "9999" ]]; then
1702 + PROPERTIES="live"
1703 +fi
1704 +RESTRICT="!test? ( test )"
1705 +
1706 +if [[ "${PV}" == "9999" ]]; then
1707 + BDEPEND=">=dev-lang/tcl-8.6:0
1708 + dev-vcs/fossil"
1709 +else
1710 + BDEPEND="app-arch/unzip
1711 + >=dev-lang/tcl-8.6:0"
1712 +fi
1713 +RDEPEND="sys-libs/zlib:0=[${MULTILIB_USEDEP}]
1714 + icu? ( dev-libs/icu:0=[${MULTILIB_USEDEP}] )
1715 + readline? ( sys-libs/readline:0=[${MULTILIB_USEDEP}] )
1716 + tcl? ( dev-lang/tcl:0=[${MULTILIB_USEDEP}] )
1717 + tools? ( dev-lang/tcl:0=[${MULTILIB_USEDEP}] )"
1718 +DEPEND="${RDEPEND}
1719 + test? ( >=dev-lang/tcl-8.6:0[${MULTILIB_USEDEP}] )"
1720 +
1721 +if [[ "${PV}" == "9999" ]]; then
1722 + S="${WORKDIR}/${PN}"
1723 +else
1724 + S="${WORKDIR}/${PN}-src-${SRC_PV}"
1725 +fi
1726 +
1727 +_fossil_fetch() {
1728 + local distdir="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}"
1729 + local repo_id="${1}"
1730 + local repo_uri="${2}"
1731 +
1732 + local -x FOSSIL_HOME="${HOME}"
1733 +
1734 + mkdir -p "${T}/fossil/${repo_id}" || die
1735 + pushd "${T}/fossil/${repo_id}" > /dev/null || die
1736 +
1737 + if [[ -n "${EVCS_OFFLINE}" ]]; then
1738 + if [[ ! -f "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" ]]; then
1739 + die "Network activity disabled using EVCS_OFFLINE and clone of repository missing: \"${distdir}/fossil-src/${repo_id}/${repo_id}.fossil\""
1740 + fi
1741 + else
1742 + if [[ ! -f "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" ]]; then
1743 + einfo fossil clone --verbose "${repo_uri}" "${repo_id}.fossil"
1744 + fossil clone --verbose "${repo_uri}" "${repo_id}.fossil" || die
1745 + echo
1746 + else
1747 + cp -p "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" . || die
1748 + einfo fossil pull --repository "${repo_id}.fossil" --verbose "${repo_uri}"
1749 + fossil pull --repository "${repo_id}.fossil" --verbose "${repo_uri}" || die
1750 + echo
1751 + fi
1752 +
1753 + (
1754 + addwrite "${distdir}"
1755 + mkdir -p "${distdir}/fossil-src/${repo_id}" || die
1756 + cp -p "${repo_id}.fossil" "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" || die
1757 + )
1758 + fi
1759 +
1760 + popd > /dev/null || die
1761 +}
1762 +
1763 +_fossil_checkout() {
1764 + local distdir="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}"
1765 + local repo_id="${1}"
1766 + local branch_or_commit="${2}"
1767 + local target_directory="${3}"
1768 +
1769 + local -x FOSSIL_HOME="${HOME}"
1770 +
1771 + if [[ ! -f "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" ]]; then
1772 + die "Clone of repository missing: \"${distdir}/fossil-src/${repo_id}/${repo_id}.fossil\""
1773 + fi
1774 +
1775 + if [[ ! -f "${T}/fossil/${repo_id}/${repo_id}.fossil" ]]; then
1776 + mkdir -p "${T}/fossil/${repo_id}" || die
1777 + cp -p "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" "${T}/fossil/${repo_id}" || die
1778 + fi
1779 +
1780 + mkdir "${target_directory}" || die
1781 + pushd "${target_directory}" > /dev/null || die
1782 +
1783 + einfo fossil open --quiet "${T}/fossil/${repo_id}/${repo_id}.fossil" "${branch_or_commit}"
1784 + fossil open --quiet "${T}/fossil/${repo_id}/${repo_id}.fossil" "${branch_or_commit}" || die
1785 + echo
1786 +
1787 + popd > /dev/null || die
1788 +}
1789 +
1790 +fossil_fetch() {
1791 + local repo_id="${1}"
1792 + local repo_uri="${2}"
1793 + local target_directory="${3}"
1794 +
1795 + local branch_or_commit="${EFOSSIL_COMMIT:-${EFOSSIL_BRANCH:-trunk}}"
1796 +
1797 + _fossil_fetch "${repo_id}" "${repo_uri}"
1798 + _fossil_checkout "${repo_id}" "${branch_or_commit}" "${target_directory}"
1799 +}
1800 +
1801 +src_unpack() {
1802 + if [[ "${PV}" == "9999" ]]; then
1803 + fossil_fetch sqlite https://sqlite.org/src "${WORKDIR}/${PN}"
1804 + if use doc; then
1805 + fossil_fetch sqlite-doc https://sqlite.org/docsrc "${WORKDIR}/${PN}-doc"
1806 + fi
1807 + else
1808 + default
1809 + fi
1810 +}
1811 +
1812 +src_prepare() {
1813 + eapply "${FILESDIR}/"${PN}-3.34.0-build_{1.1,1.2,2.1,2.2}.patch
1814 +
1815 + eapply_user
1816 +
1817 + eautoreconf
1818 +
1819 + multilib_copy_sources
1820 +}
1821 +
1822 +multilib_src_configure() {
1823 + local -x CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}"
1824 + local options=()
1825 +
1826 + options+=(
1827 + --enable-load-extension
1828 + --enable-threadsafe
1829 + )
1830 +
1831 + # Support detection of misuse of SQLite API.
1832 + # https://sqlite.org/compile.html#enable_api_armor
1833 + append-cppflags -DSQLITE_ENABLE_API_ARMOR
1834 +
1835 + # Support bytecode and tables_used virtual tables.
1836 + # https://sqlite.org/compile.html#enable_bytecode_vtab
1837 + # https://sqlite.org/bytecodevtab.html
1838 + append-cppflags -DSQLITE_ENABLE_BYTECODE_VTAB
1839 +
1840 + # Support column metadata functions.
1841 + # https://sqlite.org/compile.html#enable_column_metadata
1842 + # https://sqlite.org/c3ref/column_database_name.html
1843 + append-cppflags -DSQLITE_ENABLE_COLUMN_METADATA
1844 +
1845 + # Support sqlite_dbpage virtual table.
1846 + # https://sqlite.org/compile.html#enable_dbpage_vtab
1847 + # https://sqlite.org/dbpage.html
1848 + append-cppflags -DSQLITE_ENABLE_DBPAGE_VTAB
1849 +
1850 + # Support dbstat virtual table.
1851 + # https://sqlite.org/compile.html#enable_dbstat_vtab
1852 + # https://sqlite.org/dbstat.html
1853 + append-cppflags -DSQLITE_ENABLE_DBSTAT_VTAB
1854 +
1855 + # Support sqlite3_serialize() and sqlite3_deserialize() functions.
1856 + # https://sqlite.org/compile.html#enable_deserialize
1857 + # https://sqlite.org/c3ref/serialize.html
1858 + # https://sqlite.org/c3ref/deserialize.html
1859 + append-cppflags -DSQLITE_ENABLE_DESERIALIZE
1860 +
1861 + # Support comments in output of EXPLAIN.
1862 + # https://sqlite.org/compile.html#enable_explain_comments
1863 + append-cppflags -DSQLITE_ENABLE_EXPLAIN_COMMENTS
1864 +
1865 + # Support Full-Text Search versions 3, 4 and 5.
1866 + # https://sqlite.org/compile.html#enable_fts3
1867 + # https://sqlite.org/compile.html#enable_fts3_parenthesis
1868 + # https://sqlite.org/compile.html#enable_fts4
1869 + # https://sqlite.org/compile.html#enable_fts5
1870 + # https://sqlite.org/fts3.html
1871 + # https://sqlite.org/fts5.html
1872 + append-cppflags -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4
1873 + options+=(--enable-fts5)
1874 +
1875 + # Support hidden columns.
1876 + append-cppflags -DSQLITE_ENABLE_HIDDEN_COLUMNS
1877 +
1878 + # Support JSON1 extension.
1879 + # https://sqlite.org/compile.html#enable_json1
1880 + # https://sqlite.org/json1.html
1881 + append-cppflags -DSQLITE_ENABLE_JSON1
1882 +
1883 + # Support memsys5 memory allocator.
1884 + # https://sqlite.org/compile.html#enable_memsys5
1885 + # https://sqlite.org/malloc.html#memsys5
1886 + append-cppflags -DSQLITE_ENABLE_MEMSYS5
1887 +
1888 + # Support sqlite3_normalized_sql() function.
1889 + # https://sqlite.org/c3ref/expanded_sql.html
1890 + append-cppflags -DSQLITE_ENABLE_NORMALIZE
1891 +
1892 + # Support sqlite_offset() function.
1893 + # https://sqlite.org/compile.html#enable_offset_sql_func
1894 + # https://sqlite.org/lang_corefunc.html#sqlite_offset
1895 + append-cppflags -DSQLITE_ENABLE_OFFSET_SQL_FUNC
1896 +
1897 + # Support pre-update hook functions.
1898 + # https://sqlite.org/compile.html#enable_preupdate_hook
1899 + # https://sqlite.org/c3ref/preupdate_count.html
1900 + append-cppflags -DSQLITE_ENABLE_PREUPDATE_HOOK
1901 +
1902 + # Support Resumable Bulk Update extension.
1903 + # https://sqlite.org/compile.html#enable_rbu
1904 + # https://sqlite.org/rbu.html
1905 + append-cppflags -DSQLITE_ENABLE_RBU
1906 +
1907 + # Support R*Trees.
1908 + # https://sqlite.org/compile.html#enable_rtree
1909 + # https://sqlite.org/compile.html#enable_geopoly
1910 + # https://sqlite.org/rtree.html
1911 + # https://sqlite.org/geopoly.html
1912 + append-cppflags -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY
1913 +
1914 + # Support Session extension.
1915 + # https://sqlite.org/compile.html#enable_session
1916 + # https://sqlite.org/sessionintro.html
1917 + append-cppflags -DSQLITE_ENABLE_SESSION
1918 +
1919 + # Support scan status functions.
1920 + # https://sqlite.org/compile.html#enable_stmt_scanstatus
1921 + # https://sqlite.org/c3ref/stmt_scanstatus.html
1922 + # https://sqlite.org/c3ref/stmt_scanstatus_reset.html
1923 + append-cppflags -DSQLITE_ENABLE_STMT_SCANSTATUS
1924 +
1925 + # Support sqlite_stmt virtual table.
1926 + # https://sqlite.org/compile.html#enable_stmtvtab
1927 + # https://sqlite.org/stmt.html
1928 + append-cppflags -DSQLITE_ENABLE_STMTVTAB
1929 +
1930 + # Support unknown() function.
1931 + # https://sqlite.org/compile.html#enable_unknown_sql_function
1932 + append-cppflags -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
1933 +
1934 + # Support unlock notification.
1935 + # https://sqlite.org/compile.html#enable_unlock_notify
1936 + # https://sqlite.org/c3ref/unlock_notify.html
1937 + # https://sqlite.org/unlock_notify.html
1938 + append-cppflags -DSQLITE_ENABLE_UNLOCK_NOTIFY
1939 +
1940 + # Support LIMIT and ORDER BY clauses on DELETE and UPDATE statements.
1941 + # https://sqlite.org/compile.html#enable_update_delete_limit
1942 + # https://sqlite.org/lang_delete.html#optional_limit_and_order_by_clauses
1943 + # https://sqlite.org/lang_update.html#optional_limit_and_order_by_clauses
1944 + append-cppflags -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT
1945 +
1946 + # Support soundex() function.
1947 + # https://sqlite.org/compile.html#soundex
1948 + # https://sqlite.org/lang_corefunc.html#soundex
1949 + append-cppflags -DSQLITE_SOUNDEX
1950 +
1951 + # Support URI filenames.
1952 + # https://sqlite.org/compile.html#use_uri
1953 + # https://sqlite.org/uri.html
1954 + append-cppflags -DSQLITE_USE_URI
1955 +
1956 + # debug USE flag.
1957 + options+=($(use_enable debug))
1958 +
1959 + # icu USE flag.
1960 + if use icu; then
1961 + # Support ICU extension.
1962 + # https://sqlite.org/compile.html#enable_icu
1963 + append-cppflags -DSQLITE_ENABLE_ICU
1964 + sed -e "s/^TLIBS = @LIBS@/& -licui18n -licuuc/" -i Makefile.in || die "sed failed"
1965 + fi
1966 +
1967 + # readline USE flag.
1968 + options+=(
1969 + --disable-editline
1970 + $(use_enable readline)
1971 + )
1972 + if use readline; then
1973 + options+=(--with-readline-inc="-I${ESYSROOT}/usr/include/readline")
1974 + fi
1975 +
1976 + # secure-delete USE flag.
1977 + if use secure-delete; then
1978 + # Enable secure_delete pragma by default.
1979 + # https://sqlite.org/compile.html#secure_delete
1980 + # https://sqlite.org/pragma.html#pragma_secure_delete
1981 + append-cppflags -DSQLITE_SECURE_DELETE
1982 + fi
1983 +
1984 + # static-libs USE flag.
1985 + options+=($(use_enable static-libs static))
1986 +
1987 + # tcl, test, tools USE flags.
1988 + options+=(--enable-tcl)
1989 +
1990 + if [[ "${CHOST}" == *-mint* ]]; then
1991 + # sys/mman.h not available in MiNTLib.
1992 + # https://sqlite.org/compile.html#omit_wal
1993 + append-cppflags -DSQLITE_OMIT_WAL
1994 + fi
1995 +
1996 + if [[ "${ABI}" == "x86" ]]; then
1997 + if $(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P -dM - < /dev/null 2> /dev/null | grep -q "^#define __SSE__ 1$"; then
1998 + append-cflags -mfpmath=sse
1999 + else
2000 + append-cflags -ffloat-store
2001 + fi
2002 + fi
2003 +
2004 + econf "${options[@]}"
2005 +}
2006 +
2007 +multilib_src_compile() {
2008 + emake HAVE_TCL="$(usex tcl 1 "")" TCLLIBDIR="${EPREFIX}/usr/$(get_libdir)/${P}"
2009 +
2010 + if use tools && multilib_is_native_abi; then
2011 + emake changeset dbdump dbhash dbtotxt index_usage rbu scrub showdb showjournal showshm showstat4 showwal sqldiff sqlite3_analyzer sqlite3_checker sqlite3_expert sqltclsh
2012 + fi
2013 +
2014 + if [[ "${PV}" == "9999" ]] && use doc && multilib_is_native_abi; then
2015 + emake tclsqlite3.c
2016 +
2017 + local build_directory="$(pwd)"
2018 + build_directory="${build_directory##*/}"
2019 +
2020 + mkdir "${WORKDIR}/${PN}-doc-build" || die
2021 + pushd "${WORKDIR}/${PN}-doc-build" > /dev/null || die
2022 +
2023 + emake -f "../${PN}-doc/Makefile" -j1 SRC="../${PN}" BLD="../${build_directory}" DOC="../${PN}-doc" CC="$(tc-getBUILD_CC)" TCLINC="" TCLFLAGS="$($(tc-getBUILD_PKG_CONFIG) --libs tcl) -ldl -lm" base doc
2024 + rmdir doc/matrix{/*,} || die
2025 +
2026 + popd > /dev/null || die
2027 + fi
2028 +}
2029 +
2030 +multilib_src_test() {
2031 + if [[ "${EUID}" -eq 0 ]]; then
2032 + ewarn "Skipping tests due to root permissions"
2033 + return
2034 + fi
2035 +
2036 + local -x SQLITE_HISTORY="${T}/sqlite_history_${ABI}"
2037 +
2038 + emake HAVE_TCL="$(usex tcl 1 "")" $(use debug && echo fulltest || echo test)
2039 +}
2040 +
2041 +multilib_src_install() {
2042 + emake DESTDIR="${D}" HAVE_TCL="$(usex tcl 1 "")" TCLLIBDIR="${EPREFIX}/usr/$(get_libdir)/${P}" install
2043 +
2044 + if use tools && multilib_is_native_abi; then
2045 + install_tool() {
2046 + if [[ -f ".libs/${1}" ]]; then
2047 + newbin ".libs/${1}" "${2}"
2048 + else
2049 + newbin "${1}" "${2}"
2050 + fi
2051 + }
2052 +
2053 + install_tool changeset sqlite3-changeset
2054 + install_tool dbdump sqlite3-db-dump
2055 + install_tool dbhash sqlite3-db-hash
2056 + install_tool dbtotxt sqlite3-db-to-txt
2057 + install_tool index_usage sqlite3-index-usage
2058 + install_tool rbu sqlite3-rbu
2059 + install_tool scrub sqlite3-scrub
2060 + install_tool showdb sqlite3-show-db
2061 + install_tool showjournal sqlite3-show-journal
2062 + install_tool showshm sqlite3-show-shm
2063 + install_tool showstat4 sqlite3-show-stat4
2064 + install_tool showwal sqlite3-show-wal
2065 + install_tool sqldiff sqlite3-diff
2066 + install_tool sqlite3_analyzer sqlite3-analyzer
2067 + install_tool sqlite3_checker sqlite3-checker
2068 + install_tool sqlite3_expert sqlite3-expert
2069 + install_tool sqltclsh sqlite3-tclsh
2070 +
2071 + unset -f install_tool
2072 + fi
2073 +}
2074 +
2075 +multilib_src_install_all() {
2076 + find "${ED}" -name "*.la" -delete || die
2077 +
2078 + doman sqlite3.1
2079 +
2080 + if use doc; then
2081 + if [[ "${PV}" == "9999" ]]; then
2082 + pushd "${WORKDIR}/${PN}-doc-build/doc" > /dev/null || die
2083 + else
2084 + pushd "${WORKDIR}/${PN}-doc-${DOC_PV}" > /dev/null || die
2085 + fi
2086 +
2087 + find "(" -name "*.db" -o -name "*.txt" ")" -delete || die
2088 + if [[ "${PV}" != "9999" ]]; then
2089 + rm search search.d/admin || die
2090 + rmdir search.d || die
2091 + find -name "*~" -delete || die
2092 + fi
2093 +
2094 + (
2095 + docinto html
2096 + dodoc -r *
2097 + )
2098 +
2099 + popd > /dev/null || die
2100 + fi
2101 +}