Skip to content
Closed
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
5 changes: 5 additions & 0 deletions cmake/compile_definitions/linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ if (${SUNSHINE_TRAY} EQUAL 0 AND SUNSHINE_REQUIRE_TRAY)
message(FATAL_ERROR "Tray icon is required")
endif()

pkg_check_modules(EVDEV libevdev REQUIRED)
include_directories(SYSTEM ${EVDEV_INCLUDE_DIRS})
link_directories(${EVDEV_LIBRARY_DIRS})
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES ${EVDEV_LIBRARIES})

list(APPEND PLATFORM_TARGET_FILES
"${CMAKE_SOURCE_DIR}/src/platform/linux/publish.cpp"
"${CMAKE_SOURCE_DIR}/src/platform/linux/graphics.h"
Expand Down
176 changes: 133 additions & 43 deletions docker/fedora-38.dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
# syntax=docker/dockerfile:1.4
# artifacts: true
# platforms: linux/amd64,linux/arm64/v8
# platforms_pr: linux/amd64
# platforms_pr: linux/amd64,linux/arm64/v8
# no-cache-filters: sunshine-base,artifacts,sunshine
ARG BASE=fedora
ARG TAG=38
FROM ${BASE}:${TAG} AS sunshine-base
FROM --platform=$BUILDPLATFORM ${BASE}:${TAG} AS sunshine-base

FROM sunshine-base as sunshine-build

# reused args from base
ARG TAG
ENV TAG=${TAG}

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

# args from ci workflow
ARG BRANCH
ARG BUILD_VERSION
ARG COMMIT
Expand All @@ -22,57 +27,117 @@ ENV BUILD_VERSION=${BUILD_VERSION}
ENV COMMIT=${COMMIT}

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# install dependencies
# setup env
WORKDIR /env
RUN <<_ENV
#!/bin/bash
set -e
case "${TARGETPLATFORM}" in
linux/amd64)
TARGETARCH=x86_64
echo GCC_FLAVOR="" >> ./env
echo "DNF=( dnf -y --releasever \"${TAG}\" --forcearch \"${TARGETARCH}\" )" >> ./env
;;
linux/arm64)
TARGETARCH=aarch64
echo GCC_FLAVOR="-${TARGETARCH}-linux-gnu" >> ./env
echo "DNF=( dnf -y --installroot /mnt/cross --releasever \"${TAG}\" --forcearch \"${TARGETARCH}\" )" >> ./env
;;
*)
echo "unsupported platform: ${TARGETPLATFORM}";
exit 1
;;
esac
echo TARGETARCH=${TARGETARCH} >> ./env
echo TUPLE=${TARGETARCH}-linux-gnu >> ./env
_ENV

# reset workdir
WORKDIR /

# install build dependencies
# hadolint ignore=DL3041
RUN <<_DEPS
RUN <<_DEPS_A
#!/bin/bash
set -e

# shellcheck source=/dev/null
source /env/env

dnf -y update
dnf -y group install "Development Tools"
dnf -y install \
boost-devel-1.78.0* \
cmake-3.27.* \
doxygen \
gcc-13.2.* \
gcc-c++-13.2.* \
git \
graphviz \
libappindicator-gtk3-devel \
libcap-devel \
libcurl-devel \
libdrm-devel \
libevdev-devel \
libnotify-devel \
libva-devel \
libvdpau-devel \
libX11-devel \
libxcb-devel \
libXcursor-devel \
libXfixes-devel \
libXi-devel \
libXinerama-devel \
libXrandr-devel \
libXtst-devel \
mesa-libGL-devel \
miniupnpc-devel \
gcc"${GCC_FLAVOR}"-13.2.* \
gcc-c++"${GCC_FLAVOR}"-13.2.* \
git-core \
nodejs \
numactl-devel \
openssl-devel \
opus-devel \
pulseaudio-libs-devel \
python3.10 \
pkgconf-pkg-config \
rpm-build \
wayland-devel \
wget \
which \
xorg-x11-server-Xvfb
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
dnf -y install intel-mediasdk-devel
fi
which
dnf clean all
_DEPS_A

# install host dependencies
# hadolint ignore=DL3041
RUN <<_DEPS_B
#!/bin/bash
set -e

# shellcheck source=/dev/null
source /env/env

# Initialize an array for packages
packages=(
boost-devel-1.78.0*
doxygen
glibc-devel
graphviz
libappindicator-gtk3-devel
libcap-devel
libcurl-devel
libdrm-devel
libevdev-devel
libnotify-devel
libstdc++-devel
libva-devel
libvdpau-devel
libX11-devel
libxcb-devel
libXcursor-devel
libXfixes-devel
libXi-devel
libXinerama-devel
libXrandr-devel
libXtst-devel
mesa-libGL-devel
miniupnpc-devel
numactl-devel
openssl-devel
opus-devel
pulseaudio-libs-devel
python3.10
wayland-devel
)

# Conditionally include arch specific packages
if [[ "${TARGETARCH}" == 'x86_64' ]]; then
packages+=(intel-mediasdk-devel)
fi

"${DNF[@]}" install \
filesystem

# Install packages using the array
"${DNF[@]}" --setopt=tsflags=noscripts install "${packages[@]}"

# Clean up
"${DNF[@]}" clean all
rm -rf /var/cache/yum
_DEPS
_DEPS_B

## install cuda
# install cuda
WORKDIR /build/cuda
## versions: https://developer.nvidia.com/cuda-toolkit-archive
ENV CUDA_VERSION="12.4.0"
Expand All @@ -83,7 +148,7 @@ RUN <<_INSTALL_CUDA
set -e
cuda_prefix="https://developer.download.nvidia.com/compute/cuda/"
cuda_suffix=""
if [[ "${TARGETPLATFORM}" == 'linux/arm64' ]]; then
if [[ "${TARGETARCH}" == 'aarch64' ]]; then
cuda_suffix="_sbsa"
fi
url="${cuda_prefix}${CUDA_VERSION}/local_installers/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux${cuda_suffix}.run"
Expand All @@ -105,7 +170,32 @@ WORKDIR /build/sunshine/build
RUN <<_MAKE
#!/bin/bash
set -e

# shellcheck source=/dev/null
source /env/env

# shellcheck disable=SC2086
if [[ "${TARGETARCH}" == 'aarch64' ]]; then
CXX_FLAG_1="$(echo /mnt/cross/usr/include/c++/[0-9]*/)"
CXX_FLAG_2="$(echo /mnt/cross/usr/include/c++/[0-9]*/${TUPLE%%-*}-*/)"
LD_FLAG="$(echo /mnt/cross/usr/lib/gcc/${TUPLE%%-*}-*/[0-9]*/)"

export \
CXXFLAGS="-isystem ${CXX_FLAG_1} -isystem ${CXX_FLAG_2}" \
LDFLAGS="-L${LD_FLAG}" \
PKG_CONFIG_LIBDIR=/mnt/cross/usr/lib64/pkgconfig:/mnt/cross/usr/share/pkgconfig \
PKG_CONFIG_SYSROOT_DIR=/mnt/cross \
PKG_CONFIG_SYSTEM_INCLUDE_PATH=/mnt/cross/usr/include \
PKG_CONFIG_SYSTEM_LIBRARY_PATH=/mnt/cross/usr/lib64
fi

TOOLCHAIN_OPTION=""
if [[ "${TARGETARCH}" != 'x86_64' ]]; then
TOOLCHAIN_OPTION="-DCMAKE_TOOLCHAIN_FILE=toolchain-${TUPLE}.cmake"
fi

cmake \
"$TOOLCHAIN_OPTION" \
-DCMAKE_CUDA_COMPILER:PATH=/build/cuda/bin/nvcc \
-DBUILD_WERROR=ON \
-DCMAKE_BUILD_TYPE=Release \
Expand Down Expand Up @@ -138,7 +228,7 @@ ARG TAG
ARG TARGETARCH
COPY --link --from=sunshine-build /build/sunshine/build/cpack_artifacts/Sunshine.rpm /sunshine-${BASE}-${TAG}-${TARGETARCH}.rpm

FROM sunshine-base as sunshine
FROM ${BASE}:${TAG} AS sunshine

# copy deb from builder
COPY --link --from=artifacts /sunshine*.rpm /sunshine.rpm
Expand Down
Loading