Get SQLite to build

* changed all necessary #includes with find-and-replace.
* changed two switch statements involving EACCES to if-else
* changed noinline to __noinline__
* commented useless headers, redundant declarations/definitions
This commit is contained in:
ahgamut 2021-05-04 16:57:02 +05:30
parent ed0ebc7561
commit d93248bd9f
20 changed files with 550 additions and 447 deletions

View file

@ -137,6 +137,7 @@ include libc/testlib/testlib.mk
include tool/viz/lib/vizlib.mk
include third_party/lua/lua.mk
include third_party/quickjs/quickjs.mk
include third_party/sqlite3/sqlite3.mk
include third_party/lz4cli/lz4cli.mk
include tool/build/lib/buildlib.mk
include third_party/chibicc/chibicc.mk

View file

@ -213,7 +213,7 @@
** 4 Number of leaf pointers on this page
** * zero or more pages numbers of leaves
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/headers/sqliteInt.h"
/* The following value is the maximum cell size assuming a maximum page
** size give above.

View file

@ -25,7 +25,7 @@
/* Define to 1 if the system has the type `intptr_t'. */
#define HAVE_INTPTR_T 1
/* Define to 1 if you have the <inttypes.h> header file. */
/* Define to 1 if you have the "libc/calls/weirdtypes.h" header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `isnan' function. */
@ -37,7 +37,7 @@
/* Define to 1 if you have the `localtime_s' function. */
/* #undef HAVE_LOCALTIME_S */
/* Define to 1 if you have the <malloc.h> header file. */
/* Define to 1 if you have the "libc/mem/mem.h" header file. */
#define HAVE_MALLOC_H 1
/* Define to 1 if you have the `malloc_usable_size' function. */
@ -58,10 +58,10 @@
/* Define to 1 if you have the pwrite64() function. */
/* #undef HAVE_PWRITE64 */
/* Define to 1 if you have the <stdint.h> header file. */
/* Define to 1 if you have the "libc/calls/weirdtypes.h" header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
/* Define to 1 if you have the "libc/mem/mem.h" header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the strchrnul() function */
@ -70,7 +70,7 @@
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
/* Define to 1 if you have the "libc/str/str.h" header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
@ -94,7 +94,7 @@
/* Define to 1 if the system has the type `uintptr_t'. */
#define HAVE_UINTPTR_T 1
/* Define to 1 if you have the <unistd.h> header file. */
/* Define to 1 if you have the "libc/isystem/unistd.h" header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the `usleep' function. */

View file

