diff --git a/devel/RStudio/Makefile b/devel/RStudio/Makefile
index ec7266fdaa73..4f7928153818 100644
--- a/devel/RStudio/Makefile
+++ b/devel/RStudio/Makefile
@@ -1,151 +1,153 @@
# 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= 2024.09.0+375
+DISTVERSION= 2022.12.0+353
+PORTREVISION= 6
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= 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
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 \
- quarto-dev:quarto:v1.115.0-vsix:quarto/src/gwt/lib/quarto
+ 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 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= QUARTO_ENABLED
+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}/
+ @${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|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
+ @${REINPLACE_CMD} -e ' \
+ s|||' \
+ ${WRKSRC}/src/gwt/build.xml
# add $PREFIX/bin to PATH for the server daemon
.if ${FLAVOR:U} == server
@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|' ${WRKSRC}/src/cpp/session/modules/SessionGit.cpp
.endif
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
+ @${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
# 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 b5bf14aa5108..5b7326f0a4e5 100644
--- a/devel/RStudio/distinfo
+++ b/devel/RStudio/distinfo
@@ -1,17 +1,19 @@
-TIMESTAMP = 1727743998
+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-v2024.09.0+375_GH0.tar.gz) = 8a29b77c53a3db8379d824a9f4a491843036003d105ed71981cd40fe39d2c8c8
-SIZE (RStudio-rstudio-v2024.09.0+375_GH0.tar.gz) = 268564378
+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
-SHA256 (quarto-dev-quarto-v1.115.0-vsix_GH0.tar.gz) = 59a10967d3d4a45f1224180aaa52c96b334a1c82c0e7411dfeac53137bef48ed
-SIZE (quarto-dev-quarto-v1.115.0-vsix_GH0.tar.gz) = 5207281
diff --git a/devel/RStudio/files/patch-CMakeGlobals.txt b/devel/RStudio/files/patch-CMakeGlobals.txt
new file mode 100644
index 000000000000..92ea09a5490e
--- /dev/null
+++ b/devel/RStudio/files/patch-CMakeGlobals.txt
@@ -0,0 +1,46 @@
+--- 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 "")
+@@ -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()
+
+@@ -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-CMakeLists.txt b/devel/RStudio/files/patch-CMakeLists.txt
index 082f605a65db..b37c19a9ebd1 100644
--- a/devel/RStudio/files/patch-CMakeLists.txt
+++ b/devel/RStudio/files/patch-CMakeLists.txt
@@ -1,26 +1,19 @@
---- CMakeLists.txt.orig 2024-09-16 17:02:32 UTC
+--- CMakeLists.txt.orig 2019-09-19 13:59:21 UTC
+++ CMakeLists.txt
-@@ -39,7 +39,7 @@ if (NOT RSTUDIO_SESSION_WIN32)
+@@ -31,7 +31,7 @@ endif()
if (NOT RSTUDIO_SESSION_WIN32)
# dynamically configure SOURCE with the git revision hash
INSTALL(CODE "
- execute_process(COMMAND git rev-parse HEAD
+ execute_process(COMMAND printf ${FREEBSD_PORT_VERSION}
WORKING_DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}\"
OUTPUT_VARIABLE RSTUDIO_GIT_REVISION_HASH)
configure_file (\"${CMAKE_CURRENT_SOURCE_DIR}/SOURCE.in\"
-@@ -48,6 +48,7 @@ if (NOT RSTUDIO_SESSION_WIN32)
+@@ -40,6 +40,7 @@ if (NOT RSTUDIO_SESSION_WIN32)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/VERSION.in
${CMAKE_CURRENT_BINARY_DIR}/VERSION)
+ set(RSTUDIO_VERSION ${FREEBSD_RSTUDIO_VERSION})
# install root docs
- include(cmake/install-docs.cmake)
-@@ -62,5 +63,5 @@ add_subdirectory(src)
- add_subdirectory(src)
-
- # packaging
--add_subdirectory(package)
-+#add_subdirectory(package)
-
+ include(CMakeInstallDocs.txt)
diff --git a/devel/RStudio/files/patch-src_cpp_CMakeLists.txt b/devel/RStudio/files/patch-src_cpp_CMakeLists.txt
index 7621f1157514..ec5582ff9cdd 100644
--- a/devel/RStudio/files/patch-src_cpp_CMakeLists.txt
+++ b/devel/RStudio/files/patch-src_cpp_CMakeLists.txt
@@ -1,16 +1,15 @@
---- src/cpp/CMakeLists.txt.orig 2024-09-16 17:02:32 UTC
+--- src/cpp/CMakeLists.txt.orig 2022-12-03 07:38:59 UTC
+++ src/cpp/CMakeLists.txt
-@@ -479,10 +479,10 @@ if(UNIX)
+@@ -468,9 +468,9 @@ endif()
# find SOCI libraries
if(UNIX)
if(NOT APPLE AND RSTUDIO_USE_SYSTEM_SOCI)
-- find_library(SOCI_CORE_LIB NAMES "libsoci_core.a" "soci_core" REQUIRED)
-- find_library(SOCI_SQLITE_LIB NAMES "libsoci_sqlite3.a" "soci_sqlite3" REQUIRED)
-+ find_library(SOCI_CORE_LIB NAMES "libsoci_core.so" "soci_core" REQUIRED)
-+ find_library(SOCI_SQLITE_LIB NAMES "libsoci_sqlite3.so" "soci_sqlite3" REQUIRED)
- if(RSTUDIO_PRO_BUILD)
-- find_library(SOCI_POSTGRESQL_LIB NAMES "libsoci_postgresql.a" "soci_postgresql" REQUIRED)
-+ find_library(SOCI_POSTGRESQL_LIB NAMES "libsoci_postgresql.so" "soci_postgresql" REQUIRED)
+- 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()
- get_filename_component(SOCI_LIBRARY_DIR "${SOCI_CORE_LIB}" DIRECTORY)
- else()
diff --git a/devel/RStudio/files/patch-src_cpp_core_CMakeLists.txt b/devel/RStudio/files/patch-src_cpp_core_CMakeLists.txt
index 7310ef8a7cd2..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 2024-09-16 17:02:32 UTC
+--- src/cpp/core/CMakeLists.txt.orig 2022-12-03 07:38:59 UTC
+++ src/cpp/core/CMakeLists.txt
-@@ -162,12 +162,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()
# missing on non-glibc platforms like macOS, musl-based Linux distros, and
# the BSDs
diff --git a/devel/RStudio/files/patch-src_cpp_core_include_core_Thread.hpp b/devel/RStudio/files/patch-src_cpp_core_include_core_Thread.hpp
new file mode 100644
index 000000000000..debc7a255c0c
--- /dev/null
+++ b/devel/RStudio/files/patch-src_cpp_core_include_core_Thread.hpp
@@ -0,0 +1,12 @@
+- workaround for https://github.com/rstudio/rstudio/issues/12611
+
+--- src/cpp/core/include/core/Thread.hpp.orig 2023-01-22 20:42:46 UTC
++++ src/cpp/core/include/core/Thread.hpp
+@@ -17,6 +17,7 @@
+ #define CORE_THREAD_HPP
+
+ #include
++#include
+
+ #include
+ #include
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 13319ea6239a..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,23 +1,23 @@
---- src/cpp/core/system/PosixChildProcess.cpp.orig 2024-09-16 17:02:32 UTC
+--- src/cpp/core/system/PosixChildProcess.cpp.orig 2022-12-30 20:28:33 UTC
+++ src/cpp/core/system/PosixChildProcess.cpp
@@ -28,6 +28,11 @@
#include
#include
#include
+#elif defined(__FreeBSD__) // for forkpty
+#include
+#include
+#include
+#include
#endif
#include
-@@ -812,7 +817,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_PosixSystem.cpp b/devel/RStudio/files/patch-src_cpp_core_system_PosixSystem.cpp
index 029fc8ecde18..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,41 +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 2024-06-04 21:19:10 UTC
+--- src/cpp/core/system/PosixSystem.cpp.orig 2022-12-03 07:38:59 UTC
+++ src/cpp/core/system/PosixSystem.cpp
-@@ -69,6 +69,11 @@
-
+@@ -56,6 +56,11 @@
+ #include
#endif
+#if defined(__FreeBSD__)
+#include
+#include
+#endif
+
#include
#include
#include
-@@ -633,6 +638,7 @@ Error getOpenFds(pid_t pid, std::vector* pFd
+@@ -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));
-@@ -659,6 +665,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();
}
-@@ -984,7 +991,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
diff --git a/devel/RStudio/files/patch-src_cpp_desktop_DesktopDownloadItemHelper.cpp b/devel/RStudio/files/patch-src_cpp_desktop_DesktopDownloadItemHelper.cpp
new file mode 100644
index 000000000000..3d716be9b79b
--- /dev/null
+++ b/devel/RStudio/files/patch-src_cpp_desktop_DesktopDownloadItemHelper.cpp
@@ -0,0 +1,15 @@
+--- src/cpp/desktop/DesktopDownloadItemHelper.cpp.orig 2018-05-30 17:56:35 UTC
++++ src/cpp/desktop/DesktopDownloadItemHelper.cpp
+@@ -37,9 +37,9 @@ DownloadHelper::DownloadHelper(QWebEngin
+
+ connect(item, &QWebEngineDownloadItem::finished,
+ this, &DownloadHelper::onFinished);
+-
+- connect(item, &QWebEngineDownloadItem::isPausedChanged,
+- this, &DownloadHelper::onPausedChanged);
++ // exists from 5.10, while FreeBSD kept qt5-webengine at 5.9.5, the handler is empty anyway
++ //connect(item, &QWebEngineDownloadItem::isPausedChanged,
++ // this, &DownloadHelper::onPausedChanged);
+
+ connect(item, &QWebEngineDownloadItem::stateChanged,
+ this, &DownloadHelper::onStateChanged);
diff --git a/devel/RStudio/files/patch-src_cpp_desktop_DesktopMain.cpp b/devel/RStudio/files/patch-src_cpp_desktop_DesktopMain.cpp
new file mode 100644
index 000000000000..f41019b204b7
--- /dev/null
+++ b/devel/RStudio/files/patch-src_cpp_desktop_DesktopMain.cpp
@@ -0,0 +1,28 @@
+--- src/cpp/desktop/DesktopMain.cpp.orig 2021-05-24 22:22:25 UTC
++++ src/cpp/desktop/DesktopMain.cpp
+@@ -49,6 +49,8 @@
+ #include "DesktopActivationOverlay.hpp"
+ #include "DesktopSessionServersOverlay.hpp"
+
++#include "global-setenv.h"
++
+ #ifdef _WIN32
+ #include
+ #include
+@@ -349,7 +351,7 @@ QString inferDefaultRenderingEngineMac()
+
+ #endif /* Q_OS_MAC */
+
+-#ifdef Q_OS_LINUX
++#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
+
+ QString inferDefaultRenderingEngineLinux()
+ {
+@@ -477,6 +479,7 @@ std::string getSessionUrl()
+
+ int main(int argc, char* argv[])
+ {
++ GLOBAL_SETENV
+ core::system::initHook();
+
+ try
diff --git a/devel/RStudio/files/patch-src_cpp_server_CMakeLists.txt b/devel/RStudio/files/patch-src_cpp_server_CMakeLists.txt
index 02bae8efe9ec..167552275470 100644
--- a/devel/RStudio/files/patch-src_cpp_server_CMakeLists.txt
+++ b/devel/RStudio/files/patch-src_cpp_server_CMakeLists.txt
@@ -1,12 +1,12 @@
---- src/cpp/server/CMakeLists.txt.orig 2024-06-04 21:19:10 UTC
+--- src/cpp/server/CMakeLists.txt.orig 2021-05-24 22:22:25 UTC
+++ src/cpp/server/CMakeLists.txt
-@@ -146,6 +146,9 @@ add_stripped_executable(rserver ServerMain.cpp ${SERVE
+@@ -137,6 +137,9 @@ include_directories(
# define executable
add_stripped_executable(rserver ServerMain.cpp ${SERVER_SOURCE_FILES} ${SERVER_HEADER_FILES})
+# additional libraries
+target_link_libraries(rserver -L${FREEBSD_LIBDIR} -linotify)
+
# set link dependencies
target_link_libraries(rserver
rstudio-core
diff --git a/devel/RStudio/files/patch-src_cpp_server_auth_ServerAuthHandler.cpp b/devel/RStudio/files/patch-src_cpp_server_auth_ServerAuthHandler.cpp
new file mode 100644
index 000000000000..50698fa7bb48
--- /dev/null
+++ b/devel/RStudio/files/patch-src_cpp_server_auth_ServerAuthHandler.cpp
@@ -0,0 +1,26 @@
+- workaround for the std:bad_cast exception in the licensed user info retrievel code
+- that isn't even used on FreeBSD
+- see https://github.com/rstudio/rstudio/issues/12377
+- resolution: the offending function's body is commented out for the time being
+
+--- src/cpp/server/auth/ServerAuthHandler.cpp.orig 2023-08-28 18:24:18 UTC
++++ src/cpp/server/auth/ServerAuthHandler.cpp
+@@ -383,6 +383,7 @@ Error getUserFromDatabase(const boost::shared_ptr
+ #include
+ #include
++#include
+ #include
++#include
++#include
++
+
+ #ifdef __linux__
+ #include
diff --git a/lang/rust-nightly/Makefile b/lang/rust-nightly/Makefile
index fd3ff873b005..b3b8ab296639 100644
--- a/lang/rust-nightly/Makefile
+++ b/lang/rust-nightly/Makefile
@@ -1,21 +1,21 @@
# Run update.sh to update to the latest nightly
-PORTVERSION= 1.81.0.${NIGHTLY_DATE:C,-,,g}
+PORTVERSION= 1.80.0.${NIGHTLY_DATE:C,-,,g}
# Always set PORTREVISION explicitly as otherwise it is inherited from lang/rust
PORTREVISION= 0
PKGNAMESUFFIX= -nightly
DISTNAME= rustc-nightly-src
ONLY_FOR_ARCHS= amd64
ONLY_FOR_ARCHS_REASON= upstream does not provide bootstraps for other architectures
CONFLICTS_INSTALL= rust
MASTERDIR= ${.CURDIR}/../rust
PATCHDIR= ${.CURDIR}/files
DISTINFO_FILE= ${.CURDIR}/distinfo
-NIGHTLY_DATE= 2024-10-01
-BOOTSTRAPS_DATE= 2024-08-08
+NIGHTLY_DATE= 2024-05-07
+BOOTSTRAPS_DATE= 2024-04-29
RUST_BOOTSTRAP_VERSION= beta
.include "${MASTERDIR}/Makefile"
diff --git a/lang/rust-nightly/distinfo b/lang/rust-nightly/distinfo
index 0e004c8a9d1b..b5947b78c52b 100644
--- a/lang/rust-nightly/distinfo
+++ b/lang/rust-nightly/distinfo
@@ -1,9 +1,9 @@
-TIMESTAMP = 1727818173
-SHA256 (rust/2024-10-01/rustc-nightly-src.tar.xz) = 46c2d963da26229b8cdeed978b5c9affa091486015d474c1f8a754282a332d1a
-SIZE (rust/2024-10-01/rustc-nightly-src.tar.xz) = 353516056
+TIMESTAMP = 1715170997
+SHA256 (rust/2024-05-07/rustc-nightly-src.tar.xz) = 980396ea6f15b926155ffaab4d56f70a0729a18a98ed99fe11004b5709855458
+SIZE (rust/2024-05-07/rustc-nightly-src.tar.xz) = 162781340
SHA256 (rust/2024-04-29/rustc-beta-x86_64-unknown-freebsd.tar.xz) = 786f40030dbe5e6897aafe4bda44770920b2010b93fc5ce86574774e531e2eff
SIZE (rust/2024-04-29/rustc-beta-x86_64-unknown-freebsd.tar.xz) = 75473648
SHA256 (rust/2024-04-29/rust-std-beta-x86_64-unknown-freebsd.tar.xz) = 69626178bc5309afc8a02c941bd77e70e1aa6917ffb6bf0d67a57d921b5c664a
SIZE (rust/2024-04-29/rust-std-beta-x86_64-unknown-freebsd.tar.xz) = 27096208
SHA256 (rust/2024-04-29/cargo-beta-x86_64-unknown-freebsd.tar.xz) = 7fab806227d1a3be817602abb121ac7e039ba0bbf81e0a1d47bdcccca74203c6
SIZE (rust/2024-04-29/cargo-beta-x86_64-unknown-freebsd.tar.xz) = 9257888
diff --git a/lang/rust-nightly/files/patch-compiler_rustc__target_src_spec_i686__unknown__freebsd.rs b/lang/rust-nightly/files/patch-compiler_rustc__target_src_spec_i686__unknown__freebsd.rs
new file mode 100644
index 000000000000..c1f57467f264
--- /dev/null
+++ b/lang/rust-nightly/files/patch-compiler_rustc__target_src_spec_i686__unknown__freebsd.rs
@@ -0,0 +1,11 @@
+--- compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs.orig 2023-11-27 08:52:00 UTC
++++ compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs
+@@ -2,7 +2,7 @@ pub fn target() -> Target {
+
+ pub fn target() -> Target {
+ let mut base = base::freebsd::opts();
+- base.cpu = "pentium4".into();
++ base.cpu = "pentiumpro".into();
+ base.max_atomic_width = Some(64);
+ base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "-Wl,-znotext"]);
+ base.stack_probes = StackProbeType::X86;
diff --git a/lang/rust-nightly/files/patch-src_bootstrap_src_core_build__steps_install.rs b/lang/rust-nightly/files/patch-src_bootstrap_src_core_build__steps_install.rs
index e92cad711a11..6d7f6d612496 100644
--- a/lang/rust-nightly/files/patch-src_bootstrap_src_core_build__steps_install.rs
+++ b/lang/rust-nightly/files/patch-src_bootstrap_src_core_build__steps_install.rs
@@ -1,17 +1,17 @@
Only install docs for the host target
It otherwise wastes significant time (there are a lot of individual
files) and stages host docs, wasm docs, which unstages the host
docs first.
---- src/bootstrap/src/core/build_steps/install.rs.orig 2024-09-30 19:13:29 UTC
+--- src/bootstrap/src/core/build_steps/install.rs.orig 2022-05-01 20:28:31 UTC
+++ src/bootstrap/src/core/build_steps/install.rs
-@@ -197,7 +197,7 @@ install!((self, builder, _config),
+@@ -138,7 +138,7 @@ macro_rules! install {
}
install!((self, builder, _config),
- Docs, path = "src/doc", _config.docs, only_hosts: false, {
+ Docs, path = "src/doc", _config.docs, only_hosts: true, {
let tarball = builder.ensure(dist::Docs { host: self.target }).expect("missing docs");
install_sh(builder, "docs", self.compiler.stage, Some(self.target), &tarball);
};
diff --git a/lang/rust-nightly/files/patch-src_tools_cargo_src_cargo_sources_git_source.rs b/lang/rust-nightly/files/patch-src_tools_cargo_src_cargo_sources_git_source.rs
index 8503c4bc7a56..fc3b22aebde1 100644
--- a/lang/rust-nightly/files/patch-src_tools_cargo_src_cargo_sources_git_source.rs
+++ b/lang/rust-nightly/files/patch-src_tools_cargo_src_cargo_sources_git_source.rs
@@ -1,36 +1,36 @@
We run cargo update during USES=cargo ports builds to update specific
crates and patch Cargo.lock for us. For normal crates this is based
on what's available in the vendor dir. For Git sources this pulls
new changes from the net instead even if we replace the source with
a static path in a patch section in the config file. Add a hack
to skip this.
This is for experimentation to solve [1]. For this to maybe be
useful for USES=cargo, the patch-in-config feature also needs to
be stabilized first. It will be available in Rust 1.56.
[1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256581
---- src/tools/cargo/src/cargo/sources/git/source.rs.orig 2024-09-30 19:13:29 UTC
+--- src/tools/cargo/src/cargo/sources/git/source.rs.orig 2021-10-04 20:59:57 UTC
+++ src/tools/cargo/src/cargo/sources/git/source.rs
-@@ -243,6 +243,9 @@ impl<'gctx> Source for GitSource<'gctx> {
+@@ -195,6 +195,9 @@ impl<'cfg> Source for GitSource<'cfg> {
kind: QueryKind,
f: &mut dyn FnMut(IndexSummary),
) -> Poll> {
+ if std::env::var("CARGO_FREEBSD_PORTS_SKIP_GIT_UPDATE").is_ok() {
+ return Poll::Ready(Ok(()));
+ }
if let Some(src) = self.path_source.as_mut() {
src.query(dep, kind, f)
} else {
-@@ -265,6 +268,10 @@ impl<'gctx> Source for GitSource<'gctx> {
+@@ -217,6 +220,10 @@ impl<'cfg> Source for GitSource<'cfg> {
fn block_until_ready(&mut self) -> CargoResult<()> {
if self.path_source.is_some() {
- self.mark_used()?;
+ self.mark_used(None)?;
+ return Ok(());
+ }
+
+ if std::env::var("CARGO_FREEBSD_PORTS_SKIP_GIT_UPDATE").is_ok() {
return Ok(());
}
diff --git a/lang/rust-nightly/files/patch-vendor_cc.rs b/lang/rust-nightly/files/patch-vendor_cc.rs
new file mode 100644
index 000000000000..5b6888c4c087
--- /dev/null
+++ b/lang/rust-nightly/files/patch-vendor_cc.rs
@@ -0,0 +1,107 @@
+When the compiler has "clang" in its name the cc crate will pass
+an LLVM target triple to it. Rust uses a triple that lacks the OS
+version and LLVM will default to FreeBSD 9 behavior, i.e., it will
+default to libstdc++ which is no longer available in newer releases.
+
+To avoid this issue assume we have a GNU compatible toolchain instead
+until LLVM can be updated to use libc++ by default.
+
+https://reviews.llvm.org/D77776
+
+--- vendor/cc-1.0.73/src/lib.rs.orig 2021-03-04 20:58:54 UTC
++++ vendor/cc-1.0.73/src/lib.rs
+@@ -2659,24 +2659,7 @@ impl Tool {
+ }
+
+ fn with_features(path: PathBuf, clang_driver: Option<&str>, cuda: bool) -> Self {
+- // Try to detect family of the tool from its name, falling back to Gnu.
+- let family = if let Some(fname) = path.file_name().and_then(|p| p.to_str()) {
+- if fname.contains("clang-cl") {
+- ToolFamily::Msvc { clang_cl: true }
+- } else if fname.ends_with("cl") || fname == "cl.exe" {
+- ToolFamily::Msvc { clang_cl: false }
+- } else if fname.contains("clang") {
+- match clang_driver {
+- Some("cl") => ToolFamily::Msvc { clang_cl: true },
+- _ => ToolFamily::Clang,
+- }
+- } else {
+- ToolFamily::Gnu
+- }
+- } else {
+- ToolFamily::Gnu
+- };
+-
++ let family = ToolFamily::Gnu;
+ Tool {
+ path: path,
+ cc_wrapper_path: None,
+
+--- vendor/cc-1.0.79/src/lib.rs.orig 2021-03-04 20:58:54 UTC
++++ vendor/cc-1.0.79/src/lib.rs
+@@ -2659,24 +2659,7 @@ impl Tool {
+ }
+
+ fn with_features(path: PathBuf, clang_driver: Option<&str>, cuda: bool) -> Self {
+- // Try to detect family of the tool from its name, falling back to Gnu.
+- let family = if let Some(fname) = path.file_name().and_then(|p| p.to_str()) {
+- if fname.contains("clang-cl") {
+- ToolFamily::Msvc { clang_cl: true }
+- } else if fname.ends_with("cl") || fname == "cl.exe" {
+- ToolFamily::Msvc { clang_cl: false }
+- } else if fname.contains("clang") {
+- match clang_driver {
+- Some("cl") => ToolFamily::Msvc { clang_cl: true },
+- _ => ToolFamily::Clang,
+- }
+- } else {
+- ToolFamily::Gnu
+- }
+- } else {
+- ToolFamily::Gnu
+- };
+-
++ let family = ToolFamily::Gnu;
+ Tool {
+ path: path,
+ cc_wrapper_path: None,
+
+--- vendor/cc-1.0.90/src/tool.rs.orig 2024-03-18 11:23:17 UTC
++++ vendor/cc-1.0.90/src/tool.rs
+@@ -122,22 +122,7 @@ impl Tool {
+ };
+
+ // Try to detect family of the tool from its name, falling back to Gnu.
+- let family = if let Some(fname) = path.file_name().and_then(|p| p.to_str()) {
+- if fname.contains("clang-cl") {
+- ToolFamily::Msvc { clang_cl: true }
+- } else if fname.ends_with("cl") || fname == "cl.exe" {
+- ToolFamily::Msvc { clang_cl: false }
+- } else if fname.contains("clang") {
+- match clang_driver {
+- Some("cl") => ToolFamily::Msvc { clang_cl: true },
+- _ => ToolFamily::Clang,
+- }
+- } else {
+- detect_family(&path)
+- }
+- } else {
+- detect_family(&path)
+- };
++ let family = ToolFamily::Gnu;
+
+ Tool {
+ path,
+--- vendor/cc-1.0.92/src/tool.rs.orig 2024-05-09 18:20:47 UTC
++++ vendor/cc-1.0.92/src/tool.rs
+@@ -151,9 +151,7 @@ impl Tool {
+
+ match (clang, accepts_cl_style_flags, gcc) {
+ (clang_cl, true, _) => Ok(ToolFamily::Msvc { clang_cl }),
+- (true, false, _) => Ok(ToolFamily::Clang {
+- zig_cc: is_zig_cc(path, cargo_output),
+- }),
++ (true, false, _) => Ok(ToolFamily::Gnu),
+ (false, false, true) => Ok(ToolFamily::Gnu),
+ (false, false, false) => {
+ cargo_output.print_warning(&"Compiler family detection failed since it does not define `__clang__`, `__GNUC__` or `_MSC_VER`, fallback to treating it as GNU");
diff --git a/lang/rust/Makefile b/lang/rust/Makefile
index 8142a9904464..5f3a427ae029 100644
--- a/lang/rust/Makefile
+++ b/lang/rust/Makefile
@@ -1,286 +1,286 @@
PORTNAME= rust
PORTVERSION?= 1.81.0
PORTREVISION?= 0
CATEGORIES= lang
MASTER_SITES= https://static.rust-lang.org/dist/:src \
https://dev-static.rust-lang.org/dist/:src \
LOCAL/rust:bootstrap \
https://static.rust-lang.org/dist/:bootstrap
DISTNAME?= ${PORTNAME}c-${PORTVERSION}-src
DISTFILES?= ${NIGHTLY_DATE:D${NIGHTLY_DATE}/}${DISTNAME}${EXTRACT_SUFX}:src \
${_RUSTC_BOOTSTRAP}${EXTRACT_SUFX}:bootstrap \
${_RUST_STD_BOOTSTRAP}${EXTRACT_SUFX}:bootstrap \
${_CARGO_BOOTSTRAP}${EXTRACT_SUFX}:bootstrap
DIST_SUBDIR?= rust
MAINTAINER= rust@FreeBSD.org
COMMENT= Language with a focus on memory safety and concurrency
WWW= https://www.rust-lang.org/
LICENSE= APACHE20 MIT
LICENSE_COMB= dual
LICENSE_FILE_APACHE20= ${WRKSRC}/LICENSE-APACHE
LICENSE_FILE_MIT= ${WRKSRC}/LICENSE-MIT
ONLY_FOR_ARCHS?= aarch64 amd64 armv7 i386 powerpc64 powerpc64le powerpc \
riscv64
ONLY_FOR_ARCHS_REASON?= requires prebuilt bootstrap compiler
LIB_DEPENDS= libcurl.so:ftp/curl
USES= cmake:indirect cpe ninja:build pkgconfig python:build ssl tar:xz
CPE_VENDOR= rust-lang
MAKE_ENV= DESTDIR=${STAGEDIR} \
LIBGIT2_NO_PKG_CONFIG=1 \
OPENSSL_DIR="${OPENSSLBASE}"
TEST_ENV= ${MAKE_ENV} \
ALLOW_NONZERO_RLIMIT_CORE=1
CONFLICTS_INSTALL?= rust-nightly
# rustc stashes intermediary files in TMPDIR (default /tmp) which
# might cause issues for users that for some reason space limit
# their /tmp. WRKDIR should have plenty of space.
# ?= to allow users to still overwrite it in make.conf.
TMPDIR?= ${WRKDIR}
OPTIONS_DEFINE= DOCS GDB LTO PORT_LLVM SOURCES WASM
OPTIONS_DEFAULT= SOURCES WASM
GDB_DESC= Install ports gdb (necessary for debugging rust programs)
PORT_LLVM_DESC= Build against devel/llvm instead of bundled copy (experimental)
SOURCES_DESC= Install source files
WASM_DESC= Build the WebAssembly target (wasm32-unknown-unknown)
DOCS_VARS= _RUST_BUILD_DOCS=true \
_COMPONENTS+="rust-docs-${_PACKAGE_VERS}-${_RUST_TARGET} rust-docs-json-${_PACKAGE_VERS}-${_RUST_TARGET}" \
_RUST_TOOLS+=rustdoc
DOCS_VARS_OFF= _RUST_BUILD_DOCS=false
GDB_RUN_DEPENDS= ${LOCALBASE}/bin/gdb:devel/gdb
PORT_LLVM_USES= llvm:min=17,lib,noexport
PORT_LLVM_MAKE_ENV= RUSTFLAGS="-Lnative=${LOCALBASE}/lib"
SOURCES_VARS= _COMPONENTS+=rust-src-${_PACKAGE_VERS} \
_RUST_TOOLS+=src
WASM_VARS= _COMPONENTS+="rust-analysis-${_PACKAGE_VERS}-wasm32-unknown-unknown rust-std-${_PACKAGE_VERS}-wasm32-unknown-unknown" \
_RUST_TARGETS+=wasm32-unknown-unknown
# See WRKSRC/src/stage0.json for the date and version values
BOOTSTRAPS_DATE?= 2024-08-08
RUST_BOOTSTRAP_VERSION?= 1.80.0
CARGO_VENDOR_DIR?= ${WRKSRC}/vendor
# Rust's target arch string might be different from *BSD arch strings
_RUST_ARCH_amd64= x86_64
_RUST_ARCH_i386= i686
_RUST_ARCH_riscv64= riscv64gc
_RUST_TARGET= ${_RUST_ARCH_${ARCH}:U${ARCH}}-unknown-${OPSYS:tl}
_RUST_TARGETS= ${_RUST_TARGET}
_RUST_TOOLS= analysis cargo clippy rust-analyzer rustdoc rustfmt
_RUSTC_BOOTSTRAP= ${BOOTSTRAPS_DATE_${ARCH}:U${BOOTSTRAPS_DATE}}/rustc-${RUST_BOOTSTRAP_VERSION_${ARCH}:U${RUST_BOOTSTRAP_VERSION}}-${_RUST_TARGET}
_RUST_STD_BOOTSTRAP= ${BOOTSTRAPS_DATE_${ARCH}:U${BOOTSTRAPS_DATE}}/rust-std-${RUST_BOOTSTRAP_VERSION_${ARCH}:U${RUST_BOOTSTRAP_VERSION}}-${_RUST_TARGET}
_CARGO_BOOTSTRAP= ${BOOTSTRAPS_DATE_${ARCH}:U${BOOTSTRAPS_DATE}}/cargo-${RUST_BOOTSTRAP_VERSION_${ARCH}:U${RUST_BOOTSTRAP_VERSION}}-${_RUST_TARGET}
_PACKAGE_VERS= ${NIGHTLY_DATE:?nightly:${PORTVERSION}}
_COMPONENTS+= cargo-${_PACKAGE_VERS}-${_RUST_TARGET} \
clippy-${_PACKAGE_VERS}-${_RUST_TARGET} \
rustc-${_PACKAGE_VERS}-${_RUST_TARGET} \
rustfmt-${_PACKAGE_VERS}-${_RUST_TARGET} \
rust-analysis-${_PACKAGE_VERS}-${_RUST_TARGET} \
rust-std-${_PACKAGE_VERS}-${_RUST_TARGET}
.include
.if ${OPSYS} != FreeBSD
IGNORE= is only for FreeBSD
.endif
.if ${ARCH} == powerpc
LIB_DEPENDS+= libatomic.so:lang/gcc${GCC_DEFAULT}
MAKE_ENV+= RUSTFLAGS="-L/usr/local/lib/gcc${GCC_DEFAULT}"
.endif
# rls doesn't build on rust nightly
.if !defined(NIGHTLY_DATE)
_RUST_TOOLS+= rls
_COMPONENTS+= rls-${_PACKAGE_VERS}-${_RUST_TARGET}
.endif
.if ${ARCH} != powerpc64le
MAKE_ENV+= RUST_BACKTRACE=1
.endif
# per https://rust-lang.github.io/rustup/concepts/components.html
# rustc-dev is only usefull on nightly
.if defined(NIGHTLY_DATE)
_COMPONENTS+= rustc-dev-${_PACKAGE_VERS}-${_RUST_TARGET}
.endif
.if ${PORT_OPTIONS:MWASM} && ${PORT_OPTIONS:MDOCS}
_COMPONENTS+= rust-docs-${_PACKAGE_VERS}-wasm32-unknown-unknown rust-docs-json-${_PACKAGE_VERS}-wasm32-unknown-unknown
.endif
.if exists(${PATCHDIR}/${ARCH}${BOOTSTRAPS_SUFFIX})
EXTRA_PATCHES+= ${PATCHDIR}/${ARCH}${BOOTSTRAPS_SUFFIX}
.endif
.ifdef QEMU_EMULATING
IGNORE= fails to build with qemu-user-static
.endif
.if make(makesum)
DISTFILES:= ${DISTFILES:M*\:src} \
${ONLY_FOR_ARCHS:O:@_arch@${:!${MAKE} ARCH=${_arch} -V'DISTFILES:N*\:src'!}@}
.endif
post-patch:
@${REINPLACE_CMD} 's,gdb,${LOCALBASE}/bin/gdb,' ${WRKSRC}/src/etc/rust-gdb
-#.if defined(NIGHTLY_DATE)
-# @${REINPLACE_CMD} 's/"rustfmt"/"nothx"/' ${WRKSRC}/src/stage0.json
-#.endif
+.if defined(NIGHTLY_DATE)
+ @${REINPLACE_CMD} 's/"rustfmt"/"nothx"/' ${WRKSRC}/src/stage0.json
+.endif
# Disable vendor checksums
@${REINPLACE_CMD} 's,"files":{[^}]*},"files":{},' \
${CARGO_VENDOR_DIR}/*/.cargo-checksum.json
post-patch-PORT_LLVM-on:
# WASM target hardcodes bundled lld
@${REINPLACE_CMD} 's|"rust-lld"|"wasm-ld${LLVM_VERSION}"|' \
${WRKSRC}/compiler/rustc_target/src/spec/base/wasm.rs
do-configure:
# Check that the running kernel has COMPAT_FREEBSD11 required by lang/rust post-ino64
@${SETENV} CC="${CC}" OPSYS="${OPSYS}" OSVERSION="${OSVERSION}" WRKDIR="${WRKDIR}" \
${SH} ${SCRIPTSDIR}/rust-compat11-canary.sh
.for _component in cargo rust-std rustc
@cd ${WRKDIR}/${_component}-*-${OPSYS:tl} && \
${SH} install.sh --prefix=${WRKDIR}/bootstrap --verbose
.endfor
@${ECHO_CMD} '[build]' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'build-dir="${WRKDIR}/_build"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'build-stage=2' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'doc-stage=2' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'test-stage=2' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'vendor=true' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'extended=true' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'python="${PYTHON_CMD}"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'docs=${_RUST_BUILD_DOCS}' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'verbose=2' >> ${WRKSRC}/config.toml
.if defined(NIGHTLY_DATE)
@${ECHO_CMD} 'profiler=true' >> ${WRKSRC}/config.toml
.endif
@${ECHO_CMD} 'target=[${_RUST_TARGETS:@.target.@"${.target.}"@:ts,}]' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'cargo="${WRKDIR}/bootstrap/bin/cargo"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'rustc="${WRKDIR}/bootstrap/bin/rustc"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'tools=[${_RUST_TOOLS:@.tool.@"${.tool.}"@:ts,}]' >> ${WRKSRC}/config.toml
@${ECHO_CMD} '[install]' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'prefix="${PREFIX}"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'sysconfdir="${PREFIX}/etc"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} '[rust]' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'channel="${PKGNAMESUFFIX:Ustable:S/^-//}"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'default-linker="${CC}"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'deny-warnings=false' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'verbose-tests=true' >> ${WRKSRC}/config.toml
.if ${PORT_OPTIONS:MWASM} && !${PORT_OPTIONS:MPORT_LLVM}
@${ECHO_CMD} 'lld=true' >> ${WRKSRC}/config.toml
.else
@${ECHO_CMD} 'lld=false' >> ${WRKSRC}/config.toml
.endif
.if ${PORT_OPTIONS:MLTO}
@${ECHO_CMD} 'lto="thin"' >> ${WRKSRC}/config.toml
.endif
@${ECHO_CMD} 'remap-debuginfo=true' >> ${WRKSRC}/config.toml
@${ECHO_CMD} '[llvm]' >> ${WRKSRC}/config.toml
.if ${PORT_OPTIONS:MLTO}
@${ECHO_CMD} 'thin-lto=true' >> ${WRKSRC}/config.toml
.endif
.if defined(WITH_CCACHE_BUILD) && !defined(NO_CCACHE)
@${ECHO_CMD} 'ccache="${CCACHE_BIN}"' >> ${WRKSRC}/config.toml
.else
@${ECHO_CMD} 'ccache=false' >> ${WRKSRC}/config.toml
.endif
@${ECHO_CMD} 'ninja=true' >> ${WRKSRC}/config.toml
.if ${ARCH} == powerpc
# Rust doesn't call the system compiler with the full version of the target.
# This makes powerpc miscompile due to the secure-plt ABI change.
# Additionally, force using ld.bfd to work around a linking problem in rustc_mir
@${PRINTF} '#!/bin/sh\nexec ${CC} "$$@" --target=powerpc-unknown-freebsd13.2' > ${WRKDIR}/cc-wrapper
@${CHMOD} +x ${WRKDIR}/cc-wrapper
@${PRINTF} '#!/bin/sh\nexec ${CXX} "$$@" --target=powerpc-unknown-freebsd13.2' > ${WRKDIR}/cxx-wrapper
@${CHMOD} +x ${WRKDIR}/cxx-wrapper
.endif
.for _target in ${_RUST_TARGETS}
@${ECHO_CMD} '[target.${_target}]' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'ar="${AR}"' >> ${WRKSRC}/config.toml
.if ${ARCH} == powerpc
@${ECHO_CMD} 'cc="${WRKDIR}/cc-wrapper"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'cxx="${WRKDIR}/cxx-wrapper"' >> ${WRKSRC}/config.toml
.else
@${ECHO_CMD} 'cc="${CC}"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'cxx="${CXX}"' >> ${WRKSRC}/config.toml
.endif
@${ECHO_CMD} 'linker="${CC}"' >> ${WRKSRC}/config.toml
.if ${PORT_OPTIONS:MPORT_LLVM}
@${ECHO_CMD} 'llvm-config="${LOCALBASE}/bin/${LLVM_CONFIG}"' >> ${WRKSRC}/config.toml
.endif
.endfor
@${ECHO_CMD} '[dist]' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'src-tarball=false' >> ${WRKSRC}/config.toml
.if defined(NIGHTLY_DATE)
# Don't abort if optional tools fail to build
@${ECHO_CMD} 'missing-tools=true' >> ${WRKSRC}/config.toml
.endif
do-build:
@cd ${WRKSRC} && \
${SETENV} ${MAKE_ENV} ${PYTHON_CMD} x.py dist --jobs=${MAKE_JOBS_NUMBER}
do-install:
${RM} -r ${WRKDIR}/_extractdist
.for _c in ${_COMPONENTS}
${MKDIR} ${WRKDIR}/_extractdist
${TAR} xf ${WRKDIR}/_build/dist/${_c}.tar.xz -C ${WRKDIR}/_extractdist
cd ${WRKDIR}/_extractdist/${_c} && \
${SH} install.sh \
--docdir="${STAGEDIR}${DOCSDIR}" \
--mandir="${STAGEDIR}${PREFIX}/share/man" \
--prefix="${STAGEDIR}${PREFIX}"
${RM} -r ${WRKDIR}/_extractdist
.endfor
# We autogenerate the plist file. We do that, instead of the
# regular pkg-plist, because several libraries have a computed
# filename based on the absolute path of the source files. As it
# is user-specific, we cannot know their filename in advance.
@${RM} ${STAGEDIR}${DOCSDIR}/*.old \
${STAGEDIR}${PREFIX}/lib/rustlib/components \
${STAGEDIR}${PREFIX}/lib/rustlib/install.log \
${STAGEDIR}${PREFIX}/lib/rustlib/manifest-* \
${STAGEDIR}${PREFIX}/lib/rustlib/rust-installer-version \
${STAGEDIR}${PREFIX}/lib/rustlib/uninstall.sh
@${FIND} ${STAGEDIR}${PREFIX}/bin ${STAGEDIR}${PREFIX}/lib \
${STAGEDIR}${PREFIX}/libexec -exec ${FILE} -i {} + | \
${AWK} -F: '/executable|sharedlib/ { print $$1 }' | ${XARGS} ${STRIP_CMD}
@${FIND} ${STAGEDIR}${PREFIX} -not -type d | \
${SED} -E -e 's,^${STAGEDIR}${PREFIX}/,,' \
-e 's,(share/man/man[1-9]/.*\.[0-9]),\1.gz,' >> ${TMPPLIST}
post-install-DOCS-on:
# Ignore any left behind empty directories in case some docs fail
# to build (failures are ignored due to deny-warnings=false).
@${FIND} ${STAGEDIR}${DOCSDIR}/html -empty -type d | \
${SED} 's,^${STAGEDIR},@comment @dir ,' >> ${TMPPLIST}
post-install-SOURCES-on:
# Silence stage-qa warnings by sanitizing permissions on sources
@${FIND} ${STAGEDIR}${PREFIX}/lib/rustlib/src -type f -exec ${CHMOD} \
${SHAREMODE} {} +
# Note that make test does not work when rust is already installed.
do-test:
@cd ${WRKSRC} && \
${SETENV} ${TEST_ENV} ${PYTHON_CMD} x.py test --jobs=${MAKE_JOBS_NUMBER}
.include