svn commit: r564182 - in head/devel/RStudio: . files

Yuri Victorovich yuri at FreeBSD.org
Sat Feb 6 02:43:26 UTC 2021


Author: yuri
Date: Sat Feb  6 02:43:24 2021
New Revision: 564182
URL: https://svnweb.freebsd.org/changeset/ports/564182

Log:
  devel/RStudio: Flavorize into 'desktop' and 'server' flavors
  
  The RStudio project builds in two modes: Desktop and Server.
  
  These modes are now reflected as port flavors.

Added:
  head/devel/RStudio/files/patch-src_cpp_shared__core_system_User.cpp   (contents, props changed)
Modified:
  head/devel/RStudio/Makefile
  head/devel/RStudio/files/patch-src_cpp_core_system_PosixSystem.cpp
  head/devel/RStudio/pkg-message

Modified: head/devel/RStudio/Makefile
==============================================================================
--- head/devel/RStudio/Makefile	Sat Feb  6 02:16:14 2021	(r564181)
+++ head/devel/RStudio/Makefile	Sat Feb  6 02:43:24 2021	(r564182)
@@ -1,11 +1,12 @@
 # $FreeBSD$
 
 # 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
+# Its build is known to succeed with MAX_FILES_RStudio=4096 and MAX_FILES_RStudio_server=4096 in poudriere.conf
 
 PORTNAME=	RStudio
 DISTVERSIONPREFIX=	v
 DISTVERSION=	1.3.1093
+PORTREVISION=	1
 CATEGORIES=	devel math java
 MASTER_SITES=	https://s3.amazonaws.com/rstudio-buildtools/dictionaries/:dictionaries \
 		https://s3.amazonaws.com/rstudio-buildtools/:buildtools
@@ -31,7 +32,11 @@ LIB_DEPENDS=	libR.so:math/R \
 		libinotify.so:devel/libinotify \
 		libuuid.so:misc/e2fsprogs-libuuid
 
-USES=		cmake desktop-file-utils fortran localbase:ldflags pkgconfig qt:5 shared-mime-info ssl
+FLAVORS=	desktop server
+FLAVOR?=	${FLAVORS:[1]}
+server_PKGNAMESUFFIX=	-server
+
+USES=		cmake fortran localbase:ldflags pkgconfig qt:5 ssl
 USE_QT=		core dbus declarative gui location network opengl printsupport quickcontrols sensors \
 		sql svg webchannel webengine webkit widgets xml xmlpatterns buildtools_build qmake_build
 USE_JAVA=	yes
@@ -44,8 +49,7 @@ GH_TUPLE=	rstudio:r2d3:v0.2.0:r2d3/dependencies/common
 		rstudio:rsconnect:03c379b:rsconnect/dependencies/common/rsconnect \
 		trestletech:plumber:v0.4.6:plumber/dependencies/common/plumber
 
-CMAKE_ARGS=	-DRSTUDIO_TARGET=Desktop \
-		-DFREEBSD_RSTUDIO_VERSION:STRING=${PORTVERSION} \
+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
@@ -58,6 +62,23 @@ MAKE_ENV=	HOME=${WRKDIR} \
 GWT_VERSION=	2.8.1
 GIN_VERSION=	2.1.2
 
+.if ${FLAVOR:U} == desktop
+USES+=		desktop-file-utils shared-mime-info
+CMAKE_ARGS+=	-DRSTUDIO_TARGET=Desktop
+INSTALL_SUBDIR=	${PORTNAME:tl}
+EXECUTABLE=	${PORTNAME:tl}
+.endif
+
+.if ${FLAVOR:U} == server
+COMMENT+=	(web UI version)
+USES+=		shebangfix
+SHEBANG_FILES=	src/cpp/server/extras/admin/rstudio-server.in
+CMAKE_ARGS+=	-DRSTUDIO_TARGET=Server
+INSTALL_SUBDIR=	${PORTNAME:tl}-server
+EXECUTABLE=	rserver
+RUN_DEPENDS+=	bash:shells/bash
+.endif
+
 post-extract:
 	@${MKDIR} ${WRKSRC}/dependencies/common/dictionaries && ${MV} ${WRKDIR}/en_* ${WRKSRC}/dependencies/common/dictionaries/
 	@${MV} ${WRKDIR}/mathjax-* ${WRKSRC}/dependencies/common/
@@ -92,14 +113,16 @@ post-install:
 	  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/rstudio/bin/rstudio \"$$"@"\"" \
-	) > ${STAGEDIR}${PREFIX}/bin/rstudio
-	@${CHMOD} +x ${STAGEDIR}${PREFIX}/bin/rstudio
-	@${REINPLACE_CMD} -e 's|^Exec=.*/rstudio|Exec=${PREFIX}/bin/rstudio|' ${STAGEDIR}${PREFIX}/share/applications/rstudio.desktop
+	  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} -e 's|^Exec=.*/rstudio|Exec=${PREFIX}/bin/${EXECUTABLE}|' ${STAGEDIR}${PREFIX}/share/applications/${EXECUTABLE}.desktop
+.endif
 	# Some functions expect the pandoc symlink.
