File collaboraoffice.spec of Package collaboraoffice

#
# spec file for package collaboraoffice
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# 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 https://bugs.opensuse.org/
#


%{!?aarch64:%global aarch64 aarch64 arm64 armv8}
# Urls
%define external_url https://dev-www.libreoffice.org/src/
%global core_hash a3b2f090ae24
%global dictionaries_hash 43e5151
%global translations_hash 65f49d9bf5e
%if 0%{?gcc_version} < 12
%global with_gcc 12
%endif
Name:           collaboraoffice
Version:        25.4.7.2
Release:        0
Summary:        A Free Office Suite
License:        LGPL-3.0-or-later AND MPL-2.0+
Group:          Productivity/Office/Suite
URL:            https://www.documentfoundation.org/
Source0:        core-%{core_hash}.tar.xz
Source1:        dictionaries-%{dictionaries_hash}.tar.xz
Source2:        translations-%{translations_hash}.tar.xz
Source101:      %{external_url}/pdfium-7012.tar.bz2
Source102:      %{external_url}/pixman-0.42.2.tar.gz
Source103:      %{external_url}/cairo-1.17.6.tar.xz
Source104:      %{external_url}/afdko-4.0.2.tar.gz
Source105:      %{external_url}/CoinMP-1.8.4.tgz
Source106:      %{external_url}/antlr4-cpp-runtime-4.13.2-source.zip
Source107:      https://dev-www.libreoffice.org/extern/f543e6e2d7275557a839a164941c0a86e5f2c3f2a0042bfc434c88c6dde9e140-opens___.ttf
Patch0:         0001-Upgrade-mdds-to-3.0.0-and-liborcus-to-0.20.0.patch
Patch3:         mediawiki-no-broken-help.diff
# PATCH-FIX-OPENSUSE boo#1186110 fix GCC 11 error
Patch6:         gcc11-fix-error.patch
# PATCH-FIX-SUSE Fix make distro-pack-install
Patch15:        fix-sdk-idl.patch
# save time by relying on rpm check rather than doing stupid find+grep
Patch991:       libreoffice-no-destdircheck.patch
# PATCH-FIX-OPENSUSE override date in clucene files (boo#1047218)
Patch995:       reproducible-clucene.patch
# Add .key (Apple Keynote) files to Bash completion (tdf#167995)
Patch996:       bash-completion-key.patch
BuildRequires:  abseil-cpp-devel
BuildRequires:  ant
BuildRequires:  argon2-devel
BuildRequires:  autoconf
BuildRequires:  awk
BuildRequires:  bison
BuildRequires:  bsh2
BuildRequires:  cups-devel
BuildRequires:  curl-devel >= 7.68.0
BuildRequires:  dejavu-fonts
BuildRequires:  doxygen >= 1.8.4
BuildRequires:  dragonbox-devel
BuildRequires:  fast_float-devel
BuildRequires:  fdupes
BuildRequires:  fixmath-devel
BuildRequires:  flex >= 2.6.0
BuildRequires:  flute
BuildRequires:  fontforge
BuildRequires:  frozen-devel
BuildRequires:  gcc%{?with_gcc}
BuildRequires:  gcc%{?with_gcc}-c++
BuildRequires:  glm-devel
BuildRequires:  google-carlito-fonts
BuildRequires:  gperf >= 3.1
BuildRequires:  graphviz
BuildRequires:  hyphen-devel
# genbrk binary is required
BuildRequires:  icu
BuildRequires:  java-devel >= 1.8
BuildRequires:  junit4
BuildRequires:  libbase
BuildRequires:  libboost_date_time-devel
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_iostreams-devel
BuildRequires:  libboost_locale-devel
BuildRequires:  libboost_thread-devel
BuildRequires:  libbox2d-devel
BuildRequires:  libcmis-devel
BuildRequires:  libcppunit-devel >= 1.14.0
BuildRequires:  liberation-fonts
BuildRequires:  libexif
BuildRequires:  libfonts
BuildRequires:  libformula
BuildRequires:  libgpgmepp-devel >= 1.14
BuildRequires:  libjpeg-devel
BuildRequires:  liblayout
BuildRequires:  libloader
BuildRequires:  libmariadb-devel
BuildRequires:  librepository
BuildRequires:  libserializer
BuildRequires:  libtool
BuildRequires:  libwebp-devel
BuildRequires:  libzstd-devel
BuildRequires:  lpsolve-devel
BuildRequires:  make
BuildRequires:  openldap2-devel
BuildRequires:  pkgconfig
# needed by python3_sitelib
BuildRequires:  python-rpm-macros
BuildRequires:  python3-lxml
BuildRequires:  python3-xml
BuildRequires:  rhino
BuildRequires:  sac
BuildRequires:  ucpp
BuildRequires:  unixODBC-devel
BuildRequires:  unzip
BuildRequires:  update-desktop-files
BuildRequires:  xml-commons-apis
BuildRequires:  xz
BuildRequires:  zip
BuildRequires:  zlib-devel
BuildRequires:  zxcvbn-devel
BuildRequires:  perl(Archive::Zip)
BuildRequires:  perl(Digest::MD5)
BuildRequires:  pkgconfig(Qt6Core)
BuildRequires:  pkgconfig(Qt6Gui)
BuildRequires:  pkgconfig(Qt6Multimedia)
BuildRequires:  pkgconfig(Qt6MultimediaWidgets)
BuildRequires:  pkgconfig(Qt6Network)
BuildRequires:  pkgconfig(Qt6Widgets)
BuildRequires:  pkgconfig(apr-util-1)
BuildRequires:  pkgconfig(atk) >= 2.28
BuildRequires:  pkgconfig(bluez)
BuildRequires:  pkgconfig(dbus-1) >= 0.60
BuildRequires:  pkgconfig(epoxy) >= 1.2
BuildRequires:  pkgconfig(expat)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(glib-2.0) >= 2.40
BuildRequires:  pkgconfig(glu)
BuildRequires:  pkgconfig(gobject-introspection-1.0)
BuildRequires:  pkgconfig(graphite2) >= 0.9.3
BuildRequires:  pkgconfig(gssrpc)
BuildRequires:  pkgconfig(gstreamer-plugins-base-1.0)
BuildRequires:  pkgconfig(gtk+-3.0) >= 3.20
BuildRequires:  pkgconfig(harfbuzz) >= 5.1.0
BuildRequires:  pkgconfig(harfbuzz-icu) >= 5.1.0
BuildRequires:  pkgconfig(hunspell)
BuildRequires:  pkgconfig(icu-i18n)
BuildRequires:  pkgconfig(krb5)
BuildRequires:  pkgconfig(lcms2)
BuildRequires:  pkgconfig(libabw-0.1)
BuildRequires:  pkgconfig(libcdr-0.1) >= 0.1
BuildRequires:  pkgconfig(libclucene-core)
BuildRequires:  pkgconfig(libe-book-0.1) >= 0.1.2
BuildRequires:  pkgconfig(libeot) >= 0.01
BuildRequires:  pkgconfig(libepubgen-0.1)
BuildRequires:  pkgconfig(libetonyek-0.1) >= 0.1.10
BuildRequires:  pkgconfig(libexttextcat) >= 3.4.1
BuildRequires:  pkgconfig(libfreehand-0.1)
BuildRequires:  pkgconfig(liblangtag)
BuildRequires:  pkgconfig(libmspub-0.1) >= 0.1
BuildRequires:  pkgconfig(libmwaw-0.3) >= 0.3.21
BuildRequires:  pkgconfig(libnumbertext) >= 1.0.6
BuildRequires:  pkgconfig(libodfgen-0.1) >= 0.1.4
BuildRequires:  pkgconfig(libopenjp2)
BuildRequires:  pkgconfig(liborcus-0.20) >= 0.20.0
BuildRequires:  pkgconfig(libpagemaker-0.0)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(libpq)
BuildRequires:  pkgconfig(libqxp-0.0)
BuildRequires:  pkgconfig(librevenge-0.0) >= 0.0.1
BuildRequires:  pkgconfig(librsvg-2.0)
BuildRequires:  pkgconfig(libstaroffice-0.0) >= 0.0.7
BuildRequires:  pkgconfig(libtiff-4) >= 4.0.10
BuildRequires:  pkgconfig(libvisio-0.1) >= 0.1
BuildRequires:  pkgconfig(libwpd-0.10) >= 0.10
BuildRequires:  pkgconfig(libwpg-0.3)
BuildRequires:  pkgconfig(libwps-0.4) >= 0.4.11
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  pkgconfig(libxslt)
BuildRequires:  pkgconfig(libzmf-0.0)
BuildRequires:  pkgconfig(md4c)
BuildRequires:  pkgconfig(mdds-3.0)
BuildRequires:  pkgconfig(mythes)
BuildRequires:  pkgconfig(nspr) >= 4.8
BuildRequires:  pkgconfig(nss) >= 3.9.3
BuildRequires:  pkgconfig(poppler) >= 21.01.0
BuildRequires:  pkgconfig(poppler-cpp)
BuildRequires:  pkgconfig(python3)
BuildRequires:  pkgconfig(redland)
BuildRequires:  pkgconfig(sane-backends)
BuildRequires:  pkgconfig(xmlsec1-nss) >= 1.2.35
BuildRequires:  pkgconfig(xrandr)
BuildRequires:  pkgconfig(xt)
BuildRequires:  pkgconfig(zxing)
%if 0%{?suse_version} > 1500
BuildRequires:  strip-nondeterminism
%endif