@ -20,7 +20,7 @@
#ifndef _FTS5_H
#define _FTS5_H
#include "sqlite3.h"
#include "third_party/sqlite3/headers/sqlite3.h"
#ifdef __cplusplus
extern "C" {

View file

@ -24,7 +24,7 @@
** Attempt to automatically detect the operating system and setup the
** necessary pre-processor macros for it.
*/
#include "os_setup.h"
#include "third_party/sqlite3/headers/os_setup.h"
/* If the SET_FULLSYNC macro is not defined above, then make it
** a no-op

View file

@ -39,7 +39,7 @@
** hwtime.h contains inline assembler code for implementing
** high-performance timing routines.
*/
#include "hwtime.h"
#include "third_party/sqlite3/headers/hwtime.h"
static sqlite_uint64 g_start;
static sqlite_uint64 g_elapsed;

View file

@ -18,10 +18,10 @@
/*
** Include the primary Windows SDK header file.
*/
#include "windows.h"
#include "third_party/sqlite3/headers/windows.h"
#ifdef __CYGWIN__
#include <errno.h> /* amalgamator: dontcache */
#include "libc/errno.h" /* amalgamator: dontcache */
#include <sys/cygwin.h>
#endif

View file

@ -32,7 +32,6 @@
*/
#ifndef SQLITE3_H
#define SQLITE3_H
#include <stdarg.h> /* Needed for the definition of va_list */
/*
** Make sure we can call this stuff from C++.
@ -9576,7 +9575,7 @@ SQLITE_API int sqlite3_system_errno(sqlite3 *);
** the most recent version.
*/
typedef struct sqlite3_snapshot {
unsigned char hidden[48];
unsigned char dummyhidden[48];
} sqlite3_snapshot;
/*

View file

@ -17,7 +17,7 @@
*/
#ifndef SQLITE3EXT_H
#define SQLITE3EXT_H
#include "sqlite3.h"
#include "third_party/sqlite3/headers/sqlite3.h"
/*
** The following structure holds pointers to all of the SQLite API

View file

@ -9,7 +9,7 @@
extern "C" {
#endif
#include "sqlite3.h"
#include "third_party/sqlite3/headers/sqlite3.h"
/*
** CAPI3REF: Session Object Handle

View file

@ -56,12 +56,12 @@
** compiler warnings due to subsequent content in this file and other files
** that are included by this file.
*/
#include "msvc.h"
#include "third_party/sqlite3/headers/msvc.h"
/*
** Special setup for VxWorks
*/
#include "vxworks.h"
#include "third_party/sqlite3/headers/vxworks.h"
/*
** These #defines should enable >2GB file support on POSIX if the
@ -165,9 +165,9 @@
** disabled.
*/
#if defined(_HAVE_MINGW_H)
#include "mingw.h"
#include "third_party/sqlite3/headers/mingw.h"
#elif defined(_HAVE__MINGW_H)
#include "_mingw.h"
#include "third_party/sqlite3/headers/_mingw.h"
#endif
/*
@ -185,18 +185,18 @@
** first in QNX. Also, the _USE_32BIT_TIME_T macro must appear first for
** MinGW.
*/
#include "sqlite3.h"
#include "third_party/sqlite3/headers/sqlite3.h"
/*
** Include the configuration header output by 'configure' if we're using the
** autoconf-based build
*/
#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H)
#include "config.h"
#include "third_party/sqlite3/headers/config.h"
#define SQLITECONFIG_H 1
#endif
#include "sqliteLimit.h"
#include "third_party/sqlite3/headers/sqliteLimit.h"
/* Disable nuisance warnings on Borland compilers */
#if defined(__BORLANDC__)
@ -227,10 +227,10 @@
** Include standard header files as necessary
*/
#ifdef HAVE_STDINT_H
#include <stdint.h>
#include "libc/calls/weirdtypes.h"
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#include "libc/calls/weirdtypes.h"
#endif
/*
@ -585,14 +585,13 @@ extern int sqlite3OSTrace;
#define likely(X) (X)
#define unlikely(X) (X)
#include <assert.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "libc/assert.h"
#include "libc/stdio/stdio.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "hash.h"
#include "parse.h"
#include "third_party/sqlite3/headers/hash.h"
#include "third_party/sqlite3/headers/parse.h"
/*
** Use a macro to replace memcpy() if compiled with SQLITE_INLINE_MEMCPY.
@ -1234,12 +1233,12 @@ typedef int VList;
** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque
** pointer types (i.e. FuncDef) defined above.
*/
#include "btree.h"
#include "mutex.h"
#include "os.h"
#include "pager.h"
#include "pcache.h"
#include "vdbe.h"
#include "third_party/sqlite3/headers/btree.h"
#include "third_party/sqlite3/headers/mutex.h"
#include "third_party/sqlite3/headers/os.h"
#include "third_party/sqlite3/headers/pager.h"
#include "third_party/sqlite3/headers/pcache.h"
#include "third_party/sqlite3/headers/vdbe.h"
/* The SQLITE_EXTRA_DURABLE compile-time option used to set the default
** synchronous setting to EXTRA. It is no longer supported.
@ -4181,7 +4180,7 @@ int sqlite3CorruptPgnoError(int, Pgno);
*/
#if !defined(SQLITE_ASCII) || \
(defined(SQLITE_ENABLE_FTS3) && defined(SQLITE_AMALGAMATION))
#include <ctype.h>
#include "libc/str/str.h"
#endif
/*

View file

@ -81,7 +81,7 @@
** implemented, it is not allowed to invoke sqlite3_intarray_create(D,N,P)
** more than once with the same D and N values.
*/
#include "sqlite3.h"
#include "third_party/sqlite3/headers/sqlite3.h"
#ifndef SQLITE_INTARRAY_H
#define SQLITE_INTARRAY_H

View file

@ -27,11 +27,11 @@
** continues as if nothing had happened.
*/
#ifndef _QUOTA_H_
#include <stdio.h>
#include "libc/stdio/stdio.h"
#include <sys/stat.h>
#include <sys/types.h>
#include "sqlite3.h"
#include "third_party/sqlite3/headers/sqlite3.h"
/* Make this callable from C++ */
#ifdef __cplusplus

View file

@ -24,23 +24,23 @@
#define WIN32_LEAN_AND_MEAN
#endif
#include "windows.h"
#include "third_party/sqlite3/headers/windows.h"
/*
** We need several support functions from the SQLite core.
*/
#include "sqlite3.h"
#include "third_party/sqlite3/headers/sqlite3.h"
/*
** We need several things from the ANSI and MSVCRT headers.
*/
#include <errno.h>
#include "libc/errno.h"
#include <io.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include "libc/limits.h"
#include "libc/stdio/stdio.h"
#include "libc/mem/mem.h"
#include <sys/stat.h>
#include <sys/types.h>

View file

@ -17,7 +17,7 @@
*/
#ifndef SQLITE_VDBE_H
#define SQLITE_VDBE_H
#include <stdio.h>
#include "libc/stdio/stdio.h"
/*
** A single VDBE is an opaque structure named "Vdbe". Only routines
@ -165,7 +165,7 @@ typedef struct VdbeOpList VdbeOpList;
** The makefile scans the vdbe.c source file and creates the "opcodes.h"
** header file that defines a number for each opcode used by the VDBE.
*/
#include "opcodes.h"
#include "third_party/sqlite3/headers/opcodes.h"
/*
** Additional non-public SQLITE_PREPARE_* flags

View file

@ -17,7 +17,7 @@
#ifndef SQLITE_WAL_H
#define SQLITE_WAL_H
#include "sqliteInt.h"
#include "third_party/sqlite3/headers/sqliteInt.h"
/* Macros for extracting appropriate sync flags for either transaction
** commits (WAL_SYNC_FLAGS(X)) or for checkpoint ops (CKPT_SYNC_FLAGS(X)):

View file

@ -82,30 +82,31 @@
#define _LARGEFILE_SOURCE 1
#endif
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "libc/assert.h"
#include "libc/stdio/stdio.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "libc/fmt/fmt.h"
#include "libc/fmt/conv.h"
#include "sqlite3.h"
#include "third_party/sqlite3/headers/sqlite3.h"
typedef sqlite3_int64 i64;
typedef sqlite3_uint64 u64;
typedef unsigned char u8;
#if SQLITE_USER_AUTHENTICATION
#include "sqlite3userauth.h"
#include "third_party/sqlite3/headers/sqlite3userauth.h"
#endif
#include <ctype.h>
#include <stdarg.h>
#include "libc/str/str.h"
#if !defined(_WIN32) && !defined(WIN32)
#include <signal.h>
#include "libc/calls/sigbits.h"
#if !defined(__RTP__) && !defined(_WRS_KERNEL)
#include <pwd.h>
#include "third_party/musl/passwd.h"
#endif
#endif
#if (!defined(_WIN32) && !defined(WIN32)) || defined(__MINGW32__)
#include <dirent.h>
#include <unistd.h>
#include "libc/calls/calls.h"
#include "libc/isystem/unistd.h"
#define GETPID getpid
#if defined(__MINGW32__)
#define DIRENT dirent
@ -116,8 +117,7 @@ typedef unsigned char u8;
#else
#define GETPID (int)GetCurrentProcessId
#endif
#include <sys/stat.h>
#include <sys/types.h>
#include "libc/calls/weirdtypes.h"
#if HAVE_READLINE
#include <readline/history.h>
@ -138,7 +138,7 @@ typedef unsigned char u8;
#elif HAVE_LINENOISE
#include "linenoise.h"
#include "third_party/sqlite3/headers/linenoise.h"
#define shell_add_history(X) linenoiseHistoryAdd(X)
#define shell_read_history(X) linenoiseHistoryLoad(X)
#define shell_write_history(X) linenoiseHistorySave(X)
@ -177,13 +177,13 @@ typedef unsigned char u8;
#endif
#else
/* Make sure isatty() has a prototype. */
extern int isatty(int);
/* extern int isatty(int); */
#if !defined(__RTP__) && !defined(_WRS_KERNEL)
/* popen and pclose are not C89 functions and so are
** sometimes omitted from the <stdio.h> header */
extern FILE *popen(const char *, const char *);
extern int pclose(FILE *);
** sometimes omitted from the "libc/stdio/stdio.h" header */
/* extern FILE *popen(const char *, const char *); */
/* extern int pclose(FILE *); */
#else
#define SQLITE_OMIT_POPEN 1
#endif
@ -254,8 +254,8 @@ static sqlite3_int64 timeOfDay(void) {
}
#if !defined(_WIN32) && !defined(WIN32) && !defined(__minux)
#include <sys/resource.h>
#include <sys/time.h>
#include "libc/sysv/consts/rusage.h"
#include "libc/time/time.h"
/* VxWorks does not support getrusage() as far as we can determine */
#if defined(_WRS_KERNEL) || defined(__RTP__)
@ -1050,25 +1050,23 @@ static void shellAddSchemaName(sqlite3_context *pCtx, int nVal,
#define WIN32_LEAN_AND_MEAN
#endif
#include "windows.h"
/* #include "third_party/sqlite3/headers/windows.h" */
/*
** We need several support functions from the SQLite core.
*/
/* #include "sqlite3.h" */
/* #include "third_party/sqlite3/headers/sqlite3.h" */
/*
** We need several things from the ANSI and MSVCRT headers.
*/
#include <errno.h>
#include <io.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "libc/errno.h"
#include "libc/limits.h"
#include "libc/stdio/stdio.h"
#include "libc/mem/mem.h"
#include "libc/calls/weirdtypes.h"
/*
** We may need several defines that should have been in "sys/stat.h".
@ -1203,7 +1201,7 @@ extern INT closedir(LPDIR dirp);
*/
#if defined(_WIN32) && defined(_MSC_VER)
/* #include "test_windirent.h" */
/* #include "third_party/sqlite3/headers/test_windirent.h" */
/*
** Implementation of the POSIX getenv() function using the Win32 API.
@ -1399,11 +1397,10 @@ INT closedir(LPDIR dirp) {
** is used. If SIZE is included it must be one of the integers 224, 256,
** 384, or 512, to determine SHA3 hash variant that is computed.
*/
/* #include "sqlite3ext.h" */
/* #include "third_party/sqlite3/headers/sqlite3ext.h" */
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <stdarg.h>
#include <string.h>
#include "libc/assert.h"
#include "libc/str/str.h"
#ifndef SQLITE_AMALGAMATION
/* typedef sqlite3_uint64 u64; */
@ -2152,25 +2149,23 @@ int sqlite3_shathree_init(sqlite3 *db, char **pzErrMsg,
** And the paths returned in the "name" column of the table are also
** relative to directory $dir.
*/
/* #include "sqlite3ext.h" */
/* #include "third_party/sqlite3/headers/sqlite3ext.h" */
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "libc/assert.h"
#include "libc/calls/calls.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/calls/weirdtypes.h"
#if !defined(_WIN32) && !defined(WIN32)
#include <dirent.h>
#include <sys/time.h>
#include <unistd.h>
#include <utime.h>
#include "libc/calls/sigbits.h"
#include "libc/time/time.h"
#include "libc/isystem/unistd.h"
#else
#include <direct.h>
#include <io.h>
/* #include "test_windirent.h" */
#include "windows.h"
/* #include "third_party/sqlite3/headers/test_windirent.h" */
#include "third_party/sqlite3/headers/windows.h"
#define dirent DIRENT
#ifndef chmod
#define chmod _chmod
@ -2181,8 +2176,8 @@ SQLITE_EXTENSION_INIT1
#define mkdir(path, mode) _mkdir(path)
#define lstat(path, buf) stat(path, buf)
#endif
#include <errno.h>
#include <time.h>
#include "libc/errno.h"
#include "libc/time/time.h"
/*
** Structure of the fsdir() table-valued function
@ -3074,11 +3069,11 @@ int sqlite3_fileio_init(sqlite3 *db, char **pzErrMsg,
** faster than any human can type.
**
*/
/* #include "sqlite3ext.h" */
/* #include "third_party/sqlite3/headers/sqlite3ext.h" */
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <ctype.h>
#include <string.h>
#include "libc/assert.h"
#include "libc/str/str.h"
#include "libc/str/str.h"
#ifndef SQLITE_OMIT_VIRTUALTABLE
@ -3585,10 +3580,10 @@ int sqlite3_completion_init(sqlite3 *db, char **pzErrMsg,
** If the file being opened is a plain database (not an appended one), then
** this shim is a pass-through into the default underlying VFS. (rule 3)
**/
/* #include "sqlite3ext.h" */
/* #include "third_party/sqlite3/headers/sqlite3ext.h" */
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <string.h>
#include "libc/assert.h"
#include "libc/str/str.h"
/* The append mark at the end of the database is:
**
@ -4190,9 +4185,9 @@ int sqlite3_appendvfs_init(sqlite3 *db, char **pzErrMsg,
** This extension is used to implement the --memtrace option of the
** command-line shell.
*/
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "libc/assert.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
/* The original memory allocation routines */
static sqlite3_mem_methods memtraceBase;
@ -4300,11 +4295,10 @@ int sqlite3MemTraceDeactivate(void) {
** is *not* limited integers that can be expressed as a
** 64-bit machine integer.
*/
/* #include "sqlite3ext.h" */
/* #include "third_party/sqlite3/headers/sqlite3ext.h" */
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <ctype.h>
#include <string.h>
#include "libc/assert.h"
#include "libc/str/str.h"
/*
** Compare text in lexicographic order, except strings of digits
@ -4380,12 +4374,11 @@ int sqlite3_uint_init(sqlite3 *db, char **pzErrMsg,
**
** The focus here is on simplicity and correctness, not performance.
*/
/* #include "sqlite3ext.h" */
/* #include "third_party/sqlite3/headers/sqlite3ext.h" */
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "libc/assert.h"
#include "libc/str/str.h"
#include "libc/mem/mem.h"
/* Mark a function parameter as unused, to suppress nuisance compiler
** warnings. */
@ -5056,10 +5049,10 @@ int sqlite3_decimal_init(sqlite3 *db, char **pzErrMsg,
** FROM pow2, c WHERE pow2.x=ieee754_exponent(c.bin);
**
*/
/* #include "sqlite3ext.h" */
/* #include "third_party/sqlite3/headers/sqlite3ext.h" */
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <string.h>
#include "libc/assert.h"
#include "libc/str/str.h"
/* Mark a function parameter as unused, to suppress nuisance compiler
** warnings. */
@ -5314,10 +5307,10 @@ int sqlite3_ieee_init(sqlite3 *db, char **pzErrMsg,
** encourages the query planner to order joins such that the bounds of the
** series are well-defined.
*/
/* #include "sqlite3ext.h" */
/* #include "third_party/sqlite3/headers/sqlite3ext.h" */
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <string.h>
#include "libc/assert.h"
#include "libc/str/str.h"
#ifndef SQLITE_OMIT_VIRTUALTABLE
@ -5714,12 +5707,12 @@ int sqlite3_series_init(sqlite3 *db, char **pzErrMsg,
** * No support for zip64 extensions
** * Only the "inflate/deflate" (zlib) compression method is supported
*/
/* #include "sqlite3ext.h" */
/* #include "third_party/sqlite3/headers/sqlite3ext.h" */
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <zlib.h>
#include "libc/assert.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "third_party/zlib/zlib.h"
#ifndef SQLITE_OMIT_VIRTUALTABLE
@ -7872,10 +7865,10 @@ int sqlite3_zipfile_init(sqlite3 *db, char **pzErrMsg,
** for working with sqlar archives and used by the shell tool's built-in
** sqlar support.
*/
/* #include "sqlite3ext.h" */
/* #include "third_party/sqlite3/headers/sqlite3ext.h" */
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <zlib.h>
#include "libc/assert.h"
#include "third_party/zlib/zlib.h"
/*
** Implementation of the "sqlar_compress(X)" SQL function.
@ -7989,7 +7982,7 @@ int sqlite3_sqlar_init(sqlite3 *db, char **pzErrMsg,
*/
#if !defined(SQLITEEXPERT_H)
#define SQLITEEXPERT_H 1
/* #include "sqlite3.h" */
/* #include "third_party/sqlite3/headers/sqlite3.h" */
typedef struct sqlite3expert sqlite3expert;
@ -8159,11 +8152,11 @@ void sqlite3_expert_destroy(sqlite3expert *);
**
*************************************************************************
*/
/* #include "sqlite3expert.h" */
/* #include "third_party/sqlite3/headers/sqlite3expert.h" */
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "libc/assert.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#ifndef SQLITE_OMIT_VIRTUALTABLE
@ -10123,14 +10116,14 @@ void sqlite3_expert_destroy(sqlite3expert *p) {
** child page in the database.
*/
#if !defined(SQLITEINT_H)
/* #include "sqlite3ext.h" */
/* #include "third_party/sqlite3/headers/sqlite3ext.h" */
/* typedef unsigned char u8; */
#endif
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <string.h>
#include "libc/assert.h"
#include "libc/str/str.h"
#define DBDATA_PADDING_BYTES 100
@ -20683,6 +20676,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv) {
setBinaryMode(stdin, 0);
setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
setvbuf(stdin, (char *)NULL, _IONBF, BUFSIZ);
setvbuf(stdout, (char *)NULL, _IONBF, BUFSIZ);
stdin_is_interactive = isatty(0);
stdout_is_console = isatty(1);

File diff suppressed because it is too large Load diff

101
third_party/sqlite3/sqlite3.mk vendored Normal file
View file

@ -0,0 +1,101 @@
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘
PKGS += THIRD_PARTY_SQLITE3
THIRD_PARTY_SQLITE3_ARTIFACTS += THIRD_PARTY_SQLITE3_A
THIRD_PARTY_SQLITE3 = $(THIRD_PARTY_SQLITE3_A_DEPS) $(THIRD_PARTY_SQLITE3_A) $(THIRD_PARTY_SQLITE3_COMS)
THIRD_PARTY_SQLITE3_A = o/$(MODE)/third_party/sqlite3/libsqlite3.a
THIRD_PARTY_SQLITE3_A_FILES := $(wildcard third_party/sqlite3/*)
THIRD_PARTY_SQLITE3_A_HDRS = $(filter %.h,$(THIRD_PARTY_SQLITE3_A_FILES))
THIRD_PARTY_SQLITE3_A_SRCS_C = $(filter %.c,$(THIRD_PARTY_SQLITE3_A_FILES))
THIRD_PARTY_SQLITE3_BINS = $(THIRD_PARTY_SQLITE3_COMS) $(THIRD_PARTY_SQLITE3_COMS:%=%.dbg)
THIRD_PARTY_SQLITE3_A_SRCS = \
$(THIRD_PARTY_SQLITE3_A_SRCS_C)
THIRD_PARTY_SQLITE3_A_OBJS = \
$(THIRD_PARTY_SQLITE3_A_SRCS_C:%.c=o/$(MODE)/%.o)
THIRD_PARTY_SQLITE3_COMS = \
o/$(MODE)/third_party/sqlite3/sqlite3.com
THIRD_PARTY_SQLITE3_A_CHECKS = \
$(THIRD_PARTY_SQLITE3_A).pkg \
$(THIRD_PARTY_SQLITE3_A_HDRS:%=o/$(MODE)/%.ok)
THIRD_PARTY_SQLITE3_A_DIRECTDEPS = \
LIBC_ALG \
LIBC_BITS \
LIBC_CALLS \
LIBC_FMT \
LIBC_INTRIN \
LIBC_MEM \
LIBC_NEXGEN32E \
LIBC_RUNTIME \
LIBC_STDIO \
LIBC_STR \
LIBC_STUBS \
LIBC_SYSV \
LIBC_SYSV_CALLS \
LIBC_TIME \
LIBC_TINYMATH \
LIBC_UNICODE \
THIRD_PARTY_MUSL \
THIRD_PARTY_ZLIB
THIRD_PARTY_SQLITE3_A_DEPS := \
$(call uniq,$(foreach x,$(THIRD_PARTY_SQLITE3_A_DIRECTDEPS),$($(x))))
o/$(MODE)/third_party/sqlite3/sqlite3.com.dbg: \
$(THIRD_PARTY_SQLITE3_A_DEPS) \
$(THIRD_PARTY_SQLITE3_A) \
o/$(MODE)/third_party/sqlite3/shell.o \
$(CRT) \
$(APE)
-@$(APELINK)
$(THIRD_PARTY_SQLITE3_A): \
third_party/sqlite3/ \
$(THIRD_PARTY_SQLITE3_A).pkg \
$(filter-out %/shell.o,$(THIRD_PARTY_SQLITE3_A_OBJS))
$(THIRD_PARTY_SQLITE3_A).pkg: \
$(filter-out %/shell.o,$(THIRD_PARTY_SQLITE3_A_OBJS)) \
$(foreach x,$(THIRD_PARTY_SQLITE3_A_DIRECTDEPS),$($(x)_A).pkg)
$(THIRD_PARTY_SQLITE3_A_OBJS): \
OVERRIDE_CFLAGS = \
-DSTACK_FRAME_UNLIMITED \
-DSQLITE_OS_UNIX=1 \
-D_HAVE_SQLITE_CONFIG_H \
-DBUILD_sqlite -DNDEBUG \
-DSQLITE_THREADSAFE=0 \
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
-DSQLITE_ENABLE_MATH_FUNCTIONS \
-DSQLITE_ENABLE_FTS4 \
-DSQLITE_ENABLE_FTS5 \
-DSQLITE_ENABLE_JSON1 \
-DSQLITE_ENABLE_GEOPOLY \
-DSQLITE_ENABLE_RTREE \
-DSQLITE_ENABLE_SESSION \
-DSQLITE_ENABLE_PREUPDATE_HOOK \
-DSQLITE_TEMP_STORE=1 \
-DHAVE_READLINE=0 \
-DHAVE_EDITLINE=0 \
-DSQLITE_ENABLE_JSON1 \
-DSQLITE_ENABLE_FTS4 \
-DSQLITE_ENABLE_RTREE \
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \
-DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION \
-DSQLITE_ENABLE_STMTVTAB \
-DSQLITE_ENABLE_DBPAGE_VTAB \
-DSQLITE_ENABLE_DBSTAT_VTAB \
-DSQLITE_ENABLE_BYTECODE_VTAB \
-DSQLITE_ENABLE_OFFSET_SQL_FUNC \
-DSQLITE_ENABLE_DESERIALIZE
.PHONY: o/$(MODE)/third_party/sqlite3
o/$(MODE)/third_party/sqlite3: \
$(THIRD_PARTY_SQLITE3_BINS) \
$(THIRD_PARTY_SQLITE3_CHECKS)

View file

@ -13,6 +13,7 @@ o/$(MODE)/third_party: \
o/$(MODE)/third_party/musl \
o/$(MODE)/third_party/quickjs \
o/$(MODE)/third_party/regex \
o/$(MODE)/third_party/sqlite3 \
o/$(MODE)/third_party/stb \
o/$(MODE)/third_party/xed \
o/$(MODE)/third_party/zlib