Skip to content

Commit

Permalink
Merge pull request koreader#824 from houqp/master
Browse files Browse the repository at this point in the history
add bootstrap emu for old code base
  • Loading branch information
hwhw committed Mar 24, 2013
2 parents 6c8d7df + 68cd802 commit d6f928f
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 64 deletions.
32 changes: 1 addition & 31 deletions .gitignore
@@ -1,42 +1,12 @@
*.swp
lua
lua-*
.reader.kpdfview.lua
settings.reader.lua
mupdf-thirdparty.zip
djvulibre*
cr3cache
history
crash.log
.vimrc
git-rev
data
fonts
kpdfview
slider_watcher
*.o

kindlepdfviewer-*.zip

/.cproject
/.project
/.reader.kpdfview

kpvcrlib/CMakeCache.txt
kpvcrlib/CMakeFiles/
kpvcrlib/cmake_install.cmake
kpvcrlib/Makefile

popen-noshell/libpopen_noshell.a
popen-noshell/*.o
popen-noshell/.svn/
popen-noshell/CREDITS
popen-noshell/Makefile
popen-noshell/README
popen-noshell/performance_tests/
popen-noshell/popen_noshell.c
popen-noshell/popen_noshell.h
popen-noshell/popen_noshell_examples.c
popen-noshell/popen_noshell_tests.c
popen-noshell/popen_noshell_tests.cpp

emu
20 changes: 15 additions & 5 deletions Makefile
Expand Up @@ -8,22 +8,32 @@ VERSION=$(shell git describe HEAD)
# subdirectory we use to build the installation bundle
INSTALL_DIR=kindlepdfviewer

# subdirectory we use to setup emulation environment
EMU_DIR=emu

# files to copy from main directory
LUA_FILES=battery.lua commands.lua crereader.lua defaults.lua dialog.lua djvureader.lua readerchooser.lua filechooser.lua filehistory.lua fileinfo.lua filesearcher.lua font.lua graphics.lua helppage.lua image.lua inputbox.lua keys.lua pdfreader.lua koptconfig.lua koptreader.lua picviewer.lua reader.lua rendertext.lua screen.lua selectmenu.lua settings.lua unireader.lua widget.lua

all: koreader-base/koreader-base koreader-base/extr

koreader-base/koreader-base:
cd koreader-base && make koreader-base

koreader-base/extr:
cd koreader-base && make extr
koreader-base/koreader-base koreader-base/extr:
make -C koreader-base extr koreader-base

fetchthirdparty:
git submodule init
git submodule update
cd koreader-base && make fetchthirdparty

bootstrapemu:
test -d $(EMU_DIR) || mkdir $(EMU_DIR)
test -d $(EMU_DIR)/libs-emu || (cd $(EMU_DIR) && ln -s ../koreader-base/libs-emu ./)
test -d $(EMU_DIR)/fonts || (cd $(EMU_DIR) && ln -s ../koreader-base/fonts ./)
test -d $(EMU_DIR)/data || (cd $(EMU_DIR) && ln -s ../koreader-base/data ./)
test -d $(EMU_DIR)/resources || (cd $(EMU_DIR) && ln -s ../resources ./)
test -e $(EMU_DIR)/koreader-base || (cd $(EMU_DIR) && ln -s ../koreader-base/koreader-base ./)
test -e $(EMU_DIR)/extr || (cd $(EMU_DIR) && ln -s ../koreader-base/extr ./)
rm -f $(EMU_DIR)/*.lua && (cd $(EMU_DIR) && ln -s ../*.lua ./)

clean:
cd koreader-base && make clean

Expand Down
51 changes: 24 additions & 27 deletions README.md
Expand Up @@ -13,7 +13,6 @@ The application is licensed under the GPLv3 (see COPYING file).
Building
========


Follow these steps:

* fetch thirdparty sources
Expand All @@ -27,6 +26,7 @@ Follow these steps:
* install CREngine sources into subfolder "kpvcrlib/crengine"
* install LuaJit sources into subfolder "luajit-2.0"
* install popen_noshell sources into subfolder "popen-noshell"
* install libk2pdfopt sources into subfolder "libk2pdfopt"

* automatically fetch thirdparty sources with Makefile:
* make sure you have patch, wget, unzip, git and svn installed
Expand All @@ -35,19 +35,21 @@ 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.
on), libDjvuLibre, CREngine, libk2pdfopt and Lua.

* run `make`. This will build the kpdfview application
* run `make`. This will build the koreader-base application


Running
=======

The user interface (or what's there yet) is scripted in Lua. See "reader.lua".
In real eink devices
---------------------
The user interface is scripted in Lua. See "reader.lua".
It uses the Linux feature to run scripts by using a corresponding line at its
start.

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

You would then just call reader.lua, giving the document file path, or any
Expand All @@ -56,35 +58,30 @@ 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.


Device emulation
================

The code also features a device emulation. You need SDL headers and library
for this. It allows to develop on a standard PC and saves precious development
time. It might also compose the most unfriendly desktop PDF reader, depending
on your view.

If you are using Fedora Core Linux, do `yum install SDL SDL-devel`.
If you are using Ubuntu, install `libsdl-dev1.2` package.
In emulator
-----------
You need to first compile koreader-base in emulation mode.
* If you have built kindlepdfviewer in real mode before, you need to
clean it up:

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
make clean && make cleanthirdparty
```

or:
* Then compile with emulation mode flag:

```
./reader.lua /ANY/PATH
EMULATE_READER=1 make
```

By default emulation will provide DXG resolution of 824*1200. It can be
specified at compile time, this is example for Kindle 3:
* You may want to see README.md in koreader-base for more information.


Next run `make bootstrapemu` to setup basic runtime environment needed by
emulation mode. A new emu directory will be created.


Last, run the emulator with following command:
```
EMULATE_READER_W=600 EMULATE_READER_H=800 EMULATE_READER=1 make kpdfview
cd emu && reader.lua -d ./
```

2 changes: 1 addition & 1 deletion koreader-base
Submodule koreader-base updated 3 files
+1 −5 Makefile.defs
+8 −6 README.md
+17 −7 einkfb.c

0 comments on commit d6f928f

Please sign in to comment.