Various changes to enable compilation of SQLite library and command

line shell with the Windows CE cross compiler from cegcc.sourceforge.net (CVS 4541)

FossilOrigin-Name: 8ad0ab8cb374bd34e47af9e71b2aad9dd9af0d1b
This commit is contained in:
chw 2007-11-12 21:09:10 +00:00
parent 1c96cac1cc
commit 65d3c13cad
7 changed files with 182 additions and 14 deletions

View File

@ -0,0 +1,138 @@
#!/usr/make
#
# Makefile for SQLITE
#
# This is a template makefile for SQLite. Most people prefer to
# use the autoconf generated "configure" script to generate the
# makefile automatically. But that does not work for everybody
# and in every situation. If you are having problems with the
# "configure" script, you might want to try this makefile as an
# alternative. Create a copy of this file, edit the parameters
# below and type "make".
#
#### The directory where to find the mingw32ce tools
MINGW32CE = /opt/mingw32ce/bin
#### The target prefix of the mingw32ce tools
TARGET = arm-wince-mingw32ce
#### The toplevel directory of the source tree. This is the directory
# that contains this "Makefile.in" and the "configure.in" script.
#
TOP = ../sqlite
#### C Compiler and options for use in building executables that
# will run on the platform that is doing the build.
#
BCC = gcc -g -O2
#BCC = /opt/ancic/bin/c89 -0
#### If the target operating system supports the "usleep()" system
# call, then define the HAVE_USLEEP macro for all C modules.
#
USLEEP =
#USLEEP = -DHAVE_USLEEP=1
#### If you want the SQLite library to be safe for use within a
# multi-threaded program, then define the following macro
# appropriately:
#
THREADSAFE = -DTHREADSAFE=1
#THREADSAFE = -DTHREADSAFE=0
#### Specify any extra linker options needed to make the library
# thread safe
#
#THREADLIB = -lpthread
THREADLIB =
#### Specify any extra libraries needed to access required functions.
#
#TLIBS = -lrt # fdatasync on Solaris 8
TLIBS =
#### Leave SQLITE_DEBUG undefined for maximum speed. Use SQLITE_DEBUG=1
# to check for memory leaks. Use SQLITE_DEBUG=2 to print a log of all
# malloc()s and free()s in order to track down memory leaks.
#
# SQLite uses some expensive assert() statements in the inner loop.
# You can make the library go almost twice as fast if you compile
# with -DNDEBUG=1
#
#OPTS = -DSQLITE_DEBUG=2
#OPTS = -DSQLITE_DEBUG=1
#OPTS =
OPTS = -DNDEBUG=1 -DOS_WIN=1 -D_WIN32_WCE=1
#OPTS += -DHAVE_FDATASYNC=1
#### The suffix to add to executable files. ".exe" for windows.
# Nothing for unix.
#
EXE = .exe
#EXE =
#### C Compile and options for use in building executables that
# will run on the target platform. This is usually the same
# as BCC, unless you are cross-compiling.
#
#TCC = gcc -O6
#TCC = gcc -g -O0 -Wall
#TCC = gcc -g -O0 -Wall -fprofile-arcs -ftest-coverage
#TCC = /opt/mingw/bin/i386-mingw32-gcc -O6
TCC = $(MINGW32CE)/$(TARGET)-gcc -O2
#TCC = /opt/ansic/bin/c89 -O +z -Wl,-a,archive
#### Tools used to build a static library.
#
#AR = ar cr
#AR = /opt/mingw/bin/i386-mingw32-ar cr
AR = $(MINGW32CE)/$(TARGET)-ar cr
#RANLIB = ranlib
#RANLIB = /opt/mingw/bin/i386-mingw32-ranlib
RANLIB = $(MINGW32CE)/$(TARGET)-ranlib
#MKSHLIB = gcc -shared
#SO = so
#SHPREFIX = lib
MKSHLIB = $(MINGW32CE)/$(TARGET)-gcc -shared
SO = dll
SHPREFIX =
#### Extra compiler options needed for programs that use the TCL library.
#
#TCL_FLAGS =
#TCL_FLAGS = -DSTATIC_BUILD=1
TCL_FLAGS = -I/home/drh/tcltk/8.4linux
#TCL_FLAGS = -I/home/drh/tcltk/8.4win -DSTATIC_BUILD=1
#TCL_FLAGS = -I/home/drh/tcltk/8.3hpux
#### Linker options needed to link against the TCL library.
#
#LIBTCL = -ltcl -lm -ldl
LIBTCL = /home/drh/tcltk/8.4linux/libtcl8.4g.a -lm -ldl
#LIBTCL = /home/drh/tcltk/8.4win/libtcl84s.a -lmsvcrt
#LIBTCL = /home/drh/tcltk/8.3hpux/libtcl8.3.a -ldld -lm -lc
#### Additional objects for SQLite library when TCL support is enabled.
TCLOBJ =
#TCLOBJ = tclsqlite.o
#### Compiler options needed for programs that use the readline() library.
#
READLINE_FLAGS =
#READLINE_FLAGS = -DHAVE_READLINE=1 -I/usr/include/readline
#### Linker options needed by programs using readline() must link against.
#
LIBREADLINE =
#LIBREADLINE = -static -lreadline -ltermcap
#### Which "awk" program provides nawk compatibilty
#
# NAWK = nawk
NAWK = awk
# You should not have to change anything below this line
###############################################################################
include $(TOP)/main.mk

