1
0
forked from ports/contrib

rstudio: fixed build against R 4.0.0 and boost 1.73.0

This commit is contained in:
Tim Biermann 2020-05-14 15:25:43 +02:00
parent 60b753ee99
commit 39405b41a1
8 changed files with 259 additions and 124 deletions

View File

@ -1,9 +1,12 @@
untrusted comment: verify with /etc/ports/contrib.pub
RWSagIOpLGJF31npxNs+weh3PFm9UhoN8kr5Q0BCtmuL+ZwLLSILLl5emCOiIxYPYPxu3GSbtHNTfkrZ/AmmlRRWQe5pEj4MQws=
SHA256 (Pkgfile) = 54c42d876a6e2b704650f3b417769ce767c351b4f1c7605bfe500e0dfcf537e4
RWSagIOpLGJF3zNSASryMVzyTNdta5KnJ9OSN172yGaM+8fBV79LWdH5eB+yb6HBZ0IdszSOba271oXQQi7lnVpGaerY1TJMoQs=
SHA256 (Pkgfile) = 9cf2cb83524ea25e75834f3a432a7c96ec0dbfb8250e53552bf8fe7eb6e3f508
SHA256 (.footprint) = bcde50a8850d52066713cd22252d77e2a3afcc7eb436b954816a5ef82594db16
SHA256 (rstudio-1.2.5042.tar.gz) = 2bcd1d525d92e9ce42f4c7a57383c025e10d34313f8ed245429f02980b47c1fc
SHA256 (gin-2.1.2.zip) = b98e704164f54be596779696a3fcd11be5785c9907a99ec535ff6e9525ad5f9a
SHA256 (gwt-2.8.1.zip) = 0b7af89fdadb4ec51cdb400ace94637d6fe9ffa401b168e2c3d372392a00a0a7
SHA256 (core-dictionaries.zip) = 4341a9630efb9dcf7f215c324136407f3b3d6003e1c96f2e5e1f9f14d5787494
SHA256 (217ce0962734ae85621fd82f0eed86129c991a79.patch) = d252111e28a7de8602b4df1f66b36dded260061f094b504895e5c789f8681091
SHA256 (rstudio-1.2.1335-boost-1.70.0_p1.patch) = 0e7a4e1e6c43d0dcee80c63ffdebbaf8335a4a693ab693e9dab75d85edd0d24a
SHA256 (rstudio-1.2.1335-boost-1.70.0_p2.patch) = 3add12ebcdab67ad14ac6ec4bf5e960a08a829ebd40442843513d7c3243f3445
SHA256 (rstudio-1.2.5042-boost-1.73.0.patch) = 5d282059731b64579c0f8c8eeb280b4c4efe810ce829ad7332385b0a92e1215e
SHA256 (r-nosave.patch) = 88d6924605de8d9e50c545bbf1e18a1146db8756be3d65e3e47e7cc1f7f324be

View File

