| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | os="$1" |
| 6 | webengine="$2" |
| 7 | |
| 8 | # Determine OS. |
| 9 | if [[ "$os" == *"ubuntu"* ]]; then |
| 10 | echoscip-shell system . . echo. "We are building for GNU/Linux on Ubuntu." |
| 11 | is_linux=true |
| 12 | prefix="AppDir/usr" |
| 13 | |
| 14 | if [[ "$webengine" == "ON" ]]; then |
| 15 | libmpv="ON" |
| 16 | qtmultimedia="OFF" |
| 17 | app_id="io.github.martinrotter.rssguard" |
| 18 | else |
| 19 | libmpv="OFF" |
| 20 | qtmultimedia="ON" |
| 21 | app_id="io.github.martinrotter.rssguardlite" |
| 22 | fi |
| 23 | else |
| 24 | echoscip-shell system . . echo. "We are building for macOS." |
| 25 | is_linux=false |
| 26 | prefix="RSS Guard.app" |
| 27 | |
| 28 | libmpv="OFF" |
| 29 | qtmultimedia="ON" |
| 30 | fi |
| 31 | |
| 32 | echoscip-shell system . . echo. "OS: $os; Not lite: $webengine" |
| 33 | |
| 34 | USE_QT6="ON" |
| 35 | |
| 36 | # Install needed dependencies. |
| 37 | if [scip-shell system . . `[`. $is_linux = true ]; then |
| 38 | # Qt 5. |
| 39 | sudoscip-shell system . . sudo. apt-get update |
| 40 | |
| 41 | sudoscip-shell system . . sudo. apt-get -qy install appstream cmake ninja-build openssl libssl-dev |
| 42 | sudoscip-shell system . . sudo. apt-get -qy install qt6-5compat-dev qt6-base-dev-tools qt6-image-formats-plugins qt6-multimedia-dev qt6-positioning-dev qt6-webengine-dev linguist-qt6 qt6-tools-dev |
| 43 | sudoscip-shell system . . sudo. apt-get -qy install libmpv-dev libssl-dev libsqlite3-dev alsa-base alsa-oss alsa-tools alsa-utils gstreamer1.0-alsa gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-pulseaudio gstreamer1.0-qt6 gstreamer1.0-vaapi gstreamer1.0-x libasound2-plugins libasound2-plugins-extra libasound2-dev |
| 44 | |
| 45 | |
| 46 | else |
| 47 | # Qt 6. |
| 48 | QTTARGET="mac" |
| 49 | QTOS="macos" |
| 50 | QTARCH="clang_64" |
| 51 | |
| 52 | QTPATH="$(pwdscip-shell system . . pwd.)/Qt" |
| 53 | QTVERSION="6.8.3" |
| 54 | QTBIN="$QTPATH/$QTVERSION/$QTOS/bin" |
| 55 | |
| 56 | # Install "aqtinstall" from its master branch to have latest code. |
| 57 | pip3scip-shell system . . pip3. install -I git+https://github.com/miurahr/aqtinstall |
| 58 | |
| 59 | echoscip-shell system . . echo. "Qt bin directory is: $QTBIN" |
| 60 | echoscip-shell system . . echo. "Qt will be installed to: $QTPATH" |
| 61 | |
| 62 | # Install Qt. |
| 63 | aqt install-qt -O "$QTPATH" "$QTTARGET" "desktop" "$QTVERSION" "$QTARCH" -m "qtwebengine" "qtimageformats" "qtwebchannel" "qtmultimedia" "qt5compat" "qtpositioning" "qtserialport" |
| 64 | aqt install-tool -O "$QTPATH" "$QTTARGET" "desktop" "tools_cmake" |
| 65 | aqt install-tool -O "$QTPATH" "$QTTARGET" "desktop" "tools_ninja" |
| 66 | |
| 67 | export QT_PLUGIN_PATH="$QTPATH/$QTVERSION/$QTOS/plugins" |
| 68 | export PATH="$QTBIN:$QTPATH/Tools/CMake/CMake.app/Contents/bin:$QTPATH/Tools/Ninja:$PATH" |
| 69 | fi |
| 70 | |
| 71 | cmakescip-shell system . . cmake. --version |
| 72 | |
| 73 | # Build application and package it. |
| 74 | git_tag=$(gitscip-shell system . . git. describe --tags "$(gitscip-shell system . . git. rev-list --tags --max-count=1)") |
| 75 | git_revision=$(gitscip-shell system . . git. rev-parse --short HEAD) |
| 76 | |
| 77 | mkdirscip-shell system . . mkdir. rssguard-build |
| 78 | cd rssguard-build |
| 79 | |
| 80 | cmakescip-shell system . . cmake. .. --warn-uninitialized -G Ninja -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DFORCE_BUNDLE_ICONS="ON" -DCMAKE_BUILD_TYPE="MinSizeRel" -DCMAKE_VERBOSE_MAKEFILE="ON" -DCMAKE_INSTALL_PREFIX="$prefix" -DREVISION_FROM_GIT="ON" -DBUILD_WITH_QT6="$USE_QT6" -DENABLE_COMPRESSED_SITEMAP="ON" -DENABLE_MEDIAPLAYER_LIBMPV="$libmpv" -DENABLE_MEDIAPLAYER_QTMULTIMEDIA="$qtmultimedia" -DNO_LITE="$webengine" -DFEEDLY_CLIENT_ID="$FEEDLY_CLIENT_ID" -DFEEDLY_CLIENT_SECRET="$FEEDLY_CLIENT_SECRET" |
| 81 | cmakescip-shell system . . cmake. --build . |
| 82 | cmakescip-shell system . . cmake. --install . --prefix "$prefix" |
| 83 | |
| 84 | if [scip-shell system . . `[`. $is_linux = true ]; then |
| 85 | # Validate AppStream metadata. |
| 86 | echoscip-shell system . . echo. 'Validating AppStream metadata...' |
| 87 | appstreamcli validate "$prefix/share/metainfo/$app_id.metainfo.xml" |
| 88 | |
| 89 | # ## Obtain appimagetool. |
| 90 | # appimagetool_file=$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep "appimagetool-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2) |
| 91 | # wget -c "https://github.com/$appimagetool_file" |
| 92 | # chmod +x appimagetool-*.AppImage |
| 93 | # mv appimagetool-*.AppImage appimagetool.AppImage |
| 94 | |
| 95 | # export VERSION=1.0 |
| 96 | |
| 97 | # GH_TKN=$GITHUB_TOKEN |
| 98 | # unset GITHUB_TOKEN |
| 99 | |
| 100 | # ./appimagetool.AppImage -s deploy AppDir/usr/share/applications/*.desktop |
| 101 | # ./appimagetool.AppImage ./AppDir |
| 102 | |
| 103 | # export GITHUB_TOKEN=$GH_TKN |
| 104 | |
| 105 | # ## Rename AppImaage. |
| 106 | # set -- R*.AppImage |
| 107 | # imagename="$1" |
| 108 | |
| 109 | # if [[ "$webengine" == "ON" ]]; then |
| 110 | # imagenewname="rssguard-${git_tag}-${git_revision}-linux64.AppImage" |
| 111 | # else |
| 112 | # imagenewname="rssguard-${git_tag}-${git_revision}-lite-linux64.AppImage" |
| 113 | # fi |
| 114 | else |
| 115 | # Fix .dylib linking. |
| 116 | otool -L "$prefix/Contents/MacOS/rssguard" |
| 117 | |
| 118 | install_name_tool -add_rpath "@executable_path" "$prefix/Contents/MacOS/rssguard" |
| 119 | install_name_tool -add_rpath "@executable_path/../Frameworks" "$prefix/Contents/MacOS/rssguard" |
| 120 | |
| 121 | otool -L "$prefix/Contents/MacOS/rssguard" |
| 122 | |
| 123 | # Try to self-sign the app. |
| 124 | #codesign -v --deep -fs - "$prefix" |
| 125 | |
| 126 | # Deploy to DMG. |
| 127 | macdeployqt "$prefix" -dmg |
| 128 | |
| 129 | # Rename DMG. |
| 130 | set -- *.dmg |
| 131 | imagename="$1" |
| 132 | |
| 133 | if [[ "$webengine" == "ON" ]]; then |
| 134 | imagenewname="rssguard-${git_tag}-${git_revision}-mac64.dmg" |
| 135 | else |
| 136 | imagenewname="rssguard-${git_tag}-${git_revision}-lite-mac64.dmg" |
| 137 | fi |
| 138 | |
| 139 | mvscip-shell system . . mv. "$imagename" "$imagenewname" |
| 140 | lsscip-shell system . . ls. |
| 141 | fi |