about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/office/wpsoffice/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/office/wpsoffice/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/office/wpsoffice/default.nix165
1 files changed, 122 insertions, 43 deletions
diff --git a/nixpkgs/pkgs/applications/office/wpsoffice/default.nix b/nixpkgs/pkgs/applications/office/wpsoffice/default.nix
index 7032632da884..2d8f4d18621c 100644
--- a/nixpkgs/pkgs/applications/office/wpsoffice/default.nix
+++ b/nixpkgs/pkgs/applications/office/wpsoffice/default.nix
@@ -1,67 +1,112 @@
-{ stdenv, fetchurl
-, libX11, glib, xorg, fontconfig, freetype
-, zlib, libpng12, libICE, libXrender, cups
-, alsaLib, atk, cairo, dbus, expat
-, gdk-pixbuf, gtk2-x11, lzma, pango, zotero
-, sqlite, libuuid, qt5, dpkg }:
+{ stdenv
+, mkDerivation
+, fetchurl
+, autoPatchelfHook
+, dpkg
+, wrapGAppsHook
+, wrapQtAppsHook
+, alsaLib
+, atk
+, bzip2
+, cairo
+, cups
+, dbus
+, expat
+, ffmpeg_3
+, fontconfig
+, freetype
+, gdk-pixbuf
+, glib
+, gperftools
+, gtk2-x11
+, libpng12
+, libtool
+, libuuid
+, libxml2
+, lzma
+, nspr
+, nss
+, openssl
+, pango
+, qt4
+, qtbase
+, sqlite
+, unixODBC
+, xorg
+, zlib
+}:
 
 stdenv.mkDerivation rec{
   pname = "wpsoffice";
-  version = "11.1.0.9080";
+  version = "11.1.0.9505";
 
   src = fetchurl {
-    url = "http://wdl1.pcfg.cache.wpscdn.com/wpsdl/wpsoffice/download/linux/9080/wps-office_11.1.0.9080.XA_amd64.deb";
-    sha256 = "1731e9aea22ef4e558ad66b1373d863452b4f570aecf09d448ae28a821333454";
+    url = "http://wdl1.pcfg.cache.wpscdn.com/wpsdl/wpsoffice/download/linux/9505/wps-office_11.1.0.9505.XA_amd64.deb";
+    sha256 = "1bvaxwd3npw3kswk7k1p6mcbfg37x0ym4sp6xis6ykz870qivqk5";
   };
   unpackCmd = "dpkg -x $src .";
   sourceRoot = ".";
 
-  nativeBuildInputs = [ qt5.wrapQtAppsHook dpkg ];
+  postUnpack = stdenv.lib.optionalString (version == "11.1.0.9505") ''
+    # distribution is missing libjsapiservice.so, so we should not let
+    # autoPatchelfHook fail on the following dead libraries
+    rm opt/kingsoft/wps-office/office6/{libjsetapi.so,libjswppapi.so,libjswpsapi.so}
+  '';
+
+  nativeBuildInputs = [ autoPatchelfHook dpkg wrapGAppsHook wrapQtAppsHook ];
 
   meta = {
     description = "Office program originally named Kingsoft Office";
-    homepage = http://wps-community.org/;
-    platforms = [ "i686-linux" "x86_64-linux" ];
+    homepage = "http://wps-community.org/";
+    platforms = [ "x86_64-linux" ];
     hydraPlatforms = [];
     license = stdenv.lib.licenses.unfreeRedistributable;
     maintainers = [ stdenv.lib.maintainers.mlatus ];
   };
 
-  libPath = with xorg; stdenv.lib.makeLibraryPath [
-    libX11
-    libpng12
-    glib
-    libSM
-    libXext
-    fontconfig
-    zlib
-    freetype
-    libICE
-    cups
-    libXrender
-    libxcb
-
+  buildInputs = with xorg; [
     alsaLib
     atk
+    bzip2
     cairo
-    dbus.daemon.lib
+    dbus.lib
     expat
-    fontconfig.lib
+    ffmpeg_3
+    fontconfig
+    freetype
     gdk-pixbuf
+    glib
+    gperftools
     gtk2-x11
-    lzma
-    pango
-    zotero
-    sqlite
-    libuuid
+    libICE
+    libSM
+    libX11
+    libX11
+    libXScrnSaver
     libXcomposite
     libXcursor
     libXdamage
+    libXext
     libXfixes
     libXi
     libXrandr
-    libXScrnSaver
+    libXrender
     libXtst
+    libpng12
+    libtool
+    libuuid
+    libxcb
+    libxml2
+    lzma
+    nspr
+    nss
+    openssl
+    pango
+    qt4
+    qtbase
+    sqlite
+    unixODBC
+    zlib
   ];
 
   dontPatchELF = true;
@@ -70,25 +115,59 @@ stdenv.mkDerivation rec{
   # references to nix own build directory
   noAuditTmpdir = true;
 
+  unvendoredLibraries = [
+    # Have to use parts of the vendored qt4
+    #"Qt"
+    "SDL2"
+    "bz2"
+    "avcodec"
+    "avdevice"
+    "avformat"
+    "avutil"
+    "swresample"
+    "swscale"
+    "jpeg"
+    "png"
+    # File saving breaks unless we are using vendored llvmPackages_8.libcxx
+    #"c++"
+    "ssl" "crypto"
+    "nspr"
+    "nss"
+    "odbc"
+    "tcmalloc" # gperftools
+  ];
+
   installPhase = ''
     prefix=$out/opt/kingsoft/wps-office
     mkdir -p $out
     cp -r opt $out
     cp -r usr/* $out
-    # Avoid forbidden reference error due use of patchelf
-    rm -r *
+    for lib in $unvendoredLibraries; do
+      rm -v "$prefix/office6/lib$lib"*.so{,.*}
+    done
     for i in wps wpp et wpspdf; do
-      patchelf \
-        --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
-        --force-rpath --set-rpath "$(patchelf --print-rpath $prefix/office6/$i):${stdenv.cc.cc.lib}/lib64:${libPath}" \
-        $prefix/office6/$i
       substituteInPlace $out/bin/$i \
         --replace /opt/kingsoft/wps-office $prefix
     done
     for i in $out/share/applications/*;do
       substituteInPlace $i \
-        --replace /usr/bin $out/bin \
-        --replace /opt/kingsoft/wps-office $prefix
+        --replace /usr/bin $out/bin
+    done
+  '';
+
+  runtimeLibPath = stdenv.lib.makeLibraryPath [
+    cups.lib
+  ];
+
+  dontWrapQtApps = true;
+  dontWrapGApps = true;
+  postFixup = ''
+    for f in "$out"/bin/*; do
+      echo "Wrapping $f"
+      wrapProgram "$f" \
+        "''${gappsWrapperArgs[@]}" \
+        "''${qtWrapperArgs[@]}" \
+        --suffix LD_LIBRARY_PATH : "$runtimeLibPath"
     done
   '';
-}
\ No newline at end of file
+}