View File

@ -104,6 +104,10 @@ LIBTCL = /home/drh/tcltk/8.4linux/libtcl8.4g.a -lm -ldl
#LIBTCL = /home/drh/tcltk/8.4win/libtcl84s.a -lmsvcrt
#LIBTCL = /home/drh/tcltk/8.3hpux/libtcl8.3.a -ldld -lm -lc
#### Additional objects for SQLite library when TCL support is enabled.
#TCLOBJ =
TCLOBJ = tclsqlite.o
#### Compiler options needed for programs that use the readline() library.
#
READLINE_FLAGS =

View File

@ -55,7 +55,7 @@ LIBOBJ+= alter.o analyze.o attach.o auth.o btmutex.o btree.o build.o \
mutex_unix.o mutex_w32.o \
opcodes.o os.o os_os2.o os_unix.o os_win.o \
pager.o parse.o pragma.o prepare.o printf.o random.o \
select.o table.o tclsqlite.o tokenize.o trigger.o \
select.o table.o $(TCLOBJ) tokenize.o trigger.o \
update.o util.o vacuum.o \
vdbe.o vdbeapi.o vdbeaux.o vdbeblob.o vdbefifo.o vdbemem.o \
where.o utf.o legacy.o vtab.o

View File

@ -1,7 +1,8 @@
C Another\sattempt\sat\sfixing\sa\smemory\sleak\sin\sthe\sTCL\sinterface.\nSee\scheck-in\s(4338)\sfor\sthe\sfirst\sattempt.\s\sTicket\s#2597.\s(CVS\s4540)
D 2007-11-12T17:56:43
C Various\schanges\sto\senable\scompilation\sof\sSQLite\slibrary\sand\scommand\nline\sshell\swith\sthe\sWindows\sCE\scross\scompiler\sfrom\scegcc.sourceforge.net\s(CVS\s4541)
D 2007-11-12T21:09:11
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in 30c7e3ba426ddb253b8ef037d1873425da6009a8
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F VERSION 7462505067ad1163a13b6763eea21e0d0c0413a6
F aclocal.m4 d20ba55930a05197b484809fba1d2b603f4e67a6
@ -63,7 +64,7 @@ F ext/icu/README.txt 3b130aa66e7a681136f6add198b076a2f90d1e33
F ext/icu/icu.c 61a345d8126686aa3487aa8d2d0f68abd655f7a4
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895
F ltmain.sh 56abb507100ed2d4261f6dd1653dec3cf4066387
F main.mk bec651944103119cf086abffbd8d443f8f7f1268
F main.mk 23046f8d5bacd5fce5d1b7a0933b12978fe2dcae
F mkdll.sh 37fa8a7412e51b5ab2bc6d4276135f022a0feffb
F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f
F mkextw.sh 1a866b53637dab137191341cc875575a5ca110fb
@ -119,7 +120,7 @@ F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
F src/os_unix.c db6755454c84004d0041eb1b2194c90b35db0a5b
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
F src/os_win.c 81690a858b90a1e0b83e7afbce6b6498bb3d3a1d
F src/os_win.c 1fb40eb62fb0719ea578d69edcb1a2974f04d214
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c c5ffa55c299663b579fbcb430752c1e79d302c5b
F src/pager.h d783e7f184afdc33adff37ba58d4e029bd8793b3
@ -130,7 +131,7 @@ F src/printf.c 96c8d55315a13fc53cb3754cb15046f3ff891ea2
F src/random.c 4a22746501bf36b0a088c66e38dde5daba6a35da
F src/select.c aef87a179e287c4ab864cb927c1e95f5ee66bf45
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
F src/shell.c 0b9dd90afc34f28b8786638155d32f6248d0bf0a
F src/shell.c 5b950381f6fb030f123fcd41ae3fdf431c9b0689
F src/sqlite.h.in 3844177d389d58bd4a8be4ee81eefb01a084ed72
F src/sqlite3ext.h a93f59cdee3638dc0c9c086f80df743a4e68c3cb
F src/sqliteInt.h 4e6fdeb5630ead97bcec60b941e7a72203c64b9e
@ -586,7 +587,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P cf41d6a00f658d2cd64ff9811a3b1270ad1a580b
R b85e86f0e00579d26110152442d23592
U drh
Z c7e01fdf5ed2429e27dcf878b216c197
P 68a43c99f1b02b8a93bfdcd5c8426b2b4199d68f
R 15eebd2e25d598175fdc22da0e8e2af5
U chw
Z 30b89c8b53d433ead58916dedc043066

