#squidf: this spec is heavily inspired by Fedora # %global bundled_gwt_version 2.10.0 %global bundled_websockets_version 1.0.4 %global bundled_gin_version 2.1.2 %global bundled_elemental2_version 1.0.0 %global bundled_junit_version 4.9b3 %global bundled_guice_version 3.0 %global bundled_aopalliance_version 1.0 %global bundled_rapidjson_version 5cd62c2 %global bundled_treehh_version 2.81 %global bundled_sundown_version 1.16.0 %global bundled_synctex_version 1.17 %global bundled_gsllite_version 0.34.0 %global bundled_ace_version 1.32.5 %global bundled_datatables_version 1.10.4 %global bundled_jquery_version 3.5.1 %global bundled_pdfjs_version 1.3.158 %global bundled_revealjs_version 2.4.0 %global bundled_jsbn_version 1.1 %global bundled_highlightjs_version c589dcc %global bundled_qunitjs_version 1.18.0 %global bundled_xtermjs_version 3.14.5 %global bundled_inertpol_version 0.2.5 %global bundled_focusvis_version 5.0.2 %global bundled_jsyaml_version 5.0.2 %global mathjax_short 27 %global rstudio_version_major 2024 %global rstudio_version_minor 04 %global rstudio_version_patch 2 %global rstudio_version_suffix 764 %global rstudio_git_revision_hash e4392fc9ddc21961fd1d0efd47484b43f07a4177 %global rstudio_version %{rstudio_version_major}.%{rstudio_version_minor}.%{rstudio_version_patch} %global rstudio_flags \ export RSTUDIO_VERSION_MAJOR=%{rstudio_version_major} ; \ export RSTUDIO_VERSION_MINOR=%{rstudio_version_minor} ; \ export RSTUDIO_VERSION_PATCH=%{rstudio_version_patch} ; \ export RSTUDIO_VERSION_SUFFIX=+%{rstudio_version_suffix} ; \ export RSTUDIO_GIT_REVISION_HASH=%{rstudio_git_revision_hash} ; \ export GIT_COMMIT=%{rstudio_git_revision_hash} ; \ export PACKAGE_OS=$(cat /etc/mageia-release) # Do not build non-lto objects, as that may result in # memory exhaustion by the linker. %global optflags %(echo '%{optflags}' | sed -e 's!-ffat-lto-objects!-fno-fat-lto-objects!g') Name: rstudio Version: %{rstudio_version}%{?rstudio_version_suffix:+%rstudio_version_suffix} Release: %mkrel 1 Summary: RStudio IDE is a powerful and productive user interface for R Group: Sciences/Mathematics ExcludeArch: %{arm} aarch64 # See NOTICE file License: AGPLv3 URL: https://github.com/rstudio/rstudio Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz Source3: %{name}.metainfo.xml # Unbundle mathjax, pandoc, hunspell dictionaries, qtsingleapplication Patch0: rstudio-2024.04.2-unbundle-dependencies-common.patch Patch1: rstudio-2023.12.1-unbundle-qtsingleapplication.patch # Remove the installation prefix from the exec path in the .desktop file Patch2: rstudio-2023.12.1-fix-rstudio-exec-path.patch # We don't want to set RSTUDIO_PACKAGE_BUILD Patch3: rstudio-2023.12.1-fix-resources-path.patch #squidf: for i586 Patch5: rstudio-2023.12.1-disable-quarto.patch # https://github.com/rstudio/rstudio/issues/9854 # We don't need this with our version of QtWebEngine Patch6: rstudio-2023.12.1-do-not-disable-seccomp-filter-sandbox.patch # Squidf: panmirror from Fedora fails for i586 Patch7: rstudio-2023.12.1-remove-panmirror.patch # adapt to boost 1.85 Patch8: rstudio-2023.12.1-fix-boost-1.85-build.patch BuildRequires: cmake, ant BuildRequires: extra-cmake-modules BuildRequires: java-devel BuildRequires: R-base BuildRequires: yarnpkg, jq BuildRequires: nodejs BuildRequires: mathjax BuildRequires: lato-fonts BuildRequires: soci-postgresql-devel, soci-sqlite3-devel BuildRequires: pkgconfig(appstream-glib) BuildRequires: pkgconfig(pam) BuildRequires: pkgconfig(systemd) BuildRequires: pkgconfig(uuid) BuildRequires: pkgconfig(openssl) BuildRequires: cmake(boost) BuildRequires: cmake(yaml-cpp) BuildRequires: cmake(websocketpp) BuildRequires: cmake(fmt) BuildRequires: cmake(tl-expected) BuildRequires: cmake(Qt5Location) BuildRequires: cmake(Qt5OpenGL) BuildRequires: cmake(Qt5Sensors) BuildRequires: cmake(Qt5Sql) BuildRequires: cmake(Qt5Svg) BuildRequires: cmake(Qt5WebEngine) BuildRequires: cmake(Qt5WebChannel) BuildRequires: cmake(Qt5Xml) BuildRequires: cmake(Qt5XmlPatterns) BuildRequires: qtsingleapplication-qt5-devel BuildRequires: rapidxml-devel BuildRequires: hicolor-icon-theme Requires: hunspell Requires: R-base Requires: rstudio-common Provides: bundled(gwt) = %{bundled_gwt_version} Provides: bundled(gwt-websockets) = %{bundled_websockets_version} Provides: bundled(gin) = %{bundled_gin_version} Provides: bundled(elemental2) = %{bundled_elemental2_version} Provides: bundled(junit) = %{bundled_junit_version} Provides: bundled(guice) = %{bundled_guice_version} Provides: bundled(aopalliance) = %{bundled_aopalliance_version} Provides: bundled(rapidjson-devel) = %{bundled_rapidjson_version} Provides: bundled(tree-hh-devel) = %{bundled_treehh_version} Provides: bundled(sundown) = %{bundled_sundown_version} Provides: bundled(synctex) = %{bundled_synctex_version} Provides: bundled(guidelines-support-library-lite-devel) = %{bundled_gsllite_version} Provides: bundled(js-ace) = %{bundled_ace_version} Provides: bundled(js-datatables) = %{bundled_datatables_version} Provides: bundled(js-jquery) = %{bundled_jquery_version} Provides: bundled(js-pdf) = %{bundled_pdfjs_version} Provides: bundled(js-reveal) = %{bundled_revealjs_version} Provides: bundled(js-bn) = %{bundled_jsbn_version} Provides: bundled(js-highlight) = %{bundled_highlightjs_version} Provides: bundled(js-qunit) = %{bundled_qunitjs_version} Provides: bundled(js-xterm) = %{bundled_xtermjs_version} Provides: bundled(js-inert-polyfill) = %{bundled_inertpol_version} Provides: bundled(js-focus-visible) = %{bundled_focusvis_version} Provides: bundled(js-yaml) = %{bundled_jsyaml_version} %description This package provides the Desktop version, to access the RStudio IDE locally. %package common Summary: RStudio base package Group: Sciences/Mathematics Requires: R-base Requires(post): systemd >= %{systemd_required_version} Requires: hicolor-icon-theme, shared-mime-info %description common RStudio is an integrated development environment (IDE) for the R programming language. Some of its features include: - Customizable workbench with all of the tools required to work with R in one place (console, source, plots, workspace, help, history, etc.). - Syntax highlighting editor with code completion. - Execute code directly from the source editor (line, selection, or file). - Full support for authoring Sweave and TeX documents. - Runs on all major platforms (Windows, Mac, and Linux) and can also be run as a server, enabling multiple users to access the RStudio IDE using a web browser. This package provides common files for %{name} and %{name}-server. %package server Summary: Access RStudio via a web browser Group: Sciences/Mathematics Requires: R-base Requires: rstudio-common Requires(post): rpm-helper >= %{rpmhelper_required_version} Requires(preun): rpm-helper >= %{rpmhelper_required_version} %description server This package provides the Server version, a browser-based interface to the RStudio IDE. %prep %autosetup -p1 -n %{name}-%{rstudio_version}-%{rstudio_version_suffix} # use system libraries when available rm -rf src/cpp/desktop/3rdparty src/cpp/ext/{websocketpp,fmt,expected} sed -i '/fmt/d' src/cpp/ext/CMakeLists.txt sed -i '/target_link_libraries(rstudio-core/i find_package(fmt REQUIRED)' \ src/cpp/core/CMakeLists.txt ln -sf %{_includedir}/rapidxml.h src/cpp/core/include/core/rapidxml/rapidxml.hpp ln -sf %{_includedir}/websocketpp src/cpp/ext/websocketpp ln -sf %{_includedir}/tl src/cpp/ext/expected %build %{rstudio_flags} %cmake -B build \ -DRSTUDIO_TARGET=Desktop \ -DRSTUDIO_DESKTOP=TRUE \ -DQUARTO_ENABLED=FALSE \ -DQT_QMAKE_EXECUTABLE=%{_qt5_bindir}/qmake \ -DRSTUDIO_DISABLE_CHECK_FOR_UPDATES=1 \ -DRSTUDIO_SERVER=TRUE \ -DCMAKE_BUILD_TYPE=Release \ -DRSTUDIO_USE_SYSTEM_SOCI=Yes \ -DRSTUDIO_USE_SYSTEM_BOOST=Yes \ -DRSTUDIO_USE_SYSTEM_YAML_CPP=Yes \ -DBOOST_ROOT=%{_prefix} \ -DRSTUDIO_BOOST_REQUESTED_VERSION=1.85.0 \ -DCMAKE_INSTALL_PREFIX=%{_libdir}/%{name} %make_build -C build # ALL %install %{rstudio_flags} %make_install -C build # expose symlinks in /usr/bin install -d -m 0755 %{buildroot}%{_bindir} ln -s %{_libdir}/%{name}/bin/%{name} %{buildroot}%{_bindir}/%{name} for bin in %{name}-server rserver rserver-pam; do ln -s %{_libdir}/%{name}/bin/${bin} %{buildroot}%{_bindir}/${bin} done #squidf: install desktop file with same categories than R-base desktop-file-install \ --add-category="Science;Math" \ --remove-category="Development;IDE" \ --dir=%{buildroot}%{_datadir}/applications \ %{buildroot}%{_datadir}/applications/%{name}.desktop mkdir -p %{buildroot}%{_metainfodir} install -m 0644 %{SOURCE3} %{buildroot}%{_metainfodir}/ appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/%{name}.metainfo.xml # create required directories for rstudio-server (according to INSTALL) mkdir -p %{buildroot}%{_sharedstatedir}/%{name}-server # install the systemd service file and change /var/run -> /run install -D -m 0644 \ %{buildroot}%{_libdir}/%{name}/extras/systemd/%{name}-server.service \ %{buildroot}%{_unitdir}/%{name}-server.service sed -i 's@/var/run@/run@g' %{buildroot}%{_unitdir}/%{name}-server.service # install the PAM module mkdir -p %{buildroot}%{_sysconfdir}/pam.d install -m 0644 \ %{buildroot}%{_libdir}/%{name}/extras/pam/%{name} \ %{buildroot}%{_sysconfdir}/pam.d/%{name} # symlink the location where the bundled dependencies should be pushd %{buildroot}%{_libdir}/%{name}/bin ln -sf %{_bindir}/node node popd pushd %{buildroot}%{_libdir}/%{name}/resources ln -sf %{_datadir}/hunspell dictionaries ln -sf %{_datadir}/javascript/mathjax mathjax-%{mathjax_short} pushd presentation/revealjs/fonts for fnt in Lato*.ttf; do ln -sf %{_datadir}/fonts/lato/${fnt} ${fnt} done popd # move and symlink bundled libraries mv grid/datatables grid/datatables.bundled ln -sf ./datatables.bundled grid/datatables mv pdfjs pdfjs.bundled ln -sf ./pdfjs.bundled pdfjs mv presentation/revealjs presentation/revealjs.bundled ln -sf ./revealjs.bundled presentation/revealjs popd # clean up pushd %{buildroot}%{_libdir}/%{name} for f in .gitignore .Rbuildignore LICENSE README; do find . -name ${f} -delete done rm -rf {extras,INSTALL,COPYING,NOTICE,README.md,SOURCE,VERSION} popd #squidf: clean deprecated directories # Can be removed with MGA11 %pretrans -p path = "%{_libdir}/%{name}/resources/dictionaries" st = posix.stat(path) if st and st.type == "directory" then status = os.rename(path, path .. ".rpmmoved") if not status then suffix = 0 while not status do suffix = suffix + 1 status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix) end os.rename(path, path .. ".rpmmoved") end end path = "%{_libdir}/%{name}/resources/grid/datatables" st = posix.stat(path) if st and st.type == "directory" then status = os.rename(path, path .. ".rpmmoved") if not status then suffix = 0 while not status do suffix = suffix + 1 status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix) end os.rename(path, path .. ".rpmmoved") end end path = "%{_libdir}/%{name}/resources/presentation/revealjs" st = posix.stat(path) if st and st.type == "directory" then status = os.rename(path, path .. ".rpmmoved") if not status then suffix = 0 while not status do suffix = suffix + 1 status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix) end os.rename(path, path .. ".rpmmoved") end end path = "%{_libdir}/%{name}/resources/pdfjs" st = posix.stat(path) if st and st.type == "directory" then status = os.rename(path, path .. ".rpmmoved") if not status then suffix = 0 while not status do suffix = suffix + 1 status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix) end os.rename(path, path .. ".rpmmoved") end end %pre server # add user rstudio-server %_pre_useradd %{name}-server %{_localstatedir}/lib/%{name}-server /bin/false %post server %_tmpfilescreate %{_tmpfilesdir}/%{name}-server %_post_service %{name}-server %preun server %_preun_service %{name}-server %postun server %_postun_userdel %{name}-server %triggerun server -- %{name}-server chown -R %{name}-server:%{name}-server %{_sharedstatedir}/%{name}-server %files %{_bindir}/%{name} %dir %{_libdir}/%{name} %{_libdir}/%{name}/R %dir %{_libdir}/%{name}/bin %{_libdir}/%{name}/bin/node %{_libdir}/%{name}/bin/postback %{_libdir}/%{name}/bin/r-ldpath %{_libdir}/%{name}/bin/rpostback %{_libdir}/%{name}/bin/rsession %{_libdir}/%{name}/resources %{_libdir}/%{name}/www %{_libdir}/%{name}/www-symbolmaps %files common %license COPYING NOTICE %doc README.md %{_libdir}/%{name}/%{name}.png %{_libdir}/%{name}/bin/diagnostics %{_libdir}/%{name}/bin/%{name} %{_libdir}/%{name}/bin/%{name}-backtrace.sh %{_datadir}/applications/%{name}.desktop %{_datadir}/icons/hicolor/*/apps/* %{_datadir}/icons/hicolor/*/mimetypes/* %{_datadir}/mime/packages/%{name}.xml %{_datadir}/pixmaps/%{name}.png %{_metainfodir}/%{name}.metainfo.xml %files server %{_bindir}/%{name}-server %{_bindir}/rserver %{_bindir}/rserver-pam %{_libdir}/%{name}/bin/crash-handler-proxy %{_libdir}/%{name}/bin/rserver %{_libdir}/%{name}/bin/rserver-pam %{_libdir}/%{name}/bin/rserver-url %{_libdir}/%{name}/bin/%{name}-server %{_libdir}/%{name}/db %dir %{_sharedstatedir}/%{name}-server %{_unitdir}/%{name}-server.service %config(noreplace) %{_sysconfdir}/pam.d/%{name}