about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/office/libreoffice/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-06-16 06:56:35 +0000
committerAlyssa Ross <hi@alyssa.is>2023-06-16 06:56:35 +0000
commit99fcaeccb89621dd492203ce1f2d551c06f228ed (patch)
tree41cb730ae07383004789779b0f6e11cb3f4642a3 /nixpkgs/pkgs/applications/office/libreoffice/default.nix
parent59c5f5ac8682acc13bb22bc29c7cf02f7d75f01f (diff)
parent75a5ebf473cd60148ba9aec0d219f72e5cf52519 (diff)
downloadnixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.gz
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.bz2
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.lz
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.xz
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.zst
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.zip
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/nixos/modules/config/console.nix
	nixpkgs/nixos/modules/services/mail/mailman.nix
	nixpkgs/nixos/modules/services/mail/public-inbox.nix
	nixpkgs/nixos/modules/services/mail/rss2email.nix
	nixpkgs/nixos/modules/services/networking/ssh/sshd.nix
	nixpkgs/pkgs/applications/networking/instant-messengers/dino/default.nix
	nixpkgs/pkgs/applications/networking/irc/weechat/default.nix
	nixpkgs/pkgs/applications/window-managers/sway/default.nix
	nixpkgs/pkgs/build-support/go/module.nix
	nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix
	nixpkgs/pkgs/development/interpreters/python/default.nix
	nixpkgs/pkgs/development/node-packages/overrides.nix
	nixpkgs/pkgs/development/tools/b4/default.nix
	nixpkgs/pkgs/servers/dict/dictd-db.nix
	nixpkgs/pkgs/servers/mail/public-inbox/default.nix
	nixpkgs/pkgs/tools/security/pinentry/default.nix
	nixpkgs/pkgs/tools/text/unoconv/default.nix
	nixpkgs/pkgs/top-level/all-packages.nix
Diffstat (limited to 'nixpkgs/pkgs/applications/office/libreoffice/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/office/libreoffice/default.nix170
1 files changed, 106 insertions, 64 deletions
diff --git a/nixpkgs/pkgs/applications/office/libreoffice/default.nix b/nixpkgs/pkgs/applications/office/libreoffice/default.nix
index a75c09452135..25e8f18998e2 100644
--- a/nixpkgs/pkgs/applications/office/libreoffice/default.nix
+++ b/nixpkgs/pkgs/applications/office/libreoffice/default.nix
@@ -1,6 +1,7 @@
 { stdenv
 , fetchurl
 , lib
+, substituteAll
 , pam
 , python3
 , libxslt
@@ -32,12 +33,12 @@
 , which
 , icu
 , boost
-, jdk
+, jdk17
 , ant
 , cups
 , xorg
 , fontforge
-, jre_minimal
+, jre17_minimal
 , openssl
 , gperf
 , cppunit
@@ -88,27 +89,45 @@
 , gdb
 , commonsLogging
 , librdf_rasqal
-, wrapGAppsHook
 , gnome
 , glib
 , ncurses
 , libepoxy
 , gpgme
+, libwebp
 , abseil-cpp
-, langs ? [ "ca" "cs" "da" "de" "en-GB" "en-US" "eo" "es" "fr" "hu" "it" "ja" "nl" "pl" "pt" "pt-BR" "ro" "ru" "sl" "uk" "zh-CN" ]
+, langs ? [ "ar" "ca" "cs" "da" "de" "en-GB" "en-US" "eo" "es" "fr" "hu" "it" "ja" "nl" "pl" "pt" "pt-BR" "ro" "ru" "sl" "tr" "uk" "zh-CN" ]
 , withHelp ? true
 , kdeIntegration ? false
 , mkDerivation ? null
 , qtbase ? null
 , qtx11extras ? null
+, qtwayland ? null
 , ki18n ? null
 , kconfig ? null
 , kcoreaddons ? null
 , kio ? null
 , kwindowsystem ? null
-, wrapQtAppsHook ? null
 , variant ? "fresh"
 , symlinkJoin
+, postgresql
+# The rest are used only in passthru, for the wrapper
+, kauth ? null
+, kcompletion ? null
+, kconfigwidgets ? null
+, kglobalaccel ? null
+, kitemviews ? null
+, knotifications ? null
+, ktextwidgets ? null
+, kwidgetsaddons ? null
+, kxmlgui ? null
+, phonon ? null
+, qtdeclarative ? null
+, qtquickcontrols ? null
+, qtsvg ? null
+, qttools ? null
+, solid ? null
+, sonnet ? null
 } @ args:
 
 assert builtins.elem variant [ "fresh" "still" ];
@@ -116,11 +135,11 @@ assert builtins.elem variant [ "fresh" "still" ];
 let
   inherit (lib)
     flatten flip
-    concatMapStrings concatMapStringsSep concatStringsSep
+    concatMapStrings concatStringsSep
     getDev getLib
-    optional optionals optionalString;
+    optionals optionalString;
 
-  jre' = jre_minimal.override {
+  jre' = jre17_minimal.override {
     modules = [ "java.base" "java.desktop" "java.logging" "java.sql" ];
   };
 
