File libreoffice-online.spec of Package libreoffice-online
#
# spec file for package libreoffice-online
#
# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2020 Hillwood Yang <hillwood@opensuse.org>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# Once the concurrent connection performance have been optimized, the limit
# number can be increased
# Please refer https://www.libreoffice.org/download/libreoffice-online/
%define max_connections 20
%define max_documents 10
%ifarch x86_64 aarch64
%define with_cypress 1
%else
%define with_cypress 0
%endif
Name: libreoffice-online
Version: 7.0.1.1
Release: 0
Summary: Libreoffice Online
License: MPL-2.0+
Group: Productivity/Networking/Web/Utilities
Url: https://www.libreoffice.org
Source0: https://github.com/LibreOffice/online/archive/libreoffice-%{version}.tar.gz
Source1: loolwsd-setup.in
Source2: README.SUSE
Source99: %{name}-rpmlintrc
# PATCH-FIX-OPENSUSE loolwsd-config.patch hillwood@opensuse.org
Patch0: loolwsd-config.patch
# PATCH-FIX-OPENSUSE fix-version-hash.patch hillwood@opensuse.org
# Github tags releases don't provide git hash in source package, should patch
# configure.ac to provide the git hash manually.
Patch1: fix-version-hash.patch
# PATCH-FIX-UPSTREAM support-ppc64.patch hillwood@opensuse.org Support IBM Power8 and higher
Patch2: support-ppc64.patch
# PATCH-FIX-UPSTREAM loolwsd-timer.patch hillwood@opensuse.org
# Use systemd timer instead of cron job (boo#1177528)
Patch3: loolwsd-timer.patch
# PATCH-FIX-UPSTREAM fix-decode.patch hillwood@opensuse.org
# Trying to download file with eg. space in the name
# become impossible. This patch decodes the string to fix the issue.
Patch4: fix-decode.patch
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: intltool
BuildRequires: libtool
BuildRequires: libreoffice-sdk
BuildRequires: nodejs-devel
BuildRequires: poco-devel
BuildRequires: python3-polib
BuildRequires: python3-lxml
BuildRequires: pam-devel
BuildRequires: libreofficekit-devel
BuildRequires: npm
BuildRequires: libcap-progs
BuildRequires: git-core
BuildRequires: pkgconfig(cppunit)
BuildRequires: pkgconfig(openssl) >= 1.0.1
BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(libcap)
BuildRequires: pkgconfig(libseccomp)
BuildRequires: systemd-rpm-macros
BuildRequires: pkgconfig(systemd)
%if %{with_cypress}
BuildRequires: chromium
%endif
Recommends: python3-certbot
Recommends: noto-sans-fonts
Recommends: noto-mono-fonts
Recommends: noto-coloremoji-fonts
# Make sure libreoffice-online can display cjk characters
Recommends: noto-serif-sc-fonts-full
Recommends: noto-serif-tc-fonts-full
Recommends: noto-serif-jp-fonts-full
Recommends: noto-serif-kr-fonts-full
Recommends: noto-serif-sc-fonts-full
Recommends: noto-serif-tc-fonts-full
Recommends: noto-serif-jp-fonts-full
Recommends: noto-serif-kr-fonts-full
Requires: libreoffice-writer
Requires: libreoffice-calc
Requires: libreoffice-impress
Requires: npm
Requires: nodejs
Requires(post): libcap-progs
Requires(post): fontconfig
Requires(post): %{fillup_prereq}
PreReq: permissions
# no 32bit supported
ExclusiveArch: x86_64 aarch64 ppc64le
Provides: loolwsd = %{version}-%{release}
Obsoletes: loolwsd < %{version}-%{release}
Provides: loleaflet = %{version}-%{release}
Obsoletes: loleaflet < %{version}-%{release}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{?systemd_ordering}
%description
LibreOffice Online is a server service built from the main LibreOffice project
code, which provides display and collaborative visual editing of a range of
document types in a web browser. It does not include any form of file system. To
be fully functional, it has to be integrated with file access and authentication
provision from an underlying stack of software.
For anything more than casual use it also needs to be deployed with due
consideration for load balancing and other scaling issues. As such, LibreOffice
Online can be considered an enabling technology for the public cloud of ISPs or
the private cloud of enterprises and large organizations, when integrated - for
example - with an enterprise file sharing or a groupware solution.
%package apache2
Summary: Apache2 reverse proxy configuration templet
Requires: %{name} = %{version}
Supplements: packageand(libreoffice-online:apache2)
%description apache2
Apache2 reverse proxy configuration for Collabora Online / LibreOffice Online.
%package nginx
Summary: Nginx reverse proxy configuration templet
Requires: %{name} = %{version}
Supplements: packageand(libreoffice-online:nginx)
%description nginx
Nginx reverse proxy configuration for Collabora Online / LibreOffice Online.
%prep
%setup -q -n online-libreoffice-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
cp %{SOURCE2} .
%build
NOCONFIGURE=1 ./autogen.sh
%configure \
--enable-silent-rules \
--disable-setcap \
--enable-debug \
%if %{with_cypress}
--enable-cypress \
%endif
--docdir=%{_docdir}/libreoffice-online \
--htmldir=%{_docdir}/libreoffice-online/html \
--with-logfile=%{_localstatedir}/log/libreoffice-online/loolwsd.log \
--with-lo-path=%{_libdir}/libreoffice \
--with-lokit-path=%{_includedir}/LibreOfficeKit \
--with-max-connections=%{max_connections} \
--with-max-documents=%{max_documents} \
--with-app-name="LibreOffice Online" \
--with-vendor="openSUSE"
make CXXFLAGS="%{optflags} -Wno-error" %{?_smp_mflags}
%install
%make_install
install -d %{buildroot}%{_unitdir}
install -m 0644 loolwsd.service %{buildroot}%{_unitdir}
install -m 0644 loolwsd.timer %{buildroot}%{_unitdir}
mkdir -p %{buildroot}%{_sbindir}
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcloolwsd
install -D -m 644 sysconfig.loolwsd %{buildroot}%{_fillupdir}/sysconfig.loolwsd
install -m 755 %{SOURCE1} %{buildroot}%{_bindir}/loolwsd-setup
rm -rf %{buildroot}%{_docdir}
mkdir -p %{buildroot}%{_sysconfdir}/pam.d
cat > %{buildroot}%{_sysconfdir}/pam.d/loolwsd <<EOF
auth required pam_unix.so
account required pam_unix.so
EOF
%fdupes %{buildroot}%{_datadir}/loolwsd
# %verifyscript
# %verify_permissions -e %{_bindir}/loolforkit
%pre
%service_add_pre loolwsd.service loolwsd.timer
getent group lool >/dev/null || groupadd -r lool
getent passwd lool >/dev/null || useradd -g lool -G root -r lool
%post
%service_add_post loolwsd.service loolwsd.timer
# %set_permissions %{_bindir}/loolforkit
setcap cap_fowner,cap_mknod,cap_sys_chroot=ep %{_bindir}/loolforkit
mkdir -p %{_localstatedir}/cache/loolwsd
chown lool:lool %{_localstatedir}/cache/loolwsd
rm -rf %{_localstatedir}/cache/loolwsd/*
# Figure out where LO is installed, let's hope it is not a mount point
# Create a directory for loolwsd on the same file system
rm -rf %{_localstatedir}/lib/libreoffice-online
mkdir -p %{_localstatedir}/lib/libreoffice-online/systemplate
mkdir -p %{_localstatedir}/lib/libreoffice-online/child-roots
mkdir -p %{_localstatedir}/lib/libreoffice-online/jails
# chown lool:lool %{_localstatedir}/lib/libreoffice-online
# chown lool:lool %{_localstatedir}/lib/libreoffice-online/systemplate
# chown lool:lool %{_localstatedir}/lib/libreoffice-online/child-roots
chown lool:lool %{_localstatedir}/lib/libreoffice-online/jails
fc-cache
loolwsd-systemplate-setup %{_localstatedir}/lib/libreoffice-online/systemplate %{_libdir}/libreoffice >/dev/null 2>&1
loolwsd-generate-proof-key >/dev/null 2>&1
%{fillup_only -n loolwsd}
%preun
%service_del_preun loolwsd.service loolwsd.timer
%postun
%service_del_postun loolwsd.service loolwsd.timer
%files
%defattr(-,root,root)
%doc ChangeLog PROBLEMS README.SUSE
%doc wsd/README wsd/README.vars wsd/metrics.txt wsd/protocol.txt wsd/reference.md
%license COPYING
%{_bindir}/lool*
%{_sbindir}/rcloolwsd
%{_datadir}/loolwsd
%{_unitdir}/loolwsd.*
%dir %{_sysconfdir}/loolwsd
%config(noreplace) %{_sysconfdir}/loolwsd/loolwsd.xml
%config(noreplace) %{_sysconfdir}/loolwsd/loolkitconfig.xcu
%config %{_sysconfdir}/pam.d/loolwsd
%{_mandir}/man1/*
%{_fillupdir}/sysconfig.loolwsd
%files apache2
%defattr(-,root,root)
%dir %{_sysconfdir}/apache2
%dir %{_sysconfdir}/apache2/conf-available
%config %{_sysconfdir}/apache2/conf-available/loolwsd.conf
%files nginx
%defattr(-,root,root)
%dir %{_sysconfdir}/nginx
%dir %{_sysconfdir}/nginx/snippets
%config %{_sysconfdir}/nginx/snippets/loolwsd.conf
%changelog