From 58a8c6b4764d8b9e54fc512920c48517b13791b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= Date: Tue, 16 Apr 2024 19:00:37 +0000 Subject: [PATCH 01/15] wip: linux package --- Makefile | 89 +++++++++------ kodev | 52 ++------- platform/debian/changelog | 11 -- platform/debian/do_debian_package.sh | 119 ------------------- platform/{debian => linux}/copyright | 0 platform/linux/do_debian_package.sh | 120 ++++++++++++++++++++ platform/{debian => linux}/koreader.1 | 0 platform/{debian => linux}/koreader.desktop | 0 platform/{debian => linux}/koreader.sh | 0 9 files changed, 182 insertions(+), 209 deletions(-) delete mode 100644 platform/debian/changelog delete mode 100755 platform/debian/do_debian_package.sh rename platform/{debian => linux}/copyright (100%) create mode 100755 platform/linux/do_debian_package.sh rename platform/{debian => linux}/koreader.1 (100%) rename platform/{debian => linux}/koreader.desktop (100%) rename platform/{debian => linux}/koreader.sh (100%) diff --git a/Makefile b/Makefile index 23c4b0c17..0119c09f1 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ endif # releases do not contain tests and misc data IS_RELEASE := $(if $(or $(EMULATE_READER),$(WIN32)),,1) -IS_RELEASE := $(if $(or $(IS_RELEASE),$(APPIMAGE),$(DEBIAN),$(MACOS)),1,) +IS_RELEASE := $(if $(or $(IS_RELEASE),$(APPIMAGE),$(LINUX),$(MACOS)),1,) ifeq ($(ANDROID_ARCH), arm64) ANDROID_ABI?=arm64-v8a @@ -31,6 +31,21 @@ endif ANDROID_VERSION?=$(shell git rev-list --count HEAD) ANDROID_NAME?=$(VERSION) +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) + +# set PATH to find CC in managed toolchains +ifeq ($(TARGET), android) + PATH:=$(ANDROID_TOOLCHAIN)/bin:$(PATH) +endif + MACHINE=$(shell $(CC) -dumpmachine 2>/dev/null) ifdef KODEBUG MACHINE:=$(MACHINE)-debug @@ -55,7 +70,7 @@ ANDROID_LIBS_ROOT:=$(ANDROID_LAUNCHER_DIR)/libs ANDROID_LIBS_ABI:=$(ANDROID_LIBS_ROOT)/$(ANDROID_ABI) APPIMAGE_DIR=$(PLATFORM_DIR)/appimage CERVANTES_DIR=$(PLATFORM_DIR)/cervantes -DEBIAN_DIR=$(PLATFORM_DIR)/debian +LINUX_DIR=$(PLATFORM_DIR)/linux KINDLE_DIR=$(PLATFORM_DIR)/kindle KOBO_DIR=$(PLATFORM_DIR)/kobo MACOS_DIR=$(PLATFORM_DIR)/mac @@ -100,9 +115,10 @@ endif ifdef ANDROID cd $(INSTALL_DIR)/koreader && \ ln -sf ../../$(ANDROID_DIR)/*.lua . -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 +endif ifdef WIN32 @echo "[*] Install runtime libraries for win32..." cd $(INSTALL_DIR)/koreader && cp ../../$(WIN32_DIR)/*.dll . @@ -414,31 +430,44 @@ androidupdate: all cp $(ANDROID_LAUNCHER_DIR)/bin/NativeActivity.apk \ koreader-android-$(ANDROID_ARCH)$(KODEDUG_SUFFIX)-$(VERSION).apk -debianupdate: all +LINUX_PACKAGE:=koreader-linux-$(LINUX_ARCH_NAME)$(KODEDUG_SUFFIX)-$(VERSION).tar.xz +linuxupdate: all mkdir -pv \ - $(INSTALL_DIR)/debian/usr/bin \ - $(INSTALL_DIR)/debian/usr/lib \ - $(INSTALL_DIR)/debian/usr/share/pixmaps \ - $(INSTALL_DIR)/debian/usr/share/applications \ - $(INSTALL_DIR)/debian/usr/share/doc/koreader \ - $(INSTALL_DIR)/debian/usr/share/man/man1 - - cp -pv resources/koreader.png $(INSTALL_DIR)/debian/usr/share/pixmaps - cp -pv $(DEBIAN_DIR)/koreader.desktop $(INSTALL_DIR)/debian/usr/share/applications - cp -pv $(DEBIAN_DIR)/copyright COPYING $(INSTALL_DIR)/debian/usr/share/doc/koreader - cp -pv $(DEBIAN_DIR)/koreader.sh $(INSTALL_DIR)/debian/usr/bin/koreader - cp -Lr $(INSTALL_DIR)/koreader $(INSTALL_DIR)/debian/usr/lib - - gzip -cn9 $(DEBIAN_DIR)/changelog > $(INSTALL_DIR)/debian/usr/share/doc/koreader/changelog.Debian.gz - gzip -cn9 $(DEBIAN_DIR)/koreader.1 > $(INSTALL_DIR)/debian/usr/share/man/man1/koreader.1.gz + $(INSTALL_DIR)/linux/usr/bin \ + $(INSTALL_DIR)/linux/usr/lib \ + $(INSTALL_DIR)/linux/usr/share/pixmaps \ + $(INSTALL_DIR)/linux/usr/share/applications \ + $(INSTALL_DIR)/linux/usr/share/doc/koreader \ + $(INSTALL_DIR)/linux/usr/share/man/man1 + + cp -pv resources/koreader.png $(INSTALL_DIR)/linux/usr/share/pixmaps + cp -pv $(LINUX_DIR)/koreader.desktop $(INSTALL_DIR)/linux/usr/share/applications + cp -pv $(LINUX_DIR)/copyright COPYING $(INSTALL_DIR)/linux/usr/share/doc/koreader + cp -pv $(LINUX_DIR)/koreader.sh $(INSTALL_DIR)/linux/usr/bin/koreader + cp -Lr $(INSTALL_DIR)/koreader $(INSTALL_DIR)/linux/usr/lib + + gzip -cn9 $(LINUX_DIR)/koreader.1 > $(INSTALL_DIR)/linux/usr/share/man/man1/koreader.1.gz chmod 644 \ - $(INSTALL_DIR)/debian/usr/share/doc/koreader/changelog.Debian.gz \ - $(INSTALL_DIR)/debian/usr/share/doc/koreader/copyright \ - $(INSTALL_DIR)/debian/usr/share/man/man1/koreader.1.gz + $(INSTALL_DIR)/linux/usr/share/doc/koreader/copyright \ + $(INSTALL_DIR)/linux/usr/share/man/man1/koreader.1.gz rm -rf \ - $(INSTALL_DIR)/debian/usr/lib/koreader/{ota,cache,clipboard,screenshots,spec,tools,resources/fonts,resources/icons/src} + $(INSTALL_DIR)/linux/usr/lib/koreader/{ota,cache,clipboard,screenshots,spec,tools,l10n/templates,resources/fonts,resources/icons/src} + + # remove leftovers + find $(INSTALL_DIR)/linux -type f \( -name ".git" -o -name ".gitignore" -o -name "discovery2spore" -o -name "wadl2spore" -o -name "*.txt" -o -name "LICENSE*" -o -name "NOTICE" -o -name "README.md" \) -print0 | xargs -0 rm -rf + find $(INSTALL_DIR)/linux -type d \( -name "test" -o -name ".github" \) -print0 | xargs -0 rm -rf + + # fix permissions + find $(INSTALL_DIR)/linux -type d -print0 | xargs -0 chmod 755 + find $(INSTALL_DIR)/linux -executable -type f -print0 | xargs -0 chmod 755 + find $(INSTALL_DIR)/linux -type f \( -name "COPYING" -o -name "git-rev" -o -name "*manifest" -o -name "*.cff" -o -name "*.css" -o -name "*.desktop" -o -name "*.json" -o -name "*.html" -o -name "*.lua" -o -name "*.pattern" -o -name "*.png" -o -name "*.otf" -o -name "*.po*" -o -name "*.so*" -o -name "*.svg" -o -name "*.template" -o -name "*.tpl" -o -name "*.ttf" \) -print0 | xargs -0 chmod 644 + find $(INSTALL_DIR)/linux -type f -name "reader.lua" -print0 | xargs -0 chmod 755 + cd $(INSTALL_DIR)/linux/usr && \ + XZ_OPT=9 tar -cvJf ../../../$(LINUX_PACKAGE) * + + rm -rf $(INSTALL_DIR)/linux macosupdate: all mkdir -p \ @@ -561,18 +590,8 @@ else ifeq ($(TARGET), remarkable) make remarkableupdate else ifeq ($(TARGET), ubuntu-touch) make utupdate -else ifeq ($(TARGET), debian) - make debianupdate - $(CURDIR)/platform/debian/do_debian_package.sh $(INSTALL_DIR) -else ifeq ($(TARGET), debian-armel) - make debianupdate - $(CURDIR)/platform/debian/do_debian_package.sh $(INSTALL_DIR) armel -else ifeq ($(TARGET), debian-armhf) - make debianupdate - $(CURDIR)/platform/debian/do_debian_package.sh $(INSTALL_DIR) armhf -else ifeq ($(TARGET), debian-arm64) - make debianupdate - $(CURDIR)/platform/debian/do_debian_package.sh $(INSTALL_DIR) arm64 +else ifeq ($(TARGET), linux) + make linuxupdate else ifeq ($(TARGET), macos) make macosupdate $(CURDIR)/platform/mac/do_mac_bundle.sh $(INSTALL_DIR) diff --git a/kodev b/kodev index 423b71602..eb2e52d0f 100755 --- a/kodev +++ b/kodev @@ -154,10 +154,7 @@ SUPPORTED_TARGETS=" pocketbook ubuntu-touch appimage - debian Debian package for current arch - debian-armel Debian package for generic armel devices - debian-armhf Debian package for generic armhf devices - debian-arm64 Debian package for generic 64 bits arm devices + linux macos MacOS app bundle. You need a mac to build this package emu (*default) If no TARGET is given, assume emulator win32 @@ -268,20 +265,8 @@ ${SUPPORTED_TARGETS}" make TARGET=appimage assert_ret_zero $? ;; - debian) - make TARGET=debian - assert_ret_zero $? - ;; - debian-armel) - make TARGET=debian-armel - assert_ret_zero $? - ;; - debian-armhf) - make TARGET=debian-armhf - assert_ret_zero $? - ;; - debian-arm64) - make TARGET=debian-arm64 + linux) + make TARGET=linux assert_ret_zero $? ;; macos) @@ -389,17 +374,8 @@ ${SUPPORTED_TARGETS}" appimage) make TARGET=appimage clean ;; - debian) - make TARGET=debian clean - ;; - debian-armel) - make TARGET=debian-armel clean - ;; - debian-armhf) - make TARGET=debian-armhf clean - ;; - debian-arm64) - make TARGET=debian-arm64 clean + linux) + make TARGET=linux clean ;; macos) is_mac @@ -540,21 +516,9 @@ ${SUPPORTED_RELEASE_TARGETS}" kodev-build appimage make TARGET=appimage update ;; - debian) - kodev-build debian - make TARGET=debian update - ;; - debian-armel) - kodev-build debian-armel - make TARGET=debian-armel update - ;; - debian-armhf) - kodev-build debian-armhf - make TARGET=debian-armhf update - ;; - debian-arm64) - kodev-build debian-arm64 - make TARGET=debian-arm64 update + linux) + kodev-build linux + make TARGET=linux update ;; macos) is_mac diff --git a/platform/debian/changelog b/platform/debian/changelog deleted file mode 100644 index 75b094a00..000000000 --- a/platform/debian/changelog +++ /dev/null @@ -1,11 +0,0 @@ -koreader (0.1) unstable; urgency=low - - * Fixes most lintian errors and warnings - - -- Martín Fdez Thu, 14 May 2020 00:00:00 +0100 - -koreader (0.0.1) experimental; urgency=low - - * Initial release as Debian package (Closes: https://github.com/koreader/koreader/issues/3108) - - -- Martín Fdez Tue, 03 Jan 2019 00:00:00 +0100 diff --git a/platform/debian/do_debian_package.sh b/platform/debian/do_debian_package.sh deleted file mode 100755 index 0be09c495..000000000 --- a/platform/debian/do_debian_package.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/bash -# Script to generate debian packages for KOReader -if [ -z "${1}" ]; then - echo "${0}: can't find KOReader build, please specify a path" - exit 1 -else - INSTALL_DIR="${1}" - VERSION="$(cut -f2 -dv "${1}/koreader/git-rev" | cut -f1,2 -d-)" -fi - -uname_to_debian() { - if [ "$(uname -m)" == "x86_64" ]; then - echo "amd64" - elif [ "$(uname -m)" == "i686" ]; then - echo "i686" - elif [ "$(uname -m)" == "arm64" ]; then - echo "aarch64" - else - echo "any" - fi -} - -link_fonts() { - syspath="../../../../share/fonts/truetype/$(basename "${1}")" - for FILE in *.ttf; do - rm -rf "${FILE}" - ln -s "${syspath}/${FILE}" "${FILE}" - done -} - -if [ -z "${2}" ]; then - ARCH="$(uname_to_debian)" -else - ARCH="${2}" -fi - -command_exists() { - type "$1" >/dev/null 2>/dev/null -} - -# Run only if dpkg-deb exists -COMMAND="dpkg-deb" -if command_exists "${COMMAND}"; then - BASE_DIR="${INSTALL_DIR}/debian/usr" - - # populate debian control file - mkdir -p "${INSTALL_DIR}/debian/DEBIAN" - { - echo "Section: graphics" - echo "Priority: optional" - echo "Depends: libsdl2-2.0-0, fonts-noto-hinted, fonts-droid-fallback, libc6 (>= 2.2.3)" - echo "Architecture: ${ARCH}" - echo "Version: ${VERSION}" - echo "Installed-Size: $(du -ks "${INSTALL_DIR}/debian/usr/" | cut -f 1)" - echo "Package: koreader" - echo "Maintainer: Martín Fdez " - echo "Homepage: https://koreader.rocks" - echo "Description: Ebook reader application supporting PDF, DjVu, EPUB, FB2 and many more formats" - echo " KOReader is a document viewer for E Ink devices." - echo " Supported fileformats include EPUB, PDF, DjVu, XPS, CBT," - echo " CBZ, FB2, PDB, TXT, HTML, RTF, CHM, DOC, MOBI and ZIP files." - echo " It’s available for Kindle, Kobo, PocketBook, Android and desktop Linux." - - } >"${INSTALL_DIR}/debian/DEBIAN/control" - - # remove leftovers - find "${BASE_DIR}" -type f -name ".git" -print0 | xargs -0 rm -rf - find "${BASE_DIR}" -type f -name ".gitignore" -print0 | xargs -0 rm -rf - find "${BASE_DIR}" -type f -name "discovery2spore" -print0 | xargs -0 rm -rf - find "${BASE_DIR}" -type f -name "wadl2spore" -print0 | xargs -0 rm -rf - find "${BASE_DIR}" -type d -name "test" -print0 | xargs -0 rm -rf - find "${BASE_DIR}" -type f -name "*.txt" -print0 | xargs -0 rm -rf - find "${BASE_DIR}" -type f -name "LICENSE" -print0 | xargs -0 rm -rf - find "${BASE_DIR}" -type f -name "NOTICE" -print0 | xargs -0 rm -rf - find "${BASE_DIR}" -type f -name "README.md" -print0 | xargs -0 rm -rf - find "${BASE_DIR}/lib" -type f -name "COPYING" -print0 | xargs -0 rm -rf - - # fix permissions - find "${BASE_DIR}" -type d -print0 | xargs -0 chmod 755 - find "${BASE_DIR}" -executable -type f -print0 | xargs -0 chmod 755 - find "${BASE_DIR}" -type f -name "*.cff" -print0 | xargs -0 chmod 644 - find "${BASE_DIR}" -type f -name "*.html" -print0 | xargs -0 chmod 644 - find "${BASE_DIR}" -type f -name "*.lua" -print0 | xargs -0 chmod 644 - find "${BASE_DIR}" -type f -name "*manifest" -print0 | xargs -0 chmod 644 - find "${BASE_DIR}" -type f -name "*.pattern" -print0 | xargs -0 chmod 644 - find "${BASE_DIR}" -type f -name "*.png" -print0 | xargs -0 chmod 644 - find "${BASE_DIR}" -type f -name "*.otf" -print0 | xargs -0 chmod 644 - find "${BASE_DIR}" -type f -name "*.po*" -print0 | xargs -0 chmod 644 - find "${BASE_DIR}" -type f -name "*.so*" -print0 | xargs -0 chmod 644 - find "${BASE_DIR}" -type f -name "*.ttf" -print0 | xargs -0 chmod 644 - find "${BASE_DIR}" -type f -name "git-rev" -print0 | xargs -0 chmod 644 - find "${BASE_DIR}" -type f -name "reader.lua" -print0 | xargs -0 chmod 755 - - # use absolute path to luajit in reader.lua - sed -i 's/.\/luajit/\/usr\/lib\/koreader\/luajit/' "${BASE_DIR}/lib/koreader/reader.lua" - - # use debian packaged fonts instead of our embedded ones to save a couple of MB. - # Note: avoid linking against fonts-noto-cjk-extra, cause it weights ~200MB. - (cd "${BASE_DIR}/lib/koreader/fonts/noto" && link_fonts "$(pwd)") - - # DroidSansMono has a restrictive license. Replace it with DroidSansFallback - ( - cd "${BASE_DIR}/lib/koreader/fonts/droid" && rm -rf DroidSansMono.ttf && - ln -s ../../../../share/fonts-droid-fallback/truetype/DroidSansFallback.ttf DroidSansMono.ttf - ) - - # try to remove rpath - if command_exists chrpath; then - find "${BASE_DIR}/lib/koreader/libs" -type f -name "*.so*" -print0 | xargs -0 chrpath -d - else - echo "chrpath tool not found. Skipping RPATH deletion" - fi - - (cd "${INSTALL_DIR}/.." && - fakeroot dpkg-deb -b "${INSTALL_DIR}/debian" "koreader-${VERSION}-${ARCH}.deb") -else - echo "${COMMAND} not found, unable to build Debian package" - exit 1 -fi diff --git a/platform/debian/copyright b/platform/linux/copyright similarity index 100% rename from platform/debian/copyright rename to platform/linux/copyright diff --git a/platform/linux/do_debian_package.sh b/platform/linux/do_debian_package.sh new file mode 100755 index 000000000..50ab6739e --- /dev/null +++ b/platform/linux/do_debian_package.sh @@ -0,0 +1,120 @@ +#!/bin/bash + +# Script to generate debian packages for KOReader + +command_exists() { + type "$1" >/dev/null 2>/dev/null +} + +link_fonts() { + syspath="../../../../share/fonts/truetype/$(basename "${1}")" + for FILE in *.ttf; do + rm -rf "${FILE}" + ln -s "${syspath}/${FILE}" "${FILE}" + done +} + +uname_to_debian() { + if [ "${1}" == "x86_64" ]; then + echo "amd64" + elif [ "${1}" == "armv7l" ]; then + echo "armhf" + elif [ "${1}" == "aarch64" ]; then + echo "arm64" + else + echo "${1}" + fi +} + +write_changelog() { + CHANGELOG_PATH="${1}/share/doc/koreader/changelog.Debian.gz" + CHANGELOG=$(cat << 'END_HEREDOC' +koreader (0.1) unstable; urgency=low + + * Fixes most lintian errors and warnings + + -- Martín Fdez Thu, 14 May 2020 00:00:00 +0100 + +koreader (0.0.1) experimental; urgency=low + + * Initial release as Debian package (Closes: https://github.com/koreader/koreader/issues/3108) + + -- Martín Fdez Tue, 03 Jan 2019 00:00:00 +0100 +END_HEREDOC +) + +echo "${CHANGELOG}" | gzip -cn9 > "${CHANGELOG_PATH}" +chmod 644 "${CHANGELOG_PATH}" +} + + +if [ -z "${1}" ]; then + echo "${0}: can't find KOReader archive, please specify a path to a KOReader tar.gz" + exit 1 +else + mkdir -p tmp-debian/usr + chmod 0755 tmp-debian/usr + tar -xf "${1}" -C tmp-debian/usr + 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}")" +fi + +# Run only if dpkg-deb exists +COMMAND="dpkg-deb" +if command_exists "${COMMAND}"; then + BASE_DIR="tmp-debian" + + # populate debian control file + mkdir -p "${BASE_DIR}/DEBIAN" + { + echo "Section: graphics" + echo "Priority: optional" + echo "Depends: libsdl2-2.0-0, fonts-noto-hinted, fonts-droid-fallback, libc6 (>= 2.2.3)" + echo "Architecture: ${DEB_ARCH}" + echo "Version: ${VERSION}" + echo "Installed-Size: $(du -ks "${BASE_DIR}/usr/" | cut -f 1)" + echo "Package: koreader" + echo "Maintainer: Martín Fdez " + echo "Homepage: https://koreader.rocks" + echo "Description: Ebook reader application supporting PDF, DjVu, EPUB, FB2 and many more formats" + echo " KOReader is a document viewer for E Ink devices." + echo " Supported fileformats include EPUB, PDF, DjVu, XPS, CBT," + echo " CBZ, FB2, PDB, TXT, HTML, RTF, CHM, DOC, MOBI and ZIP files." + echo " It’s available for Kindle, Kobo, PocketBook, Android and desktop Linux." + + } > "${BASE_DIR}/DEBIAN/control" + + # use absolute path to luajit in reader.lua + sed -i 's/.\/luajit/\/usr\/lib\/koreader\/luajit/' "${BASE_DIR}/usr/lib/koreader/reader.lua" + + # use debian packaged fonts instead of our embedded ones to save a couple of MB. + # Note: avoid linking against fonts-noto-cjk-extra, cause it weights ~200MB. + (cd "${BASE_DIR}/usr/lib/koreader/fonts/noto" && link_fonts "$(pwd)") + + # DroidSansMono has a restrictive license. Replace it with DroidSansFallback + ( + cd "${BASE_DIR}/usr/lib/koreader/fonts/droid" && rm -rf DroidSansMono.ttf && + ln -s ../../../../share/fonts-droid-fallback/truetype/DroidSansFallback.ttf DroidSansMono.ttf + ) + + # add debian changelog + write_changelog "${BASE_DIR}/usr" + + # try to remove rpath + if command_exists chrpath; then + find "${BASE_DIR}/usr/lib/koreader/libs" -type f -name "*.so*" -print0 | xargs -0 chrpath -d + else + echo "chrpath tool not found. Skipping RPATH deletion" + fi + + fakeroot dpkg-deb -b "${BASE_DIR}" "koreader-${VERSION}-${DEB_ARCH}.deb" +else + echo "${COMMAND} not found, unable to build Debian package" + exit 1 +fi + + +rm -rf tmp-debian + +#echo "${1} -> koreader-$DEB_ARCH-$VERSION.deb" diff --git a/platform/debian/koreader.1 b/platform/linux/koreader.1 similarity index 100% rename from platform/debian/koreader.1 rename to platform/linux/koreader.1 diff --git a/platform/debian/koreader.desktop b/platform/linux/koreader.desktop similarity index 100% rename from platform/debian/koreader.desktop rename to platform/linux/koreader.desktop diff --git a/platform/debian/koreader.sh b/platform/linux/koreader.sh similarity index 100% rename from platform/debian/koreader.sh rename to platform/linux/koreader.sh From 0313ab3fa62157c442e9e9be730a28b3bb49e244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= Date: Tue, 16 Apr 2024 19:02:55 +0000 Subject: [PATCH 02/15] remove leftovers --- Makefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Makefile b/Makefile index 0119c09f1..39aaa2aa2 100644 --- a/Makefile +++ b/Makefile @@ -41,10 +41,6 @@ else ifeq ($(LINUX_ARCH), arm) endif LINUX_ARCH_NAME?=$(LINUX_ARCH) -# set PATH to find CC in managed toolchains -ifeq ($(TARGET), android) - PATH:=$(ANDROID_TOOLCHAIN)/bin:$(PATH) -endif MACHINE=$(shell $(CC) -dumpmachine 2>/dev/null) ifdef KODEBUG From bc416a0413fcd4d9dfee7fd90cec44fe208529cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= Date: Tue, 16 Apr 2024 19:05:21 +0000 Subject: [PATCH 03/15] remove leftovers2 --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 39aaa2aa2..d3a61503c 100644 --- a/Makefile +++ b/Makefile @@ -111,10 +111,9 @@ endif ifdef ANDROID cd $(INSTALL_DIR)/koreader && \ ln -sf ../../$(ANDROID_DIR)/*.lua . - +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 -endif ifdef WIN32 @echo "[*] Install runtime libraries for win32..." cd $(INSTALL_DIR)/koreader && cp ../../$(WIN32_DIR)/*.dll . From 58e7fcfe9ee725943aa02c13ecb15c901776dfce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= Date: Wed, 1 May 2024 20:28:29 +0000 Subject: [PATCH 04/15] do not remove RPATH --- platform/linux/do_debian_package.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/platform/linux/do_debian_package.sh b/platform/linux/do_debian_package.sh index 50ab6739e..5e605c3de 100755 --- a/platform/linux/do_debian_package.sh +++ b/platform/linux/do_debian_package.sh @@ -101,13 +101,6 @@ if command_exists "${COMMAND}"; then # add debian changelog write_changelog "${BASE_DIR}/usr" - # try to remove rpath - if command_exists chrpath; then - find "${BASE_DIR}/usr/lib/koreader/libs" -type f -name "*.so*" -print0 | xargs -0 chrpath -d - else - echo "chrpath tool not found. Skipping RPATH deletion" - fi - fakeroot dpkg-deb -b "${BASE_DIR}" "koreader-${VERSION}-${DEB_ARCH}.deb" else echo "${COMMAND} not found, unable to build Debian package" From d55088d6dacea3ed0eea0fa0ef64a4a70e1b32c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= <975883+pazos@users.noreply.github.com> Date: Fri, 3 May 2024 21:28:40 +0200 Subject: [PATCH 05/15] Update platform/linux/do_debian_package.sh Co-authored-by: Benoit Pierre --- platform/linux/do_debian_package.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/platform/linux/do_debian_package.sh b/platform/linux/do_debian_package.sh index 5e605c3de..5159956da 100755 --- a/platform/linux/do_debian_package.sh +++ b/platform/linux/do_debian_package.sh @@ -15,15 +15,12 @@ link_fonts() { } uname_to_debian() { - if [ "${1}" == "x86_64" ]; then - echo "amd64" - elif [ "${1}" == "armv7l" ]; then - echo "armhf" - elif [ "${1}" == "aarch64" ]; then - echo "arm64" - else - echo "${1}" - fi + case "$1" in + x86_64) echo "amd64" ;; + armv7l) echo "armhf" ;; + aarch64) echo "arm64" ;; + *) echo "$1" ;; + esac } write_changelog() { From 8fe8506ff8d37561f57d3be7289551f781830a98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= <975883+pazos@users.noreply.github.com> Date: Fri, 3 May 2024 21:28:51 +0200 Subject: [PATCH 06/15] Update platform/linux/do_debian_package.sh Co-authored-by: Benoit Pierre --- platform/linux/do_debian_package.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/linux/do_debian_package.sh b/platform/linux/do_debian_package.sh index 5159956da..1d0205531 100755 --- a/platform/linux/do_debian_package.sh +++ b/platform/linux/do_debian_package.sh @@ -38,10 +38,10 @@ koreader (0.0.1) experimental; urgency=low -- Martín Fdez Tue, 03 Jan 2019 00:00:00 +0100 END_HEREDOC -) + ) -echo "${CHANGELOG}" | gzip -cn9 > "${CHANGELOG_PATH}" -chmod 644 "${CHANGELOG_PATH}" + echo "${CHANGELOG}" | gzip -cn9 >"${CHANGELOG_PATH}" + chmod 644 "${CHANGELOG_PATH}" } From f91c538378f08f3b4ccc97d1eb6cb9667f1aae7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= <975883+pazos@users.noreply.github.com> Date: Fri, 3 May 2024 21:29:10 +0200 Subject: [PATCH 07/15] Update platform/linux/do_debian_package.sh Co-authored-by: Benoit Pierre --- platform/linux/do_debian_package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux/do_debian_package.sh b/platform/linux/do_debian_package.sh index 1d0205531..24c225068 100755 --- a/platform/linux/do_debian_package.sh +++ b/platform/linux/do_debian_package.sh @@ -83,7 +83,7 @@ if command_exists "${COMMAND}"; then } > "${BASE_DIR}/DEBIAN/control" # 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,' "${BASE_DIR}/usr/lib/koreader/reader.lua" # use debian packaged fonts instead of our embedded ones to save a couple of MB. # Note: avoid linking against fonts-noto-cjk-extra, cause it weights ~200MB. From c31365c9a0794806aa35161c3630d22f122fc95c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= <975883+pazos@users.noreply.github.com> Date: Fri, 3 May 2024 21:29:55 +0200 Subject: [PATCH 08/15] Update platform/linux/do_debian_package.sh Co-authored-by: Benoit Pierre --- platform/linux/do_debian_package.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/platform/linux/do_debian_package.sh b/platform/linux/do_debian_package.sh index 24c225068..a87c053cb 100755 --- a/platform/linux/do_debian_package.sh +++ b/platform/linux/do_debian_package.sh @@ -90,10 +90,7 @@ if command_exists "${COMMAND}"; then (cd "${BASE_DIR}/usr/lib/koreader/fonts/noto" && link_fonts "$(pwd)") # DroidSansMono has a restrictive license. Replace it with DroidSansFallback - ( - cd "${BASE_DIR}/usr/lib/koreader/fonts/droid" && rm -rf DroidSansMono.ttf && - ln -s ../../../../share/fonts-droid-fallback/truetype/DroidSansFallback.ttf DroidSansMono.ttf - ) + ln -snf ../../../../share/fonts-droid-fallback/truetype/DroidSansFallback.ttf "${BASE_DIR}/usr/lib/koreader/fonts/droid/DroidSansMono.ttf" # add debian changelog write_changelog "${BASE_DIR}/usr" From 60367e3bd07b33ba0737883c358b0d7fc82fd59b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= <975883+pazos@users.noreply.github.com> Date: Fri, 3 May 2024 21:30:08 +0200 Subject: [PATCH 09/15] Update platform/linux/do_debian_package.sh Co-authored-by: Benoit Pierre --- platform/linux/do_debian_package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux/do_debian_package.sh b/platform/linux/do_debian_package.sh index a87c053cb..211e07f99 100755 --- a/platform/linux/do_debian_package.sh +++ b/platform/linux/do_debian_package.sh @@ -97,7 +97,7 @@ if command_exists "${COMMAND}"; then fakeroot dpkg-deb -b "${BASE_DIR}" "koreader-${VERSION}-${DEB_ARCH}.deb" else - echo "${COMMAND} not found, unable to build Debian package" + echo "${COMMAND} not found, unable to build Debian package" 1>&2 exit 1 fi From 02d4f9143f7f603defdd46541a5104df6063fa62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= <975883+pazos@users.noreply.github.com> Date: Fri, 3 May 2024 21:30:28 +0200 Subject: [PATCH 10/15] Update platform/linux/do_debian_package.sh Co-authored-by: Benoit Pierre --- platform/linux/do_debian_package.sh | 33 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/platform/linux/do_debian_package.sh b/platform/linux/do_debian_package.sh index 211e07f99..67382e262 100755 --- a/platform/linux/do_debian_package.sh +++ b/platform/linux/do_debian_package.sh @@ -64,23 +64,22 @@ if command_exists "${COMMAND}"; then # populate debian control file mkdir -p "${BASE_DIR}/DEBIAN" - { - echo "Section: graphics" - echo "Priority: optional" - echo "Depends: libsdl2-2.0-0, fonts-noto-hinted, fonts-droid-fallback, libc6 (>= 2.2.3)" - echo "Architecture: ${DEB_ARCH}" - echo "Version: ${VERSION}" - echo "Installed-Size: $(du -ks "${BASE_DIR}/usr/" | cut -f 1)" - echo "Package: koreader" - echo "Maintainer: Martín Fdez " - echo "Homepage: https://koreader.rocks" - echo "Description: Ebook reader application supporting PDF, DjVu, EPUB, FB2 and many more formats" - echo " KOReader is a document viewer for E Ink devices." - echo " Supported fileformats include EPUB, PDF, DjVu, XPS, CBT," - echo " CBZ, FB2, PDB, TXT, HTML, RTF, CHM, DOC, MOBI and ZIP files." - echo " It’s available for Kindle, Kobo, PocketBook, Android and desktop Linux." - - } > "${BASE_DIR}/DEBIAN/control" + cat >"${BASE_DIR}/DEBIAN/control" <= 2.2.3) +Architecture: ${DEB_ARCH} +Version: ${VERSION} +Installed-Size: $(du -ks "${BASE_DIR}/usr/" | cut -f 1) +Package: koreader +Maintainer: Martín Fdez +Homepage: https://koreader.rocks +Description: Ebook reader application supporting PDF, DjVu, EPUB, FB2 and many more formats + KOReader is a document viewer for E Ink devices. + Supported fileformats include EPUB, PDF, DjVu, XPS, CBT, + CBZ, FB2, PDB, TXT, HTML, RTF, CHM, DOC, MOBI and ZIP files. + It’s available for Kindle, Kobo, PocketBook, Android and desktop Linux. +EOF # use absolute path to luajit in reader.lua sed -i 's,./luajit,/usr/lib/koreader/luajit,' "${BASE_DIR}/usr/lib/koreader/reader.lua" From 5dce604f20905a95a8f3d8bdce8a973d0d4e2d8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= <975883+pazos@users.noreply.github.com> Date: Fri, 3 May 2024 21:30:48 +0200 Subject: [PATCH 11/15] Update Makefile Co-authored-by: Benoit Pierre --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d3a61503c..4d094c33b 100644 --- a/Makefile +++ b/Makefile @@ -459,8 +459,7 @@ linuxupdate: all find $(INSTALL_DIR)/linux -executable -type f -print0 | xargs -0 chmod 755 find $(INSTALL_DIR)/linux -type f \( -name "COPYING" -o -name "git-rev" -o -name "*manifest" -o -name "*.cff" -o -name "*.css" -o -name "*.desktop" -o -name "*.json" -o -name "*.html" -o -name "*.lua" -o -name "*.pattern" -o -name "*.png" -o -name "*.otf" -o -name "*.po*" -o -name "*.so*" -o -name "*.svg" -o -name "*.template" -o -name "*.tpl" -o -name "*.ttf" \) -print0 | xargs -0 chmod 644 find $(INSTALL_DIR)/linux -type f -name "reader.lua" -print0 | xargs -0 chmod 755 - cd $(INSTALL_DIR)/linux/usr && \ - XZ_OPT=9 tar -cvJf ../../../$(LINUX_PACKAGE) * + XZ_OPT=9 tar -C $(INSTALL_DIR)/linux/usr -cvJf $(INSTALL_DIR)/$(LINUX_PACKAGE) . rm -rf $(INSTALL_DIR)/linux From 037969b1312f0a04a17cc45ee426001ac64770b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= <975883+pazos@users.noreply.github.com> Date: Fri, 3 May 2024 21:30:55 +0200 Subject: [PATCH 12/15] Update platform/linux/do_debian_package.sh Co-authored-by: Benoit Pierre --- platform/linux/do_debian_package.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/platform/linux/do_debian_package.sh b/platform/linux/do_debian_package.sh index 67382e262..4c6cde517 100755 --- a/platform/linux/do_debian_package.sh +++ b/platform/linux/do_debian_package.sh @@ -100,7 +100,6 @@ else exit 1 fi - rm -rf tmp-debian #echo "${1} -> koreader-$DEB_ARCH-$VERSION.deb" From b2bce81dd719e83ab61b373ae1b7209341b443e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= <975883+pazos@users.noreply.github.com> Date: Fri, 3 May 2024 21:31:01 +0200 Subject: [PATCH 13/15] Update platform/linux/do_debian_package.sh Co-authored-by: Benoit Pierre --- platform/linux/do_debian_package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux/do_debian_package.sh b/platform/linux/do_debian_package.sh index 4c6cde517..7ecce024e 100755 --- a/platform/linux/do_debian_package.sh +++ b/platform/linux/do_debian_package.sh @@ -46,7 +46,7 @@ END_HEREDOC if [ -z "${1}" ]; then - echo "${0}: can't find KOReader archive, please specify a path to a KOReader tar.gz" + echo "${0}: can't find KOReader archive, please specify a path to a KOReader tar.gz" 1>&2 exit 1 else mkdir -p tmp-debian/usr From b1c9bee115a1a3a1c7e61ae3ba0c3263424ae961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= <975883+pazos@users.noreply.github.com> Date: Fri, 3 May 2024 21:31:07 +0200 Subject: [PATCH 14/15] Update platform/linux/do_debian_package.sh Co-authored-by: Benoit Pierre --- platform/linux/do_debian_package.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/platform/linux/do_debian_package.sh b/platform/linux/do_debian_package.sh index 7ecce024e..7cc5bb328 100755 --- a/platform/linux/do_debian_package.sh +++ b/platform/linux/do_debian_package.sh @@ -44,7 +44,6 @@ END_HEREDOC chmod 644 "${CHANGELOG_PATH}" } - if [ -z "${1}" ]; then echo "${0}: can't find KOReader archive, please specify a path to a KOReader tar.gz" 1>&2 exit 1 From 50110ecb5cec4cf68e27dfa2da021305af110b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= <975883+pazos@users.noreply.github.com> Date: Fri, 3 May 2024 21:31:18 +0200 Subject: [PATCH 15/15] Update platform/linux/do_debian_package.sh Co-authored-by: Benoit Pierre --- platform/linux/do_debian_package.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/linux/do_debian_package.sh b/platform/linux/do_debian_package.sh index 7cc5bb328..9e59016ce 100755 --- a/platform/linux/do_debian_package.sh +++ b/platform/linux/do_debian_package.sh @@ -1,5 +1,6 @@ #!/bin/bash +set -eo pipefail # Script to generate debian packages for KOReader command_exists() {