2020-12-08 10:54:12 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-12-08 11:02:20 +01:00
|
|
|
os="$1"
|
2020-12-08 11:34:07 +01:00
|
|
|
webengine="$2"
|
2020-12-08 11:02:20 +01:00
|
|
|
|
2020-12-08 11:49:19 +01:00
|
|
|
# Determine OS.
|
2020-12-08 11:02:20 +01:00
|
|
|
if [[ "$os" == *"ubuntu"* ]]; then
|
|
|
|
echo "We are building for GNU/Linux on Ubuntu."
|
|
|
|
is_linux=true
|
2022-01-31 13:11:48 +05:00
|
|
|
prefix="AppDir/usr"
|
2020-12-08 11:02:20 +01:00
|
|
|
else
|
2021-11-16 06:39:21 +00:00
|
|
|
echo "We are building for macOS."
|
2020-12-08 11:02:20 +01:00
|
|
|
is_linux=false
|
2022-01-31 13:11:48 +05:00
|
|
|
prefix="RSS Guard.app"
|
2020-12-08 11:04:40 +01:00
|
|
|
fi
|
|
|
|
|
2020-12-08 11:34:07 +01:00
|
|
|
echo "OS: $os; WebEngine: $webengine"
|
2020-12-08 11:21:01 +01:00
|
|
|
|
2022-09-02 08:59:43 +02:00
|
|
|
# Install needed dependencies.
|
2020-12-08 11:21:01 +01:00
|
|
|
if [ $is_linux = true ]; then
|
2022-09-02 08:59:43 +02:00
|
|
|
sudo apt update
|
2021-09-08 07:06:28 +02:00
|
|
|
|
2022-09-02 08:59:43 +02:00
|
|
|
sudo apt -qy install libgl1-mesa-dev gstreamer1.0-alsa gstreamer1.0-plugins-good gstreamer1.0-plugins-base gstreamer1.0-plugins-bad gstreamer1.0-qt5 gstreamer1.0-pulseaudio libodbc1 postgresql python3-pip
|
2022-07-13 08:21:03 +02:00
|
|
|
|
2022-09-02 08:59:43 +02:00
|
|
|
QTTARGET="linux"
|
|
|
|
QTOS="gcc_64"
|
|
|
|
QTARCH="gcc_64"
|
|
|
|
else
|
|
|
|
|
|
|
|
QTTARGET="mac"
|
|
|
|
QTOS="macos"
|
|
|
|
QTARCH="clang_64"
|
|
|
|
fi
|
|
|
|
|
|
|
|
pip3 install aqtinstall
|
|
|
|
|
|
|
|
# Setup Qt information.
|
|
|
|
QTPATH="$(pwd)/Qt"
|
|
|
|
QTVERSION="6.3.1"
|
|
|
|
QTBIN="$QTPATH/$QTVERSION/$QTOS/bin"
|
2020-12-08 11:24:26 +01:00
|
|
|
|
2022-09-02 08:59:43 +02:00
|
|
|
export QT_PLUGIN_PATH="$QTPATH/$QTVERSION/$QTOS/plugins"
|
|
|
|
export PATH="$QTBIN:$QTPATH/Tools/CMake/bin:$QTPATH/Tools/Ninja:$PATH"
|
2020-12-08 11:24:26 +01:00
|
|
|
|
2022-09-02 08:59:43 +02:00
|
|
|
echo "Qt bin directory is: $QTBIN"
|
|
|
|
echo "Qt will be installed to: $QTPATH"
|
2020-12-08 11:24:26 +01:00
|
|
|
|
2022-09-02 08:59:43 +02:00
|
|
|
# Install Qt.
|
|
|
|
aqt install-qt -O "$QTPATH" "$QTTARGET" "desktop" "$QTVERSION" "$QTARCH" -m "qtwebengine" "qtwebchannel" "qtmultimedia" "qt5compat" "qtpositioning" "qtserialport"
|
|
|
|
aqt install-tool -O "$QTPATH" "$QTTARGET" "desktop" "tools_cmake"
|
|
|
|
aqt install-tool -O "$QTPATH" "$QTTARGET" "desktop" "tools_ninja"
|
2022-07-13 08:21:03 +02:00
|
|
|
|
2022-09-02 08:59:43 +02:00
|
|
|
if [ $is_linux = true ]; then
|
|
|
|
aqt install-tool -O "$QTPATH" "$QTTARGET" "desktop" "tools_openssl_x64"
|
2020-12-08 11:30:45 +01:00
|
|
|
fi
|
|
|
|
|
2022-01-31 13:11:48 +05:00
|
|
|
cmake --version
|
2020-12-10 07:31:07 +01:00
|
|
|
|
2020-12-08 11:30:45 +01:00
|
|
|
# Build application and package it.
|
2022-01-31 13:11:48 +05:00
|
|
|
git_tag=$(git describe --tags $(git rev-list --tags --max-count=1))
|
2020-12-08 11:49:19 +01:00
|
|
|
git_revision=$(git rev-parse --short HEAD)
|
|
|
|
|
|
|
|
mkdir rssguard-build && cd rssguard-build
|
2022-09-02 08:59:43 +02:00
|
|
|
cmake .. -G Ninja -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DFORCE_BUNDLE_ICONS="ON" -DCMAKE_BUILD_TYPE="MinSizeRel" -DCMAKE_INSTALL_PREFIX="$prefix" -DREVISION_FROM_GIT="ON" -DBUILD_WITH_QT6="ON" -DUSE_WEBENGINE="$webengine" -DFEEDLY_CLIENT_ID="$FEEDLY_CLIENT_ID" -DFEEDLY_CLIENT_SECRET="$FEEDLY_CLIENT_SECRET" -DGMAIL_CLIENT_ID="$GMAIL_CLIENT_ID" -DGMAIL_CLIENT_SECRET="$GMAIL_CLIENT_SECRET" -DINOREADER_CLIENT_ID="$INOREADER_CLIENT_ID" -DINOREADER_CLIENT_SECRET="$INOREADER_CLIENT_SECRET"
|
2022-01-31 13:11:48 +05:00
|
|
|
cmake --build .
|
|
|
|
cmake --install . --prefix "$prefix"
|
|
|
|
|
2020-12-08 11:30:45 +01:00
|
|
|
if [ $is_linux = true ]; then
|
2022-09-05 07:13:46 +02:00
|
|
|
# Obtain linuxdeploy.
|
2022-09-02 08:59:43 +02:00
|
|
|
wget -qc https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
|
|
|
|
wget -qc https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
|
2022-09-07 07:31:25 +02:00
|
|
|
wget -qc https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gstreamer/master/linuxdeploy-plugin-gstreamer.sh
|
|
|
|
|
|
|
|
chmod a+x linuxdeploy*.AppImage linuxdeploy*.sh
|
2020-12-08 11:49:19 +01:00
|
|
|
|
2021-09-08 02:18:28 -04:00
|
|
|
# Copy Gstreamer libs.
|
2021-09-08 09:12:35 +02:00
|
|
|
install -v -Dm755 "/usr/lib/x86_64-linux-gnu/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner" "AppDir/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner"
|
2022-09-07 08:18:29 +02:00
|
|
|
gst_executables="--executable=AppDir/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner"
|
|
|
|
gst_libs=""
|
2021-09-08 02:18:28 -04:00
|
|
|
|
2022-01-31 13:11:48 +05:00
|
|
|
for plugin in /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgst*.so; do
|
2022-09-07 08:18:29 +02:00
|
|
|
#basen=$(basename "$plugin")
|
|
|
|
#install -v -Dm755 "$plugin" "AppDir/usr/lib/gstreamer-1.0/$basen"
|
|
|
|
gst_libs="${gst_libs} --library=$plugin"
|
2021-09-08 02:18:28 -04:00
|
|
|
done
|
|
|
|
|
2022-01-31 13:11:48 +05:00
|
|
|
if [[ "$webengine" == "ON" ]]; then
|
2020-12-08 11:49:19 +01:00
|
|
|
# Copy some NSS3 files to prevent WebEngine crashes.
|
|
|
|
cp /usr/lib/x86_64-linux-gnu/nss/* ./AppDir/usr/lib/ -v
|
|
|
|
fi
|
|
|
|
|
2022-09-02 08:59:43 +02:00
|
|
|
# Fix some missing Qt folders.
|
|
|
|
mkdir "$QTPATH/$QTVERSION/$QTOS/plugins/audio"
|
|
|
|
mkdir "$QTPATH/$QTVERSION/$QTOS/plugins/mediaservice"
|
|
|
|
|
2022-09-02 09:13:24 +02:00
|
|
|
# Adjust library search paths.
|
|
|
|
export LD_LIBRARY_PATH="$QTPATH/$QTVERSION/$QTOS/lib:$(pwd)/AppDir/usr/lib"
|
|
|
|
|
2022-09-02 08:59:43 +02:00
|
|
|
# Create AppImage.
|
2022-09-07 08:18:29 +02:00
|
|
|
./linuxdeploy-x86_64.AppImage --output "appimage" --plugin "qt" --plugin "gstreamer" --appdir "AppDir" $gst_executables $gst_libs
|
2020-12-08 11:30:45 +01:00
|
|
|
|
2020-12-08 11:49:19 +01:00
|
|
|
# Rename AppImaage.
|
|
|
|
set -- R*.AppImage
|
|
|
|
imagename="$1"
|
|
|
|
|
2022-01-31 13:11:48 +05:00
|
|
|
if [[ "$webengine" == "ON" ]]; then
|
2020-12-08 11:49:19 +01:00
|
|
|
imagenewname="rssguard-${git_tag}-${git_revision}-linux64.AppImage"
|
|
|
|
else
|
|
|
|
imagenewname="rssguard-${git_tag}-${git_revision}-nowebengine-linux64.AppImage"
|
|
|
|
fi
|
|
|
|
else
|
2020-12-08 11:30:45 +01:00
|
|
|
# Fix .dylib linking.
|
2022-03-23 07:42:39 +01:00
|
|
|
otool -L "RSS Guard.app/Contents/MacOS/rssguard"
|
|
|
|
|
|
|
|
install_name_tool -add_rpath "@executable_path" "RSS Guard.app/Contents/MacOS/rssguard"
|
|
|
|
install_name_tool -add_rpath "@executable_path/../Frameworks" "RSS Guard.app/Contents/MacOS/rssguard"
|
2022-03-22 13:46:18 +01:00
|
|
|
|
2022-03-22 14:23:54 +01:00
|
|
|
otool -L "RSS Guard.app/Contents/MacOS/rssguard"
|
2022-03-23 07:42:39 +01:00
|
|
|
|
2022-03-22 14:58:09 +01:00
|
|
|
macdeployqt "./RSS Guard.app" -dmg
|
2020-12-08 11:30:45 +01:00
|
|
|
|
|
|
|
# Rename DMG.
|
|
|
|
set -- *.dmg
|
2020-12-08 11:49:19 +01:00
|
|
|
imagename="$1"
|
|
|
|
|
2022-02-02 08:52:54 +01:00
|
|
|
if [[ "$webengine" == "ON" ]]; then
|
2020-12-08 11:49:19 +01:00
|
|
|
imagenewname="rssguard-${git_tag}-${git_revision}-mac64.dmg"
|
|
|
|
else
|
|
|
|
imagenewname="rssguard-${git_tag}-${git_revision}-nowebengine-mac64.dmg"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
mv "$imagename" "$imagenewname"
|
2021-09-08 02:18:28 -04:00
|
|
|
ls
|