mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
standalone osx application bundle
This commit is contained in:
committed by
Martín Fernández
parent
7583571707
commit
bdbebb9e08
4
Makefile
4
Makefile
@@ -405,9 +405,11 @@ macosupdate: all
|
||||
$(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
|
||||
cp -pRv $(MACOS_DIR)/menu.xml $(INSTALL_DIR)/bundle/Contents/MainMenu.xib
|
||||
ibtool --compile "$(INSTALL_DIR)/bundle/Contents/Resources/Base.lproj/MainMenu.nib" "$(INSTALL_DIR)/bundle/Contents/MainMenu.xib"
|
||||
rm -rfv "$(INSTALL_DIR)/bundle/Contents/MainMenu.xib"
|
||||
|
||||
REMARKABLE_PACKAGE:=koreader-remarkable$(KODEDUG_SUFFIX)-$(VERSION).zip
|
||||
REMARKABLE_PACKAGE_OTA:=koreader-remarkable$(KODEDUG_SUFFIX)-$(VERSION).targz
|
||||
|
||||
2
base
2
base
Submodule base updated: 041e30d6c2...d2a0a1bffb
@@ -5,6 +5,7 @@ local logger = require("logger")
|
||||
|
||||
local function yes() return true end
|
||||
local function no() return false end
|
||||
local function notOSX() return jit.os ~= "OSX" end
|
||||
|
||||
local function isUrl(s)
|
||||
return type(s) == "string" and s:match("*?://")
|
||||
@@ -101,6 +102,8 @@ local AppImage = Device:new{
|
||||
local Desktop = Device:new{
|
||||
model = SDL.getPlatform(),
|
||||
isDesktop = yes,
|
||||
canRestart = notOSX,
|
||||
hasExitOptions = notOSX,
|
||||
}
|
||||
|
||||
local Emulator = Device:new{
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
#!/bin/bash
|
||||
# Script to generate mac application bundles for KOReader
|
||||
#
|
||||
# We don't use XCode at all. Just commandline tools.
|
||||
#
|
||||
# menu.xml contains the main menu of a typical OSX program.
|
||||
# each time some user facing string in menu.xml changed we can
|
||||
# generate a new translation template with:
|
||||
#
|
||||
# cp menu.xml menu.xib
|
||||
# ibtool --generate-strings-file mac.strings menu.xib
|
||||
# rm -rf menu.xib
|
||||
#
|
||||
# the generated "mac.strings" is in xliff format (binary, not plain text)
|
||||
# and can be translated using an xliff editor or an online service that support
|
||||
# IOS string format, like weblate.
|
||||
|
||||
COPYRIGHT="Copyright © $(date +"%Y") KOReader"
|
||||
|
||||
command_exists() {
|
||||
@@ -95,10 +110,14 @@ cat <<END >"${APP_PATH}/Contents/Info.plist"
|
||||
<true/>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>LSMultipleInstancesProhibited</key>
|
||||
<true/>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
||||
<key>SDL_FILESYSTEM_BASE_DIR_TYPE</key>
|
||||
<string>bundle</string>
|
||||
</dict>
|
||||
</plist>
|
||||
END
|
||||
@@ -135,18 +154,41 @@ install_name_tool -change ${BREW}/webp/lib/libwebp.7.dylib libs/libwebp.7.dylib
|
||||
|
||||
# prepare bundle for distribution
|
||||
ln -s /usr/bin/tar tar
|
||||
mv COPYING ../COPYING.txt
|
||||
mv COPYING README.md ../Resources/
|
||||
mv koreader ../MacOS/koreader
|
||||
rm -rf cache clipboard history ota \
|
||||
l10n/.git l10n/.tx l10n/templates l10n/LICENSE l10n/Makefile l10n/README.md \
|
||||
plugins/SSH.koplugin plugins/hello.koplugin plugins/timesync.koplugin \
|
||||
plugins/autofrontlight.koplugin resources/fonts resources/icons/src \
|
||||
resources/kobo-touch-probe.png resources/koreader.icns rocks/bin \
|
||||
rocks/lib/luarocks screenshots spec tools README.md
|
||||
rocks/lib/luarocks screenshots spec tools
|
||||
|
||||
# adjust reader.lua a bit.
|
||||
|
||||
sed '1d' reader.lua >tempfile
|
||||
sed -i.backup 's/.\/reader.lua/koreader/' tempfile
|
||||
sed -i.backup 's/the last viewed document will be opened"/" .. os.getenv("HOME") .. " will be opened"/' tempfile
|
||||
mv tempfile reader.lua
|
||||
rm -f tempfile*
|
||||
chmod -x reader.lua
|
||||
popd || exit 1
|
||||
|
||||
# bundle translations, if any
|
||||
for path in l10n/*; do
|
||||
lang=$(echo "${path}" | sed s'/l10n\///')
|
||||
if [ "${lang}" != "templates" ]; then
|
||||
translation_file="l10n/${lang}/mac.strings"
|
||||
if [ -f "${translation_file}" ]; then
|
||||
mkdir -p "${APP_PATH}/Contents/Resources/${lang}.lproj"
|
||||
cp -pv "${translation_file}" "${APP_PATH}/Contents/Resources/${lang}.lproj/MainMenu.strings"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# 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
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
export LC_ALL="en_US.UTF-8"
|
||||
|
||||
export KO_MULTIUSER=1
|
||||
USER_STORAGE="${HOME}/.config/koreader"
|
||||
[ ! -d "${USER_STORAGE}" ] && mkdir -p "${USER_STORAGE}"
|
||||
|
||||
# working directory of koreader
|
||||
KOREADER_DIR="${0%/*}/../koreader"
|
||||
|
||||
# arguments
|
||||
if [ -z "${1}" ]; then
|
||||
ARGS=${HOME}
|
||||
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=$?
|
||||
ARGS=${HOME}
|
||||
done
|
||||
|
||||
# remove the flag to avoid emulator confusion
|
||||
export -n KO_MULTIUSER
|
||||
|
||||
exit ${RETURN_VALUE}
|
||||
122
platform/mac/menu.xml
Normal file
122
platform/mac/menu.xml
Normal file
@@ -0,0 +1,122 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16097.2"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication"/>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<menu title="Main Menu" systemMenu="main" id="1">
|
||||
<items>
|
||||
<menuItem title="KOReader" id="2">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="KOReader" systemMenu="apple" id="3">
|
||||
<items>
|
||||
<menuItem title="About KOReader" id="4">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="orderFrontStandardAboutPanel:" target="-1" id="5"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="6"/>
|
||||
<menuItem title="Services" id="7">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Services" systemMenu="services" id="8"/>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="9"/>
|
||||
<menuItem title="Hide KOReader" keyEquivalent="h" id="10">
|
||||
<connections>
|
||||
<action selector="hide:" target="-1" id="11"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Hide Others" keyEquivalent="h" id="12">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="hideOtherApplications:" target="-1" id="13"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Show All" id="14">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="unhideAllApplications:" target="-1" id="15"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="16"/>
|
||||
<menuItem title="Quit KOReader" keyEquivalent="q" id="17">
|
||||
<connections>
|
||||
<action selector="terminate:" target="-1" id="18"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Window" id="19">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Window" systemMenu="window" id="20">
|
||||
<items>
|
||||
<menuItem title="Enter Full Screen" keyEquivalent="f" id="21">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="toggleFullScreen:" target="-1" id="22"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="23"/>
|
||||
<menuItem title="Minimize" keyEquivalent="m" id="24">
|
||||
<connections>
|
||||
<action selector="performMiniaturize:" target="-1" id="25"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Zoom" id="26">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="performZoom:" target="-1" id="27"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="28"/>
|
||||
<menuItem title="Bring All to Front" id="29">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="arrangeInFront:" target="-1" id="30"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Help" id="31">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Help" systemMenu="help" id="32">
|
||||
<items>
|
||||
<menuItem title="License" id="33">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="openLicense:" target="-1" id="34"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="35"/>
|
||||
<menuItem title="Online documentation" id="36">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="openWiki:" target="-1" id="37"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Online forum" id="38">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="openForum:" target="-1" id="39"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="40"/>
|
||||
<menuItem title="KOReader webpage" id="41">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="openWeb:" target="-1" id="42"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</objects>
|
||||
</document>
|
||||
Reference in New Issue
Block a user