2013-03-24 21:27:20 +00:00
|
|
|
# koreader-base directory
|
|
|
|
KOR_BASE=koreader-base
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
# subdirectory we use to build the installation bundle
|
2013-03-24 15:52:39 +00:00
|
|
|
INSTALL_DIR=koreader
|
2013-03-24 14:08:42 +00:00
|
|
|
|
2013-03-24 19:11:21 +00:00
|
|
|
# subdirectory we use to setup emulation environment
|
|
|
|
EMU_DIR=emu
|
|
|
|
|
2013-03-24 14:08:42 +00:00
|
|
|
# files to copy from main directory
|
|
|
|
LUA_FILES=reader.lua
|
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
|
|
|
|
MO_DIR=i18n
|
|
|
|
|
|
|
|
|
2013-04-30 10:46:04 +00:00
|
|
|
all: $(KOR_BASE)/koreader-base $(KOR_BASE)/extr $(KOR_BASE)/sdcv mo
|
2011-11-14 18:17:14 +00:00
|
|
|
|
2013-04-30 10:46:04 +00:00
|
|
|
$(KOR_BASE)/koreader-base $(KOR_BASE)/extr $(KOR_BASE)/sdcv:
|
|
|
|
make -C $(KOR_BASE) koreader-base extr sdcv
|
2011-12-02 22:10:59 +00:00
|
|
|
|
2011-11-14 18:17:14 +00:00
|
|
|
fetchthirdparty:
|
2012-03-08 13:03:18 +00:00
|
|
|
git submodule init
|
2012-03-07 16:19:52 +00:00
|
|
|
git submodule update
|
2013-03-24 21:04:32 +00:00
|
|
|
make -C $(KOR_BASE) fetchthirdparty
|
2011-11-14 18:17:14 +00:00
|
|
|
|
|
|
|
clean:
|
2013-03-24 21:04:32 +00:00
|
|
|
make -C $(KOR_BASE) clean
|
2011-11-14 18:17:14 +00:00
|
|
|
|
|
|
|
cleanthirdparty:
|
2013-03-24 21:04:32 +00:00
|
|
|
make -C $(KOR_BASE) cleanthirdparty
|
2012-09-17 20:38:05 +00:00
|
|
|
|
2013-03-24 19:11:21 +00:00
|
|
|
bootstrapemu:
|
|
|
|
test -d $(EMU_DIR) || mkdir $(EMU_DIR)
|
2013-03-24 21:04:32 +00:00
|
|
|
test -d $(EMU_DIR)/libs-emu || (cd $(EMU_DIR) && ln -s ../$(KOR_BASE)/libs-emu ./)
|
|
|
|
test -d $(EMU_DIR)/fonts || (cd $(EMU_DIR) && ln -s ../$(KOR_BASE)/fonts ./)
|
|
|
|
test -d $(EMU_DIR)/data || (cd $(EMU_DIR) && ln -s ../$(KOR_BASE)/data ./)
|
2013-03-24 19:11:21 +00:00
|
|
|
test -d $(EMU_DIR)/frontend || (cd $(EMU_DIR) && ln -s ../frontend ./)
|
|
|
|
test -d $(EMU_DIR)/resources || (cd $(EMU_DIR) && ln -s ../resources ./)
|
2013-03-24 21:04:32 +00:00
|
|
|
test -e $(EMU_DIR)/koreader-base || (cd $(EMU_DIR) && ln -s ../$(KOR_BASE)/koreader-base ./)
|
|
|
|
test -e $(EMU_DIR)/extr || (cd $(EMU_DIR) && ln -s ../$(KOR_BASE)/extr ./)
|
2013-04-30 10:46:04 +00:00
|
|
|
test -e $(EMU_DIR)/sdcv || (cd $(EMU_DIR) && ln -s ../$(KOR_BASE)/sdcv ./)
|
2013-03-24 19:11:21 +00:00
|
|
|
test -e $(EMU_DIR)/reader.lua || (cd $(EMU_DIR) && ln -s ../reader.lua ./)
|
2013-04-03 04:43:58 +00:00
|
|
|
test -e $(EMU_DIR)/history || (mkdir $(EMU_DIR)/history)
|
2013-04-10 00:13:23 +00:00
|
|
|
test -e $(EMU_DIR)/$(MO_DIR) || (cd $(EMU_DIR) && ln -s ../$(MO_DIR) ./)
|
2013-03-24 16:18:53 +00:00
|
|
|
|
2013-04-09 13:01:02 +00:00
|
|
|
customupdate: all
|
2012-10-24 10:24:05 +00:00
|
|
|
# ensure that the binaries were built for ARM
|
2013-03-24 21:04:32 +00:00
|
|
|
file $(KOR_BASE)/koreader-base | grep ARM || exit 1
|
|
|
|
file $(KOR_BASE)/extr | grep ARM || exit 1
|
|
|
|
# remove old package and dir if any
|
2013-03-24 15:52:39 +00:00
|
|
|
rm -f koreader-$(VERSION).zip
|
2012-10-02 21:18:28 +00:00
|
|
|
rm -rf $(INSTALL_DIR)
|
2013-03-24 21:04:32 +00:00
|
|
|
# create new dir for package
|
2012-11-02 09:37:13 +00:00
|
|
|
mkdir -p $(INSTALL_DIR)/{history,screenshots,clipboard,libs}
|
2013-04-30 12:06:01 +00:00
|
|
|
cp -p README.md COPYING $(KOR_BASE)/{koreader-base,extr,sdcv} koreader.sh $(LUA_FILES) $(INSTALL_DIR)
|
2013-04-30 10:46:04 +00:00
|
|
|
$(STRIP) --strip-unneeded $(INSTALL_DIR)/koreader-base $(INSTALL_DIR)/extr $(INSTALL_DIR)/sdcv
|
2012-04-08 01:58:51 +00:00
|
|
|
mkdir $(INSTALL_DIR)/data
|
2013-04-23 22:59:52 +00:00
|
|
|
cp -L koreader-base/$(DJVULIB) $(KOR_BASE)/$(CRELIB) \
|
|
|
|
$(KOR_BASE)/$(LUALIB) $(KOR_BASE)/$(K2PDFOPTLIB) \
|
|
|
|
$(KOR_BASE)/$(LEPTONICALIB) $(KOR_BASE)/$(TESSERACTLIB) \
|
|
|
|
$(INSTALL_DIR)/libs
|
2012-10-31 14:34:17 +00:00
|
|
|
$(STRIP) --strip-unneeded $(INSTALL_DIR)/libs/*
|
2013-03-24 21:04:32 +00:00
|
|
|
cp -rpL $(KOR_BASE)/data/*.css $(INSTALL_DIR)/data
|
|
|
|
cp -rpL $(KOR_BASE)/fonts $(INSTALL_DIR)
|
2013-04-10 00:13:23 +00:00
|
|
|
cp -rp $(MO_DIR) $(INSTALL_DIR)
|
2012-12-12 11:12:20 +00:00
|
|
|
rm $(INSTALL_DIR)/fonts/droid/DroidSansFallbackFull.ttf
|
2013-03-24 15:38:27 +00:00
|
|
|
echo $(VERSION) > git-rev
|
|
|
|
cp -r git-rev resources $(INSTALL_DIR)
|
2012-08-25 14:52:12 +00:00
|
|
|
cp -rpL frontend $(INSTALL_DIR)
|
2012-04-09 17:32:08 +00:00
|
|
|
mkdir $(INSTALL_DIR)/fonts/host
|
2013-03-24 15:52:39 +00:00
|
|
|
zip -9 -r koreader-$(VERSION).zip $(INSTALL_DIR) launchpad/ extensions/
|
2012-10-02 21:18:28 +00:00
|
|
|
rm -rf $(INSTALL_DIR)
|
2013-03-24 21:06:49 +00:00
|
|
|
# @TODO write an installation script for KUAL (houqp)
|
2013-03-24 21:04:32 +00:00
|
|
|
|
2013-04-07 19:05:32 +00:00
|
|
|
|
|
|
|
pot:
|
|
|
|
$(XGETTEXT_BIN) reader.lua `find frontend -iname "*.lua"` \
|
|
|
|
> $(TEMPLATE_DIR)/$(DOMAIN).pot
|
|
|
|
|
2013-04-07 19:21:03 +00:00
|
|
|
mo:
|
|
|
|
for po in `find l10n -iname '*.po'`; do \
|
|
|
|
resource=`basename $$po .po` ; \
|
|
|
|
lingua=`dirname $$po | xargs basename` ; \
|
|
|
|
mkdir -p $(MO_DIR)/$$lingua/LC_MESSAGES/ ; \
|
|
|
|
msgfmt -o $(MO_DIR)/$$lingua/LC_MESSAGES/$$resource.mo $$po ; \
|
|
|
|
done
|
2013-04-07 19:05:32 +00:00
|
|
|
|
|
|
|
|