Skip to content

build(linux): Add support for openSUSE Tumbleweed #3676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
35 changes: 21 additions & 14 deletions cmake/packaging/linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,27 @@ set(CPACK_DEBIAN_PACKAGE_DEPENDS "\
libx11-6, \
miniupnpc, \
openssl | libssl3")
set(CPACK_RPM_PACKAGE_REQUIRES "\
${CPACK_RPM_PLATFORM_PACKAGE_REQUIRES} \
libcap >= 2.22, \
libcurl >= 7.0, \
libdrm >= 2.4.97, \
libevdev >= 1.5.6, \
libopusenc >= 0.2.1, \
libva >= 2.14.0, \
libwayland-client >= 1.20.0, \
libX11 >= 1.7.3.1, \
miniupnpc >= 2.2.4, \
numactl-libs >= 2.0.14, \
openssl >= 3.0.2, \
pulseaudio-libs >= 10.0")

if (SUNSHINE_BUILD_DISTRO STREQUAL "opensuse")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (SUNSHINE_BUILD_DISTRO STREQUAL "opensuse")
if(SUNSHINE_BUILD_DISTRO STREQUAL "opensuse")

Can you also add a comment about why this behavior is needed?

set(CPACK_RPM_PACKAGE_REQUIRES "\
${CPACK_RPM_PLATFORM_PACKAGE_REQUIRES} \
libcap-progs")
ELSE()
set(CPACK_RPM_PACKAGE_REQUIRES "\
${CPACK_RPM_PLATFORM_PACKAGE_REQUIRES} \
libcap >= 2.22, \
libcurl >= 7.0, \
libdrm >= 2.4.97, \
libevdev >= 1.5.6, \
libopusenc >= 0.2.1, \
libva >= 2.14.0, \
libwayland-client >= 1.20.0, \
libX11 >= 1.7.3.1, \
miniupnpc >= 2.2.4, \
numactl-libs >= 2.0.14, \
openssl >= 3.0.2, \
pulseaudio-libs >= 10.0")
ENDIF()

if(NOT BOOST_USE_STATIC)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "\
Expand Down
44 changes: 43 additions & 1 deletion scripts/linux_build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,34 @@ function add_ubuntu_deps() {
)
}

function add_opensuse_deps() {
dependencies+=(
"git"
"gcc-c++"
"libappindicator3-devel"
"libcap-devel"
"libcurl-devel"
"libdrm-devel"
"libevdev-devel"
"libminiupnpc-devel"
"libnotify-devel"
"libnuma-devel"
"libopenssl-devel"
"libopus-devel"
"libpulse-devel"
"ninja"
"nodejs"
"rpm-build"
"udev"
)

if [ "$skip_libva" == 0 ]; then
dependencies+=(
"libva-devel" # VA-API
)
fi
}

function add_fedora_deps() {
dependencies+=(
"cmake"
Expand Down Expand Up @@ -248,6 +276,9 @@ function check_version() {
installed_version=$(dpkg -s "$package_name" 2>/dev/null | grep '^Version:' | awk '{print $2}')
elif [ "$distro" == "fedora" ]; then
installed_version=$(rpm -q --queryformat '%{VERSION}' "$package_name" 2>/dev/null)
elif [ "$distro" == "opensuse" ]; then
# avoid using system packages on openSUSE - boost and doxygen versions cause errors
return 1
Comment on lines +279 to +281
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part of the code is just supposed to check what the installed version is.

else
echo "Unsupported Distro"
return 1
Expand Down Expand Up @@ -283,6 +314,8 @@ function run_install() {
"-DSUNSHINE_ENABLE_DRM=ON"
)

cmake_args+=("-DSUNSHINE_BUILD_DISTRO='${distro}'")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how I feel about this cmake arg yet, but it should be in the array above. It doesn't need to use the += since there is no conditional logic on whether to use it or not.


if [ "$appimage_build" == 1 ]; then
cmake_args+=("-DSUNSHINE_BUILD_APPIMAGE=ON")
fi
Expand All @@ -308,6 +341,8 @@ function run_install() {
elif [ "$distro" == "fedora" ]; then
add_fedora_deps
${sudo_cmd} dnf group install "Development Tools" -y
elif [ "$distro" == "opensuse" ]; then
add_opensuse_deps
fi

# Install the dependencies
Expand Down Expand Up @@ -395,6 +430,8 @@ function run_install() {
install_cuda
cmake_args+=("-DSUNSHINE_ENABLE_CUDA=ON")
cmake_args+=("-DCMAKE_CUDA_COMPILER:PATH=${build_dir}/cuda/bin/nvcc")
else
cmake_args+=("-DSUNSHINE_ENABLE_CUDA=OFF")
fi

# Cmake stuff here
Expand All @@ -408,7 +445,7 @@ function run_install() {
if [ "$skip_package" == 0 ]; then
if [ "$distro" == "debian" ] || [ "$distro" == "ubuntu" ]; then
cpack -G DEB --config ./build/CPackConfig.cmake
elif [ "$distro" == "fedora" ]; then
elif [ "$distro" == "fedora" ] || [ "$distro" == "opensuse" ]; then
cpack -G RPM --config ./build/CPackConfig.cmake
fi
fi
Expand Down Expand Up @@ -479,6 +516,11 @@ elif grep -q "Ubuntu 24.04" /etc/os-release; then
cuda_build="520.61.05"
gcc_version="11"
nvm_node=0
elif grep -q "opensuse-tumbleweed" /etc/os-release; then
distro="opensuse"
version="tumbleweed"
package_update_command="${sudo_cmd} zypper dup"
package_install_command="${sudo_cmd} zypper in -y"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
package_install_command="${sudo_cmd} zypper in -y"
package_install_command="${sudo_cmd} zypper in -y"
cuda_version="11.8.0"
cuda_build="520.61.05"
gcc_version="11"
nvm_node=0

It appears cuda should work just fine on opensuse. https://developer.nvidia.com/cuda-11-8-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=OpenSUSE&target_version=15&target_type=runfile_local

Although, it depends on the version of gcc you can get. If gcc is too new you can set the cuda_version and cuda_build to empty like the fedora 40 one. Also please set the gcc_version to whatever version is available. I know it's not used in the script for non debian distros, but it serves as a reference for us.

else
echo "Unsupported Distro or Version"
exit 1
Expand Down