Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 3 additions & 68 deletions .codeql-prebuild-cpp-Linux.sh
Original file line number Diff line number Diff line change
@@ -1,76 +1,11 @@
# install dependencies for C++ analysis
set -e

CUDA_VERSION=11.8.0
CUDA_BUILD=520.61.05

# install wget and cuda first
sudo apt-get update -y
sudo apt-get install -y \
wget

# Install CUDA
url_base="https://developer.download.nvidia.com/compute/cuda/${CUDA_VERSION}/local_installers"
url="${url_base}/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux.run"
sudo wget -q -O /root/cuda.run ${url}
sudo chmod a+x /root/cuda.run
sudo /root/cuda.run --silent --toolkit --toolkitpath=/usr/local/cuda --no-opengl-libs --no-man-page --no-drm
sudo rm /root/cuda.run

# Install dependencies
sudo apt-get install -y \
build-essential \
gcc-10 \
g++-10 \
libayatana-appindicator3-dev \
libavdevice-dev \
libcap-dev \
libcurl4-openssl-dev \
libdrm-dev \
libevdev-dev \
libminiupnpc-dev \
libmfx-dev \
libnotify-dev \
libnuma-dev \
libopus-dev \
libpulse-dev \
libssl-dev \
libva-dev \
libvdpau-dev \
libwayland-dev \
libx11-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
libxcb1-dev \
libxfixes-dev \
libxrandr-dev \
libxtst-dev

# clean apt cache
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*

# Update gcc alias
# https://stackoverflow.com/a/70653945/11214013
sudo update-alternatives --install \
/usr/bin/gcc gcc /usr/bin/gcc-10 100 \
--slave /usr/bin/g++ g++ /usr/bin/g++-10 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-10 \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-10 \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-10

# build
mkdir -p build
cd build || exit 1
cmake \
-DBUILD_DOCS=OFF \
-DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc \
-G "Unix Makefiles" \
..
make -j"$(nproc)"
chmod +x ./scripts/linux_build.sh
./scripts/linux_build.sh --skip-package --ubuntu-test-repo

# Delete CUDA
sudo rm -rf /usr/local/cuda
rm -rf ./build/cuda

# skip autobuild
echo "skip_autobuild=true" >> "$GITHUB_OUTPUT"
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ scripts/
tools/
crowdin.yml

# don't ignore linux build script
!scripts/linux_build.sh

# ignore dev directories
build/
cmake-*/
Expand Down
99 changes: 11 additions & 88 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ jobs:
matrix:
include: # package these differently
- type: AppImage
EXTRA_ARGS: '-DSUNSHINE_BUILD_APPIMAGE=ON'
EXTRA_ARGS: '--appimage-build'
dist: 22.04

steps:
Expand All @@ -276,81 +276,23 @@ jobs:
with:
submodules: recursive

- name: Install wget
run: |
sudo apt-get update -y
sudo apt-get install -y \
wget

- name: Install CUDA
env:
CUDA_VERSION: 11.8.0
CUDA_BUILD: 520.61.05
timeout-minutes: 4
run: |
url_base="https://developer.download.nvidia.com/compute/cuda/${CUDA_VERSION}/local_installers"
url="${url_base}/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux.run"
sudo wget -q -O /root/cuda.run ${url}
sudo chmod a+x /root/cuda.run
sudo /root/cuda.run --silent --toolkit --toolkitpath=/usr/local/cuda --no-opengl-libs --no-man-page --no-drm
sudo rm /root/cuda.run

- name: Setup Dependencies Linux
timeout-minutes: 5
run: |
# allow newer gcc
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
# create the artifacts directory
mkdir -p artifacts

# allow libfuse2 for appimage on 22.04
# allow libfuse2 for appimage on 22.04+
sudo add-apt-repository universe

# libx11-xcb-dev and libxcb-dri3-dev are required for building libva
sudo apt-get install -y \
build-essential \
cmake \
doxygen \
graphviz \
gcc-10 \
g++-10 \
libayatana-appindicator3-dev \
libavdevice-dev \
libcap-dev \
libcurl4-openssl-dev \
libdrm-dev \
libevdev-dev \
libfuse2 \
libminiupnpc-dev \
libnotify-dev \
libnuma-dev \
libopus-dev \
libpulse-dev \
libssl-dev \
libvdpau-dev \
libgl-dev \
libwayland-dev \
libx11-dev \
libx11-xcb-dev \
libxcb-dri3-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
libxcb1-dev \
libxfixes-dev \
libxrandr-dev \
libxtst-dev \
python3 \
python3-venv

# clean apt cache
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*

# Update gcc alias
# https://stackoverflow.com/a/70653945/11214013
sudo update-alternatives --install \
/usr/bin/gcc gcc /usr/bin/gcc-10 100 \
--slave /usr/bin/g++ g++ /usr/bin/g++-10 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-10 \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-10 \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-10
libxfixes-dev

- name: Setup python
id: python
Expand All @@ -371,7 +313,7 @@ jobs:
--enable-x11 \
--enable-glx \
--enable-wayland \
--without-legacy # emgd, nvctrl, fglrx
--without-legacy # emgd, nvctrl, fglrx
make -j $(nproc)
sudo make install
cd .. && rm -rf libva-*
Expand All @@ -381,28 +323,9 @@ jobs:
BRANCH: ${{ github.head_ref || github.ref_name }}
BUILD_VERSION: ${{ needs.setup_release.outputs.release_tag }}
COMMIT: ${{ needs.setup_release.outputs.release_commit }}
timeout-minutes: 10
run: |
echo "nproc: $(nproc)"

mkdir -p build
mkdir -p artifacts

