devel/RStudio: Add COPILOT option; Fix fetch; Fix WITH_QUATRO option

- the custom fetch was fetching files without adding them to distinfo
- the COPILOT option relies on the binary installed by misc/github-copilot-language-server
- WITH_QUATRO used wrong cmake option name
- also: distinfo is moved to distinfo.{flavor}
This commit is contained in:
Yuri Victorovich
2025-12-04 14:56:48 -08:00
parent cbe00cabd0
commit b0c3cea12d
5 changed files with 124 additions and 43 deletions
+28 -17
View File
@@ -4,6 +4,7 @@
PORTNAME= RStudio
DISTVERSIONPREFIX= v
DISTVERSION= 2025.09.2+418
PORTREVISION= 1
CATEGORIES= devel math java
MASTER_SITES= https://s3.amazonaws.com/rstudio-buildtools/dictionaries/:dictionaries \
https://rstudio-buildtools.s3.amazonaws.com/rstudio-buildtools/:gin \
@@ -24,7 +25,7 @@ WWW= https://www.rstudio.com/ \
LICENSE= AGPLv3
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
BROKEN_i386= fails 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 \
@@ -49,6 +50,7 @@ RUN_DEPENDS= quarto:textproc/quarto
FLAVORS= desktop server
FLAVOR?= ${FLAVORS:[1]}
server_PKGNAMESUFFIX= -server
server_BROKEN= does not build with the latest RStudio version, needs to be fixed
USES= cmake fortran java:build localbase:ldflags pgsql pkgconfig sqlite ssl
JAVA_VERSION= 17 # Build requires Java 17 target
@@ -77,8 +79,7 @@ CMAKE_ON= RSTUDIO_USE_SYSTEM_YAML_CPP \
RSTUDIO_USE_SYSTEM_WEBSOCKETPP \
RSTUDIO_USE_SYSTEM_TL_EXPECTED \
RSTUDIO_INSTALL_FREEDESKTOP
CMAKE_OFF= RSTUDIO_ENABLE_COPILOT \
BUILD_TESTING \
CMAKE_OFF= BUILD_TESTING \
RSTUDIO_UNIT_TESTS_ENABLED
MAKE_ENV= HOME=${WRKDIR} \
JAVA_HOME=${JAVA_HOME} \
@@ -108,15 +109,17 @@ MAKE_ENV+= ELECTRON_SKIP_BINARY_DOWNLOAD=1 \
LDFLAGS+= -linotify
INSTALL_SUBDIR= ${PORTNAME:tl}
EXECUTABLE= ${PORTNAME:tl}
# npm dependencies are pre-fetched during do-fetch phase
# npm dependencies are pre-fetched during post-fetch phase
NPM_DISTDIR= ${DISTDIR}/${PORTNAME}
NPM_TARBALL= ${PORTNAME}-desktop-node_modules-${DISTVERSION}${EXTRACT_SUFX}
# quarto/panmirror dependencies (uses yarn workspaces)
QUARTO_TARBALL= ${PORTNAME}-quarto-node_modules-${DISTVERSION}${EXTRACT_SUFX}
# Add npm tarballs to DISTFILES for checksum verification
DISTFILES+= ${PORTNAME}/${NPM_TARBALL}:prefetch \
${PORTNAME}/${QUARTO_TARBALL}:prefetch
.endif
.if ${FLAVOR:U} == server
BROKEN= doesn't build with the latest RSTudio version, needs to be fixed
COMMENT+= (web UI version)
CMAKE_ARGS+= -DRSTUDIO_TARGET=Server
LDFLAGS+= -linotify
@@ -127,8 +130,12 @@ SUB_LIST= USER=${USER}
USE_RC_SUBR= ${PORTNAME:tl}-server
.endif
OPTIONS_DEFINE= WITH_QUARTO
OPTIONS_DEFAULT= WITH_QUARTO
OPTIONS_DEFINE= COPILOT WITH_QUARTO
OPTIONS_DEFAULT= COPILOT WITH_QUARTO
COPILOT_DESC= Build with Copilot support
COPILOT_CMAKE_BOOL= RSTUDIO_ENABLE_COPILOT
COPILOT_RUN_DEPENDS= copilot-language-server:misc/github-copilot-language-server
WITH_QUARTO_DESC= Build with support for Quarto
WITH_QUARTO_CMAKE_BOOL= QUARTO_ENABLED
@@ -139,29 +146,29 @@ post-fetch:
@if ! [ -f ${NPM_DISTDIR}/${NPM_TARBALL} ]; then \
${MKDIR} ${NPM_DISTDIR} && \
${ECHO_MSG} "====> Fetching npm dependencies for desktop..." && \
${MKDIR} /tmp/rstudio-npm-fetch && \
${FETCH_CMD} -q "https://raw.githubusercontent.com/rstudio/rstudio/v${DISTVERSION}/src/node/desktop/package.json" -o /tmp/rstudio-npm-fetch/package.json && \
${FETCH_CMD} -q "https://raw.githubusercontent.com/rstudio/rstudio/v${DISTVERSION}/src/node/desktop/package-lock.json" -o /tmp/rstudio-npm-fetch/package-lock.json && \
cd /tmp/rstudio-npm-fetch && \
HOME=/tmp/rstudio-npm-fetch npm ci --ignore-scripts && \
${MKDIR} ${WRKDIR}/tmp/rstudio-npm-fetch && \
${FETCH_CMD} -q "https://raw.githubusercontent.com/rstudio/rstudio/v${DISTVERSION}/src/node/desktop/package.json" -o ${WRKDIR}/tmp/rstudio-npm-fetch/package.json && \
${FETCH_CMD} -q "https://raw.githubusercontent.com/rstudio/rstudio/v${DISTVERSION}/src/node/desktop/package-lock.json" -o ${WRKDIR}/tmp/rstudio-npm-fetch/package-lock.json && \
cd ${WRKDIR}/tmp/rstudio-npm-fetch && \
HOME=${WRKDIR}/tmp/rstudio-npm-fetch npm ci --ignore-scripts && \
${FIND} node_modules -exec ${TOUCH} -h -d 1970-01-01T00:00:00Z {} \; 2>/dev/null; \
${TAR} -czf ${NPM_DISTDIR}/${NPM_TARBALL} node_modules && \
${RM} -rf /tmp/rstudio-npm-fetch && \
${RM} -rf ${WRKDIR}/tmp/rstudio-npm-fetch && \
${ECHO_MSG} "====> Created npm dependencies tarball ${NPM_DISTDIR}/${NPM_TARBALL}"; \
fi
@if ! [ -f ${NPM_DISTDIR}/${QUARTO_TARBALL} ]; then \
${MKDIR} ${NPM_DISTDIR} && \
${ECHO_MSG} "====> Fetching quarto/panmirror npm dependencies..." && \
${MKDIR} /tmp/rstudio-quarto-fetch && \
cd /tmp/rstudio-quarto-fetch && \
${MKDIR} ${WRKDIR}/tmp/rstudio-quarto-fetch && \
cd ${WRKDIR}/tmp/rstudio-quarto-fetch && \
${FETCH_CMD} -q "https://github.com/quarto-dev/quarto/archive/${QUARTO_MONO_COMMIT}.tar.gz" -o quarto.tar.gz && \
${TAR} -xzf quarto.tar.gz && \
cd quarto-${QUARTO_MONO_COMMIT} && \
HOME=/tmp/rstudio-quarto-fetch yarn install --ignore-scripts --network-timeout 240000 && \
HOME=${WRKDIR}/tmp/rstudio-quarto-fetch yarn install --ignore-scripts --network-timeout 240000 && \
cd apps/panmirror && PANMIRROR_OUTDIR=dist-rstudio yarn build --minify true --sourcemap true && cd ../.. && \
${FIND} node_modules apps/*/node_modules packages/*/node_modules apps/panmirror/dist-rstudio -exec ${TOUCH} -h -d 1970-01-01T00:00:00Z {} \; 2>/dev/null; \
${TAR} -czf ${NPM_DISTDIR}/${QUARTO_TARBALL} node_modules apps/*/node_modules packages/*/node_modules apps/panmirror/dist-rstudio && \
${RM} -rf /tmp/rstudio-quarto-fetch && \
${RM} -rf ${WRKDIR}/tmp/rstudio-quarto-fetch && \
${ECHO_MSG} "====> Created quarto npm dependencies tarball"; \
fi
.endif
@@ -220,6 +227,8 @@ post-patch:
.if ${FLAVOR:U} == server
@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|' ${WRKSRC}/src/cpp/session/modules/SessionGit.cpp
.endif
# substitute LOCALBASE for copilot-language-server path
@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' ${WRKSRC}/src/cpp/session/include/session/SessionConstants.hpp
# correct for boost-1.87+ class replacement
@${FIND} ${WRKSRC} -name "*.cpp" -o -name "*.hpp" | ${XARGS} ${REINPLACE_CMD} -i "" -e 's/io_service/io_context/g'
@@ -283,4 +292,6 @@ post-install:
# 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}
DISTINFO_FILE= ${.CURDIR}/distinfo.${FLAVOR}
.include <bsd.port.mk>
@@ -19,3 +19,7 @@ SHA256 (rstudio-rsconnect-03c379b_GH0.tar.gz) = d24b6ee49f32f650f6d10bbfc7b2f61a
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
SHA256 (RStudio/RStudio-desktop-node_modules-2025.09.2+418.tar.gz) = dd1f7f2577742977fbab47a34f0e0739b9242188f228bd40d7d46bedcde3869d
SIZE (RStudio/RStudio-desktop-node_modules-2025.09.2+418.tar.gz) = 35017694
SHA256 (RStudio/RStudio-quarto-node_modules-2025.09.2+418.tar.gz) = 83a3083b0144a0db3ba14d6283414d1e7c9243251b473535865b9010b3fe4ab0
SIZE (RStudio/RStudio-quarto-node_modules-2025.09.2+418.tar.gz) = 229334450
@@ -1,11 +1,23 @@
- Skip quarto installation (use quarto from separate FreeBSD package)
- Skip copilot-language-server installation (use github-copilot-language-server port)
- Always skip COPILOT_DIR validation (we use system copilot-language-server)
--- src/cpp/session/CMakeLists.txt.orig 2025-11-30 08:22:15 UTC
--- src/cpp/session/CMakeLists.txt.orig2025-11-30 08:22:15 UTC
+++ src/cpp/session/CMakeLists.txt
@@ -726,27 +726,27 @@ if(NOT RSTUDIO_SESSION_WIN32 AND NOT RSESSION_ALTERNAT
@@ -90,7 +90,7 @@ foreach(VAR RSTUDIO_DEPENDENCIES_DICTIONARIES_DIR
endif()
# skip Copilot if not enabled
- if("${VAR}" STREQUAL "RSTUDIO_DEPENDENCIES_COPILOT_DIR" AND NOT RSTUDIO_ENABLE_COPILOT)
+ if("${VAR}" STREQUAL "RSTUDIO_DEPENDENCIES_COPILOT_DIR")
continue()
endif()
@@ -725,42 +725,42 @@ if(NOT RSTUDIO_SESSION_WIN32 AND NOT RSESSION_ALTERNAT
# install mathjax for local html preview
install(DIRECTORY "${RSTUDIO_DEPENDENCIES_MATHJAX_DIR}"
DESTINATION "${RSTUDIO_INSTALL_SUPPORTING}/resources")
-
- # install quarto (or pandoc if quarto disabled)
- if(QUARTO_ENABLED)
- # install some quarto folders into Resources, as needed
@@ -27,27 +39,55 @@
- DESTINATION "${RSTUDIO_INSTALL_BIN}/pandoc"
- USE_SOURCE_PERMISSIONS)
- endif()
+# # install quarto (or pandoc if quarto disabled)
+# if(QUARTO_ENABLED)
+# # install some quarto folders into Resources, as needed
+# if(APPLE)
+# install(DIRECTORY "${RSTUDIO_DEPENDENCIES_QUARTO_DIR}"
+# DESTINATION "${RSTUDIO_INSTALL_RESOURCES}/app"
+# USE_SOURCE_PERMISSIONS
+# PATTERN ".gitignore"
+# EXCLUDE)
+# else()
+# install(DIRECTORY "${RSTUDIO_DEPENDENCIES_QUARTO_DIR}"
+# DESTINATION "${RSTUDIO_INSTALL_BIN}"
+# USE_SOURCE_PERMISSIONS
+# PATTERN ".gitignore"
+# EXCLUDE)
+# endif()
+# else()
+# install(DIRECTORY "${RSTUDIO_DEPENDENCIES_PANDOC_DIR}/"
+# DESTINATION "${RSTUDIO_INSTALL_BIN}/pandoc"
+# USE_SOURCE_PERMISSIONS)
+# endif()
# install Copilot Language Server
if(RSTUDIO_ENABLE_COPILOT)
- # install Copilot Language Server
- if(RSTUDIO_ENABLE_COPILOT)
- if(APPLE)
- install(DIRECTORY "${RSTUDIO_DEPENDENCIES_COPILOT_DIR}"
- DESTINATION "${RSTUDIO_INSTALL_RESOURCES}/app"
- USE_SOURCE_PERMISSIONS)
- else()
- install(DIRECTORY "${RSTUDIO_DEPENDENCIES_COPILOT_DIR}"
- DESTINATION "${RSTUDIO_INSTALL_BIN}"
- USE_SOURCE_PERMISSIONS)
- endif()
- endif()
-
+# # install quarto (or pandoc if quarto disabled)
+# if(QUARTO_ENABLED)
+# # install some quarto folders into Resources, as needed
+# if(APPLE)
+# install(DIRECTORY "${RSTUDIO_DEPENDENCIES_QUARTO_DIR}"
+# DESTINATION "${RSTUDIO_INSTALL_RESOURCES}/app"
+# USE_SOURCE_PERMISSIONS
+# PATTERN ".gitignore"
+# EXCLUDE)
+# else()
+# install(DIRECTORY "${RSTUDIO_DEPENDENCIES_QUARTO_DIR}"
+# DESTINATION "${RSTUDIO_INSTALL_BIN}"
+# USE_SOURCE_PERMISSIONS
+# PATTERN ".gitignore"
+# EXCLUDE)
+# endif()
+# else()
+# install(DIRECTORY "${RSTUDIO_DEPENDENCIES_PANDOC_DIR}/"
+# DESTINATION "${RSTUDIO_INSTALL_BIN}/pandoc"
+# USE_SOURCE_PERMISSIONS)
+# endif()
+#
+# # install Copilot Language Server
+# if(RSTUDIO_ENABLE_COPILOT)
+# if(APPLE)
+# install(DIRECTORY "${RSTUDIO_DEPENDENCIES_COPILOT_DIR}"
+# DESTINATION "${RSTUDIO_INSTALL_RESOURCES}/app"
+# USE_SOURCE_PERMISSIONS)
+# else()
+# install(DIRECTORY "${RSTUDIO_DEPENDENCIES_COPILOT_DIR}"
+# DESTINATION "${RSTUDIO_INSTALL_BIN}"
+# USE_SOURCE_PERMISSIONS)
+# endif()
+# endif()
+#
# install embedded packages
foreach(PKG ${RSTUDIO_EMBEDDED_PACKAGES})
file(GLOB PKG_FILES "${RSTUDIO_DEPENDENCIES_DIR}/common/${PKG}*.tar.gz")
@@ -0,0 +1,14 @@
- Use system copilot-language-server from github-copilot-language-server port
- Path must be directory containing the executable, not the executable itself
--- src/cpp/session/include/session/SessionConstants.hpp.orig 2025-11-30 08:22:15 UTC
+++ src/cpp/session/include/session/SessionConstants.hpp
@@ -158,7 +158,7 @@
#define kDefaultNodePath "bin/node"
#define kDefaultQuartoPath "bin/quarto"
-#define kDefaultCopilotPath "bin/copilot-language-server"
+#define kDefaultCopilotPath "%%LOCALBASE%%/bin"
#define kDefaultRsclangPath "bin/rsclang"
#ifdef _WIN32
+12
View File
@@ -25,6 +25,18 @@ Then navigate to http://localhost:8787/ in your browser.
You can also start the RStudio Server service once with:
# service rstudio-server onestart
=== COPILOT option ===
In order to use this (default) option you need to be
logged into your GitHub copilot account.
You can log into GitHub copilot using GitHub's CLI gh,
or directly from the GitHub copilot application 'copilot'
installed by misc/github-copilot-cli.
The gh and copilot executables are not required to use the
COPILOT option. You only need one of them to log into your
GitHub account.
EOM
}
]