87 lines
2.7 KiB
Bash
Executable File
87 lines
2.7 KiB
Bash
Executable File
|
|
set -e
|
|
|
|
# Check out the source without the Windows/Mac prebuilts
|
|
#COMMIT="master"
|
|
#echo "Checking out $COMMIT"
|
|
#git clone https://git.byte-mate.ru/drholy/moonlight-qt.git
|
|
cd /opt/moonlight-qt
|
|
|
|
# 1. Помечаем директорию как безопасную (исправляет проблемы прав в новых версиях Git)
|
|
git config --global --add safe.directory /opt/moonlight-qt
|
|
|
|
# 2. Жестко откатываем все изменения и удаляем мусор
|
|
git reset --hard
|
|
git clean -fd
|
|
|
|
#git checkout $COMMIT
|
|
#git log -1
|
|
#git -c submodule.libs.update=none submodule update --init --recursive
|
|
|
|
ldconfig
|
|
|
|
# Grab the verson metadata
|
|
VERSION=`cat app/version.txt`
|
|
|
|
EXTRA_CONFIG="CONFIG+=gpuslow"
|
|
|
|
# # Jammy requires libqt6opengl6-dev to use Qt Quick Controls
|
|
# if [ "$DISTRO" == "jammy" ]; then
|
|
# EXTRA_BUILD_DEPS="$EXTRA_BUILD_DEPS libqt6opengl6-dev,"
|
|
# fi
|
|
|
|
# # Trixie and later require qt6-svg-plugins to render SVGs in QML
|
|
# if [ "$DISTRO" != "bookworm" ] && [ "$DISTRO" != "jammy" ] && [ "$DISTRO" != "noble" ]; then
|
|
# EXTRA_DEPS="$EXTRA_DEPS qt6-svg-plugins,"
|
|
# fi
|
|
|
|
# Create a build directory
|
|
mkdir /opt/build
|
|
|
|
# Generate source tarball
|
|
scripts/generate-src.sh
|
|
|
|
# Move the tarball into the build directory
|
|
mv build/source/MoonlightSrc-$VERSION.tar.gz /opt/build/moonlight-qt_$VERSION.orig.tar.gz
|
|
|
|
# Extract the tarball into the appropriate directory
|
|
cd /opt/build
|
|
mkdir moonlight-qt-$VERSION
|
|
cd moonlight-qt-$VERSION
|
|
tar xvf ../moonlight-qt_$VERSION.orig.tar.gz
|
|
|
|
# Copy the debian directory into the build directory
|
|
cp -r /opt/debian .
|
|
|
|
# Patch the control file with target-specific dependencies
|
|
sed -i "s/EXTRA_BUILD_DEPS/$EXTRA_BUILD_DEPS/g" debian/control
|
|
sed -i "s/EXTRA_DEPS/$EXTRA_DEPS/g" debian/control
|
|
cat debian/control
|
|
|
|
# Patch the rules file with target-specific config options
|
|
sed -i "s/EXTRA_CONFIG/$EXTRA_CONFIG/g" debian/rules
|
|
cat debian/rules
|
|
|
|
# Build the package
|
|
export DEB_BUILD_OPTIONS="parallel=8"
|
|
export DEB_CFLAGS_APPEND="-O1"
|
|
export DEB_CXXFLAGS_APPEND="-O1"
|
|
# Указываем pkg-config искать библиотеки в папках, куда мы их ставили
|
|
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/aarch64-linux-gnu/pkgconfig
|
|
# Помогаем линковщику найти сами файлы .a / .so
|
|
export LDFLAGS="-L/usr/local/lib -Wl,-rpath,/usr/local/lib $LDFLAGS"
|
|
export LIBS="-lharfbuzz $LIBS"
|
|
export CPPFLAGS="-I/usr/local/include $CPPFLAGS"
|
|
export DEB_LDFLAGS_APPEND="-lharfbuzz -lgraphite2"
|
|
ldconfig
|
|
debuild -us -uc
|
|
|
|
# Copy the output to the out directory
|
|
cd /opt/build
|
|
#shopt -s extglob
|
|
find . -maxdepth 1 ! -name "moonlight-qt-$VERSION" ! -name "." -exec cp -rv {} /out/ \;
|
|
#cp -v -r !(moonlight-qt-$VERSION) /out
|
|
|
|
# Done!
|
|
echo "Build successful!"
|