%description
Collabora Office Desktop brings the familiar Collabora Online experience
to your computer - so you can create, edit, and present with a beautiful,
modern UI. Built on trusted LibreOffice technology and backed by the
largest team of LibreOffice developers worldwide, it delivers excellent
interoperability with ODF and Microsoft Office formats (DOCX\/XLSX\/PPTX),
and exports to PDF with ease. Your documents stay on your device unless
you choose to share them - privacy by design.

%package framework
Summary:        A Free Office Suite (Framework)
Group:          Productivity/Office/Suite

%description framework
Collabora Office Desktop brings the familiar Collabora Online experience
to your computer - so you can create, edit, and present with a beautiful,
modern UI. Built on trusted LibreOffice technology and backed by the
largest team of LibreOffice developers worldwide, it delivers excellent
interoperability with ODF and Microsoft Office formats (DOCX\/XLSX\/PPTX),
and exports to PDF with ease. Your documents stay on your device unless
you choose to share them - privacy by design.

%prep
%setup -q -a1 -a2 -n core-%{core_hash}
rm -rf translations && ln -s translations-%{translations_hash} translations
rm -rf dictionaries && ln -s dictionaries-%{dictionaries_hash} dictionaries
%patch -P 0 -p1
%patch -P 3
%patch -P 6 -p1
%patch -P 15 -p1
%patch -P 991 -p1
%patch -P 996 -p1

