mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
Zero-out AppImage magic bytes from the ELF header extended ABI version so binfmt+qemu can be used (e.g. when executed from `docker run --platform …`). Cf.: - https://github.com/AppImage/AppImageKit/issues/1056 - https://github.com/AppImage/AppImageSpec/blob/master/draft.md#type-2-image-format - https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#:~:text=EI_ABIVERSION
42 lines
1.8 KiB
Makefile
42 lines
1.8 KiB
Makefile
APPIMAGE_DIR = $(PLATFORM_DIR)/appimage
|
|
|
|
APPIMAGETOOL = appimagetool-$(APPIMAGE_ARCH).AppImage
|
|
APPIMAGETOOL_URL = https://github.com/AppImage/appimagetool/releases/download/continuous/$(APPIMAGETOOL)
|
|
|
|
KOREADER_APPIMAGE = koreader-$(DIST)-$(APPIMAGE_ARCH)-$(VERSION).AppImage
|
|
|
|
UBUNTU_LIBBSD = /lib/$(TARGET_MACHINE)/libbsd.so.0
|
|
|
|
define UPDATE_PATH_EXCLUDES +=
|
|
plugins/SSH.koplugin
|
|
plugins/autofrontlight.koplugin
|
|
plugins/timesync.koplugin
|
|
$(filter-out tools/trace_require.lua tools/wbuilder.lua,$(wildcard tools/*))
|
|
endef
|
|
|
|
appimagetool $(APPIMAGETOOL):
|
|
wget -O $(APPIMAGETOOL).part '$(APPIMAGETOOL_URL)'
|
|
# Zero-out AppImage magic bytes from the ELF header extended ABI version so
|
|
# binfmt+qemu can be used (e.g. when executed from `docker run --platform …`).
|
|
# Cf. https://github.com/AppImage/AppImageKit/issues/1056.
|
|
printf '\0\0\0' | dd conv=notrunc obs=1 seek=8 of=$(APPIMAGETOOL).part
|
|
chmod +x ./$(APPIMAGETOOL).part
|
|
mv $(APPIMAGETOOL).part $(APPIMAGETOOL)
|
|
|
|
update: all $(APPIMAGETOOL)
|
|
cd $(INSTALL_DIR)/koreader && '$(abspath tools/mkrelease.sh)' ../appimage/ . $(release_excludes)
|
|
cp $(APPIMAGE_DIR)/{AppRun,koreader.desktop} resources/koreader.png $(INSTALL_DIR)/appimage/
|
|
sed -e 's/%%VERSION%%/$(VERSION)/' -e 's/%%DATE%%/$(RELEASE_DATE)/' $(PLATFORM_DIR)/common/koreader.metainfo.xml >$(INSTALL_DIR)/appimage/koreader.appdata.xml
|
|
# Also copy libbsd.so.0 (cf. https://github.com/koreader/koreader/issues/4627).
|
|
ifeq (,$(wildcard $(UBUNTU_LIBBSD)))
|
|
# Only warn if it's missing (e.g. when testing on a non-Ubuntu distribution).
|
|
echo 'WARNING: not bundling missing $(UBUNTU_LIBBSD)' 1>&2
|
|
else
|
|
cp $(UBUNTU_LIBBSD) $(INSTALL_DIR)/appimage/libs/
|
|
endif
|
|
# Generate AppImage.
|
|
ARCH='$(APPIMAGE_ARCH)' ./$(APPIMAGETOOL) --appimage-extract-and-run $(INSTALL_DIR)/appimage $(KOREADER_APPIMAGE)
|
|
|
|
PHONY += appimagetool update
|
|
SOUND += $(APPIMAGETOOL)
|