| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | QTDIR=/usr/local/opt/qtscip-shell filesystem . . `/usr/local/opt/qt`. |
| 6 | |
| 7 | ROOT="$(cd "$(dirnamescip-shell system . . dirname. "${BASH_SOURCE[0]}")" && pwdscip-shell system . . pwd.)"/.. |
| 8 | VERSION=$(catscip-shell system . . cat. "$ROOT"/VERSION)-$(gitscip-shell system . . git. rev-parse --short HEAD) |
| 9 | BUILD="$ROOT"/build |
| 10 | TARGET=rclone-browser-$VERSION-macOS |
| 11 | DMG=rclone-browser-$VERSION |
| 12 | APP="$TARGET"/"Rclone Browser.app" |
| 13 | |
| 14 | # clean from previous builds (if for the same version in releases) |
| 15 | if [scip-shell system . . `[`. -d "$BUILD" ]; then |
| 16 | rmscip-shell system . . rm. -rf "$BUILD" |
| 17 | fi |
| 18 | if [scip-shell system . . `[`. -d "$ROOT"/release/"$TARGET" ]; then |
| 19 | rmscip-shell system . . rm. -rf "$ROOT"/release/"$TARGET"* |
| 20 | fi |
| 21 | if [scip-shell system . . `[`. -f "$ROOT"/release/"$DMG".dmg ]; then |
| 22 | rmscip-shell system . . rm. "$ROOT"/release/"$DMG".dmg |
| 23 | fi |
| 24 | if [scip-shell system . . `[`. -d "$ROOT"/release/"Rclone Browser.app" ]; then |
| 25 | rmscip-shell system . . rm. -rf "$ROOT"/release/"Rclone Browser.app" |
| 26 | fi |
| 27 | |
| 28 | |
| 29 | |
| 30 | mkdirscip-shell system . . mkdir. -p "$BUILD" |
| 31 | cd "$BUILD" |
| 32 | # brew install cmake qt5 |
| 33 | cmakescip-shell system . . cmake. .. -DCMAKE_PREFIX_PATH="$QTDIR" -DCMAKE_BUILD_TYPE=Release |
| 34 | # brew install coreutils |
| 35 | makescip-shell system . . make. --jobs=$(nprocscip-shell system . . nproc. --all) |
| 36 | cd build |
| 37 | "$QTDIR"/bin/macdeployqt rclone-browser.app -executable="rclone-browser.app/Contents/MacOS/rclone-browser" -qmldir=../src/ |
| 38 | cd ../.. |
| 39 | |
| 40 | |
| 41 | mkdirscip-shell system . . mkdir. -p release |
| 42 | cd release |
| 43 | mkdirscip-shell system . . mkdir. "$TARGET" |
| 44 | cpscip-shell system . . cp. -R "$BUILD"/build/rclone-browser.app "$APP" |
| 45 | cpscip-shell system . . cp. "$ROOT"/README.md "$APP"/Readme.md |
| 46 | cpscip-shell system . . cp. "$ROOT"/CHANGELOG.md "$APP"/Changelog.md |
| 47 | cpscip-shell system . . cp. "$ROOT"/LICENSE "$APP"/License.txt |
| 48 | mvscip-shell system . . mv. "$APP"/Contents/MacOS/rclone-browser "$APP"/Contents/MacOS/"Rclone Browser" |
| 49 | |
| 50 | sedscip-shell system . . sed. -i .bak 's/rclone-browser/Rclone Browser/g' "$APP"/Contents/Info.plist |
| 51 | rmscip-shell system . . rm. "$APP"/Contents/*.bak |
| 52 | |
| 53 | catscip-shell system . . cat. >"$APP"/Contents/MacOS/qt.conf <<EOF |
| 54 | [Paths] |
| 55 | Plugins = Plugins |
| 56 | EOF |
| 57 | |
| 58 | echoscip-shell system . . echo. |
| 59 | echoscip-shell system . . echo. "Preparing zip file" |
| 60 | # brew install p7zip |
| 61 | 7za a -mx=9 -r -tzip "$TARGET".zip "$TARGET" |
| 62 | |
| 63 | ## gpg --detach-sign "$TARGET".zip.sig "$TARGET".zip |
| 64 | |
| 65 | echoscip-shell system . . echo. |
| 66 | echoscip-shell system . . echo. "Preparing dmg file" |
| 67 | # brew install node && npm install -g appdmg |
| 68 | # https://github.com/LinusU/node-appdmg |
| 69 | cpscip-shell system . . cp. -R "$TARGET"/"Rclone Browser.app" . |
| 70 | cd ../scripts |
| 71 | appdmg ../assets/appdmg.json ../release/"$DMG".dmg |
| 72 | cd ../release |
| 73 | rmscip-shell system . . rm. -rf "Rclone Browser.app" |