From fb317810fa10ba00c72e2247c3f868e3385f5414 Mon Sep 17 00:00:00 2001 From: HW Date: Sun, 24 Mar 2013 15:08:42 +0100 Subject: [PATCH] Some adaptions needed after refactoring --- Makefile | 29 +++++++++++++++++++---------- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ reader.lua | 2 +- 3 files changed, 67 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index c994a1f3b..bef6f9762 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,15 @@ -VERSION?=$(shell git describe HEAD) -CHOST?=arm-none-linux-gnueabi -STRIP:=$(CHOST)-strip +# the repository might not have been checked out yet, so make this +# able to fail: +-include koreader-base/Makefile.defs + +# we want VERSION to carry the version of koreader, not koreader-base +VERSION=$(shell git describe HEAD) + +# subdirectory we use to build the installation bundle +INSTALL_DIR=kindlepdfviewer + +# files to copy from main directory +LUA_FILES=reader.lua all: koreader-base/koreader-base koreader-base/extr @@ -21,22 +30,22 @@ clean: cleanthirdparty: cd koreader-base && make cleanthirdparty -customupdate: all +customupdate: koreader-base/koreader-base koreader-base/extr # ensure that the binaries were built for ARM file koreader-base/koreader-base | grep ARM || exit 1 file koreader-base/extr | grep ARM || exit 1 rm -f kindlepdfviewer-$(VERSION).zip - $(STRIP) --strip-unneeded koreader-base/kpdfview koreader-base/extr 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) + cp -p README.md COPYING koreader-base/koreader-base koreader-base/extr kpdf.sh $(LUA_FILES) $(INSTALL_DIR) + $(STRIP) --strip-unneeded $(INSTALL_DIR)/koreader-base $(INSTALL_DIR)/extr mkdir $(INSTALL_DIR)/data - cp -L $(DJVULIB) $(CRELIB) $(LUALIB) $(K2PDFOPTLIB) $(INSTALL_DIR)/libs + cp -L koreader-base/$(DJVULIB) koreader-base/$(CRELIB) koreader-base/$(LUALIB) koreader-base/$(K2PDFOPTLIB) $(INSTALL_DIR)/libs $(STRIP) --strip-unneeded $(INSTALL_DIR)/libs/* - cp -rpL data/*.css $(INSTALL_DIR)/data - cp -rpL fonts $(INSTALL_DIR) + cp -rpL koreader-base/data/*.css $(INSTALL_DIR)/data + cp -rpL koreader-base/fonts $(INSTALL_DIR) rm $(INSTALL_DIR)/fonts/droid/DroidSansFallbackFull.ttf - cp -r git-rev resources $(INSTALL_DIR) + cp -r koreader-base/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/ diff --git a/README.md b/README.md index 14862e5ad..4647f24e5 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,50 @@ at its fork Librerator. The application is licensed under the GPLv3 (see COPYING file). + +Building +======== + + +Follow these steps: + +* fetch thirdparty sources + * manually fetch all the thirdparty sources: + * init and update submodule koreader-base + * within koreader-base: + * install muPDF sources into subfolder "mupdf" + * install muPDF third-party sources (see muPDF homepage) into a new + subfolder "mupdf/thirdparty" + * install libDjvuLibre sources into subfolder "djvulibre" + * install CREngine sources into subfolder "kpvcrlib/crengine" + * install LuaJit sources into subfolder "luajit-2.0" + * install popen_noshell sources into subfolder "popen-noshell" + + * automatically fetch thirdparty sources with Makefile: + * make sure you have patch, wget, unzip, git and svn installed + * run `make fetchthirdparty`. + +* adapt Makefile to your needs - have a look at Makefile.defs in koreader-base + +* 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 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 koreader-base +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. + + diff --git a/reader.lua b/reader.lua index 857d0601f..b2a853dee 100755 --- a/reader.lua +++ b/reader.lua @@ -1,4 +1,4 @@ -#!./kpdfview +#!./koreader-base package.path = "./frontend/?.lua" require "ui/uimanager"