wpsoffice: switch to autoPatchelfHook, update dependencies

This commit is contained in:
Dmitry Kalinkin 2020-04-14 02:11:36 -04:00
parent f6e2834821
commit 593fd37ce6
2 changed files with 62 additions and 19 deletions

View File

@ -1,29 +1,38 @@
{ stdenv { stdenv
, mkDerivation
, fetchurl , fetchurl
, autoPatchelfHook
, dpkg
, wrapQtAppsHook
, alsaLib , alsaLib
, atk , atk
, bzip2
, cairo , cairo
, cups , cups
, dbus , dbus
, dpkg
, expat , expat
, ffmpeg_3
, fontconfig , fontconfig
, freetype , freetype
, gdk-pixbuf , gdk-pixbuf
, glib , glib
, gperftools
, gtk2-x11 , gtk2-x11
, libICE
, libX11
, libXrender
, libpng12 , libpng12
, libtool
, libuuid , libuuid
, libxml2
, lzma , lzma
, nspr
, nss
, openssl
, pango , pango
, qt5 , qt4
, qtbase
, sqlite , sqlite
, unixODBC
, xorg , xorg
, zlib , zlib
, zotero
}: }:
stdenv.mkDerivation rec{ stdenv.mkDerivation rec{
@ -37,7 +46,13 @@ stdenv.mkDerivation rec{
unpackCmd = "dpkg -x $src ."; unpackCmd = "dpkg -x $src .";
sourceRoot = "."; 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 wrapQtAppsHook ];
meta = { meta = {
description = "Office program originally named Kingsoft Office"; description = "Office program originally named Kingsoft Office";
@ -48,22 +63,24 @@ stdenv.mkDerivation rec{
maintainers = [ stdenv.lib.maintainers.mlatus ]; maintainers = [ stdenv.lib.maintainers.mlatus ];
}; };
libPath = with xorg; stdenv.lib.makeLibraryPath [ buildInputs = with xorg; [
alsaLib alsaLib
atk atk
bzip2
cairo cairo
cups dbus.lib
dbus.daemon.lib
expat expat
fontconfig ffmpeg_3.out
fontconfig.lib fontconfig.lib
freetype freetype
gdk-pixbuf gdk-pixbuf
glib glib
gperftools
gtk2-x11 gtk2-x11
libICE libICE
libSM libSM
libX11 libX11
libX11
libXScrnSaver libXScrnSaver
libXcomposite libXcomposite
libXcursor libXcursor
@ -75,13 +92,20 @@ stdenv.mkDerivation rec{
libXrender libXrender
libXtst libXtst
libpng12 libpng12
libtool.lib
libuuid libuuid
libxcb libxcb
libxml2
lzma lzma
nspr
nss
openssl
pango pango
qt4
qtbase
sqlite sqlite
unixODBC
zlib zlib
zotero
]; ];
dontPatchELF = true; dontPatchELF = true;
@ -90,18 +114,37 @@ stdenv.mkDerivation rec{
# references to nix own build directory # references to nix own build directory
noAuditTmpdir = true; 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 = '' installPhase = ''
prefix=$out/opt/kingsoft/wps-office prefix=$out/opt/kingsoft/wps-office
mkdir -p $out mkdir -p $out
cp -r opt $out cp -r opt $out
cp -r usr/* $out cp -r usr/* $out
# Avoid forbidden reference error due use of patchelf for lib in $unvendoredLibraries; do
rm -r * rm -v "$prefix/office6/lib$lib"*.so{,.*}
done
for i in wps wpp et wpspdf; do 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 \ substituteInPlace $out/bin/$i \
--replace /opt/kingsoft/wps-office $prefix --replace /opt/kingsoft/wps-office $prefix
done done

View File

@ -22552,7 +22552,7 @@ in
worldengine-cli = python3Packages.worldengine; worldengine-cli = python3Packages.worldengine;
wpsoffice = callPackage ../applications/office/wpsoffice {}; wpsoffice = libsForQt5.callPackage ../applications/office/wpsoffice {};
wrapFirefox = callPackage ../applications/networking/browsers/firefox/wrapper.nix { }; wrapFirefox = callPackage ../applications/networking/browsers/firefox/wrapper.nix { };