File 0001-Unbundle-mathjax-and-pandoc.patch of Package rstudio

From 04766193f0582261cb2cb849e3be0caea7d7a88e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
Date: Mon, 13 Jan 2020 11:27:06 +0100
Subject: [PATCH 1/8] Unbundle mathjax and pandoc

Use find_file() & find_program() functions to find the dependencies in the
dependencies/ subdirectory first. If they are not there, use the system paths
instead.
---
 src/cpp/session/CMakeLists.txt | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/cpp/session/CMakeLists.txt b/src/cpp/session/CMakeLists.txt
index 8f0daa57ea..31d0ee2227 100644
--- a/src/cpp/session/CMakeLists.txt
+++ b/src/cpp/session/CMakeLists.txt
@@ -22,11 +22,26 @@ add_subdirectory(workers)
 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")
+
+find_file(MATHJAX_JS_LOCATION
+   NAMES MathJax.js
+   PATHS "${RSTUDIO_DEPENDENCIES_DIR}/common/mathjax-27" /usr/share/javascript/mathjax/)
+if("${MATHJAX_JS_LOCATION}" STREQUAL "MATHJAX_JS_LOCATION-NOTFOUND")
   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)")
+get_filename_component(MATHJAX_PATH ${MATHJAX_JS_LOCATION} DIRECTORY)
+
+find_program(PANDOC_BIN_LOCATION
+   NAMES pandoc
+   LOCATION "${RSTUDIO_DEPENDENCIES_DIR}/common/pandoc/" /usr/bin/)
+find_program(PANDOC_CITEPROC_BIN_LOCATION
+   NAMES pandoc-citeproc
+   LOCATION "${RSTUDIO_DEPENDENCIES_DIR}/common/pandoc/" /usr/bin/)
+if(
+      "${PANDOC_BIN_LOCATION}" STREQUAL "PANDOC_BIN_LOCATION-NOTFOUND"
+      OR
+      "${PANDOC_CITEPROC_BIN_LOCATION}" STREQUAL "PANDOC_CITEPROC_BIN_LOCATION-NOTFOUND")
+   message(FATAL_ERROR "pandoc not found (re-run install-dependencies script to install)")
 endif()
 
 # verify embedded packages are available
@@ -501,7 +516,7 @@ if (NOT RSTUDIO_SESSION_WIN32)
            DESTINATION "${RSTUDIO_INSTALL_SUPPORTING}/resources")
 
    # install mathjax for local html preview
-   install(DIRECTORY "${RSTUDIO_DEPENDENCIES_DIR}/common/mathjax-27"
+   install(DIRECTORY "${MATHJAX_PATH}"
            DESTINATION "${RSTUDIO_INSTALL_SUPPORTING}/resources")
 
    # icons for database connections
@@ -521,6 +536,7 @@ if (NOT RSTUDIO_SESSION_WIN32)
 
    set(PANDOC_BIN "${RSTUDIO_DEPENDENCIES_DIR}/common/pandoc/${PANDOC_VERSION}")
    file(GLOB PANDOC_FILES "${PANDOC_BIN}/pandoc*")
+   set(PANDOC_FILES ${PANDOC_CITEPROC_BIN_LOCATION} ${PANDOC_BIN_LOCATION})
    install(FILES ${PANDOC_FILES}
            PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
            DESTINATION  ${RSTUDIO_INSTALL_BIN}/pandoc)
-- 
2.28.0

openSUSE Build Service is sponsored by