Files
koreader/Makefile
T
Benoit Pierre a3dbe80d9c bump base (#15798)
- lunasvg: add pkg-config entry (koreader/koreader-base#2474)
- srell: install header to staging (koreader/koreader-base#2475)
- xxhash: add pkg-config entry (koreader/koreader-base#2476)
- bump crengine, ×4 (koreader/koreader-base#2479):
  * lvimg: fix `LVUnpackedImgSource` destructor (koreader/crengine#689)
  * lvrend: tables: fix padding calculation on min-width (koreader/crengine#692)
  * lvstsheet: update_style_content_property(): fix wrong content length (koreader/crengine#693)
  * lvtextfm: fix memory deallocation (koreader/crengine#694)
  * ci: bump actions (koreader/crengine#697)
  * lvxml: ReadRtfChar: fix charToHex buffer access (koreader/crengine#696)
  * lvtinydom: minor fixes (koreader/crengine#695)
  * hyphman: avoid using cri18n (koreader/crengine#698)
  * fix .gitignore (koreader/crengine#699)
  * miscellaneous cleanups (koreader/crengine#700)
  * chmlib: fix android compilation warning (koreader/crengine#701)
  * lvrefcache.h: initialize fields in LVIndexedRefCache constructor (koreader/crengine#690)
  * minor includes cleanups (koreader/crengine#702)
  * lvarray: fix `LVArray::set` (koreader/crengine#704)
  * lvref: fix `LVRefVec::set` (koreader/crengine#707)
  * hyphman: fix compiler warning [-Wunused-but-set-variable=] (koreader/crengine#705)
  * lvref:  suppress some "maybe-uninitialized" warnings (koreader/crengine#706)
  * CSS: fix font-variant-* handling (koreader/crengine#709)
  * CSS: fix attribute matching with id/name/href, add more length units, fix "rem", add "urem" and "urlh" - (koreader/crengine#710)
    Closes #15481.
    Closes #15339.
  * lvdocview: fix source page numbers with a page-list not in reading order (koreader/crengine#711)
  * proper build system - (koreader/crengine#703)
- einkfb: refresh the screen even when its content has not changed (koreader/koreader-base#2481)
- fix(blitbuffer): memory safety, soft-float overhead, and variable shadowing (koreader/koreader-base#2468)
- fix(wrap-mupdf): prevent integer overflow in allocator (koreader/koreader-base#2472)
- ffi/util: return available space from df, and fix its block maths (koreader/koreader-base#2478)
- fix(input): recompute nfds correctly in clearTimer (koreader/koreader-base#2467)
- fix(djvu): validate page bounds and check errors (koreader/koreader-base#2469)
- fix(nnsvg): prevent usage of freed NSVGimage (koreader/koreader-base#2471)
- fix(xtext): memory safety and input validation fixes (koreader/koreader-base#2473)
- kotasync: fix make reorder code (koreader/koreader-base#2483)
- ffi/downloader: fix range support check (koreader/koreader-base#2484)
- ffi/downloader: improve fetch implementation (koreader/koreader-base#2485)
2026-08-03 23:37:11 +02:00

231 lines
5.8 KiB
Makefile

PHONY = all android-ndk android-sdk base clean distclean doc fetchthirdparty re static-check update update-%
SOUND = $(INSTALL_DIR)/%
# koreader-base directory
KOR_BASE ?= base
include $(KOR_BASE)/Makefile.defs
RELEASE_DATE := $(shell git show -s --format=format:"%cd" --date=short HEAD)
# We want VERSION to carry the version of the KOReader main repo, not that of koreader-base
VERSION := $(shell git describe HEAD)
RELEASE_EPOCH := $(shell git log -1 --format='%cs' $(word 1,$(subst -, ,$(VERSION))))
# Only append date if we're not on a whole version, like v2018.11
ifneq (,$(findstring -,$(VERSION)))
VERSION := $(VERSION)_$(RELEASE_DATE)
endif
MACHINE=$(TARGET_MACHINE)
ifdef KODEBUG
MACHINE:=$(MACHINE)-debug
KODEDUG_SUFFIX:=-debug
endif
ifdef TARGET
DIST:=$(TARGET)
else
DIST:=emulator
endif
INSTALL_DIR ?= koreader-$(DIST)-$(MACHINE)
# platform directories
PLATFORM_DIR=platform
COMMON_DIR=$(PLATFORM_DIR)/common
WIN32_DIR=$(PLATFORM_DIR)/win32
define CR3GUI_DATADIR_EXCLUDES
%/KoboUSBMS.tar.gz
%/NOTES.txt
%/cr3.ini
%/cr3skin-format.txt
%/desktop
%/devices
%/dict
%/manual
%/tessdata
endef
CR3GUI_DATADIR_FILES = $(filter-out $(CR3GUI_DATADIR_EXCLUDES),$(wildcard $(CR3GUI_DATADIR)/*))
define DATADIR_FILES
$(CR3GUI_DATADIR_FILES)
$(OUTPUT_DIR_DATAFILES)
endef
# files to link from main directory
INSTALL_FILES=reader.lua setupkoenv.lua frontend resources defaults.lua datastorage.lua \
l10n tools README.md COPYING
OUTPUT_DIR_ARTIFACTS = $(abspath $(OUTPUT_DIR))/!(cache|cmake|data|history|staging|thirdparty)
OUTPUT_DIR_DATAFILES = $(OUTPUT_DIR)/data/*
# Release excludes. {{{
define UPDATE_PATH_EXCLUDES
cache
clipboard
data/dict
data/tessdata
ev_replay.py
help
history
l10n/templates
l10n/*/*.po
ota
resources/fonts*
resources/icons/src*
screenshots
spec
endef
# Files created after execution.
define UPDATE_PATH_EXCLUDES +=
data/cr3.ini
defaults.*.lua
history.lua
scripts
settings
settings.reader.lua*
styletweaks
version.log
endef
# Testsuite leftovers.
define UPDATE_PATH_EXCLUDES +=
dummy-test-file*
file.sdr*
i18n-test
readerbookmark.*
readerhighlight.*
testdata
this-is-not-a-valid-file*
endef
# Globally excluded.
define UPDATE_GLOBAL_EXCLUDES
*.dbg
*.dSYM
*.orig
*.swo
*.swp
*.un~
.*
endef
release_excludes = $(strip $(UPDATE_PATH_EXCLUDES:%='-x!$1%') $(UPDATE_GLOBAL_EXCLUDES:%='-xr!%'))
# }}}
define mkupdate
cd $(INSTALL_DIR) &&
'$(abspath tools/mkrelease.sh)'
--epoch=$(RELEASE_EPOCH)
$(if $(PARALLEL_JOBS),--jobs $(PARALLEL_JOBS))
--manifest=$(or $2,koreader)/ota/package.index
$(foreach a,$1,'$(if $(filter --%,$a),$a,$(abspath $a))') $(or $2,koreader)
$(call release_excludes,$(or $2,koreader)/)
endef
all: base mo
install -d $(INSTALL_DIR)/koreader
rm -f $(INSTALL_DIR)/koreader/git-rev; echo "$(VERSION)" > $(INSTALL_DIR)/koreader/git-rev
ifdef ANDROID
rm -f android-fdroid-version; echo -e "$(ANDROID_NAME)\n$(ANDROID_VERSION)" > koreader-android-fdroid-latest
endif
$(SYMLINK) $(KOR_BASE)/ev_replay.py $(INSTALL_DIR)/koreader/
bash -O extglob -c '$(SYMLINK) $(OUTPUT_DIR_ARTIFACTS) $(INSTALL_DIR)/koreader/'
ifneq (,$(EMULATE_READER))
@echo "[*] Install front spec only for the emulator"
$(SYMLINK) spec $(INSTALL_DIR)/koreader/spec/front
$(SYMLINK) test $(INSTALL_DIR)/koreader/spec/front/unit/data
@echo "[*] Install launcher for the emulator"
cp $(COMMON_DIR)/koreader.sh $(INSTALL_DIR)/koreader/
endif
$(SYMLINK) $(INSTALL_FILES) $(INSTALL_DIR)/koreader/
ifdef ANDROID
$(SYMLINK) $(ANDROID_DIR)/*.lua $(INSTALL_DIR)/koreader/
endif
@echo "[*] Install update once marker"
@echo "# This file indicates that update once patches have not been applied yet." > $(INSTALL_DIR)/koreader/update_once.marker
ifdef WIN32
@echo "[*] Install runtime libraries for win32..."
$(SYMLINK) $(WIN32_DIR)/*.dll $(INSTALL_DIR)/koreader/
endif
@echo "[*] Install plugins"
$(SYMLINK) plugins $(INSTALL_DIR)/koreader/
@echo "[*] Install resources"
$(SYMLINK) resources/fonts $(INSTALL_DIR)/koreader/fonts
install -d $(INSTALL_DIR)/koreader/{screenshots,fonts/host,ota}
# Note: the data dir is distinct from the one in base/build/…!
@echo "[*] Install data files"
! test -L $(INSTALL_DIR)/koreader/data || rm $(INSTALL_DIR)/koreader/data
install -d $(INSTALL_DIR)/koreader/data
$(SYMLINK) $(strip $(DATADIR_FILES)) $(INSTALL_DIR)/koreader/data/
base: base-all
ifeq (,$(wildcard $(KOR_BASE)/Makefile $(KOR_BASE)/Makefile.defs))
$(KOR_BASE)/Makefile $(KOR_BASE)/Makefile.defs: fetchthirdparty
# Need a recipe, even if empty, or make won't know how to remake `base-all`.
endif
fetchthirdparty:
git submodule sync --recursive
ifneq (,$(CI))
git submodule update --depth 1 --jobs 3 --init --recursive
else
# Force shallow clones of submodules configured as such.
git submodule update --jobs 3 --depth 1 --init $(shell \
git config --file=.gitmodules --name-only --get-regexp '^submodule\.[^.]+\.shallow$$' true \
| sed 's/\.shallow$$/.path/' \
| xargs -n1 git config --file=.gitmodules \
)
# Update the rest.
git submodule update --jobs 3 --init --recursive
endif
clean: base-clean mo-clean
rm -rf $(INSTALL_DIR)
distclean: clean base-distclean
$(MAKE) -C doc clean
re: clean
$(MAKE) all
# Include emulator specific rules.
ifneq (,$(EMULATE_READER))
include make/emulator.mk
endif
# Include target specific rules.
ifneq (,$(wildcard make/$(TARGET).mk))
include make/$(TARGET).mk
endif
include make/gettext.mk
android-ndk:
$(MAKE) -C $(KOR_BASE)/toolchain $(ANDROID_NDK_HOME)
android-sdk:
$(MAKE) -C $(KOR_BASE)/toolchain $(ANDROID_HOME)
static-check:
@if which luacheck > /dev/null; then \
luacheck -q {reader,setupkoenv,datastorage}.lua frontend plugins spec; \
else \
echo "[!] luacheck not found. "\
"you can install it with 'luarocks install luacheck'"; \
fi
doc:
make -C doc
.NOTPARALLEL:
.PHONY: $(PHONY)
include $(KOR_BASE)/Makefile
# vim: foldmethod=marker foldlevel=0