mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
integrated sqlite3 + luasqlite3 in build
This will pull in support for SQLite3. For the API, see here: http://lua.sqlite.org/index.cgi/index
This commit is contained in:
19
Makefile
19
Makefile
@@ -5,6 +5,9 @@ MUPDFDIR=mupdf
|
||||
MUPDFTARGET=build/debug
|
||||
MUPDFLIBDIR=$(MUPDFDIR)/$(MUPDFTARGET)
|
||||
|
||||
SQLITE3DIR=sqlite-amalgamation-3070900
|
||||
LSQLITE3DIR=lsqlite3_svn08
|
||||
|
||||
# set this to your ARM cross compiler:
|
||||
|
||||
CC:=arm-unknown-linux-gnueabi-gcc
|
||||
@@ -45,16 +48,21 @@ THIRDPARTYLIBS := $(MUPDFLIBDIR)/libfreetype.a \
|
||||
$(MUPDFLIBDIR)/libjbig2dec.a \
|
||||
$(MUPDFLIBDIR)/libz.a
|
||||
|
||||
# comment this out to build without sqlite3
|
||||
SQLITE3OBJS := lsqlite3.o sqlite3.o
|
||||
SQLITE3LDFLAGS := -lpthread
|
||||
|
||||
LUALIB := $(LUADIR)/src/liblua.a
|
||||
|
||||
kpdfview: kpdfview.o einkfb.o pdf.o blitbuffer.o input.o util.o $(MUPDFLIBS) $(THIRDPARTYLIBS) $(LUALIB)
|
||||
$(CC) -lm -ldl $(EMU_LDFLAGS) \
|
||||
kpdfview: kpdfview.o einkfb.o pdf.o blitbuffer.o input.o util.o $(SQLITE3OBJS) $(MUPDFLIBS) $(THIRDPARTYLIBS) $(LUALIB)
|
||||
$(CC) -lm -ldl $(EMU_LDFLAGS) $(SQLITE3LDFLAGS) \
|
||||
kpdfview.o \
|
||||
einkfb.o \
|
||||
pdf.o \
|
||||
blitbuffer.o \
|
||||
input.o \
|
||||
util.o \
|
||||
$(SQLITE3OBJS) \
|
||||
$(MUPDFLIBS) \
|
||||
$(THIRDPARTYLIBS) \
|
||||
$(LUALIB) \
|
||||
@@ -66,6 +74,11 @@ einkfb.o input.o: %.o: %.c
|
||||
kpdfview.o pdf.o blitbuffer.o util.o: %.o: %.c
|
||||
$(CC) -c $(KPDFREADER_CFLAGS) $< -o $@
|
||||
|
||||
sqlite3.o: $(SQLITE3DIR)/sqlite3.c
|
||||
$(CC) -c $(CFLAGS) $(SQLITE3DIR)/sqlite3.c -o $@
|
||||
|
||||
lsqlite3.o: $(LSQLITE3DIR)/lsqlite3.c
|
||||
$(CC) -c $(CFLAGS) -I$(LUADIR)/src -I$(SQLITE3DIR) $(LSQLITE3DIR)/lsqlite3.c -o $@
|
||||
|
||||
fetchthirdparty:
|
||||
-rmdir mupdf
|
||||
@@ -74,6 +87,8 @@ fetchthirdparty:
|
||||
git clone git://git.ghostscript.com/mupdf.git
|
||||
( cd mupdf ; wget http://www.mupdf.com/download/mupdf-thirdparty.zip && unzip mupdf-thirdparty.zip; patch -p1 < ../mupdf-64M-memory-limit.diff )
|
||||
wget http://www.lua.org/ftp/lua-5.1.4.tar.gz && tar xvzf lua-5.1.4.tar.gz && ln -s lua-5.1.4 lua
|
||||
wget "http://lua.sqlite.org/index.cgi/zip/lsqlite3_svn08.zip?uuid=svn_8" && unzip "lsqlite3_svn08.zip?uuid=svn_8"
|
||||
wget "http://sqlite.org/sqlite-amalgamation-3070900.zip" && unzip sqlite-amalgamation-3070900.zip
|
||||
|
||||
clean:
|
||||
-rm -f *.o kpdfview
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
#include "einkfb.h"
|
||||
#include "input.h"
|
||||
|
||||
/* forward declaration for luasqlite3: */
|
||||
LUALIB_API int luaopen_lsqlite3(lua_State *L);
|
||||
|
||||
lua_State *L;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
@@ -49,6 +52,8 @@ int main(int argc, char **argv) {
|
||||
luaopen_input(L);
|
||||
luaopen_util(L);
|
||||
|
||||
luaopen_lsqlite3(L);
|
||||
|
||||
lua_newtable(L);
|
||||
for(i=2; i < argc; i++) {
|
||||
lua_pushstring(L, argv[i]);
|
||||
|
||||
Reference in New Issue
Block a user