2011-11-14 18:17:14 +00:00
|
|
|
# you can probably leave these settings alone:
|
|
|
|
|
|
|
|
LUADIR=lua
|
|
|
|
MUPDFDIR=mupdf
|
|
|
|
MUPDFTARGET=build/debug
|
|
|
|
MUPDFLIBDIR=$(MUPDFDIR)/$(MUPDFTARGET)
|
|
|
|
|
2011-11-28 23:07:46 +00:00
|
|
|
SQLITE3DIR=sqlite-amalgamation-3070900
|
|
|
|
LSQLITE3DIR=lsqlite3_svn08
|
2011-12-01 00:35:53 +00:00
|
|
|
FREETYPEDIR=$(MUPDFDIR)/thirdparty/freetype-2.4.4
|
2011-12-02 22:10:59 +00:00
|
|
|
LFSDIR=luafilesystem
|
2011-11-28 23:07:46 +00:00
|
|
|
|
2011-11-14 18:17:14 +00:00
|
|
|
# set this to your ARM cross compiler:
|
|
|
|
|
|
|
|
CC:=arm-unknown-linux-gnueabi-gcc
|
2011-11-16 22:52:26 +00:00
|
|
|
HOSTCC:=gcc
|
2011-11-14 18:17:14 +00:00
|
|
|
|
2011-11-16 23:50:10 +00:00
|
|
|
CFLAGS:=-O0 -g
|
2011-11-14 18:17:14 +00:00
|
|
|
|
|
|
|
# you can configure an emulation for the (eink) framebuffer here.
|
|
|
|
# the application won't use the framebuffer (and the special e-ink ioctls)
|
|
|
|
# in that case.
|
|
|
|
|
2011-11-16 22:52:26 +00:00
|
|
|
ifdef EMULATE_READER
|
|
|
|
CC:=$(HOSTCC)
|
|
|
|
EMULATE_READER_W?=824
|
|
|
|
EMULATE_READER_H?=1200
|
|
|
|
EMU_CFLAGS?=$(shell sdl-config --cflags)
|
|
|
|
EMU_CFLAGS+= -DEMULATE_READER \
|
|
|
|
-DEMULATE_READER_W=$(EMULATE_READER_W) \
|
|
|
|
-DEMULATE_READER_H=$(EMULATE_READER_H) \
|
|
|
|
|
|
|
|
EMU_LDFLAGS?=$(shell sdl-config --libs)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# standard includes
|
|
|
|
KPDFREADER_CFLAGS=$(CFLAGS) -I$(LUADIR)/src -I$(MUPDFDIR)/
|
2011-11-14 18:17:14 +00:00
|
|
|
|
|
|
|
# enable tracing output:
|
|
|
|
|
2011-11-16 23:52:07 +00:00
|
|
|
#KPDFREADER_CFLAGS+= -DMUPDF_TRACE
|
2011-11-14 18:17:14 +00:00
|
|
|
|
|
|
|
# for now, all dependencies except for the libc are compiled into the final binary:
|
|
|
|
|
2011-11-16 23:50:10 +00:00
|
|
|
MUPDFLIBS := $(MUPDFLIBDIR)/libmupdf.a \
|
|
|
|
$(MUPDFLIBDIR)/libfitz.a
|
|
|
|
THIRDPARTYLIBS := $(MUPDFLIBDIR)/libfreetype.a \
|
|
|
|
$(MUPDFLIBDIR)/libjpeg.a \
|
|
|
|
$(MUPDFLIBDIR)/libopenjpeg.a \
|
|
|
|
$(MUPDFLIBDIR)/libjbig2dec.a \
|
|
|
|
$(MUPDFLIBDIR)/libz.a
|
|
|
|
|
2011-11-28 23:07:46 +00:00
|
|
|
# comment this out to build without sqlite3
|
|
|
|
SQLITE3OBJS := lsqlite3.o sqlite3.o
|
|
|
|
SQLITE3LDFLAGS := -lpthread
|
|
|
|
|
2011-11-16 23:50:10 +00:00
|
|
|
LUALIB := $(LUADIR)/src/liblua.a
|
|
|
|
|
2011-12-02 22:10:59 +00:00
|
|
|
kpdfview: kpdfview.o einkfb.o pdf.o blitbuffer.o input.o util.o ft.o $(SQLITE3OBJS) lfs.o $(MUPDFLIBS) $(THIRDPARTYLIBS) $(LUALIB)
|
2011-11-28 23:07:46 +00:00
|
|
|
$(CC) -lm -ldl $(EMU_LDFLAGS) $(SQLITE3LDFLAGS) \
|
2011-11-14 18:17:14 +00:00
|
|
|
kpdfview.o \
|
|
|
|
einkfb.o \
|
|
|
|
pdf.o \
|
|
|
|
blitbuffer.o \
|
|
|
|
input.o \
|
|
|
|
util.o \
|
2011-12-01 00:35:53 +00:00
|
|
|
ft.o \
|
2011-11-28 23:07:46 +00:00
|
|
|
$(SQLITE3OBJS) \
|
2011-12-02 22:10:59 +00:00
|
|
|
lfs.o \
|
2011-11-16 23:50:10 +00:00
|
|
|
$(MUPDFLIBS) \
|
|
|
|
$(THIRDPARTYLIBS) \
|
|
|
|
$(LUALIB) \
|
|
|
|
-o kpdfview
|
2011-11-14 18:17:14 +00:00
|
|
|
|
2011-11-16 22:52:26 +00:00
|
|
|
einkfb.o input.o: %.o: %.c
|
|
|
|
$(CC) -c $(KPDFREADER_CFLAGS) $(EMU_CFLAGS) $< -o $@
|
|
|
|
|
2011-12-01 00:35:53 +00:00
|
|
|
ft.o: %.o: %.c
|
|
|
|
$(CC) -c $(KPDFREADER_CFLAGS) -I$(FREETYPEDIR)/include $< -o $@
|
|
|
|
|
2011-11-16 22:52:26 +00:00
|
|
|
kpdfview.o pdf.o blitbuffer.o util.o: %.o: %.c
|
2011-12-02 22:10:59 +00:00
|
|
|
$(CC) -c $(KPDFREADER_CFLAGS) -I$(LFSDIR)/src $< -o $@
|
2011-11-16 22:52:26 +00:00
|
|
|
|
2011-11-28 23:07:46 +00:00
|
|
|
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 $@
|
2011-11-16 22:52:26 +00:00
|
|
|
|
2011-12-02 22:10:59 +00:00
|
|
|
lfs.o: $(LFSDIR)/src/lfs.c
|
|
|
|
$(CC) -c $(CFLAGS) -I$(LUADIR)/src -I$(LFSDIR)/src $(LFSDIR)/src/lfs.c -o $@
|
|
|
|
|
2011-11-14 18:17:14 +00:00
|
|
|
fetchthirdparty:
|
|
|
|
-rmdir mupdf
|
|
|
|
-rmdir lua
|
|
|
|
-rm lua
|
|
|
|
git clone git://git.ghostscript.com/mupdf.git
|
2011-11-20 22:02:39 +00:00
|
|
|
( cd mupdf ; wget http://www.mupdf.com/download/mupdf-thirdparty.zip && unzip mupdf-thirdparty.zip; patch -p1 < ../mupdf-64M-memory-limit.diff )
|
2011-11-14 18:17:14 +00:00
|
|
|
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
|
2011-11-28 23:07:46 +00:00
|
|
|
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
|
2011-12-02 22:10:59 +00:00
|
|
|
git clone https://github.com/keplerproject/luafilesystem.git
|
2011-11-14 18:17:14 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
-rm -f *.o kpdfview
|
|
|
|
|
|
|
|
cleanthirdparty:
|
|
|
|
make -C lua clean
|
|
|
|
make -C mupdf clean
|
|
|
|
|
|
|
|
$(MUPDFDIR)/fontdump.host:
|
2011-11-16 22:52:26 +00:00
|
|
|
make -C mupdf CC="$(HOSTCC)" $(MUPDFTARGET)/fontdump
|
2011-11-14 18:17:14 +00:00
|
|
|
cp -a $(MUPDFLIBDIR)/fontdump $(MUPDFDIR)/fontdump.host
|
|
|
|
make -C mupdf clean
|
|
|
|
|
|
|
|
$(MUPDFDIR)/cmapdump.host:
|
2011-11-16 22:52:26 +00:00
|
|
|
make -C mupdf CC="$(HOSTCC)" $(MUPDFTARGET)/cmapdump
|
2011-11-14 18:17:14 +00:00
|
|
|
cp -a $(MUPDFLIBDIR)/cmapdump $(MUPDFDIR)/cmapdump.host
|
|
|
|
make -C mupdf clean
|
|
|
|
|
2011-11-16 23:50:10 +00:00
|
|
|
$(MUPDFLIBS) $(THIRDPARTYLIBS): $(MUPDFDIR)/cmapdump.host $(MUPDFDIR)/fontdump.host
|
2011-11-14 18:17:14 +00:00
|
|
|
# build only thirdparty libs, libfitz and pdf utils, which will care for libmupdf.a being built
|
2011-11-16 22:52:26 +00:00
|
|
|
CFLAGS="$(CFLAGS)" make -C mupdf CC="$(CC)" CMAPDUMP=cmapdump.host FONTDUMP=fontdump.host MUPDF= XPS_APPS=
|
2011-11-16 23:50:10 +00:00
|
|
|
|
|
|
|
$(LUALIB):
|
2011-11-16 22:52:26 +00:00
|
|
|
make -C lua/src CC="$(CC)" CFLAGS="$(CFLAGS)" MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E" liblua.a
|
2011-11-14 18:17:14 +00:00
|
|
|
|
2011-11-16 23:50:10 +00:00
|
|
|
thirdparty: $(MUPDFLIBS) $(THIRDPARTYLIBS) $(LUALIBS)
|
|
|
|
|
2011-11-14 18:17:14 +00:00
|
|
|
install:
|
|
|
|
# install to kindle using USB networking
|
2011-11-21 17:58:02 +00:00
|
|
|
scp kpdfview reader.lua alt_getopt.lua keys.lua tilecache.lua root@192.168.2.2:/mnt/us/test/
|