diff --git a/devel/RStudio/Makefile b/devel/RStudio/Makefile
index e16543d53511..9a9d1e445294 100644
--- a/devel/RStudio/Makefile
+++ b/devel/RStudio/Makefile
@@ -1,153 +1,154 @@
# This port opens too many files during build, more than the default setting.
# Its build is known to succeed with MAX_FILES_RStudio=4096 in poudriere.conf
PORTNAME= RStudio
DISTVERSIONPREFIX= v
-DISTVERSION= 2022.07.2+576
+DISTVERSION= 2022.12.0+353
CATEGORIES= devel math java
MASTER_SITES= https://s3.amazonaws.com/rstudio-buildtools/dictionaries/:dictionaries \
https://s3.amazonaws.com/rstudio-buildtools/:buildtools
DISTFILES= core-dictionaries.zip:dictionaries \
gin-${GIN_VERSION}.zip:buildtools \
gwt-${GWT_VERSION}.zip:buildtools \
mathjax-27.zip:buildtools
MAINTAINER= yuri@FreeBSD.org
COMMENT= Integrated development environment (IDE) for R
WWW= https://rstudio.com/
LICENSE= GPLv3
LICENSE_FILE= ${WRKSRC}/COPYING
BROKEN_i386= [ERROR] Line 101: Failed to resolve 'org.rstudio.studio.client.workbench.views.vcs.common.diff.LineActionButtonRenderer.GrayResources' via deferred binding
BUILD_DEPENDS= ant:devel/apache-ant \
${LOCALBASE}/include/sys/sysinfo.h:devel/libsysinfo \
node:www/node \
pandoc:textproc/hs-pandoc \
R-cran-rstudioapi>0:devel/R-cran-rstudioapi
LIB_DEPENDS= libR.so:math/R \
libboost_thread.so:devel/boost-libs \
libinotify.so:devel/libinotify \
libsoci_core.so:databases/soci \
libuuid.so:misc/e2fsprogs-libuuid \
libyaml-cpp.so:devel/yaml-cpp
FLAVORS= desktop server
FLAVOR?= ${FLAVORS:[1]}
server_PKGNAMESUFFIX= -server
USES= cmake fortran localbase:ldflags pgsql pkgconfig sqlite ssl
USE_JAVA= yes
JAVA_VERSION= 11 # Java 8 fails on aarch64: Internal Error (assembler_aarch64.hpp:237), pid=1644, tid=0x00000000000c62b6 guarantee(val < (1U << nbits)) failed: Field too big for insn
JAVA_BUILD= yes
USE_GITHUB= yes
GH_PROJECT= ${PORTNAME:tl}
GH_TUPLE= rstudio:r2d3:v0.2.0:r2d3/dependencies/common/r2d3 \
rstudio:rmarkdown:aed26ac:rmarkdown/dependencies/common/rmarkdown \
rstudio:rsconnect:03c379b:rsconnect/dependencies/common/rsconnect \
trestletech:plumber:v0.4.6:plumber/dependencies/common/plumber
CMAKE_ARGS= -DFREEBSD_RSTUDIO_VERSION:STRING=${PORTVERSION} \
-DFREEBSD_LIBDIR:STRING=${PREFIX}/lib
CMAKE_ARGS+= -DQT_QMAKE_EXECUTABLE:STRING=${QMAKE}
CMAKE_ARGS+= -DRSTUDIO_BOOST_SIGNALS_VERSION=2
CMAKE_ARGS+= -DFREEBSD_PORT_VERSION:STRING=${DISTVERSION}
CMAKE_ARGS+= -DFREEBSD_LOCALBASE:STRING=${LOCALBASE} # SOCI package is looked up here, see patch patch-src_cpp_CMakeLists.txt
CMAKE_ON= RSTUDIO_USE_SYSTEM_YAML_CPP \
RSTUDIO_USE_SYSTEM_SOCI
MAKE_ENV= HOME=${WRKDIR} \
JAVA_HOME=${JAVA_HOME} \
PATH=${JAVA_HOME}/bin:${PATH} \
ANT_OPTS="-Duser.home=${WRKDIR}"
+LDFLAGS+= -lexecinfo
GWT_VERSION= 2.8.1
GIN_VERSION= 2.1.2
.if ${FLAVOR:U} == desktop
COMMENT+= (desktop UI version)
USES+= desktop-file-utils qt:5 shared-mime-info
USE_QT= core dbus declarative gui location network opengl printsupport quickcontrols sensors \
sql svg webchannel webengine webkit widgets xml xmlpatterns buildtools:build qmake:build
CMAKE_ARGS+= -DRSTUDIO_TARGET=Desktop
INSTALL_SUBDIR= ${PORTNAME:tl}
EXECUTABLE= ${PORTNAME:tl}
.endif
.if ${FLAVOR:U} == server
COMMENT+= (web UI version)
CMAKE_ARGS+= -DRSTUDIO_TARGET=Server
LDFLAGS+= -linotify
INSTALL_SUBDIR= ${PORTNAME:tl}-server
EXECUTABLE= rserver
USER= nobody
SUB_LIST= USER=${USER}
USE_RC_SUBR= ${PORTNAME:tl}-server
.endif
OPTIONS_DEFINE= WITH_QUARTO
WITH_QUARTO_DESC= Build with support for Quarto
WITH_QUARTO_CMAKE_BOOL= FREEBSD_QUARTO_ENABLED
WITH_QUARTO_BROKEN= Quarto isn't yet ported
post-extract:
@${MKDIR} ${WRKSRC}/dependencies/dictionaries && ${MV} ${WRKDIR}/en_* ${WRKSRC}/dependencies/dictionaries/
@${MV} ${WRKDIR}/mathjax-* ${WRKSRC}/dependencies/
@${MKDIR} ${WRKSRC}/src/gwt/lib/gwt && ${MV} ${WRKDIR}/gwt-${GWT_VERSION} ${WRKSRC}/src/gwt/lib/gwt/${GWT_VERSION}
@${MKDIR} ${WRKSRC}/src/gwt/lib/gin/${GIN_VERSION} && ${MV} ${WRKDIR}/*.jar ${WRKSRC}/src/gwt/lib/gin/${GIN_VERSION}/
post-patch:
@${REINPLACE_CMD} -e ' \
s|target_link_libraries(rstudio|target_link_libraries(rstudio procstat|; \
s|get_filename_component|#get_filename_component|; \
s|set(CMAKE_PREFIX_PATH "$${QT_BIN_DIR}//..//lib//cmake")|set(CMAKE_PREFIX_PATH "${LOCALBASE}/lib/cmake")|; \
s|/usr/share/|${PREFIX}/share/|g' \
${WRKSRC}/src/cpp/desktop/CMakeLists.txt
@${REINPLACE_CMD} -e ' \
s|||' \
${WRKSRC}/src/gwt/build.xml
@${REINPLACE_CMD} -e ' \
s|rHomePaths.push_back|//rHomePaths.push_back|; \
s|//rHomePaths.push_back(FilePath("/usr/local/lib/|rHomePaths.push_back(FilePath("${PREFIX}/lib/|' \
${WRKSRC}/src/cpp/core/r_util/RVersionsPosix.cpp
@${REINPLACE_CMD} -e ' \
s|||' \
${WRKSRC}/src/gwt/build.xml
pre-build:
@${CP} ${FILESDIR}/global-setenv.h ${WRKSRC}/src/cpp/desktop/
@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/src/cpp/desktop/global-setenv.h
post-install:
@(echo "#!/bin/sh"; \
echo ""; \
echo "if ! [ -d /proc/curproc ]; then"; \
echo " echo \"${PORTNAME} needs /proc to be mounted as procfs\" >&2"; \
echo " exit 1"; \
echo "fi"; \
echo ""; \
echo "# workaround for the problem that RStudio passes /lib with LD_LIBRARY_PATH that causes the /lib/libgcc_s.so.1 conflict with gcc"; \
echo "LD_PRELOAD=${PREFIX}/lib/gcc${GCC_DEFAULT}/libgcc_s.so JAVA_HOME=${JAVA_HOME} ${PREFIX}/lib/${INSTALL_SUBDIR}/bin/${EXECUTABLE} \"$$"@"\"" \
) > ${STAGEDIR}${PREFIX}/bin/${EXECUTABLE}
@${CHMOD} +x ${STAGEDIR}${PREFIX}/bin/${EXECUTABLE}
.if ${FLAVOR:U} == desktop
${REINPLACE_CMD} -i '' -e 's|^Exec=.*/rstudio|Exec=${PREFIX}/bin/${EXECUTABLE}|' ${STAGEDIR}${PREFIX}/share/applications/${EXECUTABLE}.desktop
.endif
.if ${FLAVOR:U} == server
${RM} ${STAGEDIR}${LOCALBASE}/lib/${INSTALL_SUBDIR}/bin/rstudio-server # not compatible with FreeBSD
.endif
# Some functions expect the pandoc symlink.
@${MKDIR} ${STAGEDIR}${PREFIX}/lib/${INSTALL_SUBDIR}/bin/pandoc
@cd ${STAGEDIR}${PREFIX}/lib/${INSTALL_SUBDIR}/bin/pandoc && ${LN} -s ../../../../bin/pandoc
# Add $LOCALBASE/bin to PATH to allow RStudio-server to run gmake (R_HOME/etc/Renviron.site is installed, see https://stat.ethz.ch/R-manual/R-devel/library/base/html/Startup.html)
.if ${FLAVOR:U} == server
#@${MKDIR} ${STAGEDIR}${LOCALBASE}/lib/R/etc
#@${ECHO} "PATH=\"${LOCALBASE}/bin:\$$PATH\"" > ${STAGEDIR}${LOCALBASE}/lib/R/etc/Renviron.site # it should be this way, but this fails: https://github.com/rstudio/rstudio/issues/9815
@${LN} -s ${LOCALBASE}/bin/${GMAKE} ${STAGEDIR}${PREFIX}/lib/rstudio-server/bin/postback/${GMAKE} # hack, should be as above, but at least gmake is in the path now
.endif
# There is a variability in .js file names due to use of random numbers, so we use the automatic plist.
@${SETENV} ${CO_ENV} ${SH} ${SCRIPTSDIR}/check-stagedir.sh makeplist | ${GREP} -v ^\/ | ${SED} -e 's|%%WWWDIR%%|www/rstudio| ; s|%%CMAKE_BUILD_TYPE%%|${CMAKE_BUILD_TYPE:tl}|' > ${TMPPLIST}
.include
diff --git a/devel/RStudio/distinfo b/devel/RStudio/distinfo
index 7f68a21bb795..5b7326f0a4e5 100644
--- a/devel/RStudio/distinfo
+++ b/devel/RStudio/distinfo
@@ -1,19 +1,19 @@
-TIMESTAMP = 1663892387
+TIMESTAMP = 1672353588
SHA256 (core-dictionaries.zip) = 4341a9630efb9dcf7f215c324136407f3b3d6003e1c96f2e5e1f9f14d5787494
SIZE (core-dictionaries.zip) = 876339
SHA256 (gin-2.1.2.zip) = b98e704164f54be596779696a3fcd11be5785c9907a99ec535ff6e9525ad5f9a
SIZE (gin-2.1.2.zip) = 1341053
SHA256 (gwt-2.8.1.zip) = 0b7af89fdadb4ec51cdb400ace94637d6fe9ffa401b168e2c3d372392a00a0a7
SIZE (gwt-2.8.1.zip) = 95650299
SHA256 (mathjax-27.zip) = c56cbaa6c4ce03c1fcbaeb2b5ea3c312d2fb7626a360254770cbcb88fb204176
SIZE (mathjax-27.zip) = 3285230
-SHA256 (RStudio-rstudio-v2022.07.2+576_GH0.tar.gz) = 55705c36a9b826064b4d9aa87b58c40bb9f7cd2f149b16d554e20136306ce301
-SIZE (RStudio-rstudio-v2022.07.2+576_GH0.tar.gz) = 100396422
+SHA256 (RStudio-rstudio-v2022.12.0+353_GH0.tar.gz) = e4f3503e2ad4229301360f56fd5288e5c8e769c490073dae7fe40366237ecce0
+SIZE (RStudio-rstudio-v2022.12.0+353_GH0.tar.gz) = 266546261
SHA256 (rstudio-r2d3-v0.2.0_GH0.tar.gz) = 6355a7632134c8c9487056019a9c458db2c98d10388cf66b018d5461d0a947af
SIZE (rstudio-r2d3-v0.2.0_GH0.tar.gz) = 21977747
SHA256 (rstudio-rmarkdown-aed26ac_GH0.tar.gz) = b6f6f48dd9930514204739d8957c2737f0b1d110aebf9f89fa31de10598cb29b
SIZE (rstudio-rmarkdown-aed26ac_GH0.tar.gz) = 2087615
SHA256 (rstudio-rsconnect-03c379b_GH0.tar.gz) = d24b6ee49f32f650f6d10bbfc7b2f61aee258f2fbf45a43c006f9e0a726bcea6
SIZE (rstudio-rsconnect-03c379b_GH0.tar.gz) = 220711
SHA256 (trestletech-plumber-v0.4.6_GH0.tar.gz) = 7bcbfdf5a8a2e3a051d2c673ac5ac51a483ed888afe73116cba7741dbb5f63a6
SIZE (trestletech-plumber-v0.4.6_GH0.tar.gz) = 83332
diff --git a/devel/RStudio/files/patch-CMakeGlobals.txt b/devel/RStudio/files/patch-CMakeGlobals.txt
index 10b2da0c4b02..92ea09a5490e 100644
--- a/devel/RStudio/files/patch-CMakeGlobals.txt
+++ b/devel/RStudio/files/patch-CMakeGlobals.txt
@@ -1,46 +1,46 @@
---- CMakeGlobals.txt.orig 2022-07-06 19:59:49 UTC
+--- CMakeGlobals.txt.orig 2022-12-03 07:38:59 UTC
+++ CMakeGlobals.txt
@@ -168,7 +168,7 @@ endif()
# record git revision hash (cache it since we don't use this in development
# mode and we don't want it to force rebuilds there)
-if(NOT RSTUDIO_SESSION_WIN32 AND NOT RSTUDIO_GIT_REVISION_HASH)
+if(FALSE AND NOT RSTUDIO_SESSION_WIN32 AND NOT RSTUDIO_GIT_REVISION_HASH)
find_program(GIT_EXECUTABLE git)
if(GIT_EXECUTABLE)
execute_process(
@@ -179,6 +179,7 @@ if(NOT RSTUDIO_SESSION_WIN32 AND NOT RSTUDIO_GIT_REVIS
SET(RSTUDIO_GIT_REVISION_HASH "${RSTUDIO_GIT_REVISION_HASH}" CACHE STRING "Git Revision Hash")
endif()
endif()
+SET(RSTUDIO_VERSION "${FREEBSD_RSTUDIO_VERSION}" CACHE STRING "FreeBSD RStudio version")
# record these from Jenkins if available
if("$ENV{GIT_COMMIT}" STREQUAL "")
-@@ -254,7 +255,7 @@ elseif(IS_CENTOS7)
- set(QUARTO_ENABLED FALSE CACHE INTERNAL "")
- else()
- # enable by default
-- set(QUARTO_ENABLED TRUE CACHE INTERNAL "")
-+ set(QUARTO_ENABLED ${FREEBSD_QUARTO_ENABLED})
- add_definitions(-DQUARTO_ENABLED)
+@@ -241,7 +242,7 @@ if(NOT DEFINED QUARTO_ENABLED)
+ set(QUARTO_ENABLED FALSE CACHE INTERNAL "")
+ else()
+ # enable by default
+- set(QUARTO_ENABLED TRUE CACHE INTERNAL "")
++ set(QUARTO_ENABLED ${FREEBSD_QUARTO_ENABLED} CACHE INTERNAL "")
+ endif()
endif()
-@@ -341,14 +342,14 @@ else()
+@@ -334,14 +335,14 @@ else()
endif()
# if the install prefix is /usr/local then tweak as appropriate
-if(NOT DEFINED CMAKE_INSTALL_PREFIX)
+if(TRUE OR NOT DEFINED CMAKE_INSTALL_PREFIX) # force to set deeper CMAKE_INSTALL_PREFIX because many files are installed into its root
if(APPLE)
set(CMAKE_INSTALL_PREFIX "/Applications")
elseif(UNIX)
if(RSTUDIO_DESKTOP OR RSTUDIO_ELECTRON)
- set(CMAKE_INSTALL_PREFIX "/usr/local/lib/rstudio")
+ set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/lib/rstudio")
else()
- set(CMAKE_INSTALL_PREFIX "/usr/local/lib/rstudio-server")
+ set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/lib/rstudio-server")
endif()
endif()
endif()
diff --git a/devel/RStudio/files/patch-src_cpp_CMakeLists.txt b/devel/RStudio/files/patch-src_cpp_CMakeLists.txt
index 6754f2c1a030..ec5582ff9cdd 100644
--- a/devel/RStudio/files/patch-src_cpp_CMakeLists.txt
+++ b/devel/RStudio/files/patch-src_cpp_CMakeLists.txt
@@ -1,18 +1,15 @@
---- src/cpp/CMakeLists.txt.orig 2021-05-24 22:22:25 UTC
+--- src/cpp/CMakeLists.txt.orig 2022-12-03 07:38:59 UTC
+++ src/cpp/CMakeLists.txt
-@@ -433,11 +433,11 @@ endif()
+@@ -468,9 +468,9 @@ endif()
+ # find SOCI libraries
if(UNIX)
- set(SOCI_LIBRARY_DIR "${RSTUDIO_TOOLS_SOCI}/build/lib")
if(NOT APPLE AND RSTUDIO_USE_SYSTEM_SOCI)
-- set(SOCI_LIBRARY_DIR "/usr/lib")
-+ set(SOCI_LIBRARY_DIR "${FREEBSD_LOCALBASE}/lib")
- endif()
-- find_library(SOCI_CORE_LIB NAMES "libsoci_core.a" "soci_core" PATHS "${SOCI_LIBRARY_DIR}" NO_DEFAULT_PATH)
-- find_library(SOCI_SQLITE_LIB NAMES "libsoci_sqlite3.a" "soci_sqlite3" PATHS "${SOCI_LIBRARY_DIR}" NO_DEFAULT_PATH)
-- find_library(SOCI_POSTGRESQL_LIB NAMES "libsoci_postgresql.a" "soci_postgresql" PATHS "${SOCI_LIBRARY_DIR}" NO_DEFAULT_PATH)
-+ find_library(SOCI_CORE_LIB NAMES "libsoci_core.so" "soci_core" PATHS "${SOCI_LIBRARY_DIR}" NO_DEFAULT_PATH)
-+ find_library(SOCI_SQLITE_LIB NAMES "libsoci_sqlite3.so" "soci_sqlite3" PATHS "${SOCI_LIBRARY_DIR}" NO_DEFAULT_PATH)
-+ find_library(SOCI_POSTGRESQL_LIB NAMES "libsoci_postgresql.so" "soci_postgresql" PATHS "${SOCI_LIBRARY_DIR}" NO_DEFAULT_PATH)
- find_library(DL_LIB "dl")
- find_library(SQLITE_LIB "sqlite3")
- get_filename_component(SQLITE_LIB "${SQLITE_LIB}" REALPATH)
+- find_library(SOCI_CORE_LIB NAMES "libsoci_core.a" "soci_core")
+- find_library(SOCI_SQLITE_LIB NAMES "libsoci_sqlite3.a" "soci_sqlite3")
+- find_library(SOCI_POSTGRESQL_LIB NAMES "libsoci_postgresql.a" "soci_postgresql")
++ find_library(SOCI_CORE_LIB NAMES "libsoci_core.so" "soci_core")
++ find_library(SOCI_SQLITE_LIB NAMES "libsoci_sqlite3.so" "soci_sqlite3")
++ find_library(SOCI_POSTGRESQL_LIB NAMES "libsoci_postgresql.so" "soci_postgresql")
+ if(NOT SOCI_CORE_LIB OR NOT SOCI_SQLITE_LIB OR NOT SOCI_POSTGRESQL_LIB)
+ message(FATAL_ERROR "Some or all SOCI libraries were not found. Ensure the SOCI dependency is installed and try again.")
+ endif()
diff --git a/devel/RStudio/files/patch-src_cpp_core_Backtrace.cpp b/devel/RStudio/files/patch-src_cpp_core_Backtrace.cpp
deleted file mode 100644
index c99ffc233e1f..000000000000
--- a/devel/RStudio/files/patch-src_cpp_core_Backtrace.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/cpp/core/Backtrace.cpp.orig 2017-11-16 21:40:37 UTC
-+++ src/cpp/core/Backtrace.cpp
-@@ -46,7 +46,7 @@ std::string demangle(const std::string&
-
- void printBacktrace(std::ostream& os)
- {
--#ifndef _WIN32
-+#if !defined(_WIN32) && !defined(__FreeBSD__)
-
- os << "Backtrace (most recent calls first):" << std::endl << std::endl;
-
diff --git a/devel/RStudio/files/patch-src_cpp_core_CMakeLists.txt b/devel/RStudio/files/patch-src_cpp_core_CMakeLists.txt
index 307bff1b6186..038925d6979b 100644
--- a/devel/RStudio/files/patch-src_cpp_core_CMakeLists.txt
+++ b/devel/RStudio/files/patch-src_cpp_core_CMakeLists.txt
@@ -1,19 +1,19 @@
---- src/cpp/core/CMakeLists.txt.orig 2020-01-23 23:30:24 UTC
+--- src/cpp/core/CMakeLists.txt.orig 2022-12-03 07:38:59 UTC
+++ src/cpp/core/CMakeLists.txt
-@@ -152,12 +152,14 @@ if (UNIX)
+@@ -161,12 +161,14 @@ if (UNIX)
# platform introspection
check_symbol_exists(SA_NOCLDWAIT "signal.h" HAVE_SA_NOCLDWAIT)
check_symbol_exists(SO_PEERCRED "sys/socket.h" HAVE_SO_PEERCRED)
+ set(CMAKE_REQUIRED_LIBRARIES ${FREEBSD_LIBDIR}/libinotify.so)
check_function_exists(inotify_init1 HAVE_INOTIFY_INIT1)
+ set(CMAKE_REQUIRED_LIBRARIES "")
check_function_exists(getpeereid HAVE_GETPEEREID)
check_function_exists(setresuid HAVE_SETRESUID)
- if(EXISTS "/proc/self")
+ #if(EXISTS "/proc/self")
set(HAVE_PROCSELF TRUE)
- endif()
+ #endif()
- # find packages and libraries
- find_library(PTHREAD_LIBRARIES pthread)
+ # missing on non-glibc platforms like macOS, musl-based Linux distros, and
+ # the BSDs
diff --git a/devel/RStudio/files/patch-src_cpp_core_r__util_RSessionContext.cpp b/devel/RStudio/files/patch-src_cpp_core_r__util_RSessionContext.cpp
deleted file mode 100644
index e335ae56ccf0..000000000000
--- a/devel/RStudio/files/patch-src_cpp_core_r__util_RSessionContext.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
---- src/cpp/core/r_util/RSessionContext.cpp.orig 2020-01-23 23:30:24 UTC
-+++ src/cpp/core/r_util/RSessionContext.cpp
-@@ -186,8 +186,8 @@ bool isSharedPath(const std::string& projectPath,
- // not shared if we're in any of the groups that own the directory
- // (note that this checks supplementary group IDs only, so the check
- // against the primary group ID above is still required)
-- if (::group_member(st.st_gid))
-- return false;
-+// if (::group_member(st.st_gid))
-+// return false;
- #endif
-
- // if we got this far, we likely have access due to project sharing
diff --git a/devel/RStudio/files/patch-src_cpp_core_system_PosixChildProcess.cpp b/devel/RStudio/files/patch-src_cpp_core_system_PosixChildProcess.cpp
index c16e45354db3..8298b028d013 100644
--- a/devel/RStudio/files/patch-src_cpp_core_system_PosixChildProcess.cpp
+++ b/devel/RStudio/files/patch-src_cpp_core_system_PosixChildProcess.cpp
@@ -1,27 +1,23 @@
---- src/cpp/core/system/PosixChildProcess.cpp.orig 2022-07-06 19:59:49 UTC
+--- src/cpp/core/system/PosixChildProcess.cpp.orig 2022-12-30 20:28:33 UTC
+++ src/cpp/core/system/PosixChildProcess.cpp
-@@ -25,9 +25,12 @@
- #include
- #include
- #else
--#include
--#include
--#include
-+//#include
-+//#include
-+//#include
-+#include
-+#include
+@@ -28,6 +28,11 @@
+ #include
+ #include
+ #include
++#elif defined(__FreeBSD__) // for forkpty
++#include
++#include
++#include
+#include
#endif
#include
-@@ -807,7 +810,7 @@ Error ChildProcess::run()
+@@ -807,7 +812,7 @@ Error ChildProcess::run()
if (options_.exitWithParent)
{
-#ifndef __APPLE__
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
// set a bit indicating we want to die when our parent dies
if (::prctl(PR_SET_PDEATHSIG, SIGTERM) == -1)
LOG_ERROR(systemError(errno, ERROR_LOCATION));
diff --git a/devel/RStudio/files/patch-src_cpp_core_system_PosixSched.cpp b/devel/RStudio/files/patch-src_cpp_core_system_PosixSched.cpp
deleted file mode 100644
index a2edb406dfae..000000000000
--- a/devel/RStudio/files/patch-src_cpp_core_system_PosixSched.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
---- src/cpp/core/system/PosixSched.cpp.orig 2020-05-18 18:11:10 UTC
-+++ src/cpp/core/system/PosixSched.cpp
-@@ -41,7 +41,7 @@ bool isCpuAffinityEmpty(const CpuAffinity& cpus)
-
- Error getCpuAffinity(CpuAffinity* pCpus)
- {
--#ifndef __APPLE__
-+#if !defined(__APPLE__) && !defined(__FreeBSD__)
- cpu_set_t cs;
- CPU_ZERO(&cs);
- if (::sched_getaffinity(0, sizeof(cs), &cs) == -1)
-@@ -66,7 +66,7 @@ Error getCpuAffinity(CpuAffinity* pCpus)
-
- Error setCpuAffinity(const CpuAffinity& cpus)
- {
--#ifndef __APPLE__
-+#if !defined(__APPLE__) && !defined(__FreeBSD__)
- cpu_set_t cs;
- CPU_ZERO(&cs);
-
diff --git a/devel/RStudio/files/patch-src_cpp_core_system_PosixSystem.cpp b/devel/RStudio/files/patch-src_cpp_core_system_PosixSystem.cpp
index c5632b95d384..cd99bfc1c394 100644
--- a/devel/RStudio/files/patch-src_cpp_core_system_PosixSystem.cpp
+++ b/devel/RStudio/files/patch-src_cpp_core_system_PosixSystem.cpp
@@ -1,93 +1,41 @@
- one of the patches is a workaround for access to /proc/{pid}/fd : https://github.com/rstudio/rstudio/issues/8912
---- src/cpp/core/system/PosixSystem.cpp.orig 2021-05-24 22:22:25 UTC
+--- src/cpp/core/system/PosixSystem.cpp.orig 2022-12-03 07:38:59 UTC
+++ src/cpp/core/system/PosixSystem.cpp
-@@ -41,20 +41,25 @@
-
- #include
-
--#ifdef __APPLE__
-+#if !defined(__APPLE__) && !defined(__FreeBSD__)
- #include
- #include
- #include
- #include
- #endif
-
--#ifndef __APPLE__
-+#if !defined(__APPLE__) && !defined(__FreeBSD__)
- #include
- #include
- #include
+@@ -56,6 +56,11 @@
#include
#endif
+#if defined(__FreeBSD__)
+#include
+#include
+#endif
+
#include
#include
#include
-@@ -560,6 +565,7 @@ Error getOpenFds(std::vector* pFds)
+@@ -619,6 +624,7 @@ Error getOpenFds(std::vector* pFds)
#ifndef __APPLE__
Error getOpenFds(pid_t pid, std::vector* pFds)
{
+#if !defined(__FreeBSD__)
std::string pidStr = safe_convert::numberToString(pid);
boost::format fmt("/proc/%1%/fd");
FilePath filePath(boost::str(fmt % pidStr));
-@@ -586,6 +592,7 @@ Error getOpenFds(pid_t pid, std::vector* pFd
+@@ -645,6 +651,7 @@ Error getOpenFds(pid_t pid, std::vector* pFd
pFds->push_back(fd.get());
}
}
+#endif
return Success();
}
-@@ -911,7 +918,7 @@ Error executablePath(const char * argv0,
+@@ -970,7 +977,7 @@ Error executablePath(const char * argv0,
#elif defined(HAVE_PROCSELF)
- executablePath = std::string("/proc/self/exe");
+ executablePath = std::string("/proc/curproc/file");
#else
-@@ -1420,7 +1427,7 @@ Error osResourceLimit(ResourceLimit limit, int* pLimit
- case CpuLimit:
- *pLimit = RLIMIT_CPU;
- break;
--#ifndef __APPLE__
-+#if !defined(__APPLE__) && !defined(__FreeBSD__)
- case NiceLimit:
- *pLimit = RLIMIT_NICE;
- break;
-@@ -1493,7 +1500,7 @@ Error systemInformation(SysInfo* pSysInfo)
- {
- pSysInfo->cores = boost::thread::hardware_concurrency();
-
--#ifndef __APPLE__
-+#if !defined(__APPLE__) && !defined(__FreeBSD__)
- struct sysinfo info;
- if (::sysinfo(&info) == -1)
- return systemError(errno, ERROR_LOCATION);
-@@ -1897,7 +1904,7 @@ Error restrictCoreDumps()
- return error;
-
- // no ptrace core dumps permitted
--#ifndef __APPLE__
-+#if !defined(__APPLE__) && !defined(__FreeBSD__)
- int res = ::prctl(PR_SET_DUMPABLE, 0);
- if (res == -1)
- return systemError(errno, ERROR_LOCATION);
-@@ -1928,7 +1935,7 @@ void printCoreDumpable(const std::string& context)
- ostr << " hard limit: " << rLimitHard << std::endl;
-
- // ptrace
--#ifndef __APPLE__
-+#if !defined(__APPLE__) && !defined(__FreeBSD__)
- int dumpable = ::prctl(PR_GET_DUMPABLE, nullptr, nullptr, nullptr, nullptr);
- if (dumpable == -1)
- LOG_ERROR(systemError(errno, ERROR_LOCATION));
diff --git a/devel/RStudio/files/patch-src_cpp_session_SessionMain.cpp b/devel/RStudio/files/patch-src_cpp_session_SessionMain.cpp
index fbe08747b118..b1e6e81dab7c 100644
--- a/devel/RStudio/files/patch-src_cpp_session_SessionMain.cpp
+++ b/devel/RStudio/files/patch-src_cpp_session_SessionMain.cpp
@@ -1,14 +1,14 @@
---- src/cpp/session/SessionMain.cpp.orig 2020-01-23 23:30:24 UTC
+--- src/cpp/session/SessionMain.cpp.orig 2022-12-03 07:38:59 UTC
+++ src/cpp/session/SessionMain.cpp
-@@ -1711,7 +1711,11 @@ int main (int argc, char * const argv[])
-
+@@ -1947,7 +1947,11 @@ int main(int argc, char * const argv[])
+
// move to own process group
#ifndef _WIN32
+#if defined(__FreeBSD__)
+ ::setpgrp(0, 0);
+#else
::setpgrp();
+#endif
#endif
- // get main thread id (used to distinguish forks which occur
+ logStartingEnv();
diff --git a/devel/RStudio/files/patch-src_cpp_shared__core_system_PosixSystem.cpp b/devel/RStudio/files/patch-src_cpp_shared__core_system_PosixSystem.cpp
index 6a304d8a4651..f5fa06e9483b 100644
--- a/devel/RStudio/files/patch-src_cpp_shared__core_system_PosixSystem.cpp
+++ b/devel/RStudio/files/patch-src_cpp_shared__core_system_PosixSystem.cpp
@@ -1,23 +1,14 @@
---- src/cpp/shared_core/system/PosixSystem.cpp.orig 2021-06-09 01:52:44 UTC
+--- src/cpp/shared_core/system/PosixSystem.cpp.orig 2022-12-30 20:20:59 UTC
+++ src/cpp/shared_core/system/PosixSystem.cpp
-@@ -29,8 +29,10 @@
+@@ -27,7 +27,11 @@
+ #include
#include
#include
++#include
#include
-+#include // for sa_family_t
-+#include // for struct sockaddr
++#include
++#include
++
--#ifndef __APPLE__
-+#if !defined(__APPLE__) && !defined(__FreeBSD__)
+ #ifdef __linux__
#include
- #endif
-
-@@ -80,7 +82,7 @@ Error restorePrivilegesImpl(uid_t in_uid)
-
- Error enableCoreDumps()
- {
--#ifndef __APPLE__
-+#if !defined(__APPLE__) && !defined(__FreeBSD__)
- int res = ::prctl(PR_SET_DUMPABLE, 1);
- if (res == -1)
- return systemError(errno, ERROR_LOCATION);