at master 146 lines 6.0 kB view raw
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 bccf5b3..0cc798a 100644 60--- a/src/node/desktop/CMakeLists.txt 61+++ b/src/node/desktop/CMakeLists.txt 62@@ -236,16 +236,21 @@ if(WIN32) 63 install(FILES ${VCRUNTIME_X86_FILES} DESTINATION "${RSTUDIO_INSTALL_BIN}/x86") 64 install(FILES ${VCRUNTIME_X64_FILES} DESTINATION "${RSTUDIO_INSTALL_BIN}") 65 66-elseif(LINUX) 67+elseif(LINUX OR APPLE) 68 69- if(UNAME_M STREQUAL aarch64) 70+ if(UNAME_M STREQUAL aarch64 OR UNAME_M STREQUAL arm64) 71 set(ELECTRON_ARCH arm64) 72 else() 73 set(ELECTRON_ARCH x64) 74 endif() 75+ if(APPLE) 76+ set(ELECTRON_PLATFORM darwin) 77+ else() 78+ set(ELECTRON_PLATFORM linux) 79+ endif() 80 81 install( 82- DIRECTORY "${ELECTRON_BINARY_DIR}/out/RStudio-linux-${ELECTRON_ARCH}/" 83+ DIRECTORY "${ELECTRON_BINARY_DIR}/out/RStudio-${ELECTRON_PLATFORM}-${ELECTRON_ARCH}/" 84 DIRECTORY_PERMISSIONS 85 OWNER_READ OWNER_WRITE OWNER_EXECUTE 86 GROUP_READ GROUP_EXECUTE 87diff --git a/src/node/desktop/src/main/session-launcher.ts b/src/node/desktop/src/main/session-launcher.ts 88index 94f56ac..fe7d5d9 100644 89--- a/src/node/desktop/src/main/session-launcher.ts 90+++ b/src/node/desktop/src/main/session-launcher.ts 91@@ -91,29 +91,9 @@ function launchProcess(absPath: FilePath, argList: string[]): ChildProcess { 92 // DYLD_INSERT_LIBRARIES to inject the library we wish to use 93 const rHome = new FilePath(getenv('R_HOME')); 94 const rLib = rHome.completePath('lib/libR.dylib'); 95- const dyldArgs = [ 96- '-e', 97- `DYLD_INSERT_LIBRARIES=${rLib.getAbsolutePath()}`, 98- '-e', 99- `DYLD_FALLBACK_LIBRARY_PATH=${dyldFallbackLibraryPath}`, 100- ]; 101- 102- // launch via /usr/bin/arch, so we can control whether the OS requests 103- // x86 or arm64 versions of the libraries in the launched rsession 104- const path = absPath.getAbsolutePath(); 105- if (process.arch === 'arm64') { 106- const fileInfo = execSync(`/usr/bin/file "${rLib}"`, { encoding: 'utf-8' }); 107- if (fileInfo.indexOf('arm64') === -1 && fileInfo.indexOf('x86_64') !== -1) { 108- argList = ['-x86_64', ...dyldArgs, path, ...argList]; 109- absPath = new FilePath('/usr/bin/arch'); 110- } else { 111- argList = ['-arm64', ...dyldArgs, path, ...argList]; 112- absPath = new FilePath('/usr/bin/arch'); 113- } 114- } else { 115- argList = ['-x86_64', ...dyldArgs, path, ...argList]; 116- absPath = new FilePath('/usr/bin/arch'); 117- } 118+ 119+ env['DYLD_INSERT_LIBRARIES'] = rLib.getAbsolutePath(); 120+ env['DYLD_FALLBACK_LIBRARY_PATH'] = dyldFallbackLibraryPath; 121 } 122 123 const rsessionOptions = new LogOptions('rsession'); 124@@ -566,22 +546,6 @@ export class SessionLauncher { 125 } 126 } 127 128- // on macOS, we need to look at R and figure out if we should be trying to run 129- // with the arm64 session binary (rsession-arm64) or with the x64 session binary (rsession) 130- if (app.isPackaged && process.platform === 'darwin' && process.arch === 'arm64') { 131- const rHome = getenv('R_HOME'); 132- const rLibPath = `${rHome}/lib/libR.dylib`; 133- logger().logDebug(`$ /usr/bin/file "${rLibPath}"`); 134- const fileInfo = execSync(`/usr/bin/file "${rLibPath}"`, { encoding: 'utf-8' }); 135- logger().logDebug(fileInfo); 136- if (fileInfo.indexOf('arm64') !== -1) { 137- this.sessionPath = this.sessionPath.getParent().completeChildPath('rsession-arm64'); 138- logger().logDebug(`R is arm64; using ${this.sessionPath}`); 139- } else { 140- logger().logDebug(`R is x86_64; using ${this.sessionPath}`); 141- } 142- } 143- 144 // if we're running automation tests, set that up now 145 if (app.commandLine.hasSwitch('run-automation')) { 146 argList.push('--run-automation');