cd build
cmake \
-DBUILD_WERROR=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CUDA_COMPILER:PATH=/usr/local/cuda/bin/nvcc \
-DCMAKE_INSTALL_PREFIX=/usr \
-DSUNSHINE_ASSETS_DIR=share/sunshine \
-DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
-DSUNSHINE_ENABLE_WAYLAND=ON \
-DSUNSHINE_ENABLE_X11=ON \
-DSUNSHINE_ENABLE_DRM=ON \
-DSUNSHINE_ENABLE_CUDA=ON \
${{ matrix.EXTRA_ARGS }} \
..
make -j $(expr $(nproc) - 1) # use all but one core
chmod +x ./scripts/linux_build.sh
./scripts/linux_build.sh --skip-cleanup --skip-package --ubuntu-test-repo ${{ matrix.EXTRA_ARGS }}

- name: Set AppImage Version
if: |
Expand All @@ -416,7 +339,7 @@ jobs:
working-directory: build
run: |
# install sunshine to the DESTDIR
make install DESTDIR=AppDir
DESTDIR=AppDir ninja install

# custom AppRun file
cp -f ../packaging/linux/AppImage/AppRun ./AppDir/
Expand Down Expand Up @@ -454,7 +377,7 @@ jobs:
- name: Delete CUDA
# free up space on the runner
run: |
sudo rm -rf /usr/local/cuda
rm -rf ./build/cuda

- name: Verify AppImage
if: ${{ matrix.type == 'AppImage' }}
Expand Down
12 changes: 8 additions & 4 deletions cmake/packaging/linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ else()
find_package(Systemd)
find_package(Udev)

install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/60-sunshine.rules"
DESTINATION "${UDEV_RULES_INSTALL_DIR}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service"
DESTINATION "${SYSTEMD_USER_UNIT_INSTALL_DIR}")
if(UDEV_FOUND)
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/60-sunshine.rules"
DESTINATION "${UDEV_RULES_INSTALL_DIR}")
endif()
if(SYSTEMD_FOUND)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service"
DESTINATION "${SYSTEMD_USER_UNIT_INSTALL_DIR}")
endif()
endif()

# Post install
Expand Down
93 changes: 6 additions & 87 deletions docker/debian-bookworm.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ ENV DEBIAN_FRONTEND=noninteractive

FROM sunshine-base as sunshine-build

ARG TARGETPLATFORM
RUN echo "target_platform: ${TARGETPLATFORM}"

ARG BRANCH
ARG BUILD_VERSION
ARG COMMIT
Expand All @@ -24,98 +21,20 @@ ENV BUILD_VERSION=${BUILD_VERSION}
ENV COMMIT=${COMMIT}

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# install dependencies
RUN <<_DEPS
#!/bin/bash
set -e
apt-get update -y
apt-get install -y --no-install-recommends \
build-essential \
cmake=3.25.* \
doxygen \
git \
graphviz \
libayatana-appindicator3-dev \
libcap-dev \
libcurl4-openssl-dev \
libdrm-dev \
libevdev-dev \
libminiupnpc-dev \
libnotify-dev \
libnuma-dev \
libopus-dev \
libpulse-dev \
libssl-dev \
libva-dev \
libvdpau-dev \
libwayland-dev \
libx11-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
libxcb1-dev \
libxfixes-dev \
libxrandr-dev \
libxtst-dev \
nodejs \
npm \
python3.11 \
python3.11-venv \
udev \
wget \
x11-xserver-utils \
xvfb
apt-get clean
rm -rf /var/lib/apt/lists/*
_DEPS

# install cuda
WORKDIR /build/cuda
# versions: https://developer.nvidia.com/cuda-toolkit-archive
ENV CUDA_VERSION="12.0.0"
ENV CUDA_BUILD="525.60.13"
# hadolint ignore=SC3010
RUN <<_INSTALL_CUDA
#!/bin/bash
set -e
cuda_prefix="https://developer.download.nvidia.com/compute/cuda/"
cuda_suffix=""
if [[ "${TARGETPLATFORM}" == 'linux/arm64' ]]; then
cuda_suffix="_sbsa"
fi
url="${cuda_prefix}${CUDA_VERSION}/local_installers/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux${cuda_suffix}.run"
echo "cuda url: ${url}"
wget "$url" --progress=bar:force:noscroll -q --show-progress -O ./cuda.run
chmod a+x ./cuda.run
./cuda.run --silent --toolkit --toolkitpath=/build/cuda --no-opengl-libs --no-man-page --no-drm
rm ./cuda.run
_INSTALL_CUDA

# copy repository
WORKDIR /build/sunshine/
COPY --link .. .

# setup build directory
WORKDIR /build/sunshine/build

# cmake and cpack
RUN <<_MAKE
RUN <<_BUILD
#!/bin/bash
set -e
cmake \
-DBUILD_WERROR=ON \
-DCMAKE_CUDA_COMPILER:PATH=/build/cuda/bin/nvcc \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DSUNSHINE_ASSETS_DIR=share/sunshine \
-DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
-DSUNSHINE_ENABLE_WAYLAND=ON \
-DSUNSHINE_ENABLE_X11=ON \
-DSUNSHINE_ENABLE_DRM=ON \
-DSUNSHINE_ENABLE_CUDA=ON \
/build/sunshine
make -j "$(nproc)"
cpack -G DEB
_MAKE
chmod +x ./scripts/linux_build.sh
./scripts/linux_build.sh --sudo-off
apt-get clean
rm -rf /var/lib/apt/lists/*
_BUILD

# run tests
WORKDIR /build/sunshine/build/tests
Expand Down
Loading