2013-03-24 21:27:20 +00:00
|
|
|
# koreader-base directory
|
2014-01-01 21:07:28 +00:00
|
|
|
KOR_BASE?=koreader-base
|
2013-03-24 21:27:20 +00:00
|
|
|
|
2013-03-24 14:08:42 +00:00
|
|
|
# the repository might not have been checked out yet, so make this
|
|
|
|
# able to fail:
|
2013-03-24 21:04:32 +00:00
|
|
|
-include $(KOR_BASE)/Makefile.defs
|
|
|
|
|
2013-03-24 14:08:42 +00:00
|
|
|
# we want VERSION to carry the version of koreader, not koreader-base
|
|
|
|
VERSION=$(shell git describe HEAD)
|
2014-05-25 08:18:55 +00:00
|
|
|
REVISION=$(shell git rev-parse --short HEAD)
|
2013-03-24 14:08:42 +00:00
|
|
|
|
|
|
|
# subdirectory we use to build the installation bundle
|
2014-05-25 08:18:55 +00:00
|
|
|
export PATH:=$(CURDIR)/$(KOR_BASE)/toolchain/android-toolchain/bin:$(PATH)
|
|
|
|
MACHINE?=$(shell PATH=$(PATH) $(CC) -dumpmachine 2>/dev/null)
|
2013-08-15 13:55:50 +00:00
|
|
|
INSTALL_DIR=koreader-$(MACHINE)
|
2013-03-24 14:08:42 +00:00
|
|
|
|
2014-06-01 15:53:09 +00:00
|
|
|
ANDROID_DIR=android
|
|
|
|
ANDROID_LAUNCHER_DIR:=$(ANDROID_DIR)/luajit-launcher
|
2014-05-26 15:38:51 +00:00
|
|
|
|
2013-08-07 18:40:00 +00:00
|
|
|
# files to link from main directory
|
2014-05-23 10:04:01 +00:00
|
|
|
INSTALL_FILES=reader.lua frontend resources defaults.lua l10n \
|
2013-08-07 18:40:00 +00:00
|
|
|
git-rev README.md COPYING
|
2011-11-16 22:52:26 +00:00
|
|
|
|
2013-04-07 19:05:32 +00:00
|
|
|
# for gettext
|
|
|
|
DOMAIN=koreader
|
|
|
|
TEMPLATE_DIR=l10n/templates
|
|
|
|
KOREADER_MISC_TOOL=../misc
|
|
|
|
XGETTEXT_BIN=$(KOREADER_MISC_TOOL)/gettext/lua_xgettext.py
|
|
|
|
|
2011-11-14 18:17:14 +00:00
|
|
|
|
2014-06-05 12:54:36 +00:00
|
|
|
all: $(if $(ANDROID),,$(KOR_BASE)/$(OUTPUT_DIR)/luajit)
|
2013-09-21 13:31:22 +00:00
|
|
|
$(MAKE) -C $(KOR_BASE)
|
2013-08-07 18:40:00 +00:00
|
|
|
echo $(VERSION) > git-rev
|
|
|
|
mkdir -p $(INSTALL_DIR)/koreader
|
|
|
|
ifdef EMULATE_READER
|
|
|
|
cp -f $(KOR_BASE)/ev_replay.py $(INSTALL_DIR)/koreader/
|
2014-01-01 21:07:28 +00:00
|
|
|
# create symlink instead of copying files in development mode
|
|
|
|
cd $(INSTALL_DIR)/koreader && \
|
|
|
|
ln -sf ../../$(KOR_BASE)/$(OUTPUT_DIR)/* .
|
2014-05-29 13:09:22 +00:00
|
|
|
# install front spec only for the emulator
|
2014-05-25 08:18:55 +00:00
|
|
|
cd $(INSTALL_DIR)/koreader/spec && test -e front || \
|
|
|
|
ln -sf ../../../../spec ./front
|
2014-05-29 13:09:22 +00:00
|
|
|
cd $(INSTALL_DIR)/koreader/spec/front/unit && test -e data || \
|
|
|
|
ln -sf ../../test ./data
|
2014-01-01 21:07:28 +00:00
|
|
|
else
|
|
|
|
cp -rfL $(KOR_BASE)/$(OUTPUT_DIR)/* $(INSTALL_DIR)/koreader/
|
2013-08-07 18:40:00 +00:00
|
|
|
endif
|
|
|
|
for f in $(INSTALL_FILES); do \
|
2013-08-07 19:58:15 +00:00
|
|
|
ln -sf ../../$$f $(INSTALL_DIR)/koreader/; \
|
2014-01-01 21:07:28 +00:00
|
|
|
done
|
2014-06-01 15:53:09 +00:00
|
|
|
ifdef ANDROID
|
|
|
|
cd $(INSTALL_DIR)/koreader && \
|
|
|
|
ln -sf ../../$(ANDROID_DIR)/*.lua .
|
|
|
|
endif
|
2014-04-23 14:19:29 +00:00
|
|
|
# install plugins
|
|
|
|
cp -r plugins/* $(INSTALL_DIR)/koreader/plugins/
|
2013-08-07 18:40:00 +00:00
|
|
|
cp -rpL resources/fonts/* $(INSTALL_DIR)/koreader/fonts/
|
2013-08-07 19:58:15 +00:00
|
|
|
mkdir -p $(INSTALL_DIR)/koreader/screenshots
|
|
|
|
mkdir -p $(INSTALL_DIR)/koreader/data/dict
|
|
|
|
mkdir -p $(INSTALL_DIR)/koreader/data/tessdata
|
|
|
|
mkdir -p $(INSTALL_DIR)/koreader/fonts/host
|
2014-08-01 04:36:32 +00:00
|
|
|
mkdir -p $(INSTALL_DIR)/koreader/ota
|
2014-01-01 21:07:28 +00:00
|
|
|
ifndef EMULATE_READER
|
|
|
|
# clean up, remove unused files for releases
|
2013-08-07 18:40:00 +00:00
|
|
|
rm -rf $(INSTALL_DIR)/koreader/data/{cr3.ini,cr3skin-format.txt,desktop,devices,manual}
|
|
|
|
rm $(INSTALL_DIR)/koreader/fonts/droid/DroidSansFallbackFull.ttf
|
2014-01-01 21:07:28 +00:00
|
|
|
endif
|
2013-08-07 18:40:00 +00:00
|
|
|
|
2013-08-15 13:55:50 +00:00
|
|
|
$(KOR_BASE)/$(OUTPUT_DIR)/luajit:
|
2013-08-07 18:40:00 +00:00
|
|
|
$(MAKE) -C $(KOR_BASE)
|
2011-12-02 22:10:59 +00:00
|
|
|
|
2014-05-15 08:07:38 +00:00
|
|
|
$(INSTALL_DIR)/koreader/.busted:
|
|
|
|
test -e $(INSTALL_DIR)/koreader/.busted || \
|
|
|
|
ln -sf ../../.busted $(INSTALL_DIR)/koreader
|
|
|
|
|
|
|
|
testfront: $(INSTALL_DIR)/koreader/.busted
|
|
|
|
cd $(INSTALL_DIR)/koreader && busted -l ./luajit
|
|
|
|
|
2014-03-25 14:26:36 +00:00
|
|
|
test:
|
|
|
|
$(MAKE) -C $(KOR_BASE) test
|
2014-05-15 08:07:38 +00:00
|
|
|
$(MAKE) testfront
|
2014-03-25 14:26:36 +00:00
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
|
2011-11-14 18:17:14 +00:00
|
|
|
fetchthirdparty:
|
2012-03-08 13:03:18 +00:00
|
|
|
git submodule init
|
2014-06-09 00:35:31 +00:00
|
|
|
git submodule sync
|
2012-03-07 16:19:52 +00:00
|
|
|
git submodule update
|
2013-08-07 18:40:00 +00:00
|
|
|
$(MAKE) -C $(KOR_BASE) fetchthirdparty
|
2011-11-14 18:17:14 +00:00
|
|
|
|
|
|
|
clean:
|
2013-08-07 19:58:15 +00:00
|
|
|
rm -rf $(INSTALL_DIR)
|
2013-08-07 18:40:00 +00:00
|
|
|
$(MAKE) -C $(KOR_BASE) clean
|
2013-03-24 16:18:53 +00:00
|
|
|
|
2014-05-08 13:05:19 +00:00
|
|
|
kindleupdate: all
|
2012-10-24 10:24:05 +00:00
|
|
|
# ensure that the binaries were built for ARM
|
2013-08-07 18:40:00 +00:00
|
|
|
file $(INSTALL_DIR)/koreader/luajit | grep ARM || exit 1
|
|
|
|
# remove old package if any
|
2013-08-15 13:55:50 +00:00
|
|
|
rm -f koreader-kindle-$(MACHINE)-$(VERSION).zip
|
2014-05-08 13:05:19 +00:00
|
|
|
# Kindle launching scripts
|
|
|
|
ln -sf ../kindle/extensions $(INSTALL_DIR)/
|
|
|
|
ln -sf ../kindle/launchpad $(INSTALL_DIR)/
|
|
|
|
ln -sf ../../kindle/koreader.sh $(INSTALL_DIR)/koreader
|
2014-08-03 22:25:23 +00:00
|
|
|
ln -sf ../../kindle/libkohelper.sh $(INSTALL_DIR)/koreader
|
2014-08-01 17:15:35 +00:00
|
|
|
ln -sf ../../kindle/kotar_cpoint $(INSTALL_DIR)/koreader
|
2013-08-07 18:40:00 +00:00
|
|
|
# create new package
|
2014-07-04 01:53:53 +00:00
|
|
|
# Don't bundle launchpad on touch devices..
|
|
|
|
ifeq ($(TARGET), kindle-legacy)
|
|
|
|
KINDLE_LEGACY_LAUNCHER:=launchpad
|
|
|
|
endif
|
2013-08-07 18:40:00 +00:00
|
|
|
cd $(INSTALL_DIR) && \
|
|
|
|
zip -9 -r \
|
2013-08-15 13:55:50 +00:00
|
|
|
../koreader-kindle-$(MACHINE)-$(VERSION).zip \
|
2014-07-04 01:53:53 +00:00
|
|
|
extensions koreader $(KINDLE_LEGACY_LAUNCHER) \
|
2014-08-01 04:36:32 +00:00
|
|
|
-x "koreader/resources/fonts/*" "koreader/ota/*" \
|
2014-05-26 15:38:51 +00:00
|
|
|
"koreader/resources/icons/src/*" "koreader/spec/*"
|
2014-08-01 04:36:32 +00:00
|
|
|
# generate kindleupdate package index file
|
|
|
|
zipinfo -1 koreader-kindle-$(MACHINE)-$(VERSION).zip > \
|
|
|
|
$(INSTALL_DIR)/koreader/ota/package.index
|
|
|
|
echo "koreader/ota/package.index" >> $(INSTALL_DIR)/koreader/ota/package.index
|
|
|
|
# update index file in zip package
|
|
|
|
cd $(INSTALL_DIR) && zip -u ../koreader-kindle-$(MACHINE)-$(VERSION).zip \
|
|
|
|
koreader/ota/package.index
|
|
|
|
# make gzip kindleupdate for zsync OTA update
|
|
|
|
cd $(INSTALL_DIR) && \
|
|
|
|
tar czafh ../koreader-kindle-$(MACHINE)-$(VERSION).tar.gz \
|
|
|
|
-T koreader/ota/package.index --no-recursion
|
2013-03-24 21:04:32 +00:00
|
|
|
|
2013-08-06 10:03:10 +00:00
|
|
|
koboupdate: all
|
|
|
|
# ensure that the binaries were built for ARM
|
2013-08-15 13:55:50 +00:00
|
|
|
file $(INSTALL_DIR)/koreader/luajit | grep ARM || exit 1
|
|
|
|
# remove old package if any
|
|
|
|
rm -f koreader-kobo-$(MACHINE)-$(VERSION).zip
|
2014-05-08 13:05:19 +00:00
|
|
|
# Kobo launching scripts
|
|
|
|
mkdir -p $(INSTALL_DIR)/kobo/mnt/onboard/.kobo
|
|
|
|
ln -sf ../../../../../kobo/fmon $(INSTALL_DIR)/kobo/mnt/onboard/.kobo/
|
|
|
|
cd $(INSTALL_DIR)/kobo && tar -czhf ../KoboRoot.tgz mnt
|
|
|
|
cp resources/koreader.png $(INSTALL_DIR)/koreader.png
|
|
|
|
cp kobo/fmon/README.txt $(INSTALL_DIR)/README_kobo.txt
|
2014-06-09 18:51:25 +00:00
|
|
|
cp kobo/koreader.sh $(INSTALL_DIR)/koreader
|
|
|
|
cp kobo/suspend.sh $(INSTALL_DIR)/koreader
|
2014-07-03 11:40:53 +00:00
|
|
|
cp kobo/nickel.sh $(INSTALL_DIR)/koreader
|
2014-07-19 14:32:41 +00:00
|
|
|
cp kobo/wifi.sh $(INSTALL_DIR)/koreader
|
2013-08-15 13:55:50 +00:00
|
|
|
# create new package
|
|
|
|
cd $(INSTALL_DIR) && \
|
|
|
|
zip -9 -r \
|
|
|
|
../koreader-kobo-$(MACHINE)-$(VERSION).zip \
|
2013-09-30 21:03:39 +00:00
|
|
|
KoboRoot.tgz koreader koreader.png README_kobo.txt \
|
2014-05-26 15:38:51 +00:00
|
|
|
-x "koreader/resources/fonts/*" \
|
|
|
|
"koreader/resources/icons/src/*" "koreader/spec/*"
|
2014-08-01 04:36:32 +00:00
|
|
|
# generate koboupdate package index file
|
|
|
|
zipinfo -1 koreader-kobo-$(MACHINE)-$(VERSION).zip > \
|
|
|
|
$(INSTALL_DIR)/koreader/ota/package.index
|
|
|
|
echo "koreader/ota/package.index" >> $(INSTALL_DIR)/koreader/ota/package.index
|
|
|
|
# update index file in zip package
|
|
|
|
cd $(INSTALL_DIR) && zip -u ../koreader-kobo-$(MACHINE)-$(VERSION).zip \
|
|
|
|
koreader/ota/package.index
|
|
|
|
# make gzip koboupdate for zsync OTA update
|
|
|
|
cd $(INSTALL_DIR) && \
|
|
|
|
tar czafh ../koreader-kobo-$(MACHINE)-$(VERSION).tar.gz \
|
|
|
|
-T koreader/ota/package.index --no-recursion
|
2013-04-07 19:05:32 +00:00
|
|
|
|
2014-05-26 15:38:51 +00:00
|
|
|
androidupdate: all
|
|
|
|
mkdir -p $(ANDROID_LAUNCHER_DIR)/assets/module
|
|
|
|
-rm $(ANDROID_LAUNCHER_DIR)/assets/module/koreader-*
|
2014-05-29 08:04:00 +00:00
|
|
|
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
|
2014-05-29 13:09:22 +00:00
|
|
|
$(MAKE) -C $(ANDROID_LAUNCHER_DIR) apk
|
|
|
|
cp $(ANDROID_LAUNCHER_DIR)/bin/NativeActivity-debug.apk \
|
|
|
|
koreader-android-$(MACHINE)-$(VERSION).apk
|
2014-05-26 15:38:51 +00:00
|
|
|
|
|
|
|
androiddev: androidupdate
|
|
|
|
$(MAKE) -C $(ANDROID_LAUNCHER_DIR) dev
|
2014-05-25 08:18:55 +00:00
|
|
|
|
2014-05-29 13:09:22 +00:00
|
|
|
android-toolchain:
|
|
|
|
$(MAKE) -C $(KOR_BASE) android-toolchain
|
|
|
|
|
2013-04-07 19:05:32 +00:00
|
|
|
pot:
|
|
|
|
$(XGETTEXT_BIN) reader.lua `find frontend -iname "*.lua"` \
|
2014-04-23 15:02:45 +00:00
|
|
|
`find plugins -iname "*.lua"` \
|
2013-04-07 19:05:32 +00:00
|
|
|
> $(TEMPLATE_DIR)/$(DOMAIN).pot
|
|
|
|
|
2013-11-29 14:41:56 +00:00
|
|
|
po:
|
|
|
|
$(MAKE) -i -C l10n bootstrap update
|