mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,6 +1,8 @@
|
||||
.DS_*
|
||||
._*
|
||||
*.AppImage
|
||||
*.app
|
||||
*.dmg
|
||||
*.directory
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
15
Makefile
15
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)),1,)
|
||||
IS_RELEASE := $(if $(or $(IS_RELEASE),$(APPIMAGE),$(DEBIAN),$(MACOS)),1,)
|
||||
|
||||
ANDROID_ARCH?=arm
|
||||
# Use the git commit count as the (integer) Android version code
|
||||
@@ -50,6 +50,7 @@ CERVANTES_DIR=$(PLATFORM_DIR)/cervantes
|
||||
DEBIAN_DIR=$(PLATFORM_DIR)/debian
|
||||
KINDLE_DIR=$(PLATFORM_DIR)/kindle
|
||||
KOBO_DIR=$(PLATFORM_DIR)/kobo
|
||||
MACOS_DIR=$(PLATFORM_DIR)/mac
|
||||
POCKETBOOK_DIR=$(PLATFORM_DIR)/pocketbook
|
||||
REMARKABLE_DIR=$(PLATFORM_DIR)/remarkable
|
||||
SONY_PRSTUX_DIR=$(PLATFORM_DIR)/sony-prstux
|
||||
@@ -399,6 +400,15 @@ debianupdate: all
|
||||
rm -rf \
|
||||
$(INSTALL_DIR)/debian/usr/lib/koreader/{ota,cache,clipboard,screenshots,spec,tools,resources/fonts,resources/icons/src}
|
||||
|
||||
macosupdate: all
|
||||
mkdir -p \
|
||||
$(INSTALL_DIR)/bundle/Contents/MacOS \
|
||||
$(INSTALL_DIR)/bundle/Contents/Resources
|
||||
|
||||
cp $(MACOS_DIR)/koreader.sh $(INSTALL_DIR)/bundle/Contents/MacOS/koreader
|
||||
cp resources/koreader.icns $(INSTALL_DIR)/bundle/Contents/Resources/icon.icns
|
||||
cp -LR $(INSTALL_DIR)/koreader $(INSTALL_DIR)/bundle/Contents/Resources
|
||||
|
||||
REMARKABLE_PACKAGE:=koreader-remarkable$(KODEDUG_SUFFIX)-$(VERSION).zip
|
||||
REMARKABLE_PACKAGE_OTA:=koreader-remarkable$(KODEDUG_SUFFIX)-$(VERSION).targz
|
||||
remarkableupdate: all
|
||||
@@ -518,6 +528,9 @@ else ifeq ($(TARGET), debian-armel)
|
||||
else ifeq ($(TARGET), debian-armhf)
|
||||
make debianupdate
|
||||
$(CURDIR)/platform/debian/do_debian_package.sh $(INSTALL_DIR) armhf
|
||||
else ifeq ($(TARGET), macos)
|
||||
make macosupdate
|
||||
$(CURDIR)/platform/mac/do_mac_bundle.sh $(INSTALL_DIR)
|
||||
endif
|
||||
|
||||
androiddev: androidupdate
|
||||
|
||||
2
base
2
base
Submodule base updated: 0c326d6eee...b4124d64d4
@@ -18,13 +18,7 @@ end
|
||||
|
||||
-- open is the macOS counterpart
|
||||
local function hasMacOpen()
|
||||
local std_out = io.popen("open")
|
||||
local all = nil
|
||||
if std_out ~= nil then
|
||||
all = std_out:read()
|
||||
std_out:close()
|
||||
end
|
||||
return all ~= nil
|
||||
return os.execute("open >/dev/null 2>&1") == 256
|
||||
end
|
||||
|
||||
-- get the name of the binary used to open links
|
||||
@@ -86,7 +80,11 @@ local Device = Generic:new{
|
||||
openLink = function(self, link)
|
||||
local enabled, tool = getLinkOpener()
|
||||
if not enabled or not tool or not link or type(link) ~= "string" then return end
|
||||
return os.execute('env -u LD_LIBRARY_PATH '..tool.." '"..link.."'") == 0
|
||||
if jit.os == "OSX" then
|
||||
return os.execute(tool .. " '" .. link .. "'") == 0
|
||||
else
|
||||
return os.execute('env -u LD_LIBRARY_PATH '..tool.." '"..link.."'") == 0
|
||||
end
|
||||
end,
|
||||
canExternalDictLookup = yes,
|
||||
getExternalDictLookupList = getExternalDicts,
|
||||
@@ -135,6 +133,11 @@ local Linux = Device:new{
|
||||
isDesktop = yes,
|
||||
}
|
||||
|
||||
local Mac = Device:new{
|
||||
model = "Mac",
|
||||
isDesktop = yes,
|
||||
}
|
||||
|
||||
local UbuntuTouch = Device:new{
|
||||
model = "UbuntuTouch",
|
||||
hasFrontlight = yes,
|
||||
@@ -356,7 +359,11 @@ end
|
||||
if os.getenv("APPIMAGE") then
|
||||
return AppImage
|
||||
elseif os.getenv("KO_MULTIUSER") then
|
||||
return Linux
|
||||
if jit.os == "OSX" then
|
||||
return Mac
|
||||
else
|
||||
return Linux
|
||||
end
|
||||
elseif os.getenv("UBUNTU_APPLICATION_ISOLATION") then
|
||||
return UbuntuTouch
|
||||
else
|
||||
|
||||
22
kodev
22
kodev
@@ -1,5 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
is_mac() {
|
||||
if [ "$(uname -s)" != "Darwin" ]; then
|
||||
echo "You need a mac to build this package"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
CURDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
VERSION=$(git describe HEAD)
|
||||
# Only append date if we're not on a whole version, like v2018.11
|
||||
@@ -125,6 +132,7 @@ SUPPORTED_TARGETS="
|
||||
debian Debian package for current arch
|
||||
debian-armel Debian package for generic armel devices
|
||||
debian-armhf Debian package for generic armhf devices
|
||||
macos MacOS app bundle. You need a mac to build this package
|
||||
emu (*default) If no TARGET is given, assume emulator
|
||||
win32
|
||||
"
|
||||
@@ -243,6 +251,11 @@ ${SUPPORTED_TARGETS}"
|
||||
make TARGET=debian-armhf
|
||||
assert_ret_zero $?
|
||||
;;
|
||||
macos)
|
||||
is_mac
|
||||
make TARGET=macos
|
||||
assert_ret_zero $?
|
||||
;;
|
||||
win32)
|
||||
make TARGET=win32
|
||||
assert_ret_zero $?
|
||||
@@ -335,6 +348,10 @@ ${SUPPORTED_TARGETS}"
|
||||
debian-armhf)
|
||||
make TARGET=debian-armhf clean
|
||||
;;
|
||||
macos)
|
||||
is_mac
|
||||
make TARGET=macos clean
|
||||
;;
|
||||
win32)
|
||||
make TARGET=win32 clean
|
||||
;;
|
||||
@@ -468,6 +485,11 @@ ${SUPPORTED_RELEASE_TARGETS}"
|
||||
kodev-build debian-armhf
|
||||
make TARGET=debian-armhf update
|
||||
;;
|
||||
macos)
|
||||
is_mac
|
||||
kodev-build macos
|
||||
make TARGET=macos update
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported target for release: $1."
|
||||
echo "${RELEASE_HELP_MSG}"
|
||||
|
||||
106
platform/mac/do_mac_bundle.sh
Executable file
106
platform/mac/do_mac_bundle.sh
Executable file
@@ -0,0 +1,106 @@
|
||||
#!/bin/bash
|
||||
# Script to generate mac application bundles for KOReader
|
||||
|
||||
command_exists() {
|
||||
type "$1" >/dev/null 2>/dev/null
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
cat <<EOF >"${INSTALL_DIR}/bundle/Contents/Info.plist"
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>KOReader</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>koreader</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>koreader.rocks</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>KOReader</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${VERSION}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>icon</string>
|
||||
</dict>
|
||||
</plist>
|
||||
EOF
|
||||
|
||||
APP_PATH="${INSTALL_DIR}/bundle"
|
||||
APP_BUNDLE="${INSTALL_DIR}/../KOReader"
|
||||
|
||||
# Use otool to change rpath of libraries.
|
||||
# Along with libs, serialize.so in common also needs to be fixed
|
||||
pushd "${INSTALL_DIR}/bundle/Contents/Resources/koreader" || exit 1
|
||||
for directory in common libs; do
|
||||
directoryName=$(basename "${directory}")
|
||||
echo "Checking ${directory}"
|
||||
pushd "${directory}" || exit 1
|
||||
for libToCheck in *.so *.dylib; do
|
||||
# there may be more than one library to fix, so get all of them and iterate
|
||||
libsToChange=$(otool -L "${libToCheck}" | grep "Users.*x86_64" | tr -s " " | cut -f1 -d" ")
|
||||
if [ -z "${libsToChange}" ]; then
|
||||
echo "Nothing to do, skipping ${libToCheck}"
|
||||
else
|
||||
for libToChange in ${libsToChange}; do
|
||||
fileNameOfLibToChange=$(basename "${libToChange}")
|
||||
if [ "${libToCheck}" = "${fileNameOfLibToChange}" ]; then
|
||||
echo "Skipping recursive ${libToChange} ${libToCheck}"
|
||||
else
|
||||
echo "Fixing ${libToCheck} ${libToChange}"
|
||||
install_name_tool -change "${libToChange}" "${directoryName}/${fileNameOfLibToChange}" "${libToCheck}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
popd || exit 1
|
||||
done
|
||||
popd || exit 1
|
||||
|
||||
# remove things from the bundle
|
||||
rm -rf \
|
||||
"${APP_PATH}/Contents/Resources/koreader/cache" \
|
||||
"${APP_PATH}/Contents/Resources/koreader/clipboard" \
|
||||
"${APP_PATH}/Contents/Resources/koreader/history" \
|
||||
"${APP_PATH}/Contents/Resources/koreader/ota" \
|
||||
"${APP_PATH}/Contents/Resources/koreader/resources/fonts" \
|
||||
"${APP_PATH}/Contents/Resources/koreader/resources/icons/src" \
|
||||
"${APP_PATH}/Contents/Resources/koreader/resources/kobo-touch.probe.png" \
|
||||
"${APP_PATH}/Contents/Resources/koreader/resources/koreader.icns" \
|
||||
"${APP_PATH}/Contents/Resources/koreader/rocks/bin" \
|
||||
"${APP_PATH}/Contents/Resources/koreader/rocks/lib/luarocks" \
|
||||
"${APP_PATH}/Contents/Resources/koreader/screenshots" \
|
||||
"${APP_PATH}/Contents/Resources/koreader/spec" \
|
||||
"${APP_PATH}/Contents/Resources/koreader/tools" \
|
||||
"${APP_PATH}/Contents/Resources/koreader/README.md"
|
||||
|
||||
mv \
|
||||
"${APP_PATH}/Contents/Resources/koreader/COPYING" \
|
||||
"${APP_PATH}/Contents/Resources/COPYING"
|
||||
|
||||
ln -s /usr/bin/tar "${APP_PATH}/Contents/Resources/koreader/tar"
|
||||
|
||||
# package as DMG if create-dmg is available
|
||||
# reduces size from 80MB to 40MB
|
||||
mv "${APP_PATH}" "${APP_BUNDLE}.app"
|
||||
if command_exists "create-dmg"; then
|
||||
# create KOReader-$VERSION.dmg with KOReader.app inside
|
||||
create-dmg "${APP_BUNDLE}.app" --overwrite
|
||||
# create-dmg fails because we omit codesign
|
||||
exit 0
|
||||
else
|
||||
# rename as KOReader-$VERSION.app
|
||||
mv -v "${APP_BUNDLE}.app" "${APP_BUNDLE}-${VERSION}.app"
|
||||
fi
|
||||
21
platform/mac/koreader.sh
Executable file
21
platform/mac/koreader.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
export LC_ALL="en_US.UTF-8"
|
||||
|
||||
# writable storage: ${HOME}/.config/koreader.
|
||||
export KO_MULTIUSER=1
|
||||
|
||||
# working directory of koreader
|
||||
KOREADER_DIR="${0%/*}/../Resources/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=$?
|
||||
done
|
||||
|
||||
# remove the flag to avoid emulator confusion
|
||||
export -n KO_MULTIUSER
|
||||
|
||||
exit ${RETURN_VALUE}
|
||||
@@ -85,6 +85,7 @@ function EvernoteExporter:readyToExport()
|
||||
end
|
||||
|
||||
function EvernoteExporter:migrateClippings()
|
||||
if jit.os == "OSX" then return end
|
||||
local old_dir = util.joinPath(util.realpath(util.joinPath(self.path, "..")),
|
||||
"evernote.sdr")
|
||||
if lfs.attributes(old_dir, "mode") == "directory" then
|
||||
|
||||
BIN
resources/koreader.icns
Normal file
BIN
resources/koreader.icns
Normal file
Binary file not shown.
Reference in New Issue
Block a user