diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..6aea6fd5f --- /dev/null +++ b/.github/workflows/build.yml @@ -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' diff --git a/datastorage.lua b/datastorage.lua index 9fdc1c102..bce2ea07d 100644 --- a/datastorage.lua +++ b/datastorage.lua @@ -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 diff --git a/platform/mac/do_mac_bundle.sh b/platform/mac/do_mac_bundle.sh index d18c8991a..02fcb4007 100755 --- a/platform/mac/do_mac_bundle.sh +++ b/platform/mac/do_mac_bundle.sh @@ -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