Created
September 21, 2025 12:13
-
-
Save luskan/53776bbb1b2a00180c919252794904c2 to your computer and use it in GitHub Desktop.
Moonlight streamer complete dependency installer, build from github sources, local binary installer for linux - works under ubuntu - as for 21-sep-2025.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
# Moonlight-Qt build & install on Ubuntu (Qt6) | |
# Uninstall existing installs (usr/local, Snap, Flatpak) | |
sudo rm -f /usr/local/bin/moonlight | |
sudo rm -f /usr/local/share/applications/com.moonlight_stream.Moonlight.desktop | |
sudo rm -f /usr/local/share/icons/hicolor/scalable/apps/moonlight.svg | |
if command -v snap >/dev/null 2>&1 && snap list 2>/dev/null | grep -q '^moonlight\b'; then | |
sudo snap remove moonlight || true | |
fi | |
if command -v flatpak >/dev/null 2>&1 && flatpak list --app 2>/dev/null | grep -q 'com.moonlight_stream.Moonlight'; then | |
flatpak uninstall -y com.moonlight_stream.Moonlight || true | |
fi | |
# Deps | |
sudo apt update | |
sudo apt install -y \ | |
build-essential git pkg-config \ | |
libegl1-mesa-dev libgl1-mesa-dev libopus-dev libsdl2-dev libsdl2-ttf-dev libssl-dev \ | |
libavcodec-dev libavformat-dev libswscale-dev libva-dev libvdpau-dev libxkbcommon-dev \ | |
wayland-protocols libdrm-dev \ | |
qt6-base-dev qt6-declarative-dev libqt6svg6-dev \ | |
qml6-module-qtquick-controls qml6-module-qtquick-templates qml6-module-qtquick-layouts \ | |
qml6-module-qtqml-workerscript qml6-module-qtquick-window qml6-module-qtquick \ | |
libplacebo-dev || true | |
command -v qmake6 >/dev/null | |
# Fresh clone | |
WORKDIR="${HOME}/src" | |
REPO_DIR="${WORKDIR}/moonlight-qt" | |
mkdir -p "${WORKDIR}" | |
rm -rf "${REPO_DIR}" | |
git clone --depth=1 --recursive https://github.com/moonlight-stream/moonlight-qt "${REPO_DIR}" | |
# Build (Release) | |
cd "${REPO_DIR}" | |
git submodule update --init --recursive | |
BUILD_DIR="${REPO_DIR}/build-release" | |
mkdir -p "${BUILD_DIR}" | |
cd "${BUILD_DIR}" | |
qmake6 ../moonlight-qt.pro | |
make -j"$(getconf _NPROCESSORS_ONLN)" | |
# Install | |
BIN_PATH="${BUILD_DIR}/app/moonlight" | |
if [ ! -x "${BIN_PATH}" ]; then | |
BIN_PATH="$(find "${BUILD_DIR}/app" -maxdepth 2 -type f -executable -print0 2>/dev/null \ | |
| xargs -0 file 2>/dev/null \ | |
| awk -F: '/ELF.*executable/ {print $1; exit}')" | |
fi | |
[ -n "${BIN_PATH}" ] && [ -x "${BIN_PATH}" ] | |
sudo install -Dm755 "${BIN_PATH}" /usr/local/bin/moonlight | |
# Desktop entry | |
sudo install -d /usr/local/share/applications | |
sudo tee /usr/local/share/applications/com.moonlight_stream.Moonlight.desktop >/dev/null <<'EOF' | |
[Desktop Entry] | |
Type=Application | |
Name=Moonlight | |
Comment=GameStream client | |
Exec=moonlight | |
Icon=moonlight | |
Categories=Game;Utility; | |
Terminal=false | |
EOF | |
# Icon (if available) | |
ICON_SRC="$(find "${REPO_DIR}" -iname 'moonlight.svg' -o -iname 'icon*.svg' | head -n1 || true)" | |
if [ -n "${ICON_SRC}" ]; then | |
sudo install -Dm644 "${ICON_SRC}" /usr/local/share/icons/hicolor/scalable/apps/moonlight.svg || true | |
fi | |
echo "Installed to /usr/local/bin/moonlight" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment