File 0009-Use-system-nodejs.patch of Package rstudio
From cda82f25c6365e19f1fae49f41af8142488b3267 Mon Sep 17 00:00:00 2001
From: haem <mixosaurus+obs@pm.me>
Date: Fri, 12 Sep 2025 18:00:22 +0200
Subject: [PATCH 09/12] Use system nodejs
---
src/node/CMakeNodeTools.txt | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/src/node/CMakeNodeTools.txt b/src/node/CMakeNodeTools.txt
index fb3f3942..e2127bd0 100644
--- a/src/node/CMakeNodeTools.txt
+++ b/src/node/CMakeNodeTools.txt
@@ -20,6 +20,7 @@ set(RSTUDIO_CMAKE_NODE_TOOLS_INCLUDED YES)
# set the node version
if(NOT DEFINED RSTUDIO_NODE_VERSION)
set(RSTUDIO_NODE_VERSION "22.13.1")
+ set(RSTUDIO_NODE_VERSION_MAJOR "22")
endif()
if(DEFINED ENV{RSTUDIO_NODE_VERSION})
set(RSTUDIO_NODE_VERSION $ENV{RSTUDIO_NODE_VERSION})
@@ -67,23 +68,35 @@ else()
"${CMAKE_CURRENT_LIST_DIR}/../../dependencies/common/node/${RSTUDIO_NODE_VERSION}")
endif()
-
+
+if (NOT NODEJS)
+ find_program(NODEJS NAMES node${RSTUDIO_NODE_VERSION_MAJOR} nodejs)
+endif()
+
if(NODEJS)
message(STATUS "Using node.js: ${NODEJS}")
else()
- message(FATAL_ERROR "node.js not found (required)")
+ message(FATAL_ERROR "node.js not found (required)")
+endif()
+
+if (NOT NPM)
+ find_program(NPM NAMES npm)
endif()
-
+
if(NPM)
message(STATUS "Using npm: ${NPM}")
else()
- message(FATAL_ERROR "npm not found (required for rsw-homepage)")
+ message(FATAL_ERROR "npm not found (required for rsw-homepage)")
+endif()
+
+if (NOT NPX)
+ find_program(NPX NAMES npx)
endif()
if(NPX)
message(STATUS "Using npx: ${NPX}")
else()
- message(STATUS "npx not found (required for Electron)")
+ message(STATUS "npx not found (required for Electron)")
endif()
get_filename_component(NODEJS_PATH ${NODEJS} DIRECTORY CACHE)
--
2.51.0