nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1diff --git a/cmake/globals.cmake b/cmake/globals.cmake
2index e53248b..c705d67 100644
3--- a/cmake/globals.cmake
4+++ b/cmake/globals.cmake
5@@ -334,6 +334,7 @@ if (APPLE)
6 set(RSTUDIO_INSTALL_SUPPORTING RStudio.app/Contents/Resources/app)
7 # handles Quarto share when not stored alongside bin
8 set(RSTUDIO_INSTALL_RESOURCES RStudio.app/Contents/Resources)
9+ set(RSTUDIO_INSTALL_ELECTRON .)
10 else()
11 set(RSTUDIO_INSTALL_BIN RStudio.app/Contents/MacOS)
12 set(RSTUDIO_INSTALL_SUPPORTING RStudio.app/Contents/Resources)
13diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt
14index 76f3acb..2910cee 100644
15--- a/src/cpp/CMakeLists.txt
16+++ b/src/cpp/CMakeLists.txt
17@@ -243,7 +243,7 @@ endif()
18 # determine whether we should statically link boost. we always do this
19 # unless we are building a non-packaged build on linux (in which case
20 # boost dynamic libraries are presumed to be installed on the system ldpath)
21-if(APPLE OR WIN32 OR RSTUDIO_PACKAGE_BUILD)
22+if(WIN32 OR RSTUDIO_PACKAGE_BUILD)
23 set(Boost_USE_STATIC_LIBS ON)
24 endif()
25
26@@ -483,7 +483,7 @@ endif()
27
28 # find SOCI libraries
29 if(UNIX)
30- if(NOT APPLE AND RSTUDIO_USE_SYSTEM_SOCI)
31+ if(RSTUDIO_USE_SYSTEM_SOCI)
32 find_library(SOCI_CORE_LIB NAMES "libsoci_core.a" "soci_core" REQUIRED)
33 find_library(SOCI_SQLITE_LIB NAMES "libsoci_sqlite3.a" "soci_sqlite3" REQUIRED)
34 if(RSTUDIO_PRO_BUILD)
35diff --git a/src/node/CMakeNodeTools.txt b/src/node/CMakeNodeTools.txt
36index 40ae0f3..756fd5f 100644
37--- a/src/node/CMakeNodeTools.txt
38+++ b/src/node/CMakeNodeTools.txt
39@@ -27,17 +27,7 @@ endif()
40
41 # set cmake env vars for node (NODEJS) and node tools, like YARN, and NPM
42
43-if(APPLE AND UNAME_M STREQUAL arm64)
44-
45- # make sure we're using arm64 binaries of node / npm for arm64 builds
46- set(NODEJS
47- "${CMAKE_CURRENT_LIST_DIR}/../../dependencies/common/node/${RSTUDIO_NODE_VERSION}-arm64/bin/node")
48- set(NPM
49- "${CMAKE_CURRENT_LIST_DIR}/../../dependencies/common/node/${RSTUDIO_NODE_VERSION}-arm64/bin/npm")
50- set(NPX
51- "${CMAKE_CURRENT_LIST_DIR}/../../dependencies/common/node/${RSTUDIO_NODE_VERSION}-arm64/bin/npx")
52-
53-else()
54+if(true)
55
56 # Detect node.js, npm, and npx; use versions supplied by the dependency scripts
57 find_program(NODEJS
58diff --git a/src/node/desktop/CMakeLists.txt b/src/node/desktop/CMakeLists.txt
59index 35438fd..f9b1951 100644
60--- a/src/node/desktop/CMakeLists.txt
61+++ b/src/node/desktop/CMakeLists.txt
62@@ -122,22 +122,9 @@ if (APPLE)
63 # configure Info.plist
64 configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
65 ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
66+endif()
67
68- # copy sources to build directory. note that the build directory cannot
69- # be the "true" CMake directory as some files are resolved relative to
70- # the desktop project's relative path in the application structure
71- set(ELECTRON_BUILD_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../desktop-build-${UNAME_M}" CACHE INTERNAL "")
72- file(REMOVE_RECURSE "${ELECTRON_BUILD_DIR}")
73- file(MAKE_DIRECTORY "${ELECTRON_BUILD_DIR}")
74- file(
75- COPY "${CMAKE_CURRENT_SOURCE_DIR}/"
76- DESTINATION "${ELECTRON_BUILD_DIR}/"
77- REGEX "/.webpack$" EXCLUDE
78- REGEX "/build$" EXCLUDE
79- REGEX "/bin$" EXCLUDE
80- REGEX "/out$" EXCLUDE
81- REGEX "/node_modules$" EXCLUDE)
82-else()
83+if(true)
84 set(ELECTRON_BUILD_DIR "${ELECTRON_SOURCE_DIR}" CACHE INTERNAL "")
85 endif()
86
87@@ -233,16 +220,21 @@ if(WIN32)
88 PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
89 DESTINATION "${RSTUDIO_INSTALL_BIN}")
90
91-elseif(LINUX)
92+elseif(LINUX OR APPLE)
93
94- if(UNAME_M STREQUAL aarch64)
95+ if(UNAME_M STREQUAL aarch64 OR UNAME_M STREQUAL arm64)
96 set(ELECTRON_ARCH arm64)
97 else()
98 set(ELECTRON_ARCH x64)
99 endif()
100+ if(APPLE)
101+ set(ELECTRON_PLATFORM darwin)
102+ else()
103+ set(ELECTRON_PLATFORM linux)
104+ endif()
105
106 install(
107- DIRECTORY "${ELECTRON_BUILD_DIR}/out/RStudio-linux-${ELECTRON_ARCH}/"
108+ DIRECTORY "${ELECTRON_BUILD_DIR}/out/RStudio-${ELECTRON_PLATFORM}-${ELECTRON_ARCH}/"
109 DIRECTORY_PERMISSIONS
110 OWNER_READ OWNER_WRITE OWNER_EXECUTE
111 GROUP_READ GROUP_EXECUTE
112diff --git a/src/node/desktop/src/main/session-launcher.ts b/src/node/desktop/src/main/session-launcher.ts
113index 94f56ac..fe7d5d9 100644
114--- a/src/node/desktop/src/main/session-launcher.ts
115+++ b/src/node/desktop/src/main/session-launcher.ts
116@@ -91,29 +91,9 @@ function launchProcess(absPath: FilePath, argList: string[]): ChildProcess {
117 // DYLD_INSERT_LIBRARIES to inject the library we wish to use
118 const rHome = new FilePath(getenv('R_HOME'));
119 const rLib = rHome.completePath('lib/libR.dylib');
120- const dyldArgs = [
121- '-e',
122- `DYLD_INSERT_LIBRARIES=${rLib.getAbsolutePath()}`,
123- '-e',
124- `DYLD_FALLBACK_LIBRARY_PATH=${dyldFallbackLibraryPath}`,
125- ];
126-
127- // launch via /usr/bin/arch, so we can control whether the OS requests
128- // x86 or arm64 versions of the libraries in the launched rsession
129- const path = absPath.getAbsolutePath();
130- if (process.arch === 'arm64') {
131- const fileInfo = execSync(`/usr/bin/file "${rLib}"`, { encoding: 'utf-8' });
132- if (fileInfo.indexOf('arm64') === -1 && fileInfo.indexOf('x86_64') !== -1) {
133- argList = ['-x86_64', ...dyldArgs, path, ...argList];
134- absPath = new FilePath('/usr/bin/arch');
135- } else {
136- argList = ['-arm64', ...dyldArgs, path, ...argList];
137- absPath = new FilePath('/usr/bin/arch');
138- }
139- } else {
140- argList = ['-x86_64', ...dyldArgs, path, ...argList];
141- absPath = new FilePath('/usr/bin/arch');
142- }
143+
144+ env['DYLD_INSERT_LIBRARIES'] = rLib.getAbsolutePath();
145+ env['DYLD_FALLBACK_LIBRARY_PATH'] = dyldFallbackLibraryPath;
146 }
147
148 const rsessionOptions = new LogOptions('rsession');
149@@ -566,22 +546,6 @@ export class SessionLauncher {
150 }
151 }
152
153- // on macOS, we need to look at R and figure out if we should be trying to run
154- // with the arm64 session binary (rsession-arm64) or with the x64 session binary (rsession)
155- if (app.isPackaged && process.platform === 'darwin' && process.arch === 'arm64') {
156- const rHome = getenv('R_HOME');
157- const rLibPath = `${rHome}/lib/libR.dylib`;
158- logger().logDebug(`$ /usr/bin/file "${rLibPath}"`);
159- const fileInfo = execSync(`/usr/bin/file "${rLibPath}"`, { encoding: 'utf-8' });
160- logger().logDebug(fileInfo);
161- if (fileInfo.indexOf('arm64') !== -1) {
162- this.sessionPath = this.sessionPath.getParent().completeChildPath('rsession-arm64');
163- logger().logDebug(`R is arm64; using ${this.sessionPath}`);
164- } else {
165- logger().logDebug(`R is x86_64; using ${this.sessionPath}`);
166- }
167- }
168-
169 // if we're running automation tests, set that up now
170 if (app.commandLine.hasSwitch('run-automation')) {
171 argList.push('--run-automation');