From c1ee690f8b12ec2eb1991cfdd9185ecb340d364c Mon Sep 17 00:00:00 2001 From: Clutchnp Date: Fri, 25 Apr 2025 10:55:09 +0530 Subject: [PATCH 1/9] add arch support for linux_build.sh script finsishing arch build --- scripts/linux_build.sh | 60 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) mode change 100644 => 100755 scripts/linux_build.sh diff --git a/scripts/linux_build.sh b/scripts/linux_build.sh old mode 100644 new mode 100755 index e13ad59452b..6abe5d11c6f --- a/scripts/linux_build.sh +++ b/scripts/linux_build.sh @@ -153,6 +153,54 @@ function add_ubuntu_deps() { ) } +function add_arch_deps() { + dependencies+=( + # Development tools and build dependencies + "bison" + "base-devel" # includes gcc, make, etc., replaces build-essential + "cmake" + "doxygen" + "git" + "graphviz" + "ninja" + "wget" + "gcc" + "gcc-fortran" + "clang" + "libcap" + "libcurl"-compat + "libdrm" + "libevdev" + "mesa" # provides libgbm + "miniupnpc" + "libnotify" + "numactl" + "opus" + "libpulse" + "openssl" # provides libssl + "wayland" + "libx11" + "libxcb" + "libxfixes" + "libxrandr" + "libxtst" + "libxshmfence" # xcb-shm replacement in some contexts + "wayland-protocols" + "xorgproto" + "nodejs" + "npm" + "systemd-libs" + "xorg-server-xvfb" + + ) + + if [ "$skip_libva" == 0 ]; then + dependencies+=( + "libva" # VA-API + ) + fi +} + function add_fedora_deps() { dependencies+=( "cmake" @@ -190,6 +238,8 @@ function add_fedora_deps() { "xorg-x11-server-Xvfb" # necessary for headless unit testing ) + + if [ "$skip_libva" == 0 ]; then dependencies+=( "libva-devel" # VA-API @@ -250,6 +300,8 @@ 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" == "arch" ]; then + installed_version=$(pacman -Q "$package_name" | awk '{print $2}' ) else echo "Unsupported Distro" return 1 @@ -310,6 +362,8 @@ function run_install() { elif [ "$distro" == "fedora" ]; then add_fedora_deps ${sudo_cmd} dnf group install "$dev_tools_group" -y + elif [ "$distro" == "arch" ]; then + add_arch_deps fi # Install the dependencies @@ -493,6 +547,12 @@ elif grep -q "Ubuntu 24.04" /etc/os-release; then cuda_build="520.61.05" gcc_version="11" nvm_node=0 +elif grep -q "Arch Linux" /etc/os-release; then + distro="arch" + version="rolling/not-needed" + package_update_command="${sudo_cmd} pacman -Syu --noconfirm" + package_install_command="${sudo_cmd} pacman -Sy" + nvm_node=0 else echo "Unsupported Distro or Version" exit 1 From fe1e66168bed51e472a278fa0e9ffa3a612f93f2 Mon Sep 17 00:00:00 2001 From: Clutchnp Date: Fri, 25 Apr 2025 20:37:21 +0530 Subject: [PATCH 2/9] remove unnecessary deps and santize code --- scripts/linux_build.sh | 115 ++++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 59 deletions(-) diff --git a/scripts/linux_build.sh b/scripts/linux_build.sh index 6abe5d11c6f..96447705a3a 100755 --- a/scripts/linux_build.sh +++ b/scripts/linux_build.sh @@ -90,6 +90,50 @@ shift $((OPTIND -1)) # dependencies array to build out dependencies=() +function add_arch_deps() { + dependencies+=( + 'avahi' + 'base-devel' + 'cmake' + 'curl' + 'git' + 'libayatana-appindicator' + 'libcap' + 'libdrm' + 'libevdev' + 'libmfx' + 'libnotify' + 'libpulse' + 'libva' + 'libx11' + 'libxcb' + 'libxfixes' + 'libxrandr' + 'libxtst' + 'miniupnpc' + 'ninja' + 'nodejs' + 'npm' + 'numactl' + 'openssl' + 'opus' + 'udev' + 'wayland' +) + + if [ "$skip_libva" == 0 ]; then + dependencies+=( + "libva" # VA-API + ) + fi + + if [ "$skip_cuda" == 0 ]; then + dependencies+=( + "cuda" # VA-API + ) + fi +} + function add_debian_based_deps() { dependencies+=( "bison" # required if we need to compile doxygen @@ -153,53 +197,6 @@ function add_ubuntu_deps() { ) } -function add_arch_deps() { - dependencies+=( - # Development tools and build dependencies - "bison" - "base-devel" # includes gcc, make, etc., replaces build-essential - "cmake" - "doxygen" - "git" - "graphviz" - "ninja" - "wget" - "gcc" - "gcc-fortran" - "clang" - "libcap" - "libcurl"-compat - "libdrm" - "libevdev" - "mesa" # provides libgbm - "miniupnpc" - "libnotify" - "numactl" - "opus" - "libpulse" - "openssl" # provides libssl - "wayland" - "libx11" - "libxcb" - "libxfixes" - "libxrandr" - "libxtst" - "libxshmfence" # xcb-shm replacement in some contexts - "wayland-protocols" - "xorgproto" - "nodejs" - "npm" - "systemd-libs" - "xorg-server-xvfb" - - ) - - if [ "$skip_libva" == 0 ]; then - dependencies+=( - "libva" # VA-API - ) - fi -} function add_fedora_deps() { dependencies+=( @@ -238,8 +235,6 @@ function add_fedora_deps() { "xorg-x11-server-Xvfb" # necessary for headless unit testing ) - - if [ "$skip_libva" == 0 ]; then dependencies+=( "libva-devel" # VA-API @@ -355,15 +350,15 @@ function run_install() { # Update the package list $package_update_command - if [ "$distro" == "debian" ]; then + if [ "$distro" == "arch" ]; then + add_arch_deps + elif [ "$distro" == "debian" ]; then add_debian_deps elif [ "$distro" == "ubuntu" ]; then add_ubuntu_deps elif [ "$distro" == "fedora" ]; then add_fedora_deps ${sudo_cmd} dnf group install "$dev_tools_group" -y - elif [ "$distro" == "arch" ]; then - add_arch_deps fi # Install the dependencies @@ -490,7 +485,15 @@ function run_install() { # Determine the OS and call the appropriate function cat /etc/os-release -if grep -q "Debian GNU/Linux 12 (bookworm)" /etc/os-release; then + +if grep -q "Arch Linux" /etc/os-release; then + distro="arch" + version="" + package_update_command="${sudo_cmd} pacman -Syu --noconfirm" + package_install_command="${sudo_cmd} pacman -Sy" + nvm_node=0 + +elif grep -q "Debian GNU/Linux 12 (bookworm)" /etc/os-release; then distro="debian" version="12" package_update_command="${sudo_cmd} apt-get update" @@ -547,12 +550,6 @@ elif grep -q "Ubuntu 24.04" /etc/os-release; then cuda_build="520.61.05" gcc_version="11" nvm_node=0 -elif grep -q "Arch Linux" /etc/os-release; then - distro="arch" - version="rolling/not-needed" - package_update_command="${sudo_cmd} pacman -Syu --noconfirm" - package_install_command="${sudo_cmd} pacman -Sy" - nvm_node=0 else echo "Unsupported Distro or Version" exit 1 From ef1d9db3ba70681661c198a930ad4cf12b6c9bd1 Mon Sep 17 00:00:00 2001 From: Clutchnp Date: Sat, 26 Apr 2025 09:14:21 +0530 Subject: [PATCH 3/9] dont install cuda if found in system cuda --- scripts/linux_build.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/linux_build.sh b/scripts/linux_build.sh index 96447705a3a..75a9e947c5d 100755 --- a/scripts/linux_build.sh +++ b/scripts/linux_build.sh @@ -197,7 +197,6 @@ function add_ubuntu_deps() { ) } - function add_fedora_deps() { dependencies+=( "cmake" @@ -243,6 +242,11 @@ function add_fedora_deps() { } function install_cuda() { + + if command -v nvcc >/dev/null 2>&1; then + echo "System CUDA found at: $(command -v nvcc)" + return + fi # check if we need to install cuda if [ -f "${build_dir}/cuda/bin/nvcc" ]; then echo "cuda already installed" @@ -492,7 +496,6 @@ if grep -q "Arch Linux" /etc/os-release; then package_update_command="${sudo_cmd} pacman -Syu --noconfirm" package_install_command="${sudo_cmd} pacman -Sy" nvm_node=0 - elif grep -q "Debian GNU/Linux 12 (bookworm)" /etc/os-release; then distro="debian" version="12" From e3c61985e65f35cab777a059e8b0079325b71c21 Mon Sep 17 00:00:00 2001 From: Clutchnp Date: Sat, 26 Apr 2025 21:22:52 +0530 Subject: [PATCH 4/9] set cuda compiler path in cmake_args --- scripts/linux_build.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/linux_build.sh b/scripts/linux_build.sh index 75a9e947c5d..44dcf6bb1cf 100755 --- a/scripts/linux_build.sh +++ b/scripts/linux_build.sh @@ -242,14 +242,14 @@ function add_fedora_deps() { } function install_cuda() { - - if command -v nvcc >/dev/null 2>&1; then - echo "System CUDA found at: $(command -v nvcc)" + nvcc_path=$(command -v nvcc) + if [ -n "$nvcc_path" ]; then + echo "found system cuda" return fi # check if we need to install cuda if [ -f "${build_dir}/cuda/bin/nvcc" ]; then - echo "cuda already installed" + nvcc_path="${build_dir}/cuda/bin/nvcc" return fi @@ -286,6 +286,7 @@ function install_cuda() { chmod a+x "${build_dir}/cuda.run" "${build_dir}/cuda.run" --silent --toolkit --toolkitpath="${build_dir}/cuda" --no-opengl-libs --no-man-page --no-drm rm "${build_dir}/cuda.run" + nvcc_path="${build_dir}/cuda/bin/nvcc" } function check_version() { @@ -446,10 +447,10 @@ function run_install() { fi # run the cuda install - if [ -n "$cuda_version" ] && [ "$skip_cuda" == 0 ]; then + if [ "$skip_cuda" == 0 ]; then install_cuda cmake_args+=("-DSUNSHINE_ENABLE_CUDA=ON") - cmake_args+=("-DCMAKE_CUDA_COMPILER:PATH=${build_dir}/cuda/bin/nvcc") + cmake_args+=("-DCMAKE_CUDA_COMPILER:PATH=$nvcc_path") fi # Cmake stuff here From a4a5b0ed2e0bb1bc5db1c2ff97db6b94c0454a1c Mon Sep 17 00:00:00 2001 From: Clutchnp Date: Sat, 26 Apr 2025 21:23:24 +0530 Subject: [PATCH 5/9] dont reinstall packages if not needed --- scripts/linux_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/linux_build.sh b/scripts/linux_build.sh index 44dcf6bb1cf..b7a44ee3e23 100755 --- a/scripts/linux_build.sh +++ b/scripts/linux_build.sh @@ -495,7 +495,7 @@ if grep -q "Arch Linux" /etc/os-release; then distro="arch" version="" package_update_command="${sudo_cmd} pacman -Syu --noconfirm" - package_install_command="${sudo_cmd} pacman -Sy" + package_install_command="${sudo_cmd} pacman -Sy --needed" nvm_node=0 elif grep -q "Debian GNU/Linux 12 (bookworm)" /etc/os-release; then distro="debian" From 9a045fb0b624fa87be893c60db8df1be55e9a0cb Mon Sep 17 00:00:00 2001 From: Clutchnp Date: Sat, 26 Apr 2025 21:27:38 +0530 Subject: [PATCH 6/9] make wording consistent --- scripts/linux_build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/linux_build.sh b/scripts/linux_build.sh index b7a44ee3e23..18a0c9fe61d 100755 --- a/scripts/linux_build.sh +++ b/scripts/linux_build.sh @@ -250,6 +250,7 @@ function install_cuda() { # check if we need to install cuda if [ -f "${build_dir}/cuda/bin/nvcc" ]; then nvcc_path="${build_dir}/cuda/bin/nvcc" + echo "found local cuda" return fi From 411cfa554189be01f7b12d01abbae0737457da9e Mon Sep 17 00:00:00 2001 From: Clutchnp Date: Sat, 26 Apr 2025 22:55:20 +0530 Subject: [PATCH 7/9] direct command -v errors to null --- scripts/linux_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/linux_build.sh b/scripts/linux_build.sh index 18a0c9fe61d..e45a9866864 100755 --- a/scripts/linux_build.sh +++ b/scripts/linux_build.sh @@ -242,7 +242,7 @@ function add_fedora_deps() { } function install_cuda() { - nvcc_path=$(command -v nvcc) + nvcc_path=$(command -v nvcc 2>/dev/null) if [ -n "$nvcc_path" ]; then echo "found system cuda" return From f7bc1cd38c4509ff08d306d36e86b35734b70406 Mon Sep 17 00:00:00 2001 From: Clutchnp Date: Tue, 29 Apr 2025 09:50:58 +0530 Subject: [PATCH 8/9] fix debian --- scripts/linux_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/linux_build.sh b/scripts/linux_build.sh index e45a9866864..83b1bfc80b5 100755 --- a/scripts/linux_build.sh +++ b/scripts/linux_build.sh @@ -242,7 +242,7 @@ function add_fedora_deps() { } function install_cuda() { - nvcc_path=$(command -v nvcc 2>/dev/null) + nvcc_path=$(command -v nvcc 2>/dev/null) || true if [ -n "$nvcc_path" ]; then echo "found system cuda" return From 4ec91718a682545f09d3d8b97da19387e3e28eb3 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Tue, 29 Apr 2025 08:30:44 -0400 Subject: [PATCH 9/9] Update scripts/linux_build.sh --- scripts/linux_build.sh | 56 +++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/scripts/linux_build.sh b/scripts/linux_build.sh index 83b1bfc80b5..3b541d95b71 100755 --- a/scripts/linux_build.sh +++ b/scripts/linux_build.sh @@ -92,34 +92,34 @@ dependencies=() function add_arch_deps() { dependencies+=( - 'avahi' - 'base-devel' - 'cmake' - 'curl' - 'git' - 'libayatana-appindicator' - 'libcap' - 'libdrm' - 'libevdev' - 'libmfx' - 'libnotify' - 'libpulse' - 'libva' - 'libx11' - 'libxcb' - 'libxfixes' - 'libxrandr' - 'libxtst' - 'miniupnpc' - 'ninja' - 'nodejs' - 'npm' - 'numactl' - 'openssl' - 'opus' - 'udev' - 'wayland' -) + 'avahi' + 'base-devel' + 'cmake' + 'curl' + 'git' + 'libayatana-appindicator' + 'libcap' + 'libdrm' + 'libevdev' + 'libmfx' + 'libnotify' + 'libpulse' + 'libva' + 'libx11' + 'libxcb' + 'libxfixes' + 'libxrandr' + 'libxtst' + 'miniupnpc' + 'ninja' + 'nodejs' + 'npm' + 'numactl' + 'openssl' + 'opus' + 'udev' + 'wayland' + ) if [ "$skip_libva" == 0 ]; then dependencies+=(