Browse Source

[CI] Mac OS app (#6955)

* use 7z instead of dmg
* osx: use always writable paths
reviewable/pr6978/r1
Martín Fernández 10 months ago
committed by GitHub
parent
commit
4345201e0e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 10 deletions
  1. +34
    -0
      .github/workflows/build.yml
  2. +2
    -1
      datastorage.lua
  3. +4
    -9
      platform/mac/do_mac_bundle.sh

+ 34
- 0
.github/workflows/build.yml View File

@ -0,0 +1,34 @@
name: test
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
steps:
- name: XCode version
run: xcode-select -p
- name: Check out Git repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Homebrew install dependencies
# Compared to the README, adds ccache for faster compilation times and removes sh5sum to prevent some conflict with coreutils
# Compared to the emulator, adds p7zip and removes sdl2.
run: brew install ccache nasm ragel binutils coreutils libtool autoconf automake cmake makedepend lua@5.1 luarocks gettext pkg-config wget p7zip
- name: Building in progress…
run: export MACOSX_DEPLOYMENT_TARGET=10.14 PATH="/usr/local/opt/gettext/bin:$PATH" && ./kodev release macos
- name: Uploading artifacts
uses: actions/upload-artifact@v2
with:
name: osx-artifacts
path: '*.7z'

+ 2
- 1
datastorage.lua View File

@ -18,7 +18,8 @@ function DataStorage:getDataDir()
-- 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") or os.getenv("KO_MULTIUSER") then
data_dir = string.format("%s/%s/%s", os.getenv("HOME"), ".config", "koreader")
local user_rw = jit.os == "OSX" and "Library/Application Support" or ".config"
data_dir = string.format("%s/%s/%s", os.getenv("HOME"), user_rw, "koreader")
else
data_dir = "."
end

+ 4
- 9
platform/mac/do_mac_bundle.sh View File

@ -185,15 +185,10 @@ for path in l10n/*; do
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
rm -rf "${APP_BUNDLE}.app"
else
# rename as KOReader-$VERSION.app
mv -v "${APP_BUNDLE}.app" "${APP_BUNDLE}-${VERSION}.app"
# package as 7z reduces size from 80MB to 30MB
if command_exists "7z"; then
7z a -l -m0=lzma2 -mx=9 "${APP_BUNDLE}-${VERSION}.7z" "${APP_BUNDLE}.app"
rm -rfv "${APP_BUNDLE}.app"
fi

Loading…
Cancel
Save