From 60f308bd763908bfacb8f034afdb980ac5399965 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 12 Feb 2020 07:27:18 -0800 Subject: [PATCH] Build dual binary bundles for Steam Link --- app/deploy/steamlink/moonlight.sh | 12 ++++++- scripts/build-steamlink-app.sh | 53 ++++++++++++++++++++++++++----- 2 files changed, 56 insertions(+), 9 deletions(-) diff --git a/app/deploy/steamlink/moonlight.sh b/app/deploy/steamlink/moonlight.sh index b182c7f1..bf8abe2c 100644 --- a/app/deploy/steamlink/moonlight.sh +++ b/app/deploy/steamlink/moonlight.sh @@ -5,9 +5,19 @@ # pairing data will be lost each reboot. HOME=/usr/local/moonlight +# For a seamless transition across the Qt 5.9 -> Qt 5.14 boundary, +# we bundle binaries built with both Qt 5.9 and Qt 5.14 and pick +# the correct one at runtime. +if [ -d "/usr/local/Qt-5.14.1" ]; then + BIN="moonlight" +else + BIN="moonlight59" +fi + # Renice PE_Single_CPU which seems to host A/V stuff renice -10 -p $(pidof PE_Single_CPU) # Renice Moonlight itself to avoid preemption by background tasks # Write output to a logfile in /tmp -exec nice -n -10 ./bin/moonlight > /tmp/moonlight.log +echo Launching $BIN +exec nice -n -10 ./bin/$BIN > /tmp/moonlight.log diff --git a/scripts/build-steamlink-app.sh b/scripts/build-steamlink-app.sh index 4fbd8a69..a3f9ffc3 100755 --- a/scripts/build-steamlink-app.sh +++ b/scripts/build-steamlink-app.sh @@ -1,4 +1,6 @@ BUILD_CONFIG="release" +QT_59_COMMIT="9181b082be53c64daa83f36c7093a783fd07b464" +QT_514_COMMIT="609d4aaccb503298e7fa9cef45e0ddc4c4afd63c" fail() { @@ -26,21 +28,56 @@ mkdir $BUILD_FOLDER mkdir $DEPLOY_FOLDER mkdir $INSTALLER_FOLDER -echo Initializing Steam Link SDK -source $STEAMLINK_SDK_PATH/setenv.sh || fail "SL SDK initialization failed!" - -echo Configuring the project -pushd $BUILD_FOLDER -qmake $SOURCE_ROOT/moonlight-qt.pro || fail "Qmake failed!" +echo Switching to Qt 5.9 SDK +pushd $STEAMLINK_SDK_PATH +git fetch origin --unshallow +git clean -f -d -x +git reset --hard +git checkout $QT_59_COMMIT || fail "Unable to checkout $QT_59_COMMIT" popd -echo Compiling Moonlight in $BUILD_CONFIG configuration +echo Initializing Steam Link SDK for Qt 5.9 +source $STEAMLINK_SDK_PATH/setenv.sh || fail "SL SDK initialization failed!" + +echo Configuring the project for Qt 5.9 +pushd $BUILD_FOLDER +qmake $SOURCE_ROOT/moonlight-qt.pro QMAKE_CFLAGS_ISYSTEM= || fail "Qmake failed!" +popd + +echo Compiling Moonlight for Qt 5.9 in $BUILD_CONFIG configuration +pushd $BUILD_FOLDER +make -j$(nproc) $(echo "$BUILD_CONFIG" | tr '[:upper:]' '[:lower:]') || fail "Make failed!" +popd + +echo Staging Moonlight for Qt 5.9 +mkdir -p $DEPLOY_FOLDER/steamlink/apps/moonlight/bin +cp $BUILD_FOLDER/app/moonlight $DEPLOY_FOLDER/steamlink/apps/moonlight/bin/moonlight59 || fail "Binary copy failed!" + +echo Cleaning build directory +rm -rf $BUILD_FOLDER +mkdir $BUILD_FOLDER + +echo Switching to Qt 5.14 SDK +pushd $STEAMLINK_SDK_PATH +git clean -f -d -x +git reset --hard +git checkout $QT_514_COMMIT || fail "Unable to checkout $QT_514_COMMIT" +popd + +echo Initializing Steam Link SDK for Qt 5.14 +source $STEAMLINK_SDK_PATH/setenv.sh || fail "SL SDK initialization failed!" + +echo Configuring the project for Qt 5.14 +pushd $BUILD_FOLDER +qmake $SOURCE_ROOT/moonlight-qt.pro QMAKE_CFLAGS_ISYSTEM= || fail "Qmake failed!" +popd + +echo Compiling Moonlight for Qt 5.14 in $BUILD_CONFIG configuration pushd $BUILD_FOLDER make -j$(nproc) $(echo "$BUILD_CONFIG" | tr '[:upper:]' '[:lower:]') || fail "Make failed!" popd echo Creating app bundle -mkdir -p $DEPLOY_FOLDER/steamlink/apps/moonlight/bin cp $BUILD_FOLDER/app/moonlight $DEPLOY_FOLDER/steamlink/apps/moonlight/bin/ || fail "Binary copy failed!" cp $SOURCE_ROOT/app/deploy/steamlink/* $DEPLOY_FOLDER/steamlink/apps/moonlight/ || fail "Metadata copy failed!" pushd $DEPLOY_FOLDER