mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Add generic Linux package (#9351)
Relates to https://github.com/koreader/koreader/issues/9268 Requires https://github.com/koreader/koreader-base/pull/1504 Usage: - `kodev release linux` for native package (same arch as host) - `LINUX_ARCH=arm release linux` for armhf on a x86_64 host. - `LINUX_ARCH=arm64 release linux` for arm64 on a x86_64 host. It produces a `koreader-linux-$ARCH-$VERSION.tar.xz` archive, where $ARCH follows `uname -m` convention {x86_64, armv7l, aarch64} To generate the debian package from the generic archive the following command is required `./platform/linux/do_debian_package.sh path_to.tar.xz`
This commit is contained in:
142
platform/linux/copyright
Normal file
142
platform/linux/copyright
Normal file
@@ -0,0 +1,142 @@
|
||||
Files: *
|
||||
Copyright: Copyright (C) 2012 - 2020 KOReader developers
|
||||
License: AGPL-3
|
||||
The full text of the AGPL-3 license is distributed with the software as in
|
||||
/usr/share/doc/koreader/COPYING on Debian systems.
|
||||
|
||||
Files: base
|
||||
Copyright: Various
|
||||
License: Various
|
||||
Have a look at https://github.com/koreader/koreader-base/tree/master/thirdparty
|
||||
for a exhaustive list of third party software distributed with this program.
|
||||
|
||||
Files: resources/fonts/nerdfonts
|
||||
Copyright: Copyright (C) 2014 Ryan L McIntyre
|
||||
License: MIT
|
||||
|
||||
Files: resources/fonts/noto
|
||||
Copyright: Copyright (C) 2018 The Noto Project Authors
|
||||
License: SIL OFL
|
||||
|
||||
Files: resources/fonts/urw
|
||||
Copyright: Copyright (C) 2019 URW Type Foundry GmbH
|
||||
License: AGPL-3
|
||||
As a special exception, permission is granted to include these font
|
||||
programs in a Postscript or PDF file that consists of a document that
|
||||
contains text to be displayed or printed using this font, regardless
|
||||
of the conditions or license applying to the document itself.
|
||||
|
||||
The full text of the AGPL-3 license is distributed with the software as in
|
||||
/usr/share/doc/koreader/COPYING on Debian systems.
|
||||
|
||||
|
||||
MIT License (for all the MIT licensed code indicated above)
|
||||
-----------------------------------------------------------
|
||||
Copyright (c) <YEAR>, <OWNER>
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
SIL Open Font License (for all the SIL licensed code indicated above)
|
||||
---------------------------------------------------------------------
|
||||
Copyright (c) <YEAR>, <OWNER>
|
||||
All rights reserved.
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font
|
||||
creation efforts of academic and linguistic communities, and to
|
||||
provide a free and open framework in which fonts may be shared and
|
||||
improved in partnership with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply to
|
||||
any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software
|
||||
components as distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to,
|
||||
deleting, or substituting -- in part or in whole -- any of the
|
||||
components of the Original Version, by changing formats or by porting
|
||||
the Font Software to a new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed,
|
||||
modify, redistribute, and sell modified and unmodified copies of the
|
||||
Font Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components, in
|
||||
Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the
|
||||
corresponding Copyright Holder. This restriction only applies to the
|
||||
primary font name as presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created using
|
||||
the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
109
platform/linux/do_debian_package.sh
Executable file
109
platform/linux/do_debian_package.sh
Executable file
@@ -0,0 +1,109 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
# 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 "$1"/*.ttf; do
|
||||
ln -snf "${syspath}/${FILE##*/}" "${FILE}"
|
||||
done
|
||||
}
|
||||
|
||||
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=$(
|
||||
cat <<'END_HEREDOC'
|
||||
koreader (0.1) unstable; urgency=low
|
||||
|
||||
* Fixes most lintian errors and warnings
|
||||
|
||||
-- Martín Fdez <paziusss@gmail.com> 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 <paziusss@gmail.com> Tue, 03 Jan 2019 00:00:00 +0100
|
||||
END_HEREDOC
|
||||
)
|
||||
|
||||
echo "${CHANGELOG}" | gzip -cn9 >"${CHANGELOG_PATH}"
|
||||
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
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for required tools.
|
||||
missing_tools=()
|
||||
for tool in dpkg-deb fakeroot; do
|
||||
if ! command_exists "${tool}"; then
|
||||
missing_tools+=("${tool}")
|
||||
fi
|
||||
done
|
||||
if [[ ${#missing_tools[@]} -ne 0 ]]; then
|
||||
echo "${0}: unable to build Debian package, the following tools are missing: ${missing_tools[*]}" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
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}")"
|
||||
BASE_DIR="tmp-debian"
|
||||
|
||||
# populate debian control file
|
||||
mkdir -p "${BASE_DIR}/DEBIAN"
|
||||
cat >"${BASE_DIR}/DEBIAN/control" <<EOF
|
||||
Section: graphics
|
||||
Priority: optional
|
||||
Depends: libsdl2-2.0-0, fonts-noto-hinted, fonts-droid-fallback, libc6 (>= 2.31)
|
||||
Architecture: ${DEB_ARCH}
|
||||
Version: ${VERSION}
|
||||
Installed-Size: $(du -ks "${BASE_DIR}/usr/" | cut -f 1)
|
||||
Package: koreader
|
||||
Maintainer: Martín Fdez <paziusss@gmail.com>
|
||||
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"
|
||||
|
||||
# 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.
|
||||
link_fonts "${BASE_DIR}/usr/lib/koreader/fonts/noto"
|
||||
|
||||
# DroidSansMono has a restrictive license. Replace it with DroidSansFallback
|
||||
ln -snf ../../../../share/fonts-droid-fallback/truetype/DroidSansFallback.ttf "${BASE_DIR}/usr/lib/koreader/fonts/droid/DroidSansMono.ttf"
|
||||
|
||||
# lintian complains if shared libraries have execute rights.
|
||||
find "${BASE_DIR}" -type f -perm /+x -name '*.so*' -print0 | xargs -0 chmod a-x
|
||||
|
||||
# add debian changelog
|
||||
write_changelog "${BASE_DIR}/usr"
|
||||
|
||||
fakeroot dpkg-deb -b "${BASE_DIR}" "koreader-${VERSION}-${DEB_ARCH}.deb"
|
||||
rm -rf tmp-debian
|
||||
41
platform/linux/koreader.1
Normal file
41
platform/linux/koreader.1
Normal file
@@ -0,0 +1,41 @@
|
||||
.TH KOReader 1 "May 4, 2020"
|
||||
.SH NAME
|
||||
koreader \- document viewer
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B koreader
|
||||
.RI [-dvp]
|
||||
.RI [file]
|
||||
|
||||
.SH DESCRIPTION
|
||||
.B KOReader
|
||||
is a document viewer primarily aimed at e-ink readers. This manual page documents briefly its desktop usage.
|
||||
|
||||
.SH OPTIONS
|
||||
|
||||
Call
|
||||
.B KOReader
|
||||
followed by a file to open it directly. Supported document formats include PDF, DjVu, XPS, CBZ, FB2, PDB, TXT, HTML, RTF, CHM, EPUB, DOC, MOBI, and ZIP
|
||||
.B files.
|
||||
|
||||
If no file is passed
|
||||
.B KOReader
|
||||
will start using user settings among a file manager (default), a history and the last document opened.
|
||||
|
||||
A list of
|
||||
.BI flags
|
||||
and their descriptions:
|
||||
|
||||
.PP
|
||||
.B -d start in debug mode
|
||||
.PP
|
||||
.B -v debug in verbose mode
|
||||
.PP
|
||||
.B -p enable Lua code profiling
|
||||
|
||||
.SH SETTINGS
|
||||
User settings are stored in ~/.config/koreader.
|
||||
|
||||
.SH SEE ALSO
|
||||
Online documentation: https://github.com/koreader/koreader/wiki
|
||||
.PP
|
||||
13
platform/linux/koreader.desktop
Normal file
13
platform/linux/koreader.desktop
Normal file
@@ -0,0 +1,13 @@
|
||||
[Desktop Entry]
|
||||
Name=KOReader
|
||||
Comment=KOReader is a document viewer
|
||||
Exec=koreader %u
|
||||
Icon=koreader
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Graphics;
|
||||
MimeType=application/pdf;application/x-cbz;application/epub+zip;image/vnd.djvu;text/plain;
|
||||
# Otherwise assumed incompatible with some mobile OSes
|
||||
# See <https://puri.sm/posts/specify-form-factors-in-your-librem-5-apps/>
|
||||
# and <https://github.com/koreader/koreader/issues/11118>
|
||||
X-Purism-FormFactor=Workstation;Mobile;
|
||||
31
platform/linux/koreader.sh
Executable file
31
platform/linux/koreader.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/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}
|
||||
|
||||
Reference in New Issue
Block a user