@ -1,105 +0,0 @@
From 33c2c42d40ad97d97ca3907df51059cd2ce76fe3 Mon Sep 17 00:00:00 2001
From: Kevin Ushey <kevinushey@gmail.com>
Date: Tue, 3 Sep 2019 13:23:23 -0700
Subject: [PATCH] first pass at Boost 1.70 support
---
src/cpp/core/include/core/http/TcpIpAsyncConnector.hpp | 6 ++++--
src/cpp/ext/websocketpp/transport/asio/connection.hpp | 2 +-
src/cpp/ext/websocketpp/transport/asio/endpoint.hpp | 10 +++-------
.../ext/websocketpp/transport/asio/security/none.hpp | 3 +--
4 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/src/cpp/core/include/core/http/TcpIpAsyncConnector.hpp b/src/cpp/core/include/core/http/TcpIpAsyncConnector.hpp
index 14e4114e15..334afb9790 100644
--- a/src/cpp/core/include/core/http/TcpIpAsyncConnector.hpp
+++ b/src/cpp/core/include/core/http/TcpIpAsyncConnector.hpp
@@ -55,7 +55,8 @@ class TcpIpAsyncConnector :
public:
TcpIpAsyncConnector(boost::asio::io_service& ioService,
boost::asio::ip::tcp::socket* pSocket)
- : pSocket_(pSocket),
+ : service_(ioService),
+ pSocket_(pSocket),
resolver_(ioService),
isConnected_(false),
hasFailed_(false)
@@ -78,7 +79,7 @@ class TcpIpAsyncConnector :
{
// start a timer that will cancel any outstanding asynchronous operations
// when it elapses if the connection operation has not succeeded
- pConnectionTimer_.reset(new boost::asio::deadline_timer(resolver_.get_io_service(), timeout));
+ pConnectionTimer_.reset(new boost::asio::deadline_timer(service_, timeout));
pConnectionTimer_->async_wait(boost::bind(&TcpIpAsyncConnector::onConnectionTimeout,
TcpIpAsyncConnector::shared_from_this(),
boost::asio::placeholders::error));
@@ -233,6 +234,7 @@ class TcpIpAsyncConnector :
}
private:
+ boost::asio::io_service& service_;
boost::asio::ip::tcp::socket* pSocket_;
boost::asio::ip::tcp::resolver resolver_;
ConnectedHandler connectedHandler_;
diff --git a/src/cpp/ext/websocketpp/transport/asio/connection.hpp b/src/cpp/ext/websocketpp/transport/asio/connection.hpp
index 395632c3f3..ef35d295ac 100644
--- a/src/cpp/ext/websocketpp/transport/asio/connection.hpp
+++ b/src/cpp/ext/websocketpp/transport/asio/connection.hpp
@@ -296,7 +296,7 @@ class connection : public config::socket_type::socket_con_type {
*/
timer_ptr set_timer(long duration, timer_handler callback) {
timer_ptr new_timer = lib::make_shared<boost::asio::deadline_timer>(
- lib::ref(*m_io_service),
+ *m_io_service,
boost::posix_time::milliseconds(duration)
);
diff --git a/src/cpp/ext/websocketpp/transport/asio/endpoint.hpp b/src/cpp/ext/websocketpp/transport/asio/endpoint.hpp
index ef3b07db46..b418060a85 100644
--- a/src/cpp/ext/websocketpp/transport/asio/endpoint.hpp
+++ b/src/cpp/ext/websocketpp/transport/asio/endpoint.hpp
@@ -183,8 +183,7 @@ class endpoint : public config::socket_type {
m_io_service = ptr;
m_external_io_service = true;
- m_acceptor = lib::make_shared<boost::asio::ip::tcp::acceptor>(
- lib::ref(*m_io_service));
+ m_acceptor = lib::make_shared<boost::asio::ip::tcp::acceptor>(*m_io_service);
m_state = READY;
ec = lib::error_code();
@@ -609,9 +608,7 @@ class endpoint : public config::socket_type {
* @since 0.3.0
*/
void start_perpetual() {
- m_work = lib::make_shared<boost::asio::io_service::work>(
- lib::ref(*m_io_service)
- );
+ m_work = lib::make_shared<boost::asio::io_service::work>(*m_io_service);
}
/// Clears the endpoint's perpetual flag, allowing it to exit when empty
@@ -775,8 +772,7 @@ class endpoint : public config::socket_type {
// Create a resolver
if (!m_resolver) {
- m_resolver = lib::make_shared<boost::asio::ip::tcp::resolver>(
- lib::ref(*m_io_service));
+ m_resolver = lib::make_shared<boost::asio::ip::tcp::resolver>(*m_io_service);
}
std::string proxy = tcon->get_proxy();
diff --git a/src/cpp/ext/websocketpp/transport/asio/security/none.hpp b/src/cpp/ext/websocketpp/transport/asio/security/none.hpp
index 14b6f8b5f7..5876c981ce 100644
--- a/src/cpp/ext/websocketpp/transport/asio/security/none.hpp
+++ b/src/cpp/ext/websocketpp/transport/asio/security/none.hpp
@@ -166,8 +166,7 @@ class connection : public lib::enable_shared_from_this<connection> {
return socket::make_error_code(socket::error::invalid_state);
}
- m_socket = lib::make_shared<boost::asio::ip::tcp::socket>(
- lib::ref(*service));
+ m_socket = lib::make_shared<boost::asio::ip::tcp::socket>(*service);
m_state = READY;

View File

@ -5,15 +5,22 @@
name=rstudio
version=1.2.5042
release=2
# $SRC/$name-$version/dependencies/common/install-gwt
_gwtver=2.8.1
_ginver=2.1.2
release=1
source=(
https://github.com/rstudio/rstudio/archive/v$version/$name-$version.tar.gz
https://s3.amazonaws.com/rstudio-buildtools/gin-$_ginver.zip
https://s3.amazonaws.com/rstudio-buildtools/gwt-$_gwtver.zip
https://s3.amazonaws.com/rstudio-dictionaries/core-dictionaries.zip
217ce0962734ae85621fd82f0eed86129c991a79.patch)
# https://gitweb.gentoo.org/repo/gentoo.git/tree/sci-mathematics/rstudio/files
rstudio-1.2.1335-boost-1.70.0_p1.patch rstudio-1.2.1335-boost-1.70.0_p2.patch
rstudio-1.2.5042-boost-1.73.0.patch
# https://github.com/rstudio/rstudio/commit/60dd6e3cd349cc208e33a12635378a1e338f8efc.patch
r-nosave.patch)
git=(https://github.com/rstudio/rstudio.git)
unpack_source() {
@ -43,11 +50,18 @@ unpack_source() {
}
build() {
cd $name-$version
#if you want your git snapshot to be a particular version
#git checkout v$version
patch -Np1 -i $SRC/217ce0962734ae85621fd82f0eed86129c991a79.patch
pushd dependencies/common
## if you want your git snapshot to be a particular version
## uncomment below and change every occurance of $name-$version to $name
#git checkout v$version $name
patch -Np1 -d $name-$version -i $SRC/rstudio-1.2.1335-boost-1.70.0_p1.patch
patch -Np1 -d $name-$version -i $SRC/rstudio-1.2.1335-boost-1.70.0_p2.patch
patch -Np1 -d $name-$version -i $SRC/rstudio-1.2.5042-boost-1.73.0.patch
sed -i 's/2009-12/2009-19/g' $name-$version/src/cpp/r/session/REmbeddedPosix.cpp
patch -Np1 -d $name-$version -i $SRC/r-nosave.patch
pushd $name-$version/dependencies/common
install -d pandoc
ln -sfT /usr/share/myspell/dicts dictionaries
ln -sfT /usr/share/mathjax mathjax-26
@ -56,21 +70,22 @@ build() {
bash install-packages
popd
mkdir build
pushd build
export PATH="/usr/lib/java/openjdk8/jre/bin/:${PATH}"
cmake -DRSTUDIO_TARGET=Desktop \
-DCMAKE_BUILD_TYPE=Release \
cmake -S$name-$version -Bbuild -GNinja\
-DCMAKE_INSTALL_PREFIX=/usr/lib/rstudio \
-DRSTUDIO_USE_SYSTEM_BOOST=yes \
-DRSTUDIO_TARGET=Desktop \
-DCMAKE_BUILD_TYPE=Release \
-DRSTUDIO_USE_SYSTEM_BOOST=ON \
-DQT_QMAKE_EXECUTABLE=/usr/lib/qt5/bin/qmake \
-DBoost_NO_BOOST_CMAKE=ON \
-DRSTUDIO_BUNDLE_QT=FALSE \
-DQT_QMAKE_EXECUTABLE=/usr/lib/qt5/bin/qmake \
..
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --build build --target install
make DESTDIR=$PKG install
install -dm755 $PKG/usr/bin/
ln -s /usr/lib/$name/bin/$name $PKG/usr/bin/$nam
ln -s /usr/lib/$name/bin/$name $PKG/usr/bin/$name
sed -i 's|/usr/lib/rstudio/bin/rstudio|/usr/bin/rstudio|g' $PKG/usr/share/applications/rstudio.desktop
find $PKG \(\
-iname '*README*' -o \

106
rstudio/r-nosave.patch Normal file
View File

@ -0,0 +1,106 @@
From 71b1a935762efd24a79de193662450de5a89f67e Mon Sep 17 00:00:00 2001
From: Jonathan McPherson <jonathan@rstudio.com>
Date: Tue, 14 Jan 2020 12:53:20 -0800
Subject: [PATCH] use R_NoSave over R_Slave for R 4.0+
---
src/cpp/r/CMakeLists.txt | 12 ++++++++++++
src/cpp/r/config.h.in | 8 +++++++-
src/cpp/r/session/REmbeddedPosix.cpp | 20 ++++++++++++++------
3 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/src/cpp/r/CMakeLists.txt b/src/cpp/r/CMakeLists.txt
index 6984ae309c..29784b8b67 100644
--- a/src/cpp/r/CMakeLists.txt
+++ b/src/cpp/r/CMakeLists.txt
@@ -15,6 +15,18 @@
project (R)
+# find the version of R in play
+find_package(LibR REQUIRED)
+execute_process(
+ COMMAND "${LIBR_EXECUTABLE}" "--vanilla" "--slave" "-e" "cat(as.character(getRversion()))"
+ OUTPUT_VARIABLE LIBR_VERSION)
+
+# parse and save the R version to a variable
+string(REPLACE "." ";" R_VERSION_LIST "${LIBR_VERSION}")
+list(GET R_VERSION_LIST 0 R_VERSION_MAJOR)
+list(GET R_VERSION_LIST 1 R_VERSION_MINOR)
+list(GET R_VERSION_LIST 2 R_VERSION_PATCH)
+
# include files
file(GLOB_RECURSE R_HEADER_FILES "*.h*")
diff --git a/src/cpp/r/config.h.in b/src/cpp/r/config.h.in
index 6ba67c8e09..00bc8b6191 100644
--- a/src/cpp/r/config.h.in
+++ b/src/cpp/r/config.h.in
@@ -1,7 +1,7 @@
/*
* config.h.in
*
- * Copyright (C) 2009-12 by RStudio, Inc.
+ * Copyright (C) 2009-20 by RStudio, Inc.
*
* Unless you have received this program directly from RStudio pursuant
* to the terms of a commercial license agreement with RStudio, then
@@ -16,4 +16,10 @@
#cmakedefine PANGO_CAIRO_FOUND
+// Important: These variables represent the version of R found during
+// compile/link time, NOT the version of R present at runtime.
+#define R_VERSION_MAJOR ${R_VERSION_MAJOR}
+#define R_VERSION_MINOR ${R_VERSION_MINOR}
+#define R_VERSION_PATCH ${R_VERSION_PATCH}
+
diff --git a/src/cpp/r/session/REmbeddedPosix.cpp b/src/cpp/r/session/REmbeddedPosix.cpp
index ac71b94522..73e2e2ce7f 100644
--- a/src/cpp/r/session/REmbeddedPosix.cpp
+++ b/src/cpp/r/session/REmbeddedPosix.cpp
@@ -1,7 +1,7 @@
/*
* REmbeddedPosix.cpp
*
- * Copyright (C) 2009-19 by RStudio, Inc.
+ * Copyright (C) 2009-20 by RStudio, Inc.
*
* Unless you have received this program directly from RStudio pursuant
* to the terms of a commercial license agreement with RStudio, then
@@ -38,6 +38,8 @@ extern "C" void (*ptr_R_ProcessEvents)(void);
extern "C" typedef void (*ptr_QuartzCocoa_SetupEventLoop)(int, unsigned long);
#endif
+#include "config.h"
+
extern int R_running_as_main_program; // from unix/system.c
using namespace rstudio::core;
@@ -103,14 +105,20 @@ void runEmbeddedR(const core::FilePath& /*rHome*/, // ignored on posix
//
structRstart rp;
Rstart Rp = &rp;
- R_DefParams(Rp) ;
- Rp->R_Slave = FALSE ;
+ R_DefParams(Rp);
+#if R_VERSION_MAJOR > 3
+ // R 4.0 and above use --no-echo to suppress output
+ Rp->R_NoEcho = FALSE;
+#else
+ // R 3.x and below use --slave
+ Rp->R_Slave = FALSE;
+#endif
Rp->R_Quiet = quiet ? TRUE : FALSE;
- Rp->R_Interactive = TRUE ;
- Rp->SaveAction = defaultSaveAction ;
+ Rp->R_Interactive = TRUE;
+ Rp->SaveAction = defaultSaveAction;
Rp->RestoreAction = SA_NORESTORE; // handled within initialize()
Rp->LoadInitFile = loadInitFile ? TRUE : FALSE;
- R_SetParams(Rp) ;
+ R_SetParams(Rp);
// redirect console
R_Interactive = TRUE; // should have also been set by call to Rf_initialize_R

View File

@ -0,0 +1,46 @@
--- rstudio-1.2.1335-orig/src/cpp/ext/websocketpp/transport/asio/connection.hpp 2019-03-28 16:08:20.000000000 +1100
+++ rstudio-1.2.1335/src/cpp/ext/websocketpp/transport/asio/connection.hpp 2019-08-20 22:38:53.808923305 +1000
@@ -296,7 +296,11 @@
*/
timer_ptr set_timer(long duration, timer_handler callback) {
timer_ptr new_timer = lib::make_shared<boost::asio::deadline_timer>(
+#if defined(BOOST_VERSION) && BOOST_VERSION >= 107000
+ *m_io_service,
+#else
lib::ref(*m_io_service),
+#endif
boost::posix_time::milliseconds(duration)
);
--- rstudio-1.2.1335-orig/src/cpp/ext/websocketpp/transport/asio/endpoint.hpp 2019-03-28 16:08:20.000000000 +1100
+++ rstudio-1.2.1335/src/cpp/ext/websocketpp/transport/asio/endpoint.hpp 2019-08-20 22:38:53.822923358 +1000
@@ -184,7 +184,12 @@
m_io_service = ptr;
m_external_io_service = true;
m_acceptor = lib::make_shared<boost::asio::ip::tcp::acceptor>(
- lib::ref(*m_io_service));
+#if defined(BOOST_VERSION) && BOOST_VERSION >= 107000
+ *m_io_service
+#else
+ lib::ref(*m_io_service)
+#endif
+ );
m_state = READY;
ec = lib::error_code();
--- rstudio-1.2.1335-orig/src/cpp/ext/websocketpp/transport/asio/security/none.hpp 2019-03-28 16:08:20.000000000 +1100
+++ rstudio-1.2.1335/src/cpp/ext/websocketpp/transport/asio/security/none.hpp 2019-08-20 22:38:53.823923362 +1000
@@ -167,7 +167,12 @@
}
m_socket = lib::make_shared<boost::asio::ip::tcp::socket>(
- lib::ref(*service));
+#if defined(BOOST_VERSION) && BOOST_VERSION >= 107000
+ *service
+#else
+ lib::ref(*service)
+#endif
+ );
m_state = READY;

View File

@ -0,0 +1,17 @@
--- rstudio-1.2.1335-orig/src/cpp/core/include/core/http/TcpIpAsyncConnector.hpp 2019-03-28 16:08:20.000000000 +1100
+++ rstudio-1.2.1335/src/cpp/core/include/core/http/TcpIpAsyncConnector.hpp 2019-04-09 22:08:45.331273559 +1000
@@ -77,7 +77,13 @@
{
// start a timer that will cancel any outstanding asynchronous operations
// when it elapses if the connection operation has not succeeded
- pConnectionTimer_.reset(new boost::asio::deadline_timer(resolver_.get_io_service(), timeout));
+ pConnectionTimer_.reset(new boost::asio::deadline_timer(
+#if BOOST_VERSION >= 107000
+ resolver_.get_executor(),
+#else
+ resolver_.get_io_service(),
+#endif
+ timeout));
pConnectionTimer_->async_wait(boost::bind(&TcpIpAsyncConnector::onConnectionTimeout,
TcpIpAsyncConnector::shared_from_this(),
boost::asio::placeholders::error));

View File

@ -0,0 +1,31 @@
From a11d0454e5fe9c50005a03b9d9de84355df5c7fd Mon Sep 17 00:00:00 2001
From: Kevin Ushey <kevinushey@gmail.com>
Date: Fri, 15 Nov 2019 14:54:02 -0800
Subject: [PATCH] avoid use of deprecated APIs
---
src/cpp/core/FilePath.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/cpp/shared_core/FilePath.cpp b/src/cpp/shared_core/FilePath.cpp
index 088366a9d6..495289e7fc 100644
--- a/src/cpp/core/FilePath.cpp
+++ b/src/cpp/core/FilePath.cpp
@@ -22,8 +22,6 @@
#include <windows.h>
#endif
-#define BOOST_FILESYSTEM_NO_DEPRECATED
-
#define BOOST_NO_CXX11_SCOPED_ENUMS
#include <boost/filesystem.hpp>
#undef BOOST_NO_CXX11_SCOPED_ENUMS
@@ -1032,7 +1030,7 @@
{
// NOTE: The path gets round-tripped through toString/fromString, would
// be nice to have a direct constructor
- if (!iterationFunction(itr.level(),
+ if (!iterationFunction(itr.depth(),
FilePath(BOOST_FS_PATH2STR(itr->path()))))
{
// end the iteration if requested

View File

@ -0,0 +1,22 @@
--- rstudio-1.2.5042-orig/src/cpp/core/system/PosixChildProcessTracker.cpp 2020-04-02 03:16:24.000000000 +1100
+++ rstudio-1.2.5042/src/cpp/core/system/PosixChildProcessTracker.cpp 2020-04-28 15:36:44.839368084 +1000
@@ -19,6 +19,8 @@
#include <boost/format.hpp>
+using namespace boost::placeholders;
+
namespace rstudio {
namespace core {
namespace system {
--- rstudio-1.2.5042-orig/src/cpp/core/system/PosixOutputCapture.cpp 2020-04-02 03:16:24.000000000 +1100
+++ rstudio-1.2.5042/src/cpp/core/system/PosixOutputCapture.cpp 2020-04-28 15:35:50.869185435 +1000
@@ -28,6 +28,8 @@
#include <core/system/System.hpp>
+using namespace boost::placeholders;
+
namespace rstudio {
namespace core {
namespace system {