-	@${MKDIR} ${STAGEDIR}${PREFIX}/lib/rstudio/bin/pandoc
-	@cd ${STAGEDIR}${PREFIX}/lib/rstudio/bin/pandoc && ${LN} -s ../../../../bin/pandoc
-	# There is a variability in .js file names due to the 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|' > ${TMPPLIST}
+	@${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 <bsd.port.mk>

Modified: head/devel/RStudio/files/patch-src_cpp_core_system_PosixSystem.cpp
==============================================================================
--- head/devel/RStudio/files/patch-src_cpp_core_system_PosixSystem.cpp	Sat Feb  6 02:16:14 2021	(r564181)
+++ head/devel/RStudio/files/patch-src_cpp_core_system_PosixSystem.cpp	Sat Feb  6 02:43:24 2021	(r564182)
@@ -1,4 +1,6 @@
---- src/cpp/core/system/PosixSystem.cpp.orig	2020-05-18 18:11:10 UTC
+- 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	2020-09-17 18:16:48 UTC
 +++ src/cpp/core/system/PosixSystem.cpp
 @@ -40,20 +40,25 @@
  
@@ -28,8 +30,24 @@
  #include <boost/thread.hpp>
  #include <boost/format.hpp>
  #include <boost/lexical_cast.hpp>
-@@ -917,7 +922,7 @@ Error executablePath(const char * argv0,
+@@ -575,6 +580,7 @@ Error getOpenFds(std::vector<uint32_t>* pFds)
+ #ifndef __APPLE__
+ Error getOpenFds(pid_t pid, std::vector<uint32_t>* pFds)
+ {
++#if !defined(__FreeBSD__)
+    std::string pidStr = safe_convert::numberToString(pid);
+    boost::format fmt("/proc/%1%/fd");
+    FilePath filePath(boost::str(fmt % pidStr));
+@@ -601,6 +607,7 @@ Error getOpenFds(pid_t pid, std::vector<uint32_t>* pFd
+          pFds->push_back(fd.get());
+       }
+    }
++#endif
  
+    return Success();
+ }
+@@ -922,7 +929,7 @@ Error executablePath(const char * argv0,
+ 
  #elif defined(HAVE_PROCSELF)
  
 -   executablePath = std::string("/proc/self/exe");
@@ -37,7 +55,7 @@
  
  #else
  
-@@ -1426,7 +1431,7 @@ Error osResourceLimit(ResourceLimit limit, int* pLimit
+@@ -1431,7 +1438,7 @@ Error osResourceLimit(ResourceLimit limit, int* pLimit
        case CpuLimit:
           *pLimit = RLIMIT_CPU;
           break;
@@ -46,7 +64,7 @@
        case NiceLimit:
           *pLimit = RLIMIT_NICE;
           break;
-@@ -1499,7 +1504,7 @@ Error systemInformation(SysInfo* pSysInfo)
+@@ -1504,7 +1511,7 @@ Error systemInformation(SysInfo* pSysInfo)
  {
     pSysInfo->cores = boost::thread::hardware_concurrency();
  
@@ -55,7 +73,7 @@
     struct sysinfo info;
     if (::sysinfo(&info) == -1)
        return systemError(errno, ERROR_LOCATION);
-@@ -1939,7 +1944,7 @@ Error restrictCoreDumps()
+@@ -1944,7 +1951,7 @@ Error restrictCoreDumps()
        return error;
  
     // no ptrace core dumps permitted
@@ -64,7 +82,7 @@
     int res = ::prctl(PR_SET_DUMPABLE, 0);
     if (res == -1)
        return systemError(errno, ERROR_LOCATION);
-@@ -1950,7 +1955,7 @@ Error restrictCoreDumps()
+@@ -1955,7 +1962,7 @@ Error restrictCoreDumps()
  
  Error enableCoreDumps()
  {
@@ -73,7 +91,7 @@
     int res = ::prctl(PR_SET_DUMPABLE, 1);
     if (res == -1)
        return systemError(errno, ERROR_LOCATION);
-@@ -1976,7 +1981,7 @@ void printCoreDumpable(const std::string& context)
+@@ -1981,7 +1988,7 @@ void printCoreDumpable(const std::string& context)
     ostr << "  hard limit: " << rLimitHard << std::endl;
  
     // ptrace

Added: head/devel/RStudio/files/patch-src_cpp_shared__core_system_User.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/RStudio/files/patch-src_cpp_shared__core_system_User.cpp	Sat Feb  6 02:43:24 2021	(r564182)
@@ -0,0 +1,13 @@
+- Workaround for https://github.com/rstudio/rstudio/issues/8908
+
+--- src/cpp/shared_core/system/User.cpp.orig	2021-02-05 21:40:04 UTC
++++ src/cpp/shared_core/system/User.cpp
+@@ -64,6 +64,8 @@ struct User::Impl
+ 
+       // Get the maximum size of a passwd for this system.
+       long buffSize = ::sysconf(_SC_GETPW_R_SIZE_MAX);
++      if (buffSize == -1)
++      	buffSize = 4096;
+       if (buffSize == 1)
+          buffSize = 4096; // some systems return -1, be conservative!
+ 

Modified: head/devel/RStudio/pkg-message
==============================================================================
--- head/devel/RStudio/pkg-message	Sat Feb  6 02:16:14 2021	(r564181)
+++ head/devel/RStudio/pkg-message	Sat Feb  6 02:43:24 2021	(r564182)
@@ -10,6 +10,15 @@ proc /proc procfs rw 0 0
 
 and then run this command as root:
 # mount /proc
+
+In order to run RStudio Server please run:
+$ sudo rserver --server-daemonize 0 --server-user nobody
+
+and then navigate to http://localhost:8787/ in your browser.
+
+The rc script will be added later to start RStudio Server as
+a service.
+
 EOM
 }
 ]


More information about the svn-ports-all mailing list