From 54277974d2bdf20e14c63b9127554c03f85b52ce Mon Sep 17 00:00:00 2001 From: chrox Date: Thu, 29 May 2014 21:09:22 +0800 Subject: [PATCH] make Android target --- Makefile | 12 ++++++--- README.md | 57 ++++++++++++++++++++++++++++++----------- android/luajit-launcher | 2 +- koreader-base | 2 +- 4 files changed, 53 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index fe4eb7008..dd71a9e49 100644 --- a/Makefile +++ b/Makefile @@ -36,17 +36,17 @@ ifdef EMULATE_READER # create symlink instead of copying files in development mode cd $(INSTALL_DIR)/koreader && \ ln -sf ../../$(KOR_BASE)/$(OUTPUT_DIR)/* . - # install front spec + # install front spec only for the emulator cd $(INSTALL_DIR)/koreader/spec && test -e front || \ ln -sf ../../../../spec ./front + cd $(INSTALL_DIR)/koreader/spec/front/unit && test -e data || \ + ln -sf ../../test ./data else cp -rfL $(KOR_BASE)/$(OUTPUT_DIR)/* $(INSTALL_DIR)/koreader/ endif for f in $(INSTALL_FILES); do \ ln -sf ../../$$f $(INSTALL_DIR)/koreader/; \ done - cd $(INSTALL_DIR)/koreader/spec/front/unit && test -e data || \ - ln -sf ../../test ./data # install plugins cp -r plugins/* $(INSTALL_DIR)/koreader/plugins/ cp -rpL resources/fonts/* $(INSTALL_DIR)/koreader/fonts/ @@ -131,10 +131,16 @@ androidupdate: all cd $(INSTALL_DIR)/koreader && 7z a -l -mx=1 \ ../../$(ANDROID_LAUNCHER_DIR)/assets/module/koreader-g$(REVISION).7z * \ -x!resources/fonts -x!resources/icons/src -x!spec + $(MAKE) -C $(ANDROID_LAUNCHER_DIR) apk + cp $(ANDROID_LAUNCHER_DIR)/bin/NativeActivity-debug.apk \ + koreader-android-$(MACHINE)-$(VERSION).apk androiddev: androidupdate $(MAKE) -C $(ANDROID_LAUNCHER_DIR) dev +android-toolchain: + $(MAKE) -C $(KOR_BASE) android-toolchain + pot: $(XGETTEXT_BIN) reader.lua `find frontend -iname "*.lua"` \ `find plugins -iname "*.lua"` \ diff --git a/README.md b/README.md index c611c3640..27e1d5e28 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,16 @@ KOReader [![Build Status][travis-icon]][travis-link] ======== -This is a document viewer application, originally created for usage on the +KOReader is a document viewer application, originally created for usage on the Kindle e-ink reader. It currently supports Kindle 5 (Touch), Kindle Paperwhite -and Kobo devices. Kindles need to be jailbroken in order to install the -application. Also, a kind of external launcher is needed. +, Kobo and Android devices. KOReader started as the KindlePDFViewer application, but it supports much more formats than PDF now. Among them are DJVU, FB2, EPUB, TXT, CBZ, HTML. KOReader is a frontend written in Lua and uses the API presented by the -KOReader-base framework. KOReader implements a GUI and is currently targeted -at Touch-based devices - for the classic user interface for button-driven +koreader-base framework. KOReader implements a GUI and is currently targeted +at touch-based devices - for the classic user interface for button-driven e-ink devices (like the Kindle 2, Kindle DX, Kindle 3, Kindle 4) see the KindlePDFviewer legacy project or - especially for the Kindle 4 - have a look at its fork Librerator. @@ -24,8 +23,8 @@ more about this project. Prerequisites ======== -Instructions about how to get and compile the source are intended for a \*nix -OS. Windows users are suggested to develop in a [Linux VM](http://www.howtogeek.com/howto/11287/how-to-run-ubuntu-in-windows-7-with-vmware-player/) or use Wubi. +Instructions about how to get and compile the source are intended for a linux +OS. Windows users are suggested to develop in a [Linux VM][linux-vm] or use Wubi. To get and compile the source you must have `patch`, `wget`, `unzip`, `git`, `autoconf`, `subversion` and `cmake` installed. Version of autoconf need to be greater than 2.64. @@ -35,7 +34,7 @@ Ubuntu users may need to run: sudo apt-get install build-essential libtool ``` -Cross toolchains are available to Ubuntu users through these commands: +Cross compile toolchains are available for Ubuntu users through these commands: ``` # for Kindle sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi @@ -43,9 +42,12 @@ sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf ``` +A recent version of Android SDK/NDK is needed in order to build Koreader for Android +devices. + You might also need SDL library packages if you want to compile and run Koreader on PC. Fedora users can install `SDL` and `SDL-devel`. -Ubuntu users probably have to run: +Ubuntu users probably need to run: ``` sudo apt-get install libsdl1.2-dev ``` @@ -66,19 +68,20 @@ Building & Running & Testing For real eink devices --------------------- -If you already done an emulator build, you must do: +If you have already built one package for a different target, remember to run +this command before you go further: ``` make clean ``` -To build for the Kindle: +To build installable package for Kindle: ``` -make kindleupdate +make TARGET=kindle kindleupdate ``` -To build for the Kobo: +To build installable package for Kobo: ``` -make TARGET_DEVICE=KOBO koboupdate +make TARGET=kobo koboupdate ``` To run, you must call the script reader.lua. Run it without arguments to see @@ -88,8 +91,31 @@ be in the same directory. You may checkout our [nightlybuild script][nb-script] to see how to build a package from scratch. +For Android devices +------------------- + +Make sure the "android" tool is in your PATH variable and the NDK variable +points to the root directory of the Android NDK. + +First, run this command to make a standalone android cross compiling toolchain +from NDK: +``` +make android-toolchain +``` + +Also, if you have already built a different target, remember to clear the source +code tree with: +``` +make clean +``` + +Then, build installable package for Android: +``` +make TARGET=android androidupdate +``` + For emulating ------------ +------------- If you already done a real device build, you must do: ``` @@ -157,4 +183,5 @@ http://ccache.samba.org [travis-icon]:https://travis-ci.org/koreader/koreader-base.png?branch=master [travis-link]:https://travis-ci.org/koreader/koreader-base [travis-conf]:https://github.com/koreader/koreader-base/blob/master/.travis.yml +[linux-vm]:http://www.howtogeek.com/howto/11287/how-to-run-ubuntu-in-windows-7-with-vmware-player/ diff --git a/android/luajit-launcher b/android/luajit-launcher index 3153b9269..f120e2a0b 160000 --- a/android/luajit-launcher +++ b/android/luajit-launcher @@ -1 +1 @@ -Subproject commit 3153b92693a4a57cbe6e21d32f94b1f89e115633 +Subproject commit f120e2a0b22e028a2e5ec41d3d5a89e9dc0561cb diff --git a/koreader-base b/koreader-base index 356557819..664db11b0 160000 --- a/koreader-base +++ b/koreader-base @@ -1 +1 @@ -Subproject commit 3565578196c001d5a3099d3fa9a754e4c2832403 +Subproject commit 664db11b0026757a303573c0f056d9180c21e4b8