View File

@ -1 +1 @@
68a43c99f1b02b8a93bfdcd5c8426b2b4199d68f
8ad0ab8cb374bd34e47af9e71b2aad9dd9af0d1b

View File

@ -1407,6 +1407,14 @@ static void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){
return (void*)h;
}
static void winDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){
#if OS_WINCE
int error = GetLastError();
if( error>0x7FFFFFF ){
sqlite3_snprintf(nBuf, zBufOut, "OsError 0x%x", error);
}else{
sqlite3_snprintf(nBuf, zBufOut, "OsError %d", error);
}
#else
FormatMessageA(
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
@ -1416,6 +1424,7 @@ static void winDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){
nBuf-1,
0
);
#endif
}
void *winDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol){
#if OS_WINCE

View File

@ -12,7 +12,7 @@
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.168 2007/11/02 12:53:04 drh Exp $
** $Id: shell.c,v 1.169 2007/11/12 21:09:11 chw Exp $
*/
#include <stdlib.h>
#include <string.h>
@ -61,6 +61,14 @@
extern int isatty();
#endif
#if defined(_WIN32_WCE)
/* Windows CE (arm-wince-mingw32ce-gcc) does not provide isatty()
* thus we always assume that we have a console. That can be
* overridden with the -batch command line option.
*/
#define isatty(x) 1
#endif
#if !defined(_WIN32) && !defined(WIN32) && !defined(__OS2__)
#include <sys/time.h>
#include <sys/resource.h>
@ -1759,7 +1767,7 @@ static int process_input(struct callback_data *p, FILE *in){
static char *find_home_dir(void){
char *home_dir = NULL;
#if !defined(_WIN32) && !defined(WIN32) && !defined(__MACOS__) && !defined(__OS2__)
#if !defined(_WIN32) && !defined(WIN32) && !defined(__MACOS__) && !defined(__OS2__) && !defined(_WIN32_WCE)
struct passwd *pwent;
uid_t uid = getuid();
if( (pwent=getpwuid(uid)) != NULL) {
@ -1772,6 +1780,12 @@ static char *find_home_dir(void){
home_dir = getcwd(home_path, _MAX_PATH);
#endif
#if defined(_WIN32_WCE)
/* Windows CE (arm-wince-mingw32ce-gcc) does not provide getenv()
*/
home_dir = strdup("/");
#else
#if defined(_WIN32) || defined(WIN32) || defined(__OS2__)
if (!home_dir) {
home_dir = getenv("USERPROFILE");
@ -1799,6 +1813,8 @@ static char *find_home_dir(void){
}
#endif
#endif /* !_WIN32_WCE */
if( home_dir ){
int n = strlen(home_dir) + 1;
char *z = malloc( n );