From 047ca4bca75bacef24a37363748c45cffe2a24f5 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Sun, 24 Mar 2013 17:11:19 -0400 Subject: [PATCH 1/3] add bootstrapemu target in Makefile & update README --- Makefile | 20 +++++++++++++++----- README.md | 51 ++++++++++++++++++++++++--------------------------- 2 files changed, 39 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index b4076717..3774c096 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index e8671d2d..c3154597 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,6 @@ The application is licensed under the GPLv3 (see COPYING file). Building ======== - Follow these steps: * fetch thirdparty sources @@ -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 @@ -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 @@ -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 ./ ``` - From 89cdf743f9e8d270ae79569fcf96949a9178e049 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Sun, 24 Mar 2013 17:11:51 -0400 Subject: [PATCH 2/3] update koreader-base --- koreader-base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koreader-base b/koreader-base index 2542686f..73ffa9e2 160000 --- a/koreader-base +++ b/koreader-base @@ -1 +1 @@ -Subproject commit 2542686fb9be45dffae9893ed484a2fb1b22fedc +Subproject commit 73ffa9e2da59cddd1f6c1136c3cc0f80b7e37f97 From 68cd8026276a8af4ffc92b25ee704f663e310b25 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Sun, 24 Mar 2013 17:12:50 -0400 Subject: [PATCH 3/3] update gitignore --- .gitignore | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index 28f0fc4a..e4d8530b 100644 --- a/.gitignore +++ b/.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