Skip to content

Commit

Permalink
factored out koreader-base
Browse files Browse the repository at this point in the history
This is part of a repository split, separating out the Lua/C-API
(including third-party C/C++ libraries). Note that now
kindlepdfviewer is known as koreader, reflecting the extended
document support.
  • Loading branch information
hwhw committed Mar 24, 2013
1 parent 8ff9a1a commit dc9f674
Show file tree
Hide file tree
Showing 132 changed files with 30 additions and 10,972 deletions.
52 changes: 13 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ else
endif

# standard includes
KPDFREADER_CFLAGS=$(CFLAGS) -I$(LUADIR)/src -I$(MUPDFDIR)/
KOREADER_BASE_CFLAGS=$(CFLAGS) -I$(LUADIR)/src -I$(MUPDFDIR)/
K2PDFOPT_CFLAGS=-I$(K2PDFOPTLIBDIR)/willuslib -I$(K2PDFOPTLIBDIR)/k2pdfoptlib -I$(K2PDFOPTLIBDIR)/

# enable tracing output:

#KPDFREADER_CFLAGS+= -DMUPDF_TRACE
#KOREADER_BASE_CFLAGS+= -DMUPDF_TRACE

# for now, all dependencies except for the libc are compiled into the final binary:

Expand Down Expand Up @@ -118,14 +118,14 @@ POPENNSLIB := $(POPENNSDIR)/libpopen_noshell.a

K2PDFOPTLIB := $(LIBDIR)/libk2pdfopt.so.1

all: kpdfview extr
all: koreader-base extr

VERSION?=$(shell git describe HEAD)
kpdfview: kpdfview.o einkfb.o pdf.o blitbuffer.o drawcontext.o koptcontext.o input.o $(POPENNSLIB) util.o ft.o lfs.o mupdfimg.o $(MUPDFLIBS) $(THIRDPARTYLIBS) $(LUALIB) djvu.o $(DJVULIBS) cre.o $(CRELIB) $(CRE_3RD_LIBS) pic.o pic_jpeg.o $(K2PDFOPTLIB)
koreader-base: koreader-base.o einkfb.o pdf.o blitbuffer.o drawcontext.o koptcontext.o input.o $(POPENNSLIB) util.o ft.o lfs.o mupdfimg.o $(MUPDFLIBS) $(THIRDPARTYLIBS) $(LUALIB) djvu.o $(DJVULIBS) cre.o $(CRELIB) $(CRE_3RD_LIBS) pic.o pic_jpeg.o $(K2PDFOPTLIB)
echo $(VERSION) > git-rev
$(CC) \
$(CFLAGS) \
kpdfview.o \
koreader-base.o \
einkfb.o \
pdf.o \
blitbuffer.o \
Expand Down Expand Up @@ -166,22 +166,22 @@ slider_watcher: slider_watcher.o $(POPENNSLIB)
$(CC) $(CFLAGS) slider_watcher.o $(POPENNSLIB) -o $@

ft.o: %.o: %.c $(THIRDPARTYLIBS)
$(CC) -c $(KPDFREADER_CFLAGS) -I$(FREETYPEDIR)/include -I$(MUPDFDIR)/fitz $< -o $@
$(CC) -c $(KOREADER_BASE_CFLAGS) -I$(FREETYPEDIR)/include -I$(MUPDFDIR)/fitz $< -o $@

blitbuffer.o util.o drawcontext.o einkfb.o input.o mupdfimg.o: %.o: %.c
$(CC) -c $(KPDFREADER_CFLAGS) $(EMU_CFLAGS) -I$(LFSDIR)/src $< -o $@
$(CC) -c $(KOREADER_BASE_CFLAGS) $(EMU_CFLAGS) -I$(LFSDIR)/src $< -o $@

kpdfview.o koptcontext.o pdf.o: %.o: %.c
$(CC) -c $(KPDFREADER_CFLAGS) $(K2PDFOPT_CFLAGS) $(EMU_CFLAGS) -I$(LFSDIR)/src $< -o $@
koreader-base.o koptcontext.o pdf.o: %.o: %.c
$(CC) -c $(KOREADER_BASE_CFLAGS) $(K2PDFOPT_CFLAGS) $(EMU_CFLAGS) -I$(LFSDIR)/src $< -o $@

djvu.o: %.o: %.c
$(CC) -c $(KPDFREADER_CFLAGS) $(K2PDFOPT_CFLAGS) -I$(DJVUDIR)/ $< -o $@
$(CC) -c $(KOREADER_BASE_CFLAGS) $(K2PDFOPT_CFLAGS) -I$(DJVUDIR)/ $< -o $@

pic.o: %.o: %.c
$(CC) -c $(KPDFREADER_CFLAGS) $< -o $@
$(CC) -c $(KOREADER_BASE_CFLAGS) $< -o $@

pic_jpeg.o: %.o: %.c
$(CC) -c $(KPDFREADER_CFLAGS) -I$(JPEGDIR)/ -I$(MUPDFDIR)/scripts/ $< -o $@
$(CC) -c $(KOREADER_BASE_CFLAGS) -I$(JPEGDIR)/ -I$(MUPDFDIR)/scripts/ $< -o $@

cre.o: %.o: %.cpp
$(CC) -c $(CFLAGS) -I$(CRENGINEDIR)/crengine/include/ -I$(LUADIR)/src $< -o $@
Expand Down Expand Up @@ -215,7 +215,7 @@ fetchthirdparty:
cd popen-noshell && test -f Makefile || patch -N -p0 < popen_noshell-buildfix.patch

