drop appimage target in favor of linux

Cf. koreader/kobase#2298.

The `linux` update target now build an AppImage too.

Other miscellaneous changes:
- AppImage:
  * better icons
  * update filename to conform to spec (`ApplicationName-$VERSION-$ARCH.AppImage`)
  * running from extracted contents will behave like the Linux distribution (multi-user mode)
- Debian package:
  * better icons
  * update version to include git commit
  * drop fakeroot requirement for building
  * fix dependencies (based on our targeted Ubuntu LTS: 22.04, AKA Jammy)
- Linux distribution:
  * better icons
  * improved start-up script (can be symlinked to)
This commit is contained in:
Benoit Pierre authored and Frans de Jonge committed 2026-03-15 23:00:26 +01:00
1 parent a2a9dfe2f7
commit b175c972fb
14 files changed
+133 -162

No files matched your search

+5 -13
View File
@@ -1,4 +1,4 @@
PHONY = all android-ndk android-sdk base clean distclean doc fetchthirdparty re static-check update
PHONY = all android-ndk android-sdk base clean distclean doc fetchthirdparty re static-check update update-%
SOUND = $(INSTALL_DIR)/%
# koreader-base directory
@@ -9,22 +9,12 @@ 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
LINUX_ARCH?=native
ifeq ($(LINUX_ARCH), native)
LINUX_ARCH_NAME:=$(shell uname -m)
else ifeq ($(LINUX_ARCH), arm64)
LINUX_ARCH_NAME:=aarch64
else ifeq ($(LINUX_ARCH), arm)
LINUX_ARCH_NAME:=armv7l
endif
LINUX_ARCH_NAME?=$(LINUX_ARCH)
MACHINE=$(TARGET_MACHINE)
ifdef KODEBUG
MACHINE:=$(MACHINE)-debug
@@ -130,7 +120,7 @@ release_excludes = $(strip $(UPDATE_PATH_EXCLUDES:%='-x!$1%') $(UPDATE_GLOBAL_EX
define mkupdate
cd $(INSTALL_DIR) &&
'$(abspath tools/mkrelease.sh)'
--epoch="$$(git log -1 --format='%cs' "$$(git describe --tags | cut -d- -f1)")"
--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)
@@ -149,6 +139,8 @@ 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
+1 -2
View File
@@ -133,7 +133,6 @@ TARGET:
android-arm64
android-x86
android-x86_64
appimage
cervantes
emulator Default if no TARGET is given
kindle Compatible with all Kindle models >= Kindle4
@@ -167,7 +166,7 @@ function setup_target() {
fi
TARGET=''
;;
appimage | linux) is_system Linux ;;
linux) is_system Linux ;;
macos) is_system macOS ;;
win32) is_system Windows ;;
# Devices.
+15 -23
View File
@@ -1,4 +1,7 @@
APPIMAGE_ARCH_arm64 = aarch64
APPIMAGE_ARCH = $(or $(APPIMAGE_ARCH_$(LINUX_ARCH)),$(LINUX_ARCH))
APPIMAGE_DIR = $(PLATFORM_DIR)/appimage
APPIMAGE_NAME = koreader-$(VERSION)-$(APPIMAGE_ARCH).AppImage
MKAPPIMAGE = mkappimage-$(APPIMAGE_ARCH).AppImage
define MKAPPIMAGE_URL
@@ -10,13 +13,6 @@ $(WGET) -O - https://api.github.com/repos/probonopd/go-appimage/releases | jq -r
'
endef
APPID = rocks.koreader.koreader
APPDIR = $(INSTALL_DIR)/appimage
DESKTOP = usr/share/applications/$(APPID).desktop
METAINFO = usr/share/metainfo/$(APPID).appdata.xml
KOREADER_APPIMAGE = koreader-$(DIST)-$(APPIMAGE_ARCH)-$(VERSION).AppImage
UBUNTU_LIBBSD = /lib/$(TARGET_MACHINE)/libbsd.so.0
define UPDATE_PATH_EXCLUDES +=
@@ -35,28 +31,24 @@ mkappimage $(MKAPPIMAGE):
chmod +x ./$(MKAPPIMAGE).part
mv $(MKAPPIMAGE).part $(MKAPPIMAGE)
update: all $(MKAPPIMAGE)
cd $(INSTALL_DIR)/koreader && '$(abspath tools/mkrelease.sh)' $(abspath $(APPDIR))/ . $(release_excludes)
# Launcher.
install -D $(APPIMAGE_DIR)/AppRun $(APPDIR)/
# Icon.
install -D resources/koreader.png $(APPDIR)/
ln -s koreader.png $(APPDIR)/.DirIcon
# Desktop entry.
install -D $(APPIMAGE_DIR)/koreader.desktop $(APPDIR)/$(DESKTOP)
ln -s $(DESKTOP) $(APPDIR)/$(notdir $(DESKTOP))
# AppStream metadata.
install -D $(PLATFORM_DIR)/common/koreader.metainfo.xml $(APPDIR)/$(METAINFO)
sed -i -e 's/%%VERSION%%/$(VERSION)/' -e 's/%%DATE%%/$(RELEASE_DATE)/' $(APPDIR)/$(METAINFO)
# Also copy libbsd.so.0 (cf. https://github.com/koreader/koreader/issues/4627).
update-appimage: all $(MKAPPIMAGE)
$(call mkupdate_linux,$(INSTALL_DIR)/appimage)
# Setup AppDir.
ln -s usr/bin/koreader $(INSTALL_DIR)/appimage/AppRun
ln -s usr/share/applications/$(DIST_APPID).desktop $(INSTALL_DIR)/appimage/
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
install $(UBUNTU_LIBBSD) $(APPDIR)/libs/
install $(UBUNTU_LIBBSD) -t $(INSTALL_DIR)/appimage/usr/lib/koreader/libs/
endif
# Generate AppImage.
ARCH='$(APPIMAGE_ARCH)' VERSION='$(VERSION)' ./$(MKAPPIMAGE) --appimage-extract-and-run $(APPDIR) $(KOREADER_APPIMAGE)
echo 'Creating appimage: $(LINUX_PACKAGE)'
ARCH='$(APPIMAGE_ARCH)' VERSION='$(VERSION)' ./$(MKAPPIMAGE) --appimage-extract-and-run $(INSTALL_DIR)/appimage $(APPIMAGE_NAME)
# Cleanup.
rm -rf $(INSTALL_DIR)/appimage
update: update-appimage
PHONY += mkappimage
SOUND += $(MKAPPIMAGE)
+15
View File
@@ -0,0 +1,15 @@
DEBIAN_ARCH_x86_64 = amd64
DEBIAN_ARCH = $(or $(DEBIAN_ARCH_$(LINUX_ARCH)),$(LINUX_ARCH))
# v2025.10-197-g7c5ee9c1a2_2026-03-13 → 2025.10-197-g7c5ee9c1a2-1
DEBIAN_VERSION = $(word 1,$(subst _, ,$(VERSION:v%=%)))-1
DEBIAN_PACKAGE = koreader_$(DEBIAN_VERSION)_$(DEBIAN_ARCH).deb
DEBIAN_PACKAGE_COMPRESSION ?= -Zxz -z9
update-deb: all
$(call mkupdate_linux,$(INSTALL_DIR)/deb)
# Generate the package.
$(LINUX_DIR)/do_debian_package.sh $(DEBIAN_PACKAGE) $(INSTALL_DIR)/deb $(DEBIAN_PACKAGE_COMPRESSION)
# Cleanup.
rm -rf $(INSTALL_DIR)/deb
update: update-deb
+42 -26
View File
@@ -1,34 +1,50 @@
LINUX_DIR = $(PLATFORM_DIR)/linux
LINUX_PACKAGE = koreader-linux-$(LINUX_ARCH_NAME)$(KODEDUG_SUFFIX)-$(VERSION).tar.xz
LINUX_PACKAGE_COMPRESSION_LEVEL ?= 9
LINUX_PACKAGE = koreader-linux-$(LINUX_ARCH)$(KODEDUG_SUFFIX)-$(VERSION).tar.xz
DIST_DIR = $(INSTALL_DIR)/dist
DIST_APPID = rocks.koreader.koreader
GLIBC_VERSION = $(shell ldd --version | sed -n '1s/.* \([0-9.]\+\)$$/\1/p')
define UPDATE_PATH_EXCLUDES +=
plugins/SSH.koplugin
plugins/autofrontlight.koplugin
plugins/timesync.koplugin
$(filter-out tools/trace_require.lua tools/wbuilder.lua,$(wildcard tools/*))
define mkupdate_linux
rm -rf $1
install -d $1/usr/lib
# Runtime.
cd $(INSTALL_DIR) && '$(abspath tools/mkrelease.sh)' $(abspath $1/usr/lib)/ . $(call release_excludes,koreader/)
# Add bin launcher indirection.
install -d $1/usr/bin
ln -s ../lib/koreader/koreader.sh $1/usr/bin/koreader
# Setup launcher to use ~/.config/koreader for writable storage.
sed -i -e 's/^# export @KOREADER_FLAVOR@$$/export KO_MULTIUSER=1/' $1/usr/lib/koreader/koreader.sh
# AppStream metadata.
install -D -m644 $(LINUX_DIR)/koreader.metainfo.xml $1/usr/share/metainfo/$(DIST_APPID).appdata.xml
sed -i -e 's/%%VERSION%%/$(VERSION)/' -e 's/%%DATE%%/$(RELEASE_DATE)/' $1/usr/share/metainfo/$(DIST_APPID).appdata.xml
# Copyright & license information.
install -D -m644 COPYING $(LINUX_DIR)/copyright -t $1/usr/share/doc/koreader/
# Desktop entry.
install -D -m644 $(LINUX_DIR)/koreader.desktop $1/usr/share/applications/$(DIST_APPID).desktop
# Icons.
install -D -m644 $(LINUX_DIR)/icons/256x256/koreader.png -t $1/usr/share/icons/hicolor/256x256/apps/
install -D -m644 $(LINUX_DIR)/icons/512x512/koreader.png -t $1/usr/share/icons/hicolor/512x512/apps/
install -D -m644 resources/koreader.svg -t $1/usr/share/icons/hicolor/scalable/apps/
# Man page.
install -D -m644 $(LINUX_DIR)/koreader.1 -t $1/usr/share/man/man1/
gzip -9 $1/usr/share/man/man1/koreader.1
endef
update: all
rm -rf $(INSTALL_DIR)/linux
mkdir -p $(INSTALL_DIR)/linux/{bin,lib,share/{applications,doc/koreader,man/man1,metainfo,pixmaps}}
sed -e 's/%%VERSION%%/$(VERSION)/g' -e 's/%%DATE%%/$(RELEASE_DATE)/' $(PLATFORM_DIR)/common/koreader.metainfo.xml >$(INSTALL_DIR)/linux/share/metainfo/koreader.metainfo.xml
$(SYMLINK) $(LINUX_DIR)/koreader.sh $(INSTALL_DIR)/linux/bin/koreader
$(SYMLINK) $(INSTALL_DIR)/koreader $(INSTALL_DIR)/linux/lib/
$(SYMLINK) resources/koreader.png $(INSTALL_DIR)/linux/share/pixmaps/
$(SYMLINK) $(LINUX_DIR)/koreader.desktop $(INSTALL_DIR)/linux/share/applications/
$(SYMLINK) $(LINUX_DIR)/copyright COPYING $(INSTALL_DIR)/linux/share/doc/koreader/
gzip -cn9 $(LINUX_DIR)/koreader.1 >$(INSTALL_DIR)/linux/share/man/man1/koreader.1.gz
# Add instructions.
update-txz: all
$(call mkupdate_linux,$(INSTALL_DIR)/txz)
# Add README.
sed -e 's/%%VERSION%%/$(VERSION)/' \
-e 's/%%ARCH%%/$(LINUX_ARCH_NAME)/' \
-e 's/%%ARCH%%/$(LINUX_ARCH)/' \
-e 's/%%ABI%%/$(GLIBC_VERSION)/' \
$(LINUX_DIR)/instructions.txt >$(INSTALL_DIR)/linux/README.md
# Create archive.
cd $(INSTALL_DIR)/linux && \
'$(abspath tools/mkrelease.sh)' \
$(if $(PARALLEL_JOBS),--jobs $(PARALLEL_JOBS)) \
--options=-$(LINUX_PACKAGE_COMPRESSION_LEVEL) \
'$(abspath $(LINUX_PACKAGE))' . $(call release_excludes,lib/koreader/)
$(LINUX_DIR)/instructions.txt >$(INSTALL_DIR)/txz/usr/README.md
# Create the final archive.
cd $(INSTALL_DIR)/txz/usr && $(strip $(abspath tools/mkrelease.sh) --epoch=$(RELEASE_DATE) $(if $(PARALLEL_JOBS),--jobs $(PARALLEL_JOBS)) --no-dereference $(if $(LINUX_PACKAGE_COMPRESSION),--options='$(LINUX_PACKAGE_COMPRESSION)') $(abspath $(LINUX_PACKAGE)) .)
# Cleanup.
rm -rf $(INSTALL_DIR)/txz
update: update-txz
include make/appimage.mk
include make/debian.mk
-25
View File
@@ -1,25 +0,0 @@
#!/bin/sh
export LC_ALL="en_US.UTF-8"
# working directory of koreader
KOREADER_DIR="${0%/*}"
if [ $# -eq 1 ] && [ -e "$(pwd)/${1}" ]; then
ARGS="$(pwd)/${1}"
else
ARGS="${*}"
fi
# we're always starting from our working directory
cd "${KOREADER_DIR}" || exit
RETURN_VALUE=85
while [ ${RETURN_VALUE} -eq 85 ]; do
./reader.lua "${ARGS}"
RETURN_VALUE=$?
# do not restart with saved arguments
ARGS="${HOME}"
done
exit ${RETURN_VALUE}
-9
View File
@@ -1,9 +0,0 @@
[Desktop Entry]
Name=KOReader
Comment=Ebook reader
Exec=reader.lua %u
Icon=koreader
Terminal=false
Type=Application
Categories=Graphics;
MimeType=application/epub+zip;application/fb2;application/fb3;application/msword;application/oxps;application/pdf;application/rtf;application/tcr;application/vnd.amazon.mobi8-ebook;application/vnd.comicbook+tar;application/vnd.comicbook+zip;application/vnd.ms-htmlhelp;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.palm;application/x-cbz;application/x-chm;application/x-fb2;application/x-fb3;application/x-mobipocket-ebook;application/x-tar;application/xhtml+xml;application/xml;application/zip;image/djvu;image/gif;image/jp2;image/jpeg;image/jxr;image/png;image/svg+xml;image/tiff;image/vnd.djvu;image/vnd.ms-photo;image/x-djvu;image/x-portable-arbitrarymap;image/x-portable-bitmap;text/html;text/plain;
+28
View File
@@ -0,0 +1,28 @@
#!/bin/sh
export LC_ALL="en_US.UTF-8"
# Working directory.
KOREADER_DIR="$(dirname "$(realpath "$0")")"
# export @KOREADER_FLAVOR@
# FIXME: handle multiple arguments.
if [ $# -eq 1 ] && [ -e "$(pwd)/$1" ]; then
ARGS="$(pwd)/$1"
else
ARGS="$*"
fi
# We're always starting from our working directory.
cd "${KOREADER_DIR}" || exit
RETURN_VALUE=85
while [ ${RETURN_VALUE} -eq 85 ]; do
./reader.lua "${ARGS}"
RETURN_VALUE=$?
# Do not restart with saved arguments.
ARGS="${HOME}"
done
exit ${RETURN_VALUE}
+27 -33
View File
@@ -3,21 +3,17 @@
set -eo pipefail
# Script to generate debian packages for KOReader
declare -r USAGE="
USAGE:
$0 OUTPUT_DEB INPUT_DIR [EXTRA_DPKG-DEB_OPTION]…
"
command_exists() {
type "$1" >/dev/null 2>/dev/null
}
uname_to_debian() {
case "$1" in
x86_64) echo "amd64" ;;
armv7l) echo "armhf" ;;
aarch64) echo "arm64" ;;
*) echo "$1" ;;
esac
}
write_changelog() {
CHANGELOG_PATH="${1}/share/doc/koreader/changelog.Debian.gz"
CHANGELOG_PATH="${1}/usr/share/doc/koreader/changelog.Debian.gz"
CHANGELOG=$(
cat <<END_HEREDOC
koreader ($2) stable; urgency=low
@@ -44,14 +40,19 @@ END_HEREDOC
chmod 644 "${CHANGELOG_PATH}"
}
if ! [ -r "${1}" ]; then
echo "${0}: can't find KOReader archive, please specify a path to a KOReader tar.gz" 1>&2
if [[ $# -lt 2 ]]; then
echo "${USAGE}" 1>&2
exit 1
fi
output_deb="$1"
input_dir="$2"
shift 2
# Check for required tools.
missing_tools=()
for tool in dpkg-deb fakeroot; do
# shellcheck disable=SC2043
for tool in dpkg-deb; do
if ! command_exists "${tool}"; then
missing_tools+=("${tool}")
fi
@@ -61,24 +62,18 @@ if [[ ${#missing_tools[@]} -ne 0 ]]; then
exit 1
fi
mkdir -p tmp-debian/usr
chmod 0755 tmp-debian/usr
tar -xf "${1}" -C tmp-debian/usr
rm -f tmp-debian/usr/README.md
ARCH="$(echo "${1}" | cut -d '-' -f3)"
VERSION="$(cut -f2 -dv "tmp-debian/usr/lib/koreader/git-rev" | cut -f1,2 -d-)"
DEB_ARCH="$(uname_to_debian "${ARCH}")"
BASE_DIR="tmp-debian"
IFS=_ read -r _package version arch <<<"${output_deb##*/}"
arch="${arch%.*}"
# populate debian control file
mkdir -p "${BASE_DIR}/DEBIAN"
cat >"${BASE_DIR}/DEBIAN/control" <<EOF
mkdir -p "${input_dir}/DEBIAN"
cat >"${input_dir}/DEBIAN/control" <<EOF
Section: graphics
Priority: optional
Depends: libsdl2-2.0-0, libc6 (>= 2.31)
Architecture: ${DEB_ARCH}
Version: ${VERSION}
Installed-Size: $(du -ks "${BASE_DIR}/usr/" | cut -f 1)
Depends: libc6 (>= 2.34), libdecor-0-0 (>= 0.1.0), libdrm2 (>= 2.4.46), libgbm1 (>= 8.1~0), libwayland-client0 (>= 1.20.0), libwayland-cursor0 (>= 1.0.2), libwayland-egl1 (>= 1.15.0), libx11-6 (>= 2:1.2.99.901), libxcursor1 (>> 1.1.2), libxext6, libxfixes3 (>= 1:5.0), libxi6 (>= 2:1.5.99.2), libxkbcommon0 (>= 0.5.0), libxrandr2 (>= 2:1.2.99.3), libxss1
Architecture: ${arch}
Version: ${version}
Installed-Size: $(du -ks "${input_dir}/usr/" | cut -f 1)
Package: koreader
Maintainer: koreader <null@koreader.rocks>
Homepage: https://koreader.rocks
@@ -110,16 +105,15 @@ Description: Ebook reader optimized for e-ink screens.
EOF
# use absolute path to luajit in reader.lua
sed -i 's,./luajit,/usr/lib/koreader/luajit,' "${BASE_DIR}/usr/lib/koreader/reader.lua"
sed -i 's,./luajit,/usr/lib/koreader/luajit,' "${input_dir}/usr/lib/koreader/reader.lua"
# lintian complains if shared libraries have execute rights.
find "${BASE_DIR}" -type f -perm /+x -name '*.so*' -print0 | xargs -0 chmod a-x
find "${input_dir}" -type f -perm /+x -name '*.so*' -print0 | xargs -0 chmod a-x
# remove misc files that are already summarized in usr/share/doc/koreader
find "${BASE_DIR}" '(' -name "*.md" -o -name "LICENSE" ')' -type f -print0 | xargs -0 rm -rf
find "${input_dir}" '(' -name "*.md" -o -name "LICENSE" ')' -type f -print0 | xargs -0 rm -rf
# add debian changelog
write_changelog "${BASE_DIR}/usr" "${VERSION}"
write_changelog "${input_dir}" "${version}"
fakeroot dpkg-deb -b "${BASE_DIR}" "koreader-${VERSION}-${DEB_ARCH}.deb"
rm -rf tmp-debian
dpkg-deb --build --root-owner-group "${@}" "${input_dir}" "${output_deb}"
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

-1
View File
@@ -4,7 +4,6 @@ KOReader %%VERSION%% (Linux %%ARCH%%)
## Requires
- `GLIBC` >= %%ABI%%
- `SDL2`
## Users
File renamed without changes.
-30
View File
@@ -1,30 +0,0 @@
#!/usr/bin/env bash
export LC_ALL="en_US.UTF-8"
# writable storage: ${HOME}/.config/koreader.
export KO_MULTIUSER=1
if [ $# -eq 1 ] && [ -e "$(pwd)/${1}" ]; then
ARGS="$(pwd)/${1}"
else
ARGS="${*}"
fi
# working directory of koreader
KOREADER_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../lib/koreader"
# we're always starting from our working directory
cd "${KOREADER_DIR}" || exit
RETURN_VALUE=85
while [ ${RETURN_VALUE} -eq 85 ]; do
./reader.lua "${ARGS}"
RETURN_VALUE=$?
# do not restart with saved arguments
ARGS="${HOME}"
done
# remove the flag to avoid emulator confusion
export -n KO_MULTIUSER
exit ${RETURN_VALUE}