1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
{ lib
, stdenv
, fetchurl
, dpkg
, autoPatchelfHook
, alsa-lib
, at-spi2-core
, libtool
, libxkbcommon
, nspr
, mesa
, libtiff
, udev
, gtk3
, qtbase
, xorg
, cups
, pango
, useChineseVersion ? false
}:
stdenv.mkDerivation rec {
pname = "wpsoffice";
version = "11.1.0.11704";
src = if useChineseVersion then fetchurl {
url = "https://wps-linux-personal.wpscdn.cn/wps/download/ep/Linux2019/${lib.last (lib.splitString "." version)}/wps-office_${version}_amd64.deb";
hash = "sha256-ffLSon9FpQZDQ1uapchBUkVaHOXs+H/6kHJLNiWqwiE=";
} else fetchurl {
url = "https://wdl1.pcfg.cache.wpscdn.com/wpsdl/wpsoffice/download/linux/${lib.last (lib.splitString "." version)}/wps-office_${version}.XA_amd64.deb";
hash = "sha256-nxpMEWKiNjjEUoVJkhpvjnCuWBCCGjPk+sUlKz+KjMI=";
};
unpackCmd = "dpkg -x $src .";
sourceRoot = ".";
nativeBuildInputs = [
dpkg
autoPatchelfHook
];
buildInputs = [
alsa-lib
at-spi2-core
libtool
libxkbcommon
nspr
mesa
libtiff
udev
gtk3
qtbase
xorg.libXdamage
xorg.libXtst
xorg.libXv
];
dontWrapQtApps = true;
runtimeDependencies = map lib.getLib [
cups
pango
];
autoPatchelfIgnoreMissingDeps = [
# distribution is missing libkappessframework.so
"libkappessframework.so"
# qt4 support is deprecated
"libQtCore.so.4"
"libQtNetwork.so.4"
"libQtXml.so.4"
];
installPhase = ''
runHook preInstall
prefix=$out/opt/kingsoft/wps-office
mkdir -p $out
cp -r opt $out
cp -r usr/* $out
for i in wps wpp et wpspdf; do
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
done
runHook postInstall
'';
preFixup = ''
# The following libraries need libtiff.so.5, but nixpkgs provides libtiff.so.6
patchelf --replace-needed libtiff.so.5 libtiff.so $out/opt/kingsoft/wps-office/office6/{libpdfmain.so,libqpdfpaint.so,qt/plugins/imageformats/libqtiff.so,addons/pdfbatchcompression/libpdfbatchcompressionapp.so}
# dlopen dependency
patchelf --add-needed libudev.so.1 $out/opt/kingsoft/wps-office/office6/addons/cef/libcef.so
'';
meta = with lib; {
description = "Office suite, formerly Kingsoft Office";
homepage = "https://www.wps.com";
platforms = [ "x86_64-linux" ];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
hydraPlatforms = [ ];
license = licenses.unfreeRedistributable;
maintainers = with maintainers; [ mlatus th0rgal rewine ];
};
}
|