sci-mathematics/rstudio: Bump to 1.3.959
authorMark Wright <gienah@gentoo.org>
Mon, 25 May 2020 11:58:49 +0000 (21:58 +1000)
committerMark Wright <gienah@gentoo.org>
Mon, 25 May 2020 11:59:45 +0000 (21:59 +1000)
Package-Manager: Portage-2.3.100, Repoman-2.3.22
Signed-off-by: Mark Wright <gienah@gentoo.org>
sci-mathematics/rstudio/Manifest
sci-mathematics/rstudio/files/rstudio-1.3.959-R-4.0.0.patch [new file with mode: 0644]
sci-mathematics/rstudio/files/rstudio-1.3.959-core.patch [new file with mode: 0644]
sci-mathematics/rstudio/files/rstudio-1.3.959-pandoc-mathjax.patch [new file with mode: 0644]
sci-mathematics/rstudio/files/rstudio-1.3.959-paths.patch [new file with mode: 0644]
sci-mathematics/rstudio/files/rstudio-1.3.959-prefs.patch [new file with mode: 0644]
sci-mathematics/rstudio/files/rstudio-1.3.959-qtsingleapplication.patch [new file with mode: 0644]
sci-mathematics/rstudio/rstudio-1.3.959.ebuild [new file with mode: 0644]

index 6821cacc59bc7b26051d4ce4f74808df4b76f871..063f628025517718f1d3232a062185840987f74d 100644 (file)
@@ -1,3 +1,4 @@
 DIST core-dictionaries.zip 876339 BLAKE2B f29afcbf5a7f8ec635e5a5b248d978af286d18488f54c9a09a2b95fde19b796e4473e5846402a46dd24b71c6e4167512539aaa32ab6d99713d500a80aaf46796 SHA512 9c5830cc9fed575e223f1c61f02e48c5aea6801bb0cd2586f02437c17fdffdb1d36c396d5a8ecbe02ba01196e73458304345b1f6b92c052bc7a7d05961fac2c9
 DIST rstudio-1.2.5033.tar.gz 20456976 BLAKE2B 3cbca6a5180690104dddf1456168bd38708d4152ed9b7a167035dd66e270aeb6405169d34461cbd899738be1872607e3f3b6f81ff0b3c9e6a9ed965a889b1393 SHA512 3569d4fed342275a9905c87e4f97be63b6391d2c37f75397e06201a7c31f80d94799214f51ff8e57d458ef18d5e54afe1ec8a7c56ac05ed8b8225ecca72d1daf
 DIST rstudio-1.2.5042.tar.gz 20456999 BLAKE2B 3251ab2511daefefa395256fedb273ecc36dbc8118457474e3647f7616baea91301e597896582ad4b191195fc7baf17645c4c25b9a957a0c17a6251151b1dd87 SHA512 e09f2360abecde0c16e240e6838efb270a355bec3d3982ffde2b01b32b21e9281fef465734edbfeb5e05375529cc7f06d5b5d41304f367982f53ae7ad98e20f9