# Following two tests are really flaky
sed -i -e /CppunitTest_dbaccess_hsqldb_test/d dbaccess/Module_dbaccess.mk
sed -i -e s/CppunitTest_dbaccess_RowSetClones// dbaccess/Module_dbaccess.mk
# Fails due to diff caused by fonts
sed -i -e /CppunitTest_sw_rtfimport/d sw/Module_sw.mk
# only due to the above
sed -i -e /CppunitTest_sw_uiwriter/d sw/Module_sw.mk
# The gpg files are not loaded properly
sed -i -e /CPPUNIT_TEST\(testODFEncryptedGPG\)/d xmlsecurity/qa/unit/signing/signing.cxx
# breaks on LTO https://bugs.documentfoundation.org/show_bug.cgi?id=126442
sed -i -e /CppunitTest_sw_apitests/d sw/Module_sw.mk
# -flto=thin is not supported by gcc
sed -i -e s/-flto=thin/-flto/ solenv/gbuild/platform/com_GCC_defs.mk
# Disable failing tests on ppc64le for now
%ifarch ppc64le
sed -i -e /CppunitTest_sc_addin_functions_test/d sc/Module_sc.mk
sed -i -e /CppunitTest_sc_array_functions_test/d sc/Module_sc.mk
sed -i -e /CppunitTest_sc_dataprovider/d sc/Module_sc.mk # https://bugs.documentfoundation.org/show_bug.cgi?id=127099
sed -i -e /CppunitTest_sc_financial_functions_test/d sc/Module_sc.mk # https://bugs.documentfoundation.org/show_bug.cgi?id=127083
sed -i -e /CppunitTest_sc_statistical_functions_test/d sc/Module_sc.mk
%endif
if grep -q setSegmentInfoStartVersion %{_includedir}/CLucene/index/IndexWriter.h ; then
%patch -P 995 -p1
fi

# Do not generate doxygen timestamp
echo "HTML_TIMESTAMP = NO" >> odk/docs/cpp/Doxyfile
echo "HTML_TIMESTAMP = NO" >> odk/docs/idl/Doxyfile

%build
# Strip lto from %_lto_cflags as the project has --enable-lto option
%define _lto_cflags %{nil}

# use RPM_OPT_FLAGS, ...
# remove big debugsymbols as we simply consume too much space
%if %{with lto}
ARCH_FLAGS="`echo %{optflags} -flifetime-dse=1 | sed -e 's/^-g /-g1 /g' -e 's/ -g / -g1 /g' -e 's/ -g$/ -g1/g'`"
%else
ARCH_FLAGS="`echo %{optflags} | sed -e 's/^-g /-g1 /g' -e 's/ -g / -g1 /g' -e 's/ -g$/ -g1/g'`"
%endif
CFLAGS="$ARCH_FLAGS -fPIC -fstack-protector-all"
CXXFLAGS="-std=c++20 $ARCH_FLAGS"
export ARCH_FLAGS CFLAGS CXXFLAGS

%if 0%{?with_gcc}
export CC=gcc-%{with_gcc}
export CXX=g++-%{with_gcc}
%endif

# do not run configure in autogen but use macro later
export NOCONFIGURE=yes
./autogen.sh
%configure \
    $(echo %{?_smp_mflags} | sed 's/-j/--with-parallelism=/') \
    --disable-community-flavor \
    --disable-dbus \
    --disable-dconf \
    --disable-epm \
    --disable-evolution2 \
    --disable-ext-nlpsolver \
    --disable-ext-wiki-publisher \
    --disable-fetch-external \
    --disable-firebird-sdbc \
    --disable-gio \
    --disable-gstreamer-1-0 \
    --disable-gtk3 \
    --disable-gui \
    --disable-kf5 \
    --disable-lotuswordpro \
    --disable-lpsolve \
    --disable-noto-font \
    --disable-odk \
    --disable-online-update \
    --disable-poppler \
    --disable-postgresql-sdbc \
    --disable-qt5 \
    --disable-randr \
    --disable-report-builder \
    --disable-sal-log \
    --disable-scripting-beanshell \
    --disable-scripting-javascript \
    --disable-sdremote \
    --disable-sdremote-bluetooth \
    --enable-cairo-rgba \
    --enable-extension-integration \
    --enable-hardening-flags \
    --enable-mergelibs \
    --enable-mpl-subset \
    --enable-release-build \
    --enable-symbols \
    --with-system-libs \
    --with-branding=icon-themes/galaxy/brand_cp \
    --without-docrepair-fonts \
    --with-external-tar="$RPM_SOURCE_DIR" \
    --without-fonts \
    --with-galleries=no \
    --with-lang=ALL \
    --with-linker-hash-style=both \
    --without-buildconfig-recorded \
    --without-help \
    --without-java \
    --without-junit \
    --without-lxml \
    --without-myspell-dicts \
    --with-system-abseil \
    --with-system-argon2 \
    --with-system-boost \
    --with-system-box2d \
    --without-system-cairo \
    --with-system-clucene \
    --without-system-coinmp \
    --with-system-cppunit \
    --with-system-dragonbox \
    --with-system-frozen \
    --with-system-glm \
    --with-system-jpeg \
    --with-system-libabw \
    --with-system-libcdr \
    --with-system-libcmis \
    --with-system-libebook \
    --with-system-libeot \
    --with-system-libepubgen \
    --with-system-libetonyek \
    --with-system-libexttextcat \
    --with-system-libfixmath \
    --with-system-libfreehand \
    --with-system-liblangtag \
    --with-system-libmspub \
    --with-system-libmwaw \
    --with-system-libnumbertext \
    --with-system-libodfgen \
    --with-system-libpagemaker \
    --with-system-libqxp \
    --with-system-librevenge \
    --with-system-libstaroffice \
    --with-system-libvisio \
    --with-system-libwpd \
    --with-system-libwpg \
    --with-system-libwps \
    --with-system-libzmf \
    --with-system-mdds \
    --with-system-odbc \
    --with-system-openldap \
    --with-system-orcus \
    --with-system-redland \
    --with-system-sane \
    --with-system-xmlsec \
    --with-system-zxcvbn \
    --with-system-zxing \
    --with-system-altlinuxhyph \
    --with-system-curl \
    --with-system-dicts \
    --with-system-expat \
    --with-system-fontconfig \
    --with-system-freetype \
    --with-system-graphite \
    --with-system-harfbuzz \
    --with-system-hunspell \
    --with-system-icu \
    --with-system-lcms2 \
    --with-system-libpng \
    --with-system-libtiff \
    --with-system-libwebp \
    --with-system-libxml \
    --with-system-mythes \
    --with-system-nss \
    --with-system-openssl \
    --with-system-zlib \
    --with-theme='colibre colibre_svg' \
    --with-vendor=SUSE

# just call make here as we added the jobs in configure
%make_build verbose=t build

%install
make verbose=t DESTDIR=%{buildroot} distro-pack-install

rm -rf %{buildroot}%{_bindir}
rm -rf %{buildroot}%{_datadir}

# Libreofficekit headers
install -dm 0755 %{buildroot}%{_libdir}/%{name}/include/LibreOfficeKit/
install -m 0644 include/LibreOfficeKit/* %{buildroot}%{_libdir}/%{name}/include/LibreOfficeKit/

# We have ton of duped files so run over it
%fdupes %{buildroot}%{_prefix}

%files framework
%{_libdir}/%{name}

%changelog
openSUSE Build Service is sponsored by