@@ -128,13 +147,14 @@ let
 
   primary-src = importVariant "primary.nix" { inherit fetchurl; };
 
-  inherit (primary-src) major minor subdir version;
+  inherit (primary-src) major minor version;
 
   langsSpaces = concatStringsSep " " langs;
 
   mkDrv = if kdeIntegration then mkDerivation else stdenv.mkDerivation;
 
   srcs = {
+    primary = primary-src;
     third_party =
       map (x: ((fetchurl { inherit (x) url sha256 name; }) // { inherit (x) md5name md5; }))
         (importVariant "download.nix" ++ [
@@ -172,12 +192,12 @@ in
 
   inherit (primary-src) src;
 
-  outputs = [ "out" "dev" ];
-
-  NIX_CFLAGS_COMPILE = [
+  env.NIX_CFLAGS_COMPILE = toString ([
     "-I${librdf_rasqal}/include/rasqal" # librdf_redland refers to rasqal.h instead of rasqal/rasqal.h
     "-fno-visibility-inlines-hidden" # https://bugs.documentfoundation.org/show_bug.cgi?id=78174#c10
-  ];
+  ] ++ optionals (stdenv.isLinux && stdenv.isAarch64 && variant == "still") [
+    "-O2" # https://bugs.gentoo.org/727188
+  ]);
 
   tarballPath = "external/tarballs";
 
@@ -194,19 +214,6 @@ in
     tar -xf ${srcs.translations}
   '';
 
-  patches = [
-    ./skip-failed-test-with-icu70.patch
-
-    # Fix build with poppler 22.03
-    (fetchurl {
-      url = "https://github.com/archlinux/svntogit-packages/raw/f82958b9538f86e41b51f1ba7134968d2f3788d1/trunk/poppler-22.03.0.patch";
-      sha256 = "5h4qJmx6Q3Q3dHUlSi8JXBziN2mAswGVWk5aDTLTwls=";
-    })
-
-    # Fix build with poppler 22.04
-    ./poppler-22-04-0.patch
-  ];
-
   ### QT/KDE
   #
   # configure.ac assumes that the first directory that contains headers and
@@ -224,7 +231,7 @@ in
   # add the missing dependencies to it).
   postPatch = ''
     substituteInPlace shell/source/unix/exec/shellexec.cxx \
-      --replace /usr/bin/xdg-open ${if kdeIntegration then "kde-open5" else "xdg-open"}
+      --replace xdg-open ${if kdeIntegration then "kde-open5" else "xdg-open"}
 
     # configure checks for header 'gpgme++/gpgmepp_version.h',
     # and if it is found (no matter where) uses a hardcoded path
@@ -339,10 +346,19 @@ in
       sed -e '/CPPUNIT_TEST(testEmbeddedDataSource);/d' -i './sw/qa/extras/uiwriter/uiwriter.cxx'
       sed -e '/CPPUNIT_TEST(testTdf96479);/d' -i './sw/qa/extras/uiwriter/uiwriter.cxx'
       sed -e '/CPPUNIT_TEST(testInconsistentBookmark);/d' -i './sw/qa/extras/uiwriter/uiwriter.cxx'
+      sed -e /CppunitTest_sw_layoutwriter/d -i sw/Module_sw.mk
+      sed -e /CppunitTest_sw_htmlimport/d -i sw/Module_sw.mk
+      sed -e /CppunitTest_sw_core_layout/d -i sw/Module_sw.mk
+      sed -e /CppunitTest_sw_uiwriter6/d -i sw/Module_sw.mk
+      sed -e /CppunitTest_sdext_pdfimport/d -i sdext/Module_sdext.mk
+      sed -e /CppunitTest_vcl_pdfexport/d -i vcl/Module_vcl.mk
       sed -e "s/DECLARE_SW_ROUNDTRIP_TEST(\([_a-zA-Z0-9.]\+\)[, ].*, *\([_a-zA-Z0-9.]\+\))/class \\1: public \\2 { public: void verify() override; }; void \\1::verify() /" -i "sw/qa/extras/ooxmlexport/ooxmlexport9.cxx"
       sed -e "s/DECLARE_SW_ROUNDTRIP_TEST(\([_a-zA-Z0-9.]\+\)[, ].*, *\([_a-zA-Z0-9.]\+\))/class \\1: public \\2 { public: void verify() override; }; void \\1::verify() /" -i "sw/qa/extras/ooxmlexport/ooxmlencryption.cxx"
       sed -e "s/DECLARE_SW_ROUNDTRIP_TEST(\([_a-zA-Z0-9.]\+\)[, ].*, *\([_a-zA-Z0-9.]\+\))/class \\1: public \\2 { public: void verify() override; }; void \\1::verify() /" -i "sw/qa/extras/odfexport/odfexport.cxx"
       sed -e "s/DECLARE_SW_ROUNDTRIP_TEST(\([_a-zA-Z0-9.]\+\)[, ].*, *\([_a-zA-Z0-9.]\+\))/class \\1: public \\2 { public: void verify() override; }; void \\1::verify() /" -i "sw/qa/extras/unowriter/unowriter.cxx"
+
+      # testReqIfTable fails since libxml2: 2.10.3 -> 2.10.4
+      sed -e 's@.*"/html/body/div/table/tr/th".*@//&@' -i sw/qa/extras/htmlexport/htmlexport.cxx
     ''
     # This to avoid using /lib:/usr/lib at linking
     + ''
@@ -361,34 +377,21 @@ in
 
   # It installs only things to $out/lib/libreoffice
   postInstall = ''
-    mkdir -p $out/bin $out/share/desktop
-
-    mkdir -p "$out/share/gsettings-schemas/collected-for-libreoffice/glib-2.0/schemas/"
-
-    for a in sbase scalc sdraw smath swriter simpress soffice unopkg; do
-      ln -s $out/lib/libreoffice/program/$a $out/bin/$a
-    done
-
-    ln -s $out/bin/soffice $out/bin/libreoffice
+    mkdir -p $out/share
     ln -s $out/lib/libreoffice/share/xdg $out/share/applications
 
-    for f in $out/share/applications/*.desktop; do
-      substituteInPlace "$f" \
-        --replace "Exec=libreofficedev${major}.${minor}" "Exec=libreoffice" \
-        --replace "Exec=libreoffice${major}.${minor}"    "Exec=libreoffice"
-    done
-
     cp -r sysui/desktop/icons  "$out/share"
     sed -re 's@Icon=libreoffice(dev)?[0-9.]*-?@Icon=@' -i "$out/share/applications/"*.desktop
 
-    mkdir -p $dev
-    cp -r include $dev
-  '' + optionalString kdeIntegration ''
-    for prog in $out/bin/*; do
-      wrapQtApp $prog
-    done
+    # Install dolphin templates, like debian does
+    install -D extras/source/shellnew/soffice.* --target-directory="$out/share/templates/.source"
+    cp ${substituteAll {src = ./soffice-template.desktop; app="Writer";  ext="odt"; type="text";        }} $out/share/templates/soffice.odt.desktop
+    cp ${substituteAll {src = ./soffice-template.desktop; app="Calc";    ext="ods"; type="spreadsheet"; }} $out/share/templates/soffice.ods.desktop
+    cp ${substituteAll {src = ./soffice-template.desktop; app="Impress"; ext="odp"; type="presentation";}} $out/share/templates/soffice.odp.desktop
+    cp ${substituteAll {src = ./soffice-template.desktop; app="Draw";    ext="odg"; type="drawing";     }} $out/share/templates/soffice.odg.desktop
   '';
 
+  # Wrapping is done in ./wrapper.nix
   dontWrapQtApps = true;
 
   configureFlags = [
@@ -413,6 +416,7 @@ in
     "--with-system-libwps"
     "--with-system-openldap"
     "--with-system-coinmp"
+    "--with-system-postgresql"
 
     # Without these, configure does not finish
     "--without-junit"
@@ -427,10 +431,8 @@ in
     # I imagine this helps. Copied from go-oo.
     # Modified on every upgrade, though
     "--disable-odk"
-    "--disable-postgresql-sdbc"
     "--disable-firebird-sdbc"
     "--without-fonts"
-    "--without-myspell-dicts"
     "--without-doxygen"
 
     # TODO: package these as system libraries
@@ -447,10 +449,14 @@ in
     "--without-system-libstaroffice"
     "--without-system-libepubgen"
     "--without-system-libqxp"
-    "--without-system-mdds" # we have mdds but our version is too new
+    "--without-system-dragonbox"
+    "--without-system-libfixmath"
+    "--with-system-mdds"
     # https://github.com/NixOS/nixpkgs/commit/5c5362427a3fa9aefccfca9e531492a8735d4e6f
     "--without-system-orcus"
     "--without-system-xmlsec"
+    "--without-system-cuckoo"
+    "--without-system-zxing"
   ] ++ optionals kdeIntegration [
     "--enable-kf5"
     "--enable-qt5"
@@ -468,11 +474,10 @@ in
     bison
     fontforge
     gdb
-    jdk
+    jdk17
     libtool
     pkg-config
-  ]
-  ++ [ (if kdeIntegration then wrapQtAppsHook else wrapGAppsHook) ];
+  ];
 
   buildInputs = with xorg; [
     ArchiveZip
@@ -553,8 +558,8 @@ in
     openssl
     pam
     perl
-    pkg-config
     poppler
+    postgresql
     python3
     sane-backends
     unixODBC
@@ -564,19 +569,56 @@ in
     zip
     zlib
   ]
-  ++ (with gst_all_1; [
-    gst-libav
-    gst-plugins-bad
-    gst-plugins-base
-    gst-plugins-good
-    gst-plugins-ugly
-    gstreamer
-  ])
-  ++ optionals kdeIntegration [ qtbase qtx11extras kcoreaddons kio ];
+  ++ passthru.gst_packages
+  ++ optionals kdeIntegration [ qtbase qtx11extras kcoreaddons kio ]
+  ++ optionals (lib.versionAtLeast (lib.versions.majorMinor version) "7.4") [ libwebp ];
 
   passthru = {
     inherit srcs;
     jdk = jre';
+    inherit kdeIntegration;
+    # For the wrapper.nix
+    inherit gtk3;
+    # Although present in qtPackages, we need qtbase.qtPluginPrefix and
+    # qtbase.qtQmlPrefix
+    inherit qtbase;
+    gst_packages = with gst_all_1; [
+      gst-libav
+      gst-plugins-bad
+      gst-plugins-base
+      gst-plugins-good
+      gst-plugins-ugly
+      gstreamer
+    ];
+    qmlPackages = [
+      ki18n
+      knotifications
+      qtdeclarative
+      qtquickcontrols
+      qtwayland
+      solid
+      sonnet
+    ];
+    qtPackages = [
+      kauth
+      kcompletion
+      kconfigwidgets
+      kglobalaccel
+      ki18n
+      kio
+      kitemviews
+      ktextwidgets
+      kwidgetsaddons
+      kwindowsystem
+      kxmlgui
+      phonon
+      qtbase
+      qtdeclarative
+      qtsvg
+      qttools
+      qtwayland
+      sonnet
+    ];
   };
 
   requiredSystemFeatures = [ "big-parallel" ];