clean:
rm -f *.o kpdfview slider_watcher extr emu_event
rm -f *.o koreader-base slider_watcher extr emu_event

cleanthirdparty:
rm -rf $(LIBDIR) ; mkdir $(LIBDIR)
Expand Down Expand Up @@ -278,29 +278,3 @@ $(K2PDFOPTLIB):
cp -a $(K2PDFOPTLIBDIR)/libk2pdfopt.so* $(LIBDIR)

thirdparty: $(MUPDFLIBS) $(THIRDPARTYLIBS) $(LUALIB) $(DJVULIBS) $(CRELIB) $(CRE_3RD_LIBS) $(POPENNSLIB) $(K2PDFOPTLIB)

INSTALL_DIR=kindlepdfviewer

LUA_FILES=reader.lua

customupdate: all
# ensure that the binaries were built for ARM
file kpdfview | grep ARM || exit 1
file extr | grep ARM || exit 1
$(STRIP) --strip-unneeded kpdfview extr
rm -f kindlepdfviewer-$(VERSION).zip
rm -rf $(INSTALL_DIR)
mkdir -p $(INSTALL_DIR)/{history,screenshots,clipboard,libs}
cp -p README.md COPYING kpdfview extr kpdf.sh $(LUA_FILES) $(INSTALL_DIR)
mkdir $(INSTALL_DIR)/data
cp -L $(DJVULIB) $(CRELIB) $(LUALIB) $(K2PDFOPTLIB) $(INSTALL_DIR)/libs
$(STRIP) --strip-unneeded $(INSTALL_DIR)/libs/*
cp -rpL data/*.css $(INSTALL_DIR)/data
cp -rpL fonts $(INSTALL_DIR)
rm $(INSTALL_DIR)/fonts/droid/DroidSansFallbackFull.ttf
cp -r git-rev resources $(INSTALL_DIR)
cp -rpL frontend $(INSTALL_DIR)
mkdir $(INSTALL_DIR)/fonts/host
zip -9 -r kindlepdfviewer-$(VERSION).zip $(INSTALL_DIR) launchpad/ extensions/
rm -rf $(INSTALL_DIR)
@echo "copy kindlepdfviewer-$(VERSION).zip to /mnt/us/customupdates and install with shift+shift+I"
55 changes: 17 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
KindlePDFViewer
===============
Koreader-base
=============

This is a PDF viewer application, created for usage on the Kindle e-ink reader.
It currently supports Kindle 2, DXG, 3 and 4, but not Touch. It's using the
muPDF library (see http://mupdf.com/), djvulibre library, CREngine library and
its UI is scripted using Lua (see http://www.lua.org/).
This is the base framework for creating document readers like Koreader,
an e-ink device oriented reader application for various document formats.

It's using the muPDF library (see http://mupdf.com/), djvulibre library,
CREngine library and it is scripted using Lua (see http://www.lua.org/).
To gain good speed at that, it uses the LuaJIT compiler.

It all started as the KindlePDFviewer application, which has since been
greatly enhanced and now reflects this in having a new name, Koreader.

The application is licensed under the GPLv3 (see COPYING file).


Building
========


Follow these steps:

* fetch thirdparty sources
Expand All @@ -32,25 +36,10 @@ Follow these steps:
* adapt Makefile to your needs

* run `make thirdparty`. This will build MuPDF (plus the libraries it depends
on), libDjvuLibre, CREngine and Lua.

* run `make`. This will build the kpdfview application


Running
=======

The user interface (or what's there yet) is scripted in Lua. See "reader.lua".
It uses the Linux feature to run scripts by using a corresponding line at its
start.
on), libDjvuLibre, CREngine and LuaJIT.

So you might just call that script. Note that the script and the kpdfview
binary currently must be in the same directory.

You would then just call reader.lua, giving the document file path, or any
directory path, as its first argument. Run reader.lua without arguments to see
usage notes. The reader.lua script can also show a file chooser: it will do
this when you call it with a directory (instead of a file) as first argument.
* run `make`. This will build the koreaderbase application which is a Lua
interpreter offering the koreader-base API to Lua scripts.


Device emulation
Expand All @@ -66,20 +55,10 @@ If you are using Ubuntu, install `libsdl-dev1.2` package.

To build in "emulation mode", you need to run make like this:
make clean cleanthirdparty
EMULATE_READER=1 make thirdparty kpdfview

And run the emulator like this:
```
./reader.lua /PATH/TO/PDF.pdf
```

or:
```
./reader.lua /ANY/PATH
```
EMULATE_READER=1 make thirdparty koreader-base

By default emulation will provide DXG resolution of 824*1200. It can be
specified at compile time, this is example for Kindle 3:
By default emulation will provide a resolution of 824x1200. It can be
specified at compile time, this is example for 600x800:

```
EMULATE_READER_W=600 EMULATE_READER_H=800 EMULATE_READER=1 make kpdfview
Expand Down
23 changes: 0 additions & 23 deletions extensions/kpdf/README.txt

This file was deleted.

12 changes: 0 additions & 12 deletions extensions/kpdf/config.xml

This file was deleted.

12 changes: 0 additions & 12 deletions extensions/kpdf/menu.json

This file was deleted.

83 changes: 0 additions & 83 deletions frontend/cache.lua

This file was deleted.

38 changes: 0 additions & 38 deletions frontend/dbg.lua

This file was deleted.

0 comments on commit dc9f674

Please sign in to comment.