mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-08-10 00:52:16 +00:00
Compare commits
1 Commits
master
...
build/dock
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88fbd5a398 |
@@ -1,16 +1,19 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
# artifacts: true
|
# artifacts: true
|
||||||
# platforms: linux/amd64,linux/arm64/v8
|
# platforms: linux/amd64,linux/arm64/v8
|
||||||
# platforms_pr: linux/amd64
|
# platforms_pr: linux/amd64,linux/arm64/v8
|
||||||
# no-cache-filters: sunshine-base,artifacts,sunshine
|
# no-cache-filters: sunshine-base,artifacts,sunshine
|
||||||
ARG BASE=debian
|
ARG BASE=debian
|
||||||
ARG TAG=bookworm
|
ARG TAG=bookworm
|
||||||
FROM ${BASE}:${TAG} AS sunshine-base
|
FROM ${BASE}:${TAG} AS sunshine-base
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
FROM sunshine-base AS sunshine-build
|
ARG BASE
|
||||||
|
ARG TAG
|
||||||
|
FROM --platform=$BUILDPLATFORM ${BASE}:${TAG} AS sunshine-build
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
ARG TARGETPLATFORM
|
||||||
ARG BRANCH
|
ARG BRANCH
|
||||||
ARG BUILD_VERSION
|
ARG BUILD_VERSION
|
||||||
ARG COMMIT
|
ARG COMMIT
|
||||||
@@ -30,8 +33,33 @@ COPY --link .. .
|
|||||||
RUN <<_BUILD
|
RUN <<_BUILD
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
if [[ "${BUILDPLATFORM}" != "${TARGETPLATFORM}" ]]; then
|
||||||
|
cross_compile="--cross-compile"
|
||||||
|
else
|
||||||
|
cross_compile=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "${TARGETPLATFORM}" in
|
||||||
|
linux/amd64)
|
||||||
|
cc_target_tuple="x86_64-linux-gnu"
|
||||||
|
cc_target_arch="amd64"
|
||||||
|
;;
|
||||||
|
linux/arm64)
|
||||||
|
cc_target_tuple="aarch64-linux-gnu"
|
||||||
|
cc_target_arch="arm64"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "unsupported platform: ${TARGETPLATFORM}";
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
chmod +x ./scripts/linux_build.sh
|
chmod +x ./scripts/linux_build.sh
|
||||||
./scripts/linux_build.sh \
|
./scripts/linux_build.sh \
|
||||||
|
${cross_compile} \
|
||||||
|
--cc-target-tuple="${cc_target_tuple}" \
|
||||||
|
--cc-target-arch="${cc_target_arch}" \
|
||||||
--publisher-name='LizardByte' \
|
--publisher-name='LizardByte' \
|
||||||
--publisher-website='https://app.lizardbyte.dev' \
|
--publisher-website='https://app.lizardbyte.dev' \
|
||||||
--publisher-issue-url='https://app.lizardbyte.dev/support' \
|
--publisher-issue-url='https://app.lizardbyte.dev/support' \
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ set -e
|
|||||||
|
|
||||||
# Default value for arguments
|
# Default value for arguments
|
||||||
appimage_build=0
|
appimage_build=0
|
||||||
|
cc_install_root="/mnt/cross"
|
||||||
|
cc_target_tuple="$(uname -m)-linux-gnu"
|
||||||
|
cc_target_arch="$(dpkg --print-architecture || rpm --eval '%{_host}')"
|
||||||
|
cross_compile=0
|
||||||
num_processors=$(nproc)
|
num_processors=$(nproc)
|
||||||
publisher_name="Third Party Publisher"
|
publisher_name="Third Party Publisher"
|
||||||
publisher_website=""
|
publisher_website=""
|
||||||
@@ -28,6 +32,10 @@ Options:
|
|||||||
-h, --help Display this help message.
|
-h, --help Display this help message.
|
||||||
-s, --sudo-off Disable sudo command.
|
-s, --sudo-off Disable sudo command.
|
||||||
--appimage-build Compile for AppImage, this will not create the AppImage, just the executable.
|
--appimage-build Compile for AppImage, this will not create the AppImage, just the executable.
|
||||||
|
--cc-install-root The root directory to install the cross compiler. Default is /mnt/cross. (Fedora only)
|
||||||
|
--cc-target-tuple The target tuple for the cross compiler.
|
||||||
|
--cc-target-arch The target architecture for the cross compiler.
|
||||||
|
--cross-compile Enable cross compilation.
|
||||||
--num-processors The number of processors to use for compilation. Default is the value of 'nproc'.
|
--num-processors The number of processors to use for compilation. Default is the value of 'nproc'.
|
||||||
--publisher-name The name of the publisher (not developer) of the application.
|
--publisher-name The name of the publisher (not developer) of the application.
|
||||||
--publisher-website The URL of the publisher's website.
|
--publisher-website The URL of the publisher's website.
|
||||||
@@ -55,6 +63,16 @@ while getopts ":hs-:" opt; do
|
|||||||
appimage_build=1
|
appimage_build=1
|
||||||
skip_libva=1
|
skip_libva=1
|
||||||
;;
|
;;
|
||||||
|
cc-install-root=*)
|
||||||
|
cc_install_root="${OPTARG#*=}"
|
||||||
|
;;
|
||||||
|
cc-target-tuple=*)
|
||||||
|
cc_target_tuple="${OPTARG#*=}"
|
||||||
|
;;
|
||||||
|
cc-target-arch=*)
|
||||||
|
cc_target_arch="${OPTARG#*=}"
|
||||||
|
;;
|
||||||
|
cross-compile) cross_compile=1 ;;
|
||||||
num-processors=*)
|
num-processors=*)
|
||||||
num_processors="${OPTARG#*=}"
|
num_processors="${OPTARG#*=}"
|
||||||
;;
|
;;
|
||||||
@@ -97,28 +115,28 @@ function add_debain_based_deps() {
|
|||||||
"cmake"
|
"cmake"
|
||||||
"doxygen"
|
"doxygen"
|
||||||
"flex" # required if we need to compile doxygen
|
"flex" # required if we need to compile doxygen
|
||||||
"gcc-${gcc_version}"
|
"gcc-${gcc_version}:${cc_target_arch}"
|
||||||
"g++-${gcc_version}"
|
"g++-${gcc_version}:${cc_target_arch}"
|
||||||
"git"
|
"git"
|
||||||
"graphviz"
|
"graphviz"
|
||||||
"libcap-dev" # KMS
|
"libcap-dev:${cc_target_arch}" # KMS
|
||||||
"libcurl4-openssl-dev"
|
"libcurl4-openssl-dev:${cc_target_arch}"
|
||||||
"libdrm-dev" # KMS
|
"libdrm-dev:${cc_target_arch}" # KMS
|
||||||
"libevdev-dev"
|
"libevdev-dev:${cc_target_arch}"
|
||||||
"libminiupnpc-dev"
|
"libminiupnpc-dev:${cc_target_arch}"
|
||||||
"libnotify-dev"
|
"libnotify-dev:${cc_target_arch}"
|
||||||
"libnuma-dev"
|
"libnuma-dev:${cc_target_arch}"
|
||||||
"libopus-dev"
|
"libopus-dev:${cc_target_arch}"
|
||||||
"libpulse-dev"
|
"libpulse-dev:${cc_target_arch}"
|
||||||
"libssl-dev"
|
"libssl-dev:${cc_target_arch}"
|
||||||
"libwayland-dev" # Wayland
|
"libwayland-dev:${cc_target_arch}" # Wayland
|
||||||
"libx11-dev" # X11
|
"libx11-dev:${cc_target_arch}" # X11
|
||||||
"libxcb-shm0-dev" # X11
|
"libxcb-shm0-dev:${cc_target_arch}" # X11
|
||||||
"libxcb-xfixes0-dev" # X11
|
"libxcb-xfixes0-dev:${cc_target_arch}" # X11
|
||||||
"libxcb1-dev" # X11
|
"libxcb1-dev:${cc_target_arch}" # X11
|
||||||
"libxfixes-dev" # X11
|
"libxfixes-dev:${cc_target_arch}" # X11
|
||||||
"libxrandr-dev" # X11
|
"libxrandr-dev:${cc_target_arch}" # X11
|
||||||
"libxtst-dev" # X11
|
"libxtst-dev:${cc_target_arch}" # X11
|
||||||
"ninja-build"
|
"ninja-build"
|
||||||
"npm" # web-ui
|
"npm" # web-ui
|
||||||
"udev"
|
"udev"
|
||||||
@@ -128,7 +146,13 @@ function add_debain_based_deps() {
|
|||||||
|
|
||||||
if [ "$skip_libva" == 0 ]; then
|
if [ "$skip_libva" == 0 ]; then
|
||||||
dependencies+=(
|
dependencies+=(
|
||||||
"libva-dev" # VA-API
|
"libva-dev:${cc_target_arch}" # VA-API
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$cross_compile" == 1 ]; then
|
||||||
|
dependencies+=(
|
||||||
|
"crossbuild-essential-${cc_target_arch}"
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -136,7 +160,7 @@ function add_debain_based_deps() {
|
|||||||
function add_debain_deps() {
|
function add_debain_deps() {
|
||||||
add_debain_based_deps
|
add_debain_based_deps
|
||||||
dependencies+=(
|
dependencies+=(
|
||||||
"libayatana-appindicator3-dev"
|
"libayatana-appindicator3-dev:${cc_target_arch}"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +172,7 @@ function add_ubuntu_deps() {
|
|||||||
|
|
||||||
add_debain_based_deps
|
add_debain_based_deps
|
||||||
dependencies+=(
|
dependencies+=(
|
||||||
"libappindicator3-dev"
|
"libappindicator3-dev:${cc_target_arch}"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,10 +180,19 @@ function add_fedora_deps() {
|
|||||||
dependencies+=(
|
dependencies+=(
|
||||||
"cmake"
|
"cmake"
|
||||||
"doxygen"
|
"doxygen"
|
||||||
"gcc"
|
|
||||||
"g++"
|
|
||||||
"git"
|
"git"
|
||||||
"graphviz"
|
"graphviz"
|
||||||
|
"ninja-build"
|
||||||
|
"npm"
|
||||||
|
"rpm-build" # if you want to build an RPM binary package
|
||||||
|
"wget" # necessary for cuda install with `run` file
|
||||||
|
"which" # necessary for cuda install with `run` file
|
||||||
|
"xorg-x11-server-Xvfb" # necessary for headless unit testing
|
||||||
|
)
|
||||||
|
|
||||||
|
arch_dependencies=(
|
||||||
|
"gcc"
|
||||||
|
"g++"
|
||||||
"libappindicator-gtk3-devel"
|
"libappindicator-gtk3-devel"
|
||||||
"libcap-devel"
|
"libcap-devel"
|
||||||
"libcurl-devel"
|
"libcurl-devel"
|
||||||
@@ -176,20 +209,14 @@ function add_fedora_deps() {
|
|||||||
"libXtst-devel" # X11
|
"libXtst-devel" # X11
|
||||||
"mesa-libGL-devel"
|
"mesa-libGL-devel"
|
||||||
"miniupnpc-devel"
|
"miniupnpc-devel"
|
||||||
"ninja-build"
|
|
||||||
"npm"
|
|
||||||
"numactl-devel"
|
"numactl-devel"
|
||||||
"openssl-devel"
|
"openssl-devel"
|
||||||
"opus-devel"
|
"opus-devel"
|
||||||
"pulseaudio-libs-devel"
|
"pulseaudio-libs-devel"
|
||||||
"rpm-build" # if you want to build an RPM binary package
|
|
||||||
"wget" # necessary for cuda install with `run` file
|
|
||||||
"which" # necessary for cuda install with `run` file
|
|
||||||
"xorg-x11-server-Xvfb" # necessary for headless unit testing
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if [ "$skip_libva" == 0 ]; then
|
if [ "$skip_libva" == 0 ]; then
|
||||||
dependencies+=(
|
arch_dependencies+=(
|
||||||
"libva-devel" # VA-API
|
"libva-devel" # VA-API
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
@@ -204,15 +231,15 @@ function install_cuda() {
|
|||||||
|
|
||||||
local cuda_prefix="https://developer.download.nvidia.com/compute/cuda/"
|
local cuda_prefix="https://developer.download.nvidia.com/compute/cuda/"
|
||||||
local cuda_suffix=""
|
local cuda_suffix=""
|
||||||
if [ "$architecture" == "aarch64" ]; then
|
if [ "$cc_target_arch" == "aarch64" ]; then
|
||||||
local cuda_suffix="_sbsa"
|
local cuda_suffix="_sbsa"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$architecture" == "aarch64" ]; then
|
if [ "$cc_target_arch" == "aarch64" ]; then
|
||||||
# we need to patch the math-vector.h file for aarch64 fedora
|
# we need to patch the math-vector.h file for aarch64 fedora
|
||||||
# back up /usr/include/bits/math-vector.h
|
# back up /usr/include/bits/math-vector.h
|
||||||
math_vector_file=""
|
math_vector_file=""
|
||||||
if [ "$distro" == "ubuntu" ] || [ "$version" == "24.04" ]; then
|
if [ "$distro" == "ubuntu" ] && [ "$version" == "24.04" ]; then
|
||||||
math_vector_file="/usr/include/aarch64-linux-gnu/bits/math-vector.h"
|
math_vector_file="/usr/include/aarch64-linux-gnu/bits/math-vector.h"
|
||||||
elif [ "$distro" == "fedora" ]; then
|
elif [ "$distro" == "fedora" ]; then
|
||||||
math_vector_file="/usr/include/bits/math-vector.h"
|
math_vector_file="/usr/include/bits/math-vector.h"
|
||||||
@@ -283,6 +310,11 @@ function run_install() {
|
|||||||
"-DSUNSHINE_ENABLE_DRM=ON"
|
"-DSUNSHINE_ENABLE_DRM=ON"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if [ "$cross_compile" == 1 ]; then
|
||||||
|
cmake_args+=("-DCMAKE_C_COMPILER=${cc_target_tuple}-gcc")
|
||||||
|
cmake_args+=("-DCMAKE_CXX_COMPILER=${cc_target_tuple}-g++")
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$appimage_build" == 1 ]; then
|
if [ "$appimage_build" == 1 ]; then
|
||||||
cmake_args+=("-DSUNSHINE_BUILD_APPIMAGE=ON")
|
cmake_args+=("-DSUNSHINE_BUILD_APPIMAGE=ON")
|
||||||
fi
|
fi
|
||||||
@@ -313,6 +345,11 @@ function run_install() {
|
|||||||
# Install the dependencies
|
# Install the dependencies
|
||||||
$package_install_command "${dependencies[@]}"
|
$package_install_command "${dependencies[@]}"
|
||||||
|
|
||||||
|
# Fedora has a special command for installing architecture specific packages
|
||||||
|
if [ "$distro" == "fedora" ]; then
|
||||||
|
$package_install_command_arch "${arch_dependencies[@]}"
|
||||||
|
fi
|
||||||
|
|
||||||
# reload the environment
|
# reload the environment
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
source ~/.bashrc
|
source ~/.bashrc
|
||||||
@@ -448,6 +485,11 @@ elif grep -q "PLATFORM_ID=\"platform:f39\"" /etc/os-release; then
|
|||||||
version="39"
|
version="39"
|
||||||
package_update_command="${sudo_cmd} dnf update -y"
|
package_update_command="${sudo_cmd} dnf update -y"
|
||||||
package_install_command="${sudo_cmd} dnf install -y"
|
package_install_command="${sudo_cmd} dnf install -y"
|
||||||
|
if [ "$cross_compile" == 0 ]; then
|
||||||
|
package_install_command_arch="${sudo_cmd} dnf -y --releasever=39 --forcearch=${cc_target_arch} install"
|
||||||
|
else
|
||||||
|
package_install_command_arch="${sudo_cmd} dnf -y --installroot=${cc_install_root} --releasever=39 --forcearch=${cc_target_arch} install"
|
||||||
|
fi
|
||||||
cuda_version="12.4.0"
|
cuda_version="12.4.0"
|
||||||
cuda_build="550.54.14"
|
cuda_build="550.54.14"
|
||||||
gcc_version="13"
|
gcc_version="13"
|
||||||
@@ -457,6 +499,11 @@ elif grep -q "PLATFORM_ID=\"platform:f40\"" /etc/os-release; then
|
|||||||
version="40"
|
version="40"
|
||||||
package_update_command="${sudo_cmd} dnf update -y"
|
package_update_command="${sudo_cmd} dnf update -y"
|
||||||
package_install_command="${sudo_cmd} dnf install -y"
|
package_install_command="${sudo_cmd} dnf install -y"
|
||||||
|
if [ "$cross_compile" == 0 ]; then
|
||||||
|
package_install_command_arch="${sudo_cmd} dnf -y --releasever=39 --forcearch=${cc_target_arch} install"
|
||||||
|
else
|
||||||
|
package_install_command_arch="${sudo_cmd} dnf -y --installroot=${cc_install_root} --releasever=39 --forcearch=${cc_target_arch} install"
|
||||||
|
fi
|
||||||
cuda_version=
|
cuda_version=
|
||||||
cuda_build=
|
cuda_build=
|
||||||
gcc_version="13"
|
gcc_version="13"
|
||||||
|
|||||||
Reference in New Issue
Block a user