+DIST rstudio-1.3.959.tar.gz 89639419 BLAKE2B d45b2c1b0e426ddb5a945e59a8127ddfd47f6230ef0929639c4b525382ae57437a273df6ade85cfbf3a29911cf0158ee2e0808bfa94e783d70d4615f6c228f31 SHA512 e5d8bfe16011790ff4723c731043f44070d8fe48f85c5a9ab8389c9a2b7a1d3813e9362063ec4c6a6ca3b0a0857e2190481cbb74191650a129c0d2e10b342fac
diff --git a/sci-mathematics/rstudio/files/rstudio-1.3.959-R-4.0.0.patch b/sci-mathematics/rstudio/files/rstudio-1.3.959-R-4.0.0.patch
new file mode 100644 (file)
index 0000000..dc35d0c
--- /dev/null
@@ -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, PBC
++ * 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, PBC
++ * 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
diff --git a/sci-mathematics/rstudio/files/rstudio-1.3.959-core.patch b/sci-mathematics/rstudio/files/rstudio-1.3.959-core.patch
new file mode 100644 (file)
index 0000000..0f6af4e
--- /dev/null
@@ -0,0 +1,184 @@
+--- rstudio-1.3.959-orig/src/cpp/session/SessionClientInit.cpp 2020-05-19 04:11:10.000000000 +1000
++++ rstudio-1.3.959/src/cpp/session/SessionClientInit.cpp      2020-05-24 17:21:56.960469575 +1000
+@@ -91,13 +91,13 @@
+       boost::shared_ptr<http::Cookie>* pCookie)
+ {
+    // extract the base URL
+-   json::JsonRpcRequest request;
++   core::json::JsonRpcRequest request;
+    Error error = parseJsonRpcRequest(ptrConnection->request().body(), &request);
+    if (error)
+       return error;
+    std::string baseURL;
+-   error = json::readParams(request.params, &baseURL);
++   error = core::json::readParams(request.params, &baseURL);
+    if (error)
+       return error;
+@@ -143,7 +143,7 @@
+    if (options.programMode() == kSessionProgramModeServer && 
+        !core::http::validateCSRFHeaders(ptrConnection->request()))
+    {
+-      ptrConnection->sendJsonRpcError(Error(json::errc::Unauthorized, ERROR_LOCATION));
++      ptrConnection->sendJsonRpcError(Error(core::json::errc::Unauthorized, ERROR_LOCATION));
+       return;
+    }
+@@ -173,12 +173,12 @@
+    }
+    // prepare session info 
+-   json::Object sessionInfo ;
++   core::json::Object sessionInfo ;
+    sessionInfo["clientId"] = clientId;
+    sessionInfo["mode"] = options.programMode();
+    // build initialization options for client
+-   json::Object initOptions;
++   core::json::Object initOptions;
+    initOptions["restore_workspace"] = options.rRestoreWorkspace();
+    initOptions["run_rprofile"] = options.rRunRprofile();
+    sessionInfo["init_options"] = initOptions;
+@@ -194,8 +194,8 @@
+    }
+    // temp dir
+-   FilePath tempDir = rstudio::r::session::utils::tempDir();
+-   Error error = tempDir.ensureDirectory();
++   core::FilePath tempDir = rstudio::r::session::utils::tempDir();
++   core::Error error = tempDir.ensureDirectory();
+    if (error)
+       LOG_ERROR(error);
+    sessionInfo["temp_dir"] = tempDir.getAbsolutePath();
+@@ -213,12 +213,12 @@
+    sessionInfo["prompt"] = rstudio::r::options::getOption<std::string>("prompt");
+    // client state
+-   json::Object clientStateObject;
++   core::json::Object clientStateObject;
+    rstudio::r::session::clientState().currentState(&clientStateObject);
+    sessionInfo["client_state"] = clientStateObject;
+    
+    // source documents
+-   json::Array jsonDocs;
++   core::json::Array jsonDocs;
+    error = modules::source::clientInitDocuments(&jsonDocs);
+    if (error)
+       LOG_ERROR(error);
+@@ -243,7 +243,7 @@
+    if (resumed)
+    {
+       // console actions
+-      json::Object actionsObject;
++     core::json::Object actionsObject;
+       consoleActions.asJson(&actionsObject);
+       sessionInfo["console_actions"] = actionsObject;
+    }
+@@ -310,12 +310,12 @@
+    }
+    else
+    {
+-      sessionInfo["active_project_file"] = json::Value();
+-      sessionInfo["project_ui_prefs"] = json::Value();
+-      sessionInfo["project_open_docs"] = json::Value();
++      sessionInfo["active_project_file"] = core::json::Value();
++      sessionInfo["project_ui_prefs"] = core::json::Value();
++      sessionInfo["project_open_docs"] = core::json::Value();
+       sessionInfo["project_supports_sharing"] = false;
+       sessionInfo["project_owned_by_user"] = false;
+-      sessionInfo["project_user_data_directory"] = json::Value();
++      sessionInfo["project_user_data_directory"] = core::json::Value();
+    }
+    sessionInfo["system_encoding"] = std::string(::locale2charset(nullptr));
+@@ -352,20 +352,20 @@
+       sessionInfo["build_tools_bookdown_website"] =
+                               module_context::isBookdownWebsite();
+-      FilePath buildTargetDir = projects::projectContext().buildTargetPath();
++      core::FilePath buildTargetDir = projects::projectContext().buildTargetPath();
+       if (!buildTargetDir.isEmpty())
+       {
+          sessionInfo["build_target_dir"] = module_context::createAliasedPath(
+                                                                 buildTargetDir);
+-         sessionInfo["has_pkg_src"] = (type == r_util::kBuildTypePackage) &&
++         sessionInfo["has_pkg_src"] = (type == core::r_util::kBuildTypePackage) &&
+             buildTargetDir.completeChildPath("src").exists();
+          sessionInfo["has_pkg_vig"] =
+-               (type == r_util::kBuildTypePackage) &&
++               (type == core::r_util::kBuildTypePackage) &&
+                   buildTargetDir.completeChildPath("vignettes").exists();
+       }
+       else
+       {
+-         sessionInfo["build_target_dir"] = json::Value();
++         sessionInfo["build_target_dir"] = core::json::Value();
+          sessionInfo["has_pkg_src"] = false;
+          sessionInfo["has_pkg_vig"] = false;
+       }
+@@ -373,9 +373,9 @@
+    }
+    else
+    {
+-      sessionInfo["build_tools_type"] = r_util::kBuildTypeNone;
++      sessionInfo["build_tools_type"] = core::r_util::kBuildTypeNone;
+       sessionInfo["build_tools_bookdown_website"] = false;
+-      sessionInfo["build_target_dir"] = json::Value();
++      sessionInfo["build_target_dir"] = core::json::Value();
+       sessionInfo["has_pkg_src"] = false;
+       sessionInfo["has_pkg_vig"] = false;
+    }
+@@ -384,7 +384,7 @@
+    sessionInfo["presentation_commands"] = options.allowPresentationCommands();
+    sessionInfo["tutorial_api_available"] = false;
+-   sessionInfo["tutorial_api_client_origin"] = json::Value();
++   sessionInfo["tutorial_api_client_origin"] = core::json::Value();
+    sessionInfo["build_state"] = modules::build::buildStateAsJson();
+    sessionInfo["devtools_installed"] = module_context::isMinimumDevtoolsInstalled();
+@@ -395,7 +395,7 @@
+    // console history -- we do this at the end because
+    // restoreBuildRestartContext may have reset it
+-   json::Array historyArray;
++   core::json::Array historyArray;
+    rstudio::r::session::consoleHistory().asJson(&historyArray);
+    sessionInfo["console_history"] = historyArray;
+    sessionInfo["console_history_capacity"] =
+@@ -470,14 +470,14 @@
+    sessionInfo["multi_session"] = options.multiSession();
+-   json::Object rVersionsJson;
++   core::json::Object rVersionsJson;
+    rVersionsJson["r_version"] = module_context::rVersion();
+    rVersionsJson["r_version_label"] = module_context::rVersionLabel();
+    rVersionsJson["r_home_dir"] = module_context::rHomeDir();
+    sessionInfo["r_versions_info"] = rVersionsJson;
+    sessionInfo["show_user_home_page"] = options.showUserHomePage();
+-   sessionInfo["user_home_page_url"] = json::Value();
++   sessionInfo["user_home_page_url"] = core::json::Value();
+    
+    sessionInfo["r_addins"] = modules::r_addins::addinRegistryAsJson();
+    sessionInfo["package_provided_extensions"] = modules::ppe::indexer().getPayload();
+@@ -501,7 +501,7 @@
+    sessionInfo["launcher_jobs_enabled"] = modules::overlay::launcherJobsFeatureDisplayed();
+-   json::Object packageDependencies;
++   core::json::Object packageDependencies;
+    error = modules::dependency_list::getDependencyList(&packageDependencies);
+    if (error)
+       LOG_ERROR(error);
+@@ -529,7 +529,7 @@
+    // create response  (we always set kEventsPending to false so that the client
+    // won't poll for events until it is ready)
+-   json::JsonRpcResponse jsonRpcResponse;
++   core::json::JsonRpcResponse jsonRpcResponse;
+    jsonRpcResponse.setField(kEventsPending, "false");
+    jsonRpcResponse.setResult(sessionInfo);
diff --git a/sci-mathematics/rstudio/files/rstudio-1.3.959-pandoc-mathjax.patch b/sci-mathematics/rstudio/files/rstudio-1.3.959-pandoc-mathjax.patch
new file mode 100644 (file)
index 0000000..d8718dd
--- /dev/null
@@ -0,0 +1,42 @@
+--- rstudio-1.3.959-orig/src/cpp/session/CMakeLists.txt        2020-05-19 04:11:10.000000000 +1000
++++ rstudio-1.3.959/src/cpp/session/CMakeLists.txt     2020-05-24 18:54:40.444955162 +1000
+@@ -22,12 +22,6 @@
+ if(NOT EXISTS "${RSTUDIO_DEPENDENCIES_DIR}/common/dictionaries")
+   message(FATAL_ERROR "Dictionaries not found (re-run install-dependencies script to install)")
+ endif()
+-if(NOT EXISTS "${RSTUDIO_DEPENDENCIES_DIR}/common/mathjax-27")
+-  message(FATAL_ERROR "Mathjax 2.7 not found (re-run install-dependencies script to install)")
+-endif()
+-if(NOT EXISTS "${RSTUDIO_DEPENDENCIES_DIR}/common/pandoc")
+-  message(FATAL_ERROR "pandoc not found (re-run install-dependencies script to install)")
+-endif()
+ # verify embedded packages are available
+ foreach(PKG ${RSTUDIO_EMBEDDED_PACKAGES})
+@@ -500,10 +494,6 @@
+    install(DIRECTORY "${RSTUDIO_DEPENDENCIES_DIR}/common/dictionaries"
+            DESTINATION "${RSTUDIO_INSTALL_SUPPORTING}/resources")
+-   # install mathjax for local html preview
+-   install(DIRECTORY "${RSTUDIO_DEPENDENCIES_DIR}/common/mathjax-27"
+-           DESTINATION "${RSTUDIO_INSTALL_SUPPORTING}/resources")
+-
+    # icons for database connections
+    install(DIRECTORY "resources/connections"
+            DESTINATION ${RSTUDIO_INSTALL_SUPPORTING}/resources)
+@@ -516,15 +506,6 @@
+    install(DIRECTORY "resources/dependencies"
+            DESTINATION ${RSTUDIO_INSTALL_SUPPORTING}/resources)
+-   # install pandoc
+-   set(PANDOC_VERSION "2.7.3" CACHE INTERNAL "Pandoc version")
+-
+-   set(PANDOC_BIN "${RSTUDIO_DEPENDENCIES_DIR}/common/pandoc/${PANDOC_VERSION}")
+-   file(GLOB PANDOC_FILES "${PANDOC_BIN}/pandoc*")
+-   install(FILES ${PANDOC_FILES}
+-           PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+-           DESTINATION  ${RSTUDIO_INSTALL_BIN}/pandoc)
+-
+    # install embedded packages
+    foreach(PKG ${RSTUDIO_EMBEDDED_PACKAGES})
+       file(GLOB PKG_FILES "${RSTUDIO_DEPENDENCIES_DIR}/common/${PKG}*.tar.gz")
diff --git a/sci-mathematics/rstudio/files/rstudio-1.3.959-paths.patch b/sci-mathematics/rstudio/files/rstudio-1.3.959-paths.patch
new file mode 100644 (file)
index 0000000..175d52f
--- /dev/null
@@ -0,0 +1,118 @@
+--- rstudio-1.3.959-orig/CMakeGlobals.txt      2020-05-19 04:11:10.000000000 +1000
++++ rstudio-1.3.959/CMakeGlobals.txt   2020-05-25 19:30:10.711859714 +1000
+@@ -181,7 +181,7 @@
+    else()
+      set(RSTUDIO_INSTALL_BIN bin)
+    endif()
+-   set(RSTUDIO_INSTALL_SUPPORTING .)
++   set(RSTUDIO_INSTALL_SUPPORTING ${DISTRO_SHARE})
+ endif()
+ # if the install prefix is /usr/local then tweak as appropriate
+--- rstudio-1.3.959-orig/src/cpp/server/CMakeLists.txt 2020-05-19 04:11:10.000000000 +1000
++++ rstudio-1.3.959/src/cpp/server/CMakeLists.txt      2020-05-25 19:30:10.711859714 +1000
+@@ -190,7 +190,7 @@
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_INITD_DEBIAN_SCRIPT}.in
+                   ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_DEBIAN_SCRIPT})
+    install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_DEBIAN_SCRIPT}
+-           DESTINATION ${RSERVER_INITD_DEBIAN_DIR})
++           DESTINATION ${DISTRO_SHARE}/${RSERVER_INITD_DEBIAN_DIR})
+    # install configured redhat init.d script
+    set(RSERVER_INITD_REDHAT_DIR "extras/init.d/redhat")
+@@ -198,7 +198,7 @@
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_INITD_REDHAT_SCRIPT}.in
+                   ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_REDHAT_SCRIPT})
+    install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_REDHAT_SCRIPT}
+-           DESTINATION ${RSERVER_INITD_REDHAT_DIR})
++           DESTINATION ${DISTRO_SHARE}/${RSERVER_INITD_REDHAT_DIR})
+    # install configured suse init.d script
+    set(RSERVER_INITD_SUSE_DIR "extras/init.d/suse")
+@@ -206,13 +206,13 @@
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_INITD_SUSE_SCRIPT}.in
+                   ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_SUSE_SCRIPT})
+    install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_SUSE_SCRIPT}
+-           DESTINATION ${RSERVER_INITD_SUSE_DIR})
++           DESTINATION ${DISTRO_SHARE}/${RSERVER_INITD_SUSE_DIR})
+    # install pam profile
+    set(RSERVER_PAM_DIR "extras/pam")
+    set(RSERVER_PAM_PROFILE "${RSERVER_PAM_DIR}/rstudio")
+    install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_PAM_PROFILE}
+-           DESTINATION ${RSERVER_PAM_DIR})
++           DESTINATION ${DISTRO_SHARE}/${RSERVER_PAM_DIR})
+    # install configured upstart profile
+    set(RSERVER_UPSTART_DIR "extras/upstart")
+@@ -220,12 +220,12 @@
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_UPSTART_PROFILE}.in
+                   ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_UPSTART_PROFILE})
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_UPSTART_PROFILE}
+-           DESTINATION ${RSERVER_UPSTART_DIR})
++           DESTINATION ${DISTRO_SHARE}/${RSERVER_UPSTART_DIR})
+    set(RSERVER_UPSTART_PROFILE_REDHAT "${RSERVER_UPSTART_DIR}/rstudio-server.redhat.conf")
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_UPSTART_PROFILE_REDHAT}.in
+                   ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_UPSTART_PROFILE_REDHAT})
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_UPSTART_PROFILE_REDHAT}
+-           DESTINATION ${RSERVER_UPSTART_DIR})
++           DESTINATION ${DISTRO_SHARE}/${RSERVER_UPSTART_DIR})
+     # install configured systemd profile
+    set(RSERVER_SYSTEMD_DIR "extras/systemd")
+--- rstudio-1.3.959-orig/src/cpp/server/ServerOptions.cpp      2020-05-19 04:11:10.000000000 +1000
++++ rstudio-1.3.959/src/cpp/server/ServerOptions.cpp   2020-05-25 19:34:19.377675880 +1000
+@@ -442,8 +442,8 @@
+    // convert relative paths by completing from the system installation
+    // path (this allows us to be relocatable)
+-   resolvePath(resourcePath, &wwwLocalPath_);
+-   resolvePath(resourcePath, &wwwSymbolMapsPath_);
++   resolvePath(resourcePath.completeChildPath(DISTRO_SHARE), &wwwLocalPath_);
++   resolvePath(resourcePath.completeChildPath(DISTRO_SHARE), &wwwSymbolMapsPath_);
+    resolvePath(binaryPath, &authPamHelperPath_);
+    resolvePath(binaryPath, &rsessionPath_);
+    resolvePath(binaryPath, &rldpathPath_);
+--- rstudio-1.3.959-orig/src/cpp/session/SessionOptions.cpp    2020-05-19 04:11:10.000000000 +1000
++++ rstudio-1.3.959/src/cpp/session/SessionOptions.cpp 2020-05-25 19:33:58.318606745 +1000
+@@ -52,7 +52,7 @@
+ namespace session {  
+ namespace {
+-const char* const kDefaultPandocPath = "bin/pandoc";
++const char* const kDefaultPandocPath = "bin";
+ const char* const kDefaultPostbackPath = "bin/postback/rpostback";
+ const char* const kDefaultRsclangPath = "bin/rsclang";
+@@ -586,14 +586,14 @@
+    }
+    
+    // convert relative paths by completing from the app resource path
+-   resolvePath(resourcePath_, &rResourcesPath_);
+-   resolvePath(resourcePath_, &agreementFilePath_);
+-   resolvePath(resourcePath_, &wwwLocalPath_);
+-   resolvePath(resourcePath_, &wwwSymbolMapsPath_);
+-   resolvePath(resourcePath_, &coreRSourcePath_);
+-   resolvePath(resourcePath_, &modulesRSourcePath_);
+-   resolvePath(resourcePath_, &sessionLibraryPath_);
+-   resolvePath(resourcePath_, &sessionPackageArchivesPath_);
++   resolvePath(resourcePath_.completeChildPath(DISTRO_SHARE), &rResourcesPath_);
++   resolvePath(resourcePath_.completeChildPath(DISTRO_SHARE), &agreementFilePath_);
++   resolvePath(resourcePath_.completeChildPath(DISTRO_SHARE), &wwwLocalPath_);
++   resolvePath(resourcePath_.completeChildPath(DISTRO_SHARE), &wwwSymbolMapsPath_);
++   resolvePath(resourcePath_.completeChildPath(DISTRO_SHARE), &coreRSourcePath_);
++   resolvePath(resourcePath_.completeChildPath(DISTRO_SHARE), &modulesRSourcePath_);
++   resolvePath(resourcePath_.completeChildPath(DISTRO_SHARE), &sessionLibraryPath_);
++   resolvePath(resourcePath_.completeChildPath(DISTRO_SHARE), &sessionPackageArchivesPath_);
+    resolvePostbackPath(resourcePath_, &rpostbackPath_);
+ #ifdef _WIN32
+    resolvePath(resourcePath_, &consoleIoPath_);
+@@ -626,7 +626,7 @@
+    }
+    winptyPath_ = pty.completePath(completion).getAbsolutePath();
+ #endif // _WIN32
+-   resolvePath(resourcePath_, &hunspellDictionariesPath_);
++   resolvePath(resourcePath_.completeChildPath(DISTRO_SHARE), &hunspellDictionariesPath_);
+    resolvePath(resourcePath_, &mathjaxPath_);
+    resolvePath(resourcePath_, &libclangHeadersPath_);
+    resolvePandocPath(resourcePath_, &pandocPath_);
diff --git a/sci-mathematics/rstudio/files/rstudio-1.3.959-prefs.patch b/sci-mathematics/rstudio/files/rstudio-1.3.959-prefs.patch
new file mode 100644 (file)
index 0000000..4f96139
--- /dev/null
@@ -0,0 +1,68 @@
+--- rstudio-1.3.959-orig/src/gwt/build.xml     2020-05-19 04:11:10.000000000 +1000
++++ rstudio-1.3.959/src/gwt/build.xml  2020-05-25 17:38:28.911881424 +1000
+@@ -28,19 +28,37 @@
+             classname="com.google.javascript.jscomp.ant.CompileTask"
+             classpath="${tools.dir}/compiler/compiler.jar"/>
++   <!-- Configure path to aopalliance -->
++   <property name="aopalliance.sdk" value="@GENTOO_PORTAGE_EPREFIX@/usr/share/aopalliance-1/lib"/>
++
++   <!-- Configure path to javax-inject -->
++   <property name="javax.inject" value="@GENTOO_PORTAGE_EPREFIX@/usr/share/javax-inject/lib"/>
++
++   <!-- Configure path to validation-api -->
++   <property name="validation.api" value="@GENTOO_PORTAGE_EPREFIX@/usr/share/validation-api-1.0/lib"/>
++   <property name="validation.api.sources" value="@GENTOO_PORTAGE_EPREFIX@/usr/share/validation-api-1.0/sources"/>
++
+    <!-- Configure path to GWT SDK -->
+    <property name="gwt.sdk" value="${lib.dir}/gwt/gwt-rstudio-1.3"/>
++   <!-- Configure path to Google Gin -->
++   <property name="gin.sdk" value="@GENTOO_PORTAGE_EPREFIX@/usr/share/gin-2.1/lib"/>
++
+    <property name="gwt.extra.args" value=""/>
+    <property name="gwt.main.module" value="org.rstudio.studio.RStudio"/>
+    <property name="ace.bin" value="${src.dir}/org/rstudio/studio/client/workbench/views/source/editors/text/ace"/>
++   <property environment="env"/>
+    <!-- configure code server -->
+    <property name="bind.address" value="127.0.0.1"/>
+    <path id="project.class.path">
+      <pathelement location="${build.dir}"/>
++      <fileset dir="${aopalliance.sdk}" includes="*.jar"/>
++      <fileset dir="${javax.inject}" includes="*.jar"/>
++      <fileset dir="${validation.api}" includes="*.jar"/>
++      <fileset dir="${validation.api.sources}" includes="*.zip"/>
+       <fileset dir="${gwt.sdk}" includes="*.jar"/>
+-      <fileset dir="${lib.dir}/gin/2.1.2" includes="*.jar"/>
++      <fileset dir="${gin.sdk}" includes="*.jar"/>
+    </path>
+    <path id="test.class.path">
+@@ -114,8 +132,10 @@
+             <pathelement location="${src.dir}"/>
+             <path refid="project.class.path"/>
+          </classpath>
++         <jvmarg value="-Duser.home=${env.T}"/>
+          <!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
+          <jvmarg value="-Xmx1536M"/>
++         <jvmarg value="-Djava.util.prefs.userRoot=${env.T}"/>
+          <arg value="-war"/>
+          <arg value="${www.dir}"/>
+          <arg value="-localWorkers"/>
+@@ -168,6 +188,7 @@
+             <pathelement location="${src.dir}"/>
+             <path refid="project.class.path"/>
+          </classpath>
++         <jvmarg value="-Duser.home=${env.T}"/>
+          <jvmarg value="-Xmx2048M"/>
+          <arg value="-style"/>
+          <arg value="PRETTY"/>
+@@ -212,6 +233,7 @@
+             <pathelement location="${test.dir}"/>
+             <pathelement location="${src.dir}"/>
+         </classpath>
++        <jvmarg value="-Duser.home=${env.T}"/>
+         <classpath refid="project.class.path"/>
+         <classpath refid="unittest.class.path"/>
+         <arg value="org.rstudio.studio.client.RStudioUnitTestSuite"/>
diff --git a/sci-mathematics/rstudio/files/rstudio-1.3.959-qtsingleapplication.patch b/sci-mathematics/rstudio/files/rstudio-1.3.959-qtsingleapplication.patch
new file mode 100644 (file)
index 0000000..3ced4f9
--- /dev/null
@@ -0,0 +1,60 @@
+--- rstudio-1.3.959-orig/src/cpp/desktop/CMakeLists.txt        2020-05-19 04:11:10.000000000 +1000
++++ rstudio-1.3.959/src/cpp/desktop/CMakeLists.txt     2020-05-24 17:15:47.039422975 +1000
+@@ -138,6 +138,13 @@
+ get_filename_component(QT_LIBRARY_PATH "${QT_BIN_DIR}/../lib"     ABSOLUTE CACHE)
+ get_filename_component(QT_INSTALL_PATH "${QT_BIN_DIR}/.."         ABSOLUTE CACHE)
++find_path(QTSINGLEAPPLIB_INCLUDE_DIR NAMES QtSingleApplication
++  PATH_SUFFIXES QtSolutions
++  PATHS
++  /usr/include/qt5)
++find_library(QTSINGLEAPPLIB Qt5Solutions_SingleApplication-2.6
++  libQt5Solutions_SingleApplication-2.6)
++
+ # disable clang warnings for qt sources
+ if(APPLE)
+    add_definitions(-Wno-unused-private-field
+@@ -156,7 +163,6 @@
+ set(MOC_DESKTOP_HEADER_FILES ${DESKTOP_HEADER_FILES})
+ list(REMOVE_ITEM MOC_DESKTOP_HEADER_FILES
+-  ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/qtsingleapplication/qtlockedfile.h
+   ${CMAKE_CURRENT_SOURCE_DIR}/DesktopDetectRHome.hpp
+   ${CMAKE_CURRENT_SOURCE_DIR}/DesktopOptions.hpp
+   ${CMAKE_CURRENT_SOURCE_DIR}/DesktopRVersion.hpp
+@@ -225,8 +231,6 @@
+   DesktopSynctex.cpp
+   DesktopJobLauncherOverlay.cpp
+   RemoteDesktopSessionLauncherOverlay.cpp
+-  3rdparty/qtsingleapplication/qtsingleapplication.cpp
+-  3rdparty/qtsingleapplication/qtlocalpeer.cpp
+ )
+ if(WIN32)
+@@ -283,6 +287,7 @@
+   ${OPENSSL_INCLUDE_DIR}
+   ${CMAKE_CURRENT_SOURCE_DIR}
+   ${CMAKE_CURRENT_BINARY_DIR}
++  ${QTSINGLEAPPLIB_INCLUDE_DIR}
+   ${EXT_SOURCE_DIR}
+   ${SESSION_SOURCE_DIR}/include
+   ${TESTS_INCLUDE_DIR}
+@@ -386,6 +391,7 @@
+    # set link dependencies
+    target_link_libraries(rstudio
+       ${RSTUDIO_QTMODULES}
++      ${QTSINGLEAPPLIB}
+       ${QT_LIBRARIES}
+       ${Boost_LIBRARIES}
+       rstudio-core
+--- rstudio-1.3.959-orig/src/cpp/desktop/DesktopPosixApplication.hpp   2020-05-19 04:11:10.000000000 +1000
++++ rstudio-1.3.959/src/cpp/desktop/DesktopPosixApplication.hpp        2020-05-24 17:13:22.050016953 +1000
+@@ -16,7 +16,7 @@
+ #ifndef DESKTOP_POSIX_APPLICATION_HPP
+ #define DESKTOP_POSIX_APPLICATION_HPP
+-#include "3rdparty/qtsingleapplication/QtSingleApplication"
++#include <QtSingleApplication>
+ #include "DesktopApplicationLaunch.hpp"
diff --git a/sci-mathematics/rstudio/rstudio-1.3.959.ebuild b/sci-mathematics/rstudio/rstudio-1.3.959.ebuild
new file mode 100644 (file)
index 0000000..d708ec5
--- /dev/null
@@ -0,0 +1,231 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit eutils cmake-utils pam xdg-utils java-pkg-2 java-ant-2 pax-utils prefix qmake-utils vcs-clean
+
+# TODO
+# * use dict from tree, linguas
+# * do src_test (use junit from tree?)
+
+GIN_VER=2.1.2
+# grep 'PANDOC_VERSION=' dependencies/common/install-pandoc
+# It should be PANDOC_VER=2.7.3 however >=app-text/pandoc-2.7.3 is not yet in portage
+PANDOC_VER=1.19.2.1
+# grep -5 QT_CANDIDATES src/cpp/desktop/CMakeLists.txt
+QT_VER=5.12.6
+QT_SLOT=5
+
+DESCRIPTION="IDE for the R language"
+HOMEPAGE="
+       http://www.rstudio.org
+       https://github.com/rstudio/rstudio/"
+SRC_URI="
+       https://github.com/rstudio/rstudio/archive/v${PV}.tar.gz -> ${P}.tar.gz
+       https://s3.amazonaws.com/rstudio-dictionaries/core-dictionaries.zip
+"
+
+LICENSE="AGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="dedicated libressl server"
+
+RDEPEND="
+       >=app-text/pandoc-${PANDOC_VER}
+       dev-java/aopalliance:1
+       dev-java/gin:2.1
+       dev-java/javax-inject
+       =dev-java/validation-api-1.0*:1.0[source]
+       dev-haskell/pandoc-citeproc
+       dev-lang/R
+       dev-libs/boost:=
+       >=dev-libs/mathjax-2.7.4
+       sys-apps/util-linux
+       sys-devel/clang:*
+       sys-libs/zlib
+       >=virtual/jre-1.8:=
+       x11-libs/pango
+       !dedicated? (
+               >=dev-qt/qtcore-${QT_VER}:${QT_SLOT}
+               >=dev-qt/qtdeclarative-${QT_VER}:${QT_SLOT}
+               >=dev-qt/qtdbus-${QT_VER}:${QT_SLOT}
+               >=dev-qt/qtgui-${QT_VER}:${QT_SLOT}
+               >=dev-qt/qtnetwork-${QT_VER}:${QT_SLOT}
+               >=dev-qt/qtopengl-${QT_VER}:${QT_SLOT}
+               >=dev-qt/qtpositioning-${QT_VER}:${QT_SLOT}
+               >=dev-qt/qtprintsupport-${QT_VER}:${QT_SLOT}
+               >=dev-qt/qtsingleapplication-2.6.1_p20150629[X,qt5(+)]
+               >=dev-qt/qtsensors-${QT_VER}:${QT_SLOT}
+               >=dev-qt/qtsql-${QT_VER}:${QT_SLOT}
+               >=dev-qt/qtsvg-${QT_VER}:${QT_SLOT}
+               >=dev-qt/qtwebchannel-${QT_VER}:${QT_SLOT}
+               >=dev-qt/qtwebengine-${QT_VER}:${QT_SLOT}[widgets]
+               >=dev-qt/qtwidgets-${QT_VER}:${QT_SLOT}
+               >=dev-qt/qtxml-${QT_VER}:${QT_SLOT}
+               >=dev-qt/qtxmlpatterns-${QT_VER}:${QT_SLOT}
+               server? ( sys-libs/pam )
+       )
+       dedicated? ( sys-libs/pam )
+       dedicated? (
+               sys-libs/pam
+               acct-user/rstudio-server
+               acct-group/rstudio-server
+       )
+       server? (
+               acct-user/rstudio-server
+               acct-group/rstudio-server
+       )
+       !libressl? ( dev-libs/openssl:0= )
+       libressl? ( dev-libs/libressl:0= )"
+DEPEND="${RDEPEND}
+       app-arch/unzip
+       dev-java/ant-core
+       >=virtual/jdk-1.8:=
+       virtual/pkgconfig"
+#      test? ( dev-java/junit:4 )
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.3.959-prefs.patch
+       "${FILESDIR}"/${PN}-1.3.959-paths.patch
+       "${FILESDIR}"/${PN}-1.3.959-pandoc-mathjax.patch
+       "${FILESDIR}"/${PN}-1.2.1335-linker_flags.patch
+       "${FILESDIR}"/${PN}-1.3.959-qtsingleapplication.patch
+       "${FILESDIR}"/${PN}-1.0.44-systemd.patch
+       "${FILESDIR}"/${PN}-1.3.959-core.patch
+       "${FILESDIR}"/${PN}-1.2.5042-boost-1.73.0.patch
+       "${FILESDIR}"/${PN}-1.3.959-R-4.0.0.patch
+)
+
+src_unpack() {
+       unpack ${P}.tar.gz
+       cd "${S}" || die
+       mkdir -p dependencies/common/dictionaries
+       unzip -qd dependencies/common/dictionaries \
+               "${DISTDIR}"/core-dictionaries.zip || die
+}
+
+src_prepare() {
+       cmake-utils_src_prepare
+       java-pkg-2_src_prepare
+       egit_clean
+
+       # Enable CMake to install our .service file for systemd usage
+       mkdir -vp "${S}/src/cpp/server/lib/systemd/system" || die
+       cp -v "${FILESDIR}/rstudio-server.service.in" "${S}/src/cpp/server/lib/systemd/system/" || die
+
+       # Adding -DDISTRO_SHARE=... to append-flags breaks cmake so using
+       # this sed hack for now. ~RMH
+       sed -i \
+               -e "s|DISTRO_SHARE|\"share/${PN}\"|g" \
+               src/cpp/server/ServerOptions.cpp \
+               src/cpp/session/SessionOptions.cpp || die
+
+       # use mathjax from system
+       ln -sf "${EPREFIX}"/usr/share/mathjax dependencies/common/mathjax-26 || die
+
+       # make sure icons and mime stuff are with prefix
+       sed -i \
+               -e "s:/usr:${EPREFIX}/usr:g" \
+               CMakeGlobals.txt src/cpp/desktop/CMakeLists.txt || die
+
+       # install themes in /etc/rstudio/extra/sthemes instead of /usr/extra/themes
+       sed -i \
+               -e "s@\(DESTINATION \"\)\(extras/themes\"\)@\1${EROOT}/etc/rstudio/\2@" \
+               src/cpp/server/CMakeLists.txt || die
+
+       # On Gentoo the rstudio-server configuration file is /etc/conf.d/rstudio-server.conf
+       sed -e "s@/etc/rstudio/rserver.conf@${EROOT}/etc/conf.d/rstudio-server.conf@" \
+               -i src/cpp/server/ServerOptions.cpp \
+               || die
+
+       # Set the rsession.conf file location for Gentoo prefix
+       sed -e "s@/etc/rstudio/rsession.conf@${EROOT}/etc/rstudio/rsession.conf@" \
+               -i src/cpp/session/SessionOptions.cpp \
+               || die
+
+       # dev-qt/qtsingleapplication-2.6.1_p20150629 does not provide a cmake module.
+       # It provides a library that has its version number appended to the end,
+       # which is difficult to handle in cmake, as find_library does not support
+       # searching for wildcard library names. So I find the library name from the
+       # qmake spec, and then sed this into the patched src/cpp/desktop/CMakeLists.txt.
+       rm -rf "${S}"/src/cpp/desktop/3rdparty || die
+       local s=$(grep '\-lQt$${QT_MAJOR_VERSION}Solutions_SingleApplication' \
+                                  $(qt5_get_mkspecsdir)/features/qtsingleapplication.prf \
+                                        | sed -e 's@\$\${QT_MAJOR_VERSION}@5@' \
+                                                  -e 's@LIBS \*= -l@@')
+       sed -e "s@Qt5Solutions_SingleApplication-2.6@${s}@g" \
+               -i "${S}"/src/cpp/desktop/CMakeLists.txt \
+               || die
+
+       # The git commit for tag: git rev-list -n 1 v${PV}
+       sed -e 's@git ARGS rev-parse HEAD@echo ARGS 3a09be39fd51a8fafa8ae330007937d31924b395@'\
+               -i "${S}"/CMakeLists.txt \
+               "${S}"/CMakeGlobals.txt \
+               || die
+
+       eprefixify src/gwt/build.xml
+}
+
+src_configure() {
+       export RSTUDIO_VERSION_MAJOR=$(ver_cut 1)
+       export RSTUDIO_VERSION_MINOR=$(ver_cut 2)
+       export RSTUDIO_VERSION_PATCH=$(ver_cut 3)
+
+       local mycmakeargs=(
+               -DDISTRO_SHARE=share/${PN}
+               -DRSTUDIO_TARGET=$(usex dedicated "Server" "$(usex server "Development" "Desktop")")
+               -DRSTUDIO_VERIFY_R_VERSION=FALSE
+               -DRSTUDIO_USE_SYSTEM_BOOST=TRUE
+               )
+
+       if use !dedicated; then
+               mycmakeargs+=(
+                       -DRSTUDIO_INSTALL_FREEDESKTOP="$(usex !dedicated "ON" "OFF")"
+                       -DQT_QMAKE_EXECUTABLE=$(qt5_get_bindir)/qmake
+               )
+       fi
+       cmake-utils_src_configure
+}
+
+src_compile() {
+       local JAVA_ANT_REWRITE_CLASSPATH="yes"
+       local EANT_BUILD_XML="src/gwt/build.xml"
+       local EANT_BUILD_TARGET="clean"
+       java-pkg-2_src_compile
+
+       # Avoid the rest of the oracle-jdk-bin-1.8.0.60 sandbox violations F: mkdir S: deny
+       # P: /root/.oracle_jre_usage.
+       export ANT_OPTS="-Duser.home=${T}"
+       cmake-utils_src_compile
+}
+
+src_install() {
+       export ANT_OPTS="-Duser.home=${T}"
+       cmake-utils_src_install
+       use dedicated || pax-mark m "${ED}/usr/bin/rstudio"
+       doconfd "${FILESDIR}"/rstudio-server.conf
+       insinto /etc/rstudio
+       doins "${FILESDIR}"/rsession.conf
+       dosym ../conf.d/rstudio-server.conf /etc/rstudio/rserver.conf
+       if use dedicated || use server; then
+               dopamd src/cpp/server/extras/pam/rstudio
+               newinitd "${FILESDIR}"/rstudio-server.initd rstudio-server
+       fi
+}
+
+pkg_preinst() {
+       java-pkg-2_pkg_preinst
+}
+
+pkg_postinst() {
+       use dedicated || { xdg_desktop_database_update
+               xdg_mimeinfo_database_update
+               xdg_icon_cache_update ;}
+}
+
+pkg_postrm() {
+       use dedicated || { xdg_desktop_database_update
+               xdg_mimeinfo_database_update
+               xdg_icon_cache_update ;}
+}