Index: devel/Makefile
===================================================================
--- devel/Makefile
+++ devel/Makefile
@@ -5274,6 +5274,7 @@
SUBDIR += rote
SUBDIR += rpc2
SUBDIR += rpm-spec-mode.el
+ SUBDIR += rstudio
SUBDIR += rsvndump
SUBDIR += rth
SUBDIR += ruby-bsearch
Index: devel/rstudio/Makefile
===================================================================
--- /dev/null
+++ devel/rstudio/Makefile
@@ -0,0 +1,79 @@
+# $FreeBSD$
+
+PORTNAME= RStudio
+DISTVERSIONPREFIX= v
+DISTVERSION= 1.1.385
+CATEGORIES= devel math java
+MASTER_SITES= https://s3.amazonaws.com/rstudio-dictionaries/:dictionaries \
+ https://s3.amazonaws.com/rstudio-buildtools/:gin \
+ https://s3.amazonaws.com/rstudio-buildtools/:gwt \
+ https://s3.amazonaws.com/rstudio-buildtools/:mathjax
+DISTFILES= core-dictionaries.zip:dictionaries \
+ gin-${GIN_VERSION}.zip:gin \
+ gwt-${GWT_VERSION}.zip:gwt \
+ mathjax-26.zip:mathjax
+
+MAINTAINER= yuri@FreeBSD.org
+COMMENT= Integrated development environment (IDE) for R
+
+LICENSE= GPLv3
+LICENSE_FILE= ${WRKSRC}/COPYING
+
+BUILD_DEPENDS= ant:devel/apache-ant \
+ ${LOCALBASE}/include/sys/sysinfo.h:devel/libsysinfo \
+ pandoc:textproc/hs-pandoc
+LIB_DEPENDS= libR.so:math/R \
+ libboost_thread.so:devel/boost-libs \
+ libinotify.so:devel/libinotify \
+ libuuid.so:misc/e2fsprogs-libuuid
+
+USES= cmake:outsource desktop-file-utils fortran pkgconfig shared-mime-info
+USE_QT5= core dbus gui location network opengl printsupport qml quick sensors \
+ sql svg webchannel webkit widgets xml xmlpatterns buildtools_build
+USE_JAVA= yes
+JAVA_BUILD= yes
+USE_GITHUB= yes
+GH_TUPLE= rstudio:rmarkdown:aed26ac:rmarkdown/dependencies/common/rmarkdown \
+ rstudio:rsconnect:03c379b:rsconnect/dependencies/common/rsconnect
+
+CMAKE_ARGS= -DRSTUDIO_TARGET=Desktop \
+ -DFREEBSD_RSTUDIO_VERSION:STRING=${PORTVERSION} \
+ -DFREEBSD_LIBDIR:STRING=${PREFIX}/lib
+MAKE_ENV= HOME=${WRKDIR} \
+ ANT_OPTS="-Duser.home=${WRKDIR}"
+WRKSRC= ${WRKDIR}/${PORTNAME:tl}-${PORTVERSION}
+
+GWT_VERSION= 2.7.0
+GIN_VERSION= 1.5
+
+post-extract:
+ @${MKDIR} ${WRKSRC}/dependencies/common/dictionaries && ${MV} ${WRKDIR}/en_* ${WRKSRC}/dependencies/common/dictionaries/
+ @${MV} ${WRKDIR}/mathjax-* ${WRKSRC}/dependencies/common/
+ @${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 ${WRKDIR}/javadoc ${WRKSRC}/src/gwt/lib/gin/${GIN_VERSION}/
+
+post-patch:
+ @${REINPLACE_CMD} -e ' \
+ 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
+
+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
+
+post-install:
+ @${LN} -s ${PREFIX}/lib/rstudio/bin/rstudio ${STAGEDIR}${PREFIX}/bin/rstudio
+ @${REINPLACE_CMD} -e 's|^Exec=.*/rstudio|Exec=${PREFIX}/bin/rstudio|' ${STAGEDIR}${PREFIX}/share/applications/rstudio.desktop
+ # 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}
+
+.include
Index: devel/rstudio/distinfo
===================================================================
--- /dev/null
+++ devel/rstudio/distinfo
@@ -0,0 +1,15 @@
+TIMESTAMP = 1511035341
+SHA256 (core-dictionaries.zip) = 4341a9630efb9dcf7f215c324136407f3b3d6003e1c96f2e5e1f9f14d5787494
+SIZE (core-dictionaries.zip) = 876339
+SHA256 (gin-1.5.zip) = f561f4eb5d5fe1cff95c881e6aed53a86e9f0de8a52863295a8600375f96ab94
+SIZE (gin-1.5.zip) = 1055663
+SHA256 (gwt-2.7.0.zip) = aa65061b73836190410720bea422eb8e787680d7bc0c2b244ae6c9a0d24747b3
+SIZE (gwt-2.7.0.zip) = 108818328
+SHA256 (mathjax-26.zip) = 939a2d7f37e26287970be942df70f3e8f272bac2eb868ce1de18bb95d3c26c71
+SIZE (mathjax-26.zip) = 3061588
+SHA256 (RStudio-RStudio-v1.1.385_GH0.tar.gz) = d4e8dd4106c85ae6352e4399667de7eccde0e6aa018f08711a8c4aad404eff3c
+SIZE (RStudio-RStudio-v1.1.385_GH0.tar.gz) = 20197003
+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
Index: devel/rstudio/files/global-setenv.h
===================================================================
--- /dev/null
+++ devel/rstudio/files/global-setenv.h
@@ -0,0 +1,7 @@
+
+#define GLOBAL_SETENV \
+ setenv("R_USER", ::getenv("HOME"), 0); \
+ setenv("R_HOME", "%%PREFIX%%/lib/R", 0); \
+ setenv("R_INCLUDE_DIR", "%%PREFIX%%/lib/R/include", 0); \
+ setenv("R_LIBS", "%%PREFIX%%/lib/R", 0); \
+ setenv("R_DOC_DIR", "%%PREFIX%%/share/doc/R", 0);
Index: devel/rstudio/files/patch-CMakeGlobals.txt
===================================================================
--- /dev/null
+++ devel/rstudio/files/patch-CMakeGlobals.txt
@@ -0,0 +1,19 @@
+--- CMakeGlobals.txt.orig 2017-11-16 21:40:37 UTC
++++ CMakeGlobals.txt
+@@ -65,15 +65,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_WIN64 AND NOT RSTUDIO_GIT_REVISION_HASH)
+- find_program(GIT_EXECUTABLE git)
+- if(GIT_EXECUTABLE)
+- exec_program(git ARGS rev-parse HEAD
+- OUTPUT_VARIABLE RSTUDIO_GIT_REVISION_HASH)
+- 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")
+
+ # required R version
+ set(RSTUDIO_R_MAJOR_VERSION_REQUIRED 2)
Index: devel/rstudio/files/patch-CMakeLists.txt
===================================================================
--- /dev/null
+++ devel/rstudio/files/patch-CMakeLists.txt
@@ -0,0 +1,21 @@
+--- CMakeLists.txt.orig 2017-11-16 21:40:37 UTC
++++ CMakeLists.txt
+@@ -31,8 +31,7 @@ endif()
+ if (NOT RSTUDIO_SESSION_WIN64)
+ # dynamically configure SOURCE with the git revision hash
+ INSTALL(CODE "
+- exec_program(git ARGS rev-parse HEAD
+- OUTPUT_VARIABLE RSTUDIO_GIT_REVISION_HASH)
++ set(RSTUDIO_VERSION ${FREEBSD_RSTUDIO_VERSION})
+ configure_file (\"${CMAKE_CURRENT_SOURCE_DIR}/SOURCE.in\"
+ \"${CMAKE_CURRENT_BINARY_DIR}/SOURCE\")
+ ")
+@@ -57,8 +56,6 @@ add_subdirectory(package)
+
+
+
+-
+-
+
+
+
Index: devel/rstudio/files/patch-src_cpp_CMakeLists.txt
===================================================================
--- /dev/null
+++ devel/rstudio/files/patch-src_cpp_CMakeLists.txt
@@ -0,0 +1,10 @@
+--- src/cpp/CMakeLists.txt.orig 2017-11-16 21:40:37 UTC
++++ src/cpp/CMakeLists.txt
+@@ -101,7 +101,6 @@ if(UNIX)
+ add_definitions(-Wformat -Wformat-security)
+ add_definitions(-D_FORTIFY_SOURCE=2)
+ add_definitions(-fstack-protector --param ssp-buffer-size=4)
+- add_definitions(-pie -fPIE)
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro,-z,now")
+ endif()
+
Index: devel/rstudio/files/patch-src_cpp_core_Backtrace.cpp
===================================================================
--- /dev/null
+++ devel/rstudio/files/patch-src_cpp_core_Backtrace.cpp
@@ -0,0 +1,11 @@
+--- src/cpp/core/Backtrace.cpp.orig 2017-11-16 21:40:37 UTC
++++ src/cpp/core/Backtrace.cpp
+@@ -46,7 +46,7 @@ std::string demangle(const std::string&
+
+ void printBacktrace(std::ostream& os)
+ {
+-#ifndef _WIN32
++#if !defined(_WIN32) && !defined(__FreeBSD__)
+
+ os << "Backtrace (most recent calls first):" << std::endl << std::endl;
+
Index: devel/rstudio/files/patch-src_cpp_core_CMakeLists.txt
===================================================================
--- /dev/null
+++ devel/rstudio/files/patch-src_cpp_core_CMakeLists.txt
@@ -0,0 +1,23 @@
+--- src/cpp/core/CMakeLists.txt.orig 2017-11-16 21:40:37 UTC
++++ src/cpp/core/CMakeLists.txt
+@@ -143,16 +143,17 @@ if (UNIX)
+ }
+ "
+ HAVE_SCANDIR_POSIX)
+-
+ # 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()
+ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+
Index: devel/rstudio/files/patch-src_cpp_core_include_core_r__util_RTokenizer.hpp
===================================================================
--- /dev/null
+++ devel/rstudio/files/patch-src_cpp_core_include_core_r__util_RTokenizer.hpp
@@ -0,0 +1,11 @@
+--- src/cpp/core/include/core/r_util/RTokenizer.hpp.orig 2017-11-16 21:40:37 UTC
++++ src/cpp/core/include/core/r_util/RTokenizer.hpp
+@@ -35,7 +35,7 @@
+
+ // On Linux confirm that wchar_t is Unicode
+ #if !defined(_WIN32) && !defined(__APPLE__) && !defined(__STDC_ISO_10646__)
+- #error "wchar_t is not Unicode"
++// #error "wchar_t is not Unicode"
+ #endif
+
+ namespace rstudio {
Index: devel/rstudio/files/patch-src_cpp_core_r__util_RSessionContext.cpp
===================================================================
--- /dev/null
+++ devel/rstudio/files/patch-src_cpp_core_r__util_RSessionContext.cpp
@@ -0,0 +1,13 @@
+--- src/cpp/core/r_util/RSessionContext.cpp.orig 2017-11-16 21:40:37 UTC
++++ src/cpp/core/r_util/RSessionContext.cpp
+@@ -138,8 +138,8 @@ bool isSharedPath(const std::string& pro
+ // not shared if we're in any of the groups that own the directory
+ // (note that this checks supplementary group IDs only, so the check
+ // against the primary group ID above is still required)
+- if (::group_member(st.st_gid))
+- return false;
++// if (::group_member(st.st_gid))
++// return false;
+ #endif
+
+ // if we got this far, we likely have access due to project sharing
Index: devel/rstudio/files/patch-src_cpp_core_system_PosixChildProcess.cpp
===================================================================
--- /dev/null
+++ devel/rstudio/files/patch-src_cpp_core_system_PosixChildProcess.cpp
@@ -0,0 +1,23 @@
+--- src/cpp/core/system/PosixChildProcess.cpp.orig 2017-11-16 21:40:37 UTC
++++ src/cpp/core/system/PosixChildProcess.cpp
+@@ -19,14 +19,18 @@
+ #include
+ #include
+ #include
++#include
+
+ #ifdef __APPLE__
+ #include
+ #include
+ #include
+ #else
+-#include
+-#include
++//#include
++//#include
++#include
++#include
++#include
+ #endif
+
+ #include
Index: devel/rstudio/files/patch-src_cpp_core_system_PosixSched.cpp
===================================================================
--- /dev/null
+++ devel/rstudio/files/patch-src_cpp_core_system_PosixSched.cpp
@@ -0,0 +1,55 @@
+--- src/cpp/core/system/PosixSched.cpp.orig 2017-11-16 21:40:37 UTC
++++ src/cpp/core/system/PosixSched.cpp
+@@ -15,7 +15,11 @@
+
+ #include
+
++#define _GNU_SOURCE
+ #include
++#include
++#include // w/out this fails on i386 with error: use of undeclared identifier 'NBBY'
++#include
+
+ #include
+
+@@ -41,9 +45,10 @@ bool isCpuAffinityEmpty(const CpuAffinit
+ Error getCpuAffinity(CpuAffinity* pCpus)
+ {
+ #ifndef __APPLE__
+- cpu_set_t cs;
++/*
++ cpuset_t cs;
+ CPU_ZERO(&cs);
+- if (::sched_getaffinity(0, sizeof(cs), &cs) == -1)
++ if (sched_getaffinity(0, sizeof(cs), &cs) == -1)
+ return systemError(errno, ERROR_LOCATION);
+
+ pCpus->clear();
+@@ -55,7 +60,7 @@ Error getCpuAffinity(CpuAffinity* pCpus)
+ else
+ pCpus->push_back(false);
+ }
+-
++*/
+ return Success();
+ #else
+ return systemError(boost::system::errc::not_supported, ERROR_LOCATION);
+@@ -66,7 +71,8 @@ Error getCpuAffinity(CpuAffinity* pCpus)
+ Error setCpuAffinity(const CpuAffinity& cpus)
+ {
+ #ifndef __APPLE__
+- cpu_set_t cs;
++/*
++ cpuset_t cs;
+ CPU_ZERO(&cs);
+
+ for (std::size_t i=0; i
+ #include
+ #include
++#include
+
+ #include
+
+@@ -46,9 +47,9 @@
+ #endif
+
+ #ifndef __APPLE__
+-#include
++//#include
+ #include
+-#include
++//#include
+ #include
+ #endif
+
+@@ -670,7 +671,7 @@ Error executablePath(const char * argv0,
+
+ #elif defined(HAVE_PROCSELF)
+
+- executablePath = std::string("/proc/self/exe");
++ executablePath = std::string("/proc/curproc/file");
+
+ #else
+
+@@ -1102,7 +1103,7 @@ Error osResourceLimit(ResourceLimit limi
+ case CpuLimit:
+ *pLimit = RLIMIT_CPU;
+ break;
+-#ifndef __APPLE__
++#if !defined(__APPLE__) && !defined(__FreeBSD__)
+ case NiceLimit:
+ *pLimit = RLIMIT_NICE;
+ break;
+@@ -1175,7 +1176,7 @@ Error systemInformation(SysInfo* pSysInf
+ {
+ pSysInfo->cores = boost::thread::hardware_concurrency();
+
+-#ifndef __APPLE__
++#if !defined(__APPLE__) && !defined(__FreeBSD__)
+ struct sysinfo info;
+ if (::sysinfo(&info) == -1)
+ return systemError(errno, ERROR_LOCATION);
+@@ -1495,9 +1496,9 @@ Error restrictCoreDumps()
+
+ // no ptrace core dumps permitted
+ #ifndef __APPLE__
+- int res = ::prctl(PR_SET_DUMPABLE, 0);
+- if (res == -1)
+- return systemError(errno, ERROR_LOCATION);
++// int res = ::prctl(PR_SET_DUMPABLE, 0);
++// if (res == -1)
++// return systemError(errno, ERROR_LOCATION);
+ #endif
+
+ return Success();
+@@ -1521,10 +1522,10 @@ void printCoreDumpable(const std::string
+
+ // ptrace
+ #ifndef __APPLE__
+- int dumpable = ::prctl(PR_GET_DUMPABLE, NULL, NULL, NULL, NULL);
+- if (dumpable == -1)
+- LOG_ERROR(systemError(errno, ERROR_LOCATION));
+- ostr << " pr_get_dumpable: " << dumpable << std::endl;
++// int dumpable = ::prctl(PR_GET_DUMPABLE, NULL, NULL, NULL, NULL);
++// if (dumpable == -1)
++// LOG_ERROR(systemError(errno, ERROR_LOCATION));
++// ostr << " pr_get_dumpable: " << dumpable << std::endl;
+ #endif
+
+ std::cerr << ostr.str();
Index: devel/rstudio/files/patch-src_cpp_desktop_DesktopMain.cpp
===================================================================
--- /dev/null
+++ devel/rstudio/files/patch-src_cpp_desktop_DesktopMain.cpp
@@ -0,0 +1,18 @@
+--- src/cpp/desktop/DesktopMain.cpp.orig 2017-11-16 21:40:37 UTC
++++ src/cpp/desktop/DesktopMain.cpp
+@@ -42,6 +42,7 @@
+ #include "DesktopSessionLauncher.hpp"
+ #include "DesktopProgressActivator.hpp"
+ #include "DesktopNetworkProxyFactory.hpp"
++#include "global-setenv.h"
+
+ QProcess* pRSessionProcess;
+ QString sharedSecret;
+@@ -198,6 +199,7 @@ bool isNonProjectFilename(QString filena
+
+ int main(int argc, char* argv[])
+ {
++ GLOBAL_SETENV
+ core::system::initHook();
+
+ try
Index: devel/rstudio/files/patch-src_cpp_server_CMakeLists.txt
===================================================================
--- /dev/null
+++ devel/rstudio/files/patch-src_cpp_server_CMakeLists.txt
@@ -0,0 +1,12 @@
+--- src/cpp/server/CMakeLists.txt.orig 2017-11-16 21:40:37 UTC
++++ src/cpp/server/CMakeLists.txt
+@@ -124,6 +124,9 @@ include_directories(
+ # define executable
+ add_executable(rserver ${SERVER_SOURCE_FILES} ${SERVER_HEADER_FILES})
+
++# additional libraries
++target_link_libraries(rserver -L${FREEBSD_LIBDIR} -linotify)
++
+ # add origin rpath for suse/sles
+ if(RSTUDIO_PACKAGE_VARIANT STREQUAL "SLES")
+ set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
Index: devel/rstudio/files/patch-src_cpp_session_CMakeLists.txt
===================================================================
--- /dev/null
+++ devel/rstudio/files/patch-src_cpp_session_CMakeLists.txt
@@ -0,0 +1,95 @@
+--- src/cpp/session/CMakeLists.txt.orig 2017-11-16 21:40:37 UTC
++++ src/cpp/session/CMakeLists.txt
+@@ -25,9 +25,9 @@ endif()
+ if(NOT EXISTS "${RSTUDIO_DEPENDENCIES_DIR}/common/mathjax-26")
+ message(FATAL_ERROR "Mathjax 2.6 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()
++#if(NOT EXISTS "${RSTUDIO_DEPENDENCIES_DIR}/common/pandoc")
++# message(FATAL_ERROR "pandoc not found (re-run install-dependencies script to install)")
++#endif()
+
+ # we often install embedded versions of these packages but don't do so currently
+
+@@ -39,19 +39,19 @@ endif()
+ # endif()
+
+ # verify libclang is installed
+-if(WIN32)
+- set(LIBCLANG_VERSION "3.4")
+-else()
+- set(LIBCLANG_VERSION "3.5")
+-endif()
+-set(LIBCLANG_DIR "${RSTUDIO_DEPENDENCIES_DIR}/common/libclang/${LIBCLANG_VERSION}")
+-if(NOT EXISTS "${LIBCLANG_DIR}")
+- message(FATAL_ERROR "libclang ${LIBCLANG_VERSION} not found (re-run install-dependencies script to install)")
+-endif()
+-set(LIBCLANG_HEADERS_DIR "${RSTUDIO_DEPENDENCIES_DIR}/common/libclang/builtin-headers")
+-if(NOT EXISTS "${LIBCLANG_HEADERS_DIR}")
+- message(FATAL_ERROR "libclang builtin-headers not found (re-run install-dependencies script to install)")
+-endif()
++#if(WIN32)
++# set(LIBCLANG_VERSION "3.4")
++#else()
++# set(LIBCLANG_VERSION "3.5")
++#endif()
++set(LIBCLANG_DIR ${CMAKE_INSTALL_PREFIX})
++#if(NOT EXISTS "${LIBCLANG_DIR}")
++# message(FATAL_ERROR "libclang ${LIBCLANG_VERSION} not found (re-run install-dependencies script to install)")
++#endif()
++set(LIBCLANG_HEADERS_DIR "${CMAKE_INSTALL_PREFIX}/include")
++#if(NOT EXISTS "${LIBCLANG_HEADERS_DIR}")
++# message(FATAL_ERROR "libclang builtin-headers not found (re-run install-dependencies script to install)")
++#endif()
+
+
+ # include files
+@@ -360,6 +360,9 @@ endif()
+ # define executable
+ add_executable(rsession ${SESSION_SOURCE_FILES} ${SESSION_HEADER_FILES})
+
++# additional libraries
++target_link_libraries(rsession -L${FREEBSD_LIBDIR} -linotify)
++
+ # skip libR RPATH at development time
+ if(RSTUDIO_DEVELOPMENT OR RSTUDIO_RUN_IN_PLACE)
+ set_target_properties(rsession PROPERTIES SKIP_BUILD_RPATH TRUE)
+@@ -466,11 +469,11 @@ if (NOT RSTUDIO_SESSION_WIN64)
+ DESTINATION ${RSTUDIO_INSTALL_SUPPORTING}/resources)
+
+ # install pandoc
+- set(PANDOC_BIN "${RSTUDIO_DEPENDENCIES_DIR}/common/pandoc/1.19.2.1")
+- 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)
++ #set(PANDOC_BIN "${}/common/pandoc/1.19.2.1")
++ #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 rmarkdown package
+ # file(GLOB RMARKDOWN_PACKAGE "${RSTUDIO_DEPENDENCIES_DIR}/common/rmarkdown*.tar.gz")
+@@ -511,14 +514,14 @@ if (NOT RSTUDIO_SESSION_WIN64)
+ install(PROGRAMS ${LIBCLANG_64_FILES}
+ DESTINATION ${RSTUDIO_INSTALL_BIN}/rsclang/x86_64)
+ else()
+- file(GLOB_RECURSE LIBCLANG_FILES "${LIBCLANG_DIR}/libclang.*")
+- install(PROGRAMS ${LIBCLANG_FILES}
+- DESTINATION ${RSTUDIO_INSTALL_BIN}/rsclang)
++ #file(GLOB_RECURSE LIBCLANG_FILES "${LIBCLANG_DIR}/libclang.*")
++ #install(PROGRAMS ${LIBCLANG_FILES}
++ # DESTINATION ${RSTUDIO_INSTALL_BIN}/rsclang)
+ endif()
+
+ # install libclang builtin-headers
+- install(DIRECTORY "${RSTUDIO_DEPENDENCIES_DIR}/common/libclang/builtin-headers"
+- DESTINATION "${RSTUDIO_INSTALL_SUPPORTING}/resources/libclang")
++ #install(DIRECTORY "${RSTUDIO_DEPENDENCIES_DIR}/common/libclang/builtin-headers"
++ # DESTINATION "${RSTUDIO_INSTALL_SUPPORTING}/resources/libclang")
+
+ # install winpty on windows
+ if(WIN32)
Index: devel/rstudio/files/patch-src_cpp_session_SessionHttpMethods.cpp
===================================================================
--- /dev/null
+++ devel/rstudio/files/patch-src_cpp_session_SessionHttpMethods.cpp
@@ -0,0 +1,11 @@
+--- src/cpp/session/SessionHttpMethods.cpp.orig 2017-11-16 21:40:37 UTC
++++ src/cpp/session/SessionHttpMethods.cpp
+@@ -326,7 +326,7 @@ std::string clientVersion()
+ return std::string();
+
+ // clientVersion is the git revision hash
+- return RSTUDIO_GIT_REVISION_HASH;
++ return RSTUDIO_VERSION;
+ }
+
+ void waitForMethodInitFunction(const ClientEvent& initEvent)
Index: devel/rstudio/files/patch-src_cpp_session_session-config.h.in
===================================================================
--- /dev/null
+++ devel/rstudio/files/patch-src_cpp_session_session-config.h.in
@@ -0,0 +1,12 @@
+--- src/cpp/session/session-config.h.in.orig 2017-11-16 21:40:37 UTC
++++ src/cpp/session/session-config.h.in
+@@ -13,8 +13,7 @@
+ *
+ */
+
+-#define RSTUDIO_VERSION "${CPACK_PACKAGE_VERSION}"
+-#define RSTUDIO_GIT_REVISION_HASH "${RSTUDIO_GIT_REVISION_HASH}"
++#define RSTUDIO_VERSION "${RSTUDIO_VERSION}"
+ #cmakedefine RSTUDIO_SERVER
+ #cmakedefine RSTUDIO_UNVERSIONED_BUILD
+ #cmakedefine TRACE_PACKRAT_OUTPUT
Index: devel/rstudio/pkg-descr
===================================================================
--- /dev/null
+++ devel/rstudio/pkg-descr
@@ -0,0 +1,6 @@
+RStudio is an integrated development environment (IDE) for R.
+It includes a console, syntax-highlighting editor that supports direct
+code execution, as well as tools for plotting, history, debugging and
+workspace management.
+
+WWW: https://www.rstudio.org