Skip to content

Commit 54e07a8

Browse files
authored
wpsoffice-cn: 11.1.0.11723 -> 12.1.0.17900 (#388432)
2 parents 5301599 + 5cd2803 commit 54e07a8

File tree

3 files changed

+318
-5
lines changed

3 files changed

+318
-5
lines changed
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
{
2+
lib,
3+
stdenv,
4+
dpkg,
5+
autoPatchelfHook,
6+
alsa-lib,
7+
at-spi2-core,
8+
libtool,
9+
libxkbcommon,
10+
nspr,
11+
mesa,
12+
libtiff,
13+
udev,
14+
gtk3,
15+
libsForQt5,
16+
xorg,
17+
cups,
18+
pango,
19+
libjpeg,
20+
gtk2,
21+
gdk-pixbuf,
22+
libpulseaudio,
23+
libbsd,
24+
libusb1,
25+
libmysqlclient,
26+
llvmPackages,
27+
dbus,
28+
gcc-unwrapped,
29+
freetype,
30+
curl,
31+
makeWrapper,
32+
runCommandLocal,
33+
cacert,
34+
coreutils,
35+
}:
36+
let
37+
pkgVersion = "12.1.0.17900";
38+
url = "https://wps-linux-personal.wpscdn.cn/wps/download/ep/Linux2023/${lib.last (lib.splitVersion pkgVersion)}/wps-office_${pkgVersion}_amd64.deb";
39+
hash = "sha256-i2EVCmDLE2gx7l2aAo+fW8onP/z+xlPIbQYwKhQ46+o=";
40+
uri = builtins.replaceStrings [ "https://wps-linux-personal.wpscdn.cn" ] [ "" ] url;
41+
securityKey = "7f8faaaa468174dc1c9cd62e5f218a5b";
42+
in
43+
stdenv.mkDerivation rec {
44+
pname = "wpsoffice-cn";
45+
version = pkgVersion;
46+
47+
src =
48+
runCommandLocal "wps-office_${version}_amd64.deb"
49+
{
50+
outputHashMode = "recursive";
51+
outputHashAlgo = "sha256";
52+
outputHash = hash;
53+
54+
nativeBuildInputs = [
55+
curl
56+
coreutils
57+
];
58+
59+
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
60+
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
61+
}
62+
''
63+
timestamp10=$(date '+%s')
64+
md5hash=($(echo -n "${securityKey}${uri}$timestamp10" | md5sum))
65+
curl \
66+
--retry 3 --retry-delay 3 \
67+
"${url}?t=$timestamp10&k=$md5hash" \
68+
> $out
69+
'';
70+
71+
unpackCmd = "dpkg -x $src .";
72+
sourceRoot = ".";
73+
74+
nativeBuildInputs = [
75+
dpkg
76+
autoPatchelfHook
77+
makeWrapper
78+
];
79+
80+
buildInputs = [
81+
alsa-lib
82+
at-spi2-core
83+
libtool
84+
libjpeg
85+
libxkbcommon
86+
nspr
87+
mesa
88+
libtiff
89+
udev
90+
gtk3
91+
libsForQt5.qt5.qtbase
92+
xorg.libXdamage
93+
xorg.libXtst
94+
xorg.libXv
95+
gtk2
96+
gdk-pixbuf
97+
libpulseaudio
98+
xorg.libXScrnSaver
99+
xorg.libXxf86vm
100+
libbsd
101+
libusb1
102+
libmysqlclient
103+
llvmPackages.openmp
104+
dbus
105+
libsForQt5.fcitx5-qt
106+
];
107+
108+
dontWrapQtApps = true;
109+
110+
runtimeDependencies = map lib.getLib [
111+
cups
112+
pango
113+
freetype
114+
gcc-unwrapped.lib
115+
];
116+
117+
autoPatchelfIgnoreMissingDeps = [
118+
# distribution is missing libkappessframework.so
119+
"libkappessframework.so"
120+
# qt4 support is deprecated
121+
"libQtCore.so.4"
122+
"libQtNetwork.so.4"
123+
"libQtXml.so.4"
124+
# file manager integration. Not needed
125+
"libnautilus-extension.so.1"
126+
"libcaja-extension.so.1"
127+
"libpeony.so.3"
128+
# libuof.so is a exclusive library in WPS. No need to repatch it
129+
"libuof.so"
130+
];
131+
132+
installPhase = ''
133+
runHook preInstall
134+
prefix=$out/opt/kingsoft/wps-office
135+
mkdir -p $out
136+
cp -r opt $out
137+
cp -r usr/* $out
138+
for i in wps wpp et wpspdf; do
139+
substituteInPlace $out/bin/$i \
140+
--replace /opt/kingsoft/wps-office $prefix
141+
done
142+
for i in $out/share/applications/*;do
143+
substituteInPlace $i \
144+
--replace /usr/bin $out/bin
145+
done
146+
# need system freetype and gcc lib to run properly
147+
for i in wps wpp et wpspdf wpsoffice; do
148+
wrapProgram $out/opt/kingsoft/wps-office/office6/$i \
149+
--set LD_PRELOAD "${freetype}/lib/libfreetype.so" \
150+
--set LD_LIBRARY_PATH "${lib.makeLibraryPath [ gcc-unwrapped.lib ]}"
151+
done
152+
runHook postInstall
153+
'';
154+
155+
preFixup = ''
156+
# The following libraries need libtiff.so.5, but nixpkgs provides libtiff.so.6
157+
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}
158+
patchelf --replace-needed libtiff.so.5 libtiff.so $out/opt/kingsoft/wps-office/office6/addons/ksplitmerge/libksplitmergeapp.so
159+
patchelf --add-needed libtiff.so $out/opt/kingsoft/wps-office/office6/libwpsmain.so
160+
# Fix: Wrong JPEG library version: library is 62, caller expects 80
161+
patchelf --add-needed libjpeg.so $out/opt/kingsoft/wps-office/office6/libwpsmain.so
162+
# dlopen dependency
163+
patchelf --add-needed libudev.so.1 $out/opt/kingsoft/wps-office/office6/addons/cef/libcef.so
164+
'';
165+
166+
meta = with lib; {
167+
description = "Office suite, formerly Kingsoft Office";
168+
homepage = "https://www.wps.com";
169+
platforms = [ "x86_64-linux" ];
170+
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
171+
hydraPlatforms = [ ];
172+
license = licenses.unfreeRedistributable;
173+
maintainers = with maintainers; [
174+
mlatus
175+
th0rgal
176+
rewine
177+
pokon548
178+
];
179+
};
180+
}
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
{
2+
lib,
3+
stdenv,
4+
dpkg,
5+
autoPatchelfHook,
6+
alsa-lib,
7+
at-spi2-core,
8+
libtool,
9+
libxkbcommon,
10+
nspr,
11+
libgbm,
12+
libtiff,
13+
udev,
14+
gtk3,
15+
xorg,
16+
cups,
17+
pango,
18+
runCommandLocal,
19+
curl,
20+
libsForQt5,
21+
coreutils,
22+
cacert,
23+
libjpeg,
24+
}:
25+
let
26+
pkgVersion = "11.1.0.11723";
27+
url = "https://wdl1.pcfg.cache.wpscdn.com/wpsdl/wpsoffice/download/linux/${lib.last (lib.splitVersion pkgVersion)}/wps-office_${pkgVersion}.XA_amd64.deb";
28+
hash = "sha256-o8njvwE/UsQpPuLyChxGAZ4euvwfuaHxs5pfUvcM7kI=";
29+
in
30+
stdenv.mkDerivation rec {
31+
pname = "wpsoffice";
32+
version = pkgVersion;
33+
34+
src =
35+
runCommandLocal "wps-office_${version}.XA_amd64.deb"
36+
{
37+
outputHashMode = "recursive";
38+
outputHashAlgo = "sha256";
39+
outputHash = hash;
40+
41+
nativeBuildInputs = [
42+
curl
43+
coreutils
44+
];
45+
46+
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
47+
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
48+
}
49+
''
50+
curl \
51+
--retry 3 --retry-delay 3 \
52+
"${url}" \
53+
> $out
54+
'';
55+
56+
unpackCmd = "dpkg -x $src .";
57+
sourceRoot = ".";
58+
59+
nativeBuildInputs = [
60+
dpkg
61+
autoPatchelfHook
62+
];
63+
64+
buildInputs = [
65+
alsa-lib
66+
at-spi2-core
67+
libtool
68+
libjpeg
69+
libxkbcommon
70+
nspr
71+
libgbm
72+
libtiff
73+
udev
74+
gtk3
75+
libsForQt5.qt5.qtbase
76+
xorg.libXdamage
77+
xorg.libXtst
78+
xorg.libXv
79+
];
80+
81+
dontWrapQtApps = true;
82+
83+
runtimeDependencies = map lib.getLib [
84+
cups
85+
pango
86+
];
87+
88+
autoPatchelfIgnoreMissingDeps = [
89+
# distribution is missing libkappessframework.so
90+
"libkappessframework.so"
91+
# qt4 support is deprecated
92+
"libQtCore.so.4"
93+
"libQtNetwork.so.4"
94+
"libQtXml.so.4"
95+
];
96+
97+
installPhase = ''
98+
runHook preInstall
99+
prefix=$out/opt/kingsoft/wps-office
100+
mkdir -p $out
101+
cp -r opt $out
102+
cp -r usr/* $out
103+
for i in wps wpp et wpspdf; do
104+
substituteInPlace $out/bin/$i \
105+
--replace /opt/kingsoft/wps-office $prefix
106+
done
107+
for i in $out/share/applications/*;do
108+
substituteInPlace $i \
109+
--replace /usr/bin $out/bin
110+
done
111+
runHook postInstall
112+
'';
113+
114+
preFixup = ''
115+
# The following libraries need libtiff.so.5, but nixpkgs provides libtiff.so.6
116+
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}
117+
patchelf --add-needed libtiff.so $out/opt/kingsoft/wps-office/office6/libwpsmain.so
118+
# Fix: Wrong JPEG library version: library is 62, caller expects 80
119+
patchelf --add-needed libjpeg.so $out/opt/kingsoft/wps-office/office6/libwpsmain.so
120+
# dlopen dependency
121+
patchelf --add-needed libudev.so.1 $out/opt/kingsoft/wps-office/office6/addons/cef/libcef.so
122+
'';
123+
124+
meta = with lib; {
125+
description = "Office suite, formerly Kingsoft Office";
126+
homepage = "https://www.wps.com";
127+
platforms = [ "x86_64-linux" ];
128+
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
129+
hydraPlatforms = [ ];
130+
license = licenses.unfreeRedistributable;
131+
maintainers = with maintainers; [
132+
mlatus
133+
th0rgal
134+
rewine
135+
pokon548
136+
];
137+
};
138+
}

pkgs/top-level/all-packages.nix

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14554,11 +14554,6 @@ with pkgs;
1455414554

1455514555
worldengine-cli = python3Packages.worldengine;
1455614556

14557-
wpsoffice = libsForQt5.callPackage ../applications/office/wpsoffice { };
14558-
wpsoffice-cn = libsForQt5.callPackage ../applications/office/wpsoffice {
14559-
useChineseVersion = true;
14560-
};
14561-
1456214557
wrapFirefox = callPackage ../applications/networking/browsers/firefox/wrapper.nix { };
1456314558

1456414559
wrapThunderbird = callPackage ../applications/networking/mailreaders/thunderbird/wrapper.nix { };

0 commit comments

Comments
 (0)