rssguard/resources/scripts/github-actions/build-linux-mac.sh

118 lines
4.2 KiB
Bash
Raw Normal View History

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
else
echo "We are building for Mac OS X."
is_linux=false
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
# Prepare environment.
if [ $is_linux = true ]; then
#sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo add-apt-repository ppa:beineri/opt-qt-5.15.2-bionic -y
2020-12-08 11:21:01 +01:00
sudo apt-get update
#sudo apt-get -y install gcc-7 g++-7
sudo apt-get -y install qt515tools qt515base qt515webengine qt515svg qt515multimedia
2021-09-08 08:51:59 +02:00
sudo apt-get -y install openssl libssl-dev libgl1-mesa-dev gstreamer1.0-alsa gstreamer1.0-plugins-good gstreamer1.0-plugins-base gstreamer1.0-plugins-bad gstreamer1.0-qt5
2020-12-08 11:49:19 +01:00
#sudo update-alternatives --remove-all gcc
#sudo update-alternatives --remove-all g++
#sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 50
#sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 50
2020-12-08 11:30:45 +01:00
source /opt/qt515/bin/qt515-env.sh
2020-12-08 11:21:01 +01:00
else
pip3 install aqtinstall
2020-12-08 11:24:26 +01:00
QTPATH="$(pwd)/Qt"
QTVERSION="5.15.2"
QTBIN="$QTPATH/$QTVERSION/clang_64/bin"
echo "Qt bin directory is: $QTBIN"
echo "Qt will be installed to: $QTPATH"
2021-05-28 07:13:40 +02:00
aqt install -O "$QTPATH" "5.15.2" "mac" "desktop" "clang_64" -m "qtwebengine" "qtmultimedia"
2020-12-08 11:24:26 +01:00
export QT_PLUGIN_PATH="$QTPATH/$QTVERSION/clang_64/plugins"
export PATH="$QTBIN:$PATH"
2020-12-08 11:30:45 +01:00
fi
2020-12-10 07:31:07 +01:00
qmake --version
2020-12-08 11:30:45 +01:00
# Build application and package it.
2020-12-08 11:49:19 +01:00
git_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
git_revision=$(git rev-parse --short HEAD)
mkdir rssguard-build && cd rssguard-build
2021-04-16 08:17:54 +02:00
qmake .. "USE_WEBENGINE=$webengine" "FEEDLY_CLIENT_ID=$FEEDLY_CLIENT_ID" "FEEDLY_CLIENT_SECRET=$FEEDLY_CLIENT_SECRET" "GMAIL_CLIENT_ID=$GMAIL_CLIENT_ID" "GMAIL_CLIENT_SECRET=$GMAIL_CLIENT_SECRET" "INOREADER_CLIENT_ID=$INOREADER_CLIENT_ID" "INOREADER_CLIENT_SECRET=$INOREADER_CLIENT_SECRET"
2020-12-08 11:49:19 +01:00
make
make install
cd "src/rssguard"
2020-12-08 11:30:45 +01:00
if [ $is_linux = true ]; then
2020-12-08 11:49:19 +01:00
# Obtain linuxdeployqt.
wget -c https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
chmod a+x linuxdeployqt-continuous-x86_64.AppImage
2021-09-08 08:18:28 +02:00
# Copy Gstreamer libs.
install -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"
gst_executables="-executable=AppDir/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner"
2021-09-08 08:55:44 +02:00
for plugin in $(ls /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgst*.so); do
basen=$(basename "$plugin")
install -Dm755 "$plugin" "AppDir/usr/lib/gstreamer-1.0/$basen"
gst_executables="${gst_executables} -executable=AppDir/usr/lib/gstreamer-1.0/$basen"
2021-09-08 08:18:28 +02:00
done
2020-12-08 11:49:19 +01:00
# Create AppImage.
unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH
2021-09-08 08:18:28 +02:00
./linuxdeployqt-continuous-x86_64.AppImage "./AppDir/usr/share/applications/com.github.rssguard.desktop" -bundle-non-qt-libs -no-translations $gst_executables
./linuxdeployqt-continuous-x86_64.AppImage "./AppDir/usr/share/applications/com.github.rssguard.desktop" -bundle-non-qt-libs -no-translations $gst_executables
2020-12-08 11:49:19 +01:00
if [[ "$webengine" == "true" ]]; then
# Copy some NSS3 files to prevent WebEngine crashes.
cp /usr/lib/x86_64-linux-gnu/nss/* ./AppDir/usr/lib/ -v
fi
2021-09-08 08:18:28 +02:00
./linuxdeployqt-continuous-x86_64.AppImage "./AppDir/usr/share/applications/com.github.rssguard.desktop" -appimage -no-translations $gst_executables
2020-12-08 11:30:45 +01:00
2020-12-08 11:49:19 +01:00
# Rename AppImaage.
set -- R*.AppImage
imagename="$1"
if [[ "$webengine" == "true" ]]; then
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.
install_name_tool -change "librssguard.dylib" "@executable_path/librssguard.dylib" "RSS Guard.app/Contents/MacOS/rssguard"
install_name_tool -change "librssguard.dylib" "@executable_path/librssguard.dylib" "rssguard"
otool -L "RSS Guard.app/Contents/MacOS/rssguard"
macdeployqt "./RSS Guard.app" -dmg
# Rename DMG.
set -- *.dmg
2020-12-08 11:49:19 +01:00
imagename="$1"
if [[ "$webengine" == "true" ]]; then
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 08:18:28 +02:00
ls