[feat] Build AppImage (#3850)

References #1417.
pull/3852/head
Frans de Jonge 6 years ago committed by GitHub
parent 0e61eb7a7b
commit ab712f1a29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -35,17 +35,20 @@ KINDLE_DIR=$(PLATFORM_DIR)/kindle
KOBO_DIR=$(PLATFORM_DIR)/kobo
POCKETBOOK_DIR=$(PLATFORM_DIR)/pocketbook
UBUNTUTOUCH_DIR=$(PLATFORM_DIR)/ubuntu-touch
APPIMAGE_DIR=$(PLATFORM_DIR)/appimage
ANDROID_DIR=$(PLATFORM_DIR)/android
ANDROID_LAUNCHER_DIR:=$(ANDROID_DIR)/luajit-launcher
UBUNTUTOUCH_SDL_DIR:=$(UBUNTUTOUCH_DIR)/ubuntu-touch-sdl
WIN32_DIR=$(PLATFORM_DIR)/win32
# appimage setup
APPIMAGETOOL=appimagetool-x86_64.AppImage
APPIMAGETOOL_URL=https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
# files to link from main directory
INSTALL_FILES=reader.lua setupkoenv.lua frontend resources defaults.lua datastorage.lua \
l10n tools README.md COPYING
all: $(if $(ANDROID),,$(KOR_BASE)/$(OUTPUT_DIR)/luajit)
$(MAKE) -C $(KOR_BASE)
install -d $(INSTALL_DIR)/koreader
@ -292,6 +295,32 @@ utupdate: all
click build koreader && \
mv *.click ../../koreader-$(DIST)-$(MACHINE)-$(VERSION).click
appimageupdate: all
# remove old package if any
rm -f koreader-appimage-$(MACHINE)-$(VERSION).appimage
ln -sf ../../$(APPIMAGE_DIR)/AppRun $(INSTALL_DIR)/koreader
ln -sf ../../$(APPIMAGE_DIR)/koreader.appdata.xml $(INSTALL_DIR)/koreader
ln -sf ../../$(APPIMAGE_DIR)/koreader.desktop $(INSTALL_DIR)/koreader
ln -sf ../../$(UBUNTUTOUCH_DIR)/koreader.png $(INSTALL_DIR)/koreader
# TODO at best this is DebUbuntu specific
ln -sf /usr/lib/x86_64-linux-gnu/libSDL2.so $(INSTALL_DIR)/koreader/libs
ifeq ("$(wildcard $(APPIMAGETOOL))","")
# download appimagetool
wget "$(APPIMAGETOOL_URL)"
chmod a+x "$(APPIMAGETOOL)"
endif
cd $(INSTALL_DIR) && pwd && \
rm -rf tmp && mkdir -p tmp && \
cp -Lr koreader tmp && \
rm -rf tmp/koreader/ota && \
rm -rf tmp/koreader/resources/icons/src && \
rm -rf tmp/koreader/spec
# generate AppImage
cd $(INSTALL_DIR)/tmp && \
ARCH=x86_64 ../../$(APPIMAGETOOL) koreader && \
mv *.AppImage ../../koreader-$(DIST)-$(MACHINE)-$(VERSION).AppImage
androidupdate: all
mkdir -p $(ANDROID_LAUNCHER_DIR)/assets/module
@ -336,6 +365,8 @@ else ifeq ($(TARGET), pocketbook)
make pbupdate
else ifeq ($(TARGET), ubuntu-touch)
make utupdate
else ifeq ($(TARGET), appimage)
make appimageupdate
else ifeq ($(TARGET), android)
make androidupdate
endif

@ -1 +1 @@
Subproject commit 2ed403b617cdb189d47b8eec9700144ec887a748
Subproject commit 3f0084f1d7457941303a29c576268944c47df071

@ -15,8 +15,10 @@ function DataStorage:getDataDir()
elseif os.getenv("UBUNTU_APPLICATION_ISOLATION") then
local app_id = os.getenv("APP_ID")
local package_name = app_id:match("^(.-)_")
-- confinded ubuntu app has write access to this dir
-- confined ubuntu app has write access to this dir
data_dir = string.format("%s/%s", os.getenv("XDG_DATA_HOME"), package_name)
elseif os.getenv("APPIMAGE") then
data_dir = string.format("%s/%s/%s", os.getenv("HOME"), ".config", "koreader")
else
data_dir = "."
end

@ -99,7 +99,7 @@ function QuickStart:getQuickStart()
FileConverter:writeStringToFile(quickstart_html, quickstart_filename)
end
end
-- remember filemaname for file manager
-- remember filename for file manager
self.quickstart_filename = quickstart_filename
G_reader_settings:saveSetting("quickstart_shown_version", version)
return quickstart_filename

14
kodev

@ -117,6 +117,7 @@ SUPPORTED_TARGETS="
android
pocketbook
ubuntu-touch
appimage
emu (*default) If no TARGET is given, assume emulator
win32
"
@ -215,6 +216,10 @@ ${SUPPORTED_TARGETS}"
make TARGET=ubuntu-touch
assert_ret_zero $?
;;
appimage)
make TARGET=appimage
assert_ret_zero $?
;;
win32)
make TARGET=win32
assert_ret_zero $?
@ -268,6 +273,9 @@ ${SUPPORTED_TARGETS}"
ubuntu-touch)
make TARGET=ubuntu-touch clean
;;
appimage)
make TARGET=appimage clean
;;
win32)
make TARGET=win32 clean
;;
@ -372,9 +380,13 @@ ${SUPPORTED_RELEASE_TARGETS}"
make TARGET=pocketbook update
;;
ubuntu-touch)
kodev-build pocketbook
kodev-build ubuntu-touch
make TARGET=ubuntu-touch update
;;
appimage)
kodev-build appimage
make TARGET=appimage update
;;
*)
echo "Unsupported target for release: $1."
echo "${RELEASE_HELP_MSG}"

@ -0,0 +1,30 @@
#!/bin/sh
export LC_ALL="en_US.UTF-8"
# working directory of koreader
KOREADER_DIR="${0%/*}"
# we're always starting from our working directory
cd "${KOREADER_DIR}" || exit
# export load library path for some old firmware
export LD_LIBRARY_PATH=${KOREADER_DIR}/libs:$LD_LIBRARY_PATH
# export external font directory
export EXT_FONT_DIR="${HOME}/.fonts"
RETURN_VALUE=85
if [ $# -eq 0 ]; then
# no arguments
start_path=~/Documents
else
start_path="$*"
fi
while [ $RETURN_VALUE -eq 85 ]; do
./reader.lua -d "$start_path"
RETURN_VALUE=$?
done
exit $RETURN_VALUE

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<component>
<id>org.koreader.KOReader</id>
<launchable type="desktop-id">org.koreader.KOReader.desktop</launchable>
<metadata_license>CC0-1.0</metadata_license>
<project_license>AGPL</project_license>
<name>KOReader</name>
<summary>A document viewer for DjVu, PDF, EPUB and more</summary>
<description>
<p>
KOReader is a document viewer for E Ink devices. It supports PDF, DjVu, XPS, CBT, CBZ, FB2, PDB, TXT, HTML, RTF, CHM, EPUB, DOC, MOBI, and ZIP files. It currently runs on Kindle, Kobo, PocketBook, Ubuntu Touch and Android devices.
</p>
</description>
<screenshots>
<screenshot type="default">
<image>https://cloud.githubusercontent.com/assets/24273478/26781004/9fdb0e8e-49ec-11e7-8de4-92cd08bf80ea.png</image>
</screenshot>
</screenshots>
<url type="homepage">https://koreader.rocks/</url>
<url type="bugtracker">https://github.com/koreader/koreader/issues</url>
<url type="faq">https://github.com/koreader/koreader/wiki</url>
<url type="translate">https://github.com/koreader/koreader#translation</url>
<categories>
<category>Document viewers</category>
</categories>
<update_contact></update_contact>
</component>

@ -0,0 +1,7 @@
[Desktop Entry]
Name=KOReader
Comment=KOReader is a document viewer
Exec=reader.lua %u
Icon=koreader
Terminal=false
Type=Application
Loading…
Cancel
Save