2022-09-09 14:08:57 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, mkDerivation
|
|
|
|
, fetchurl
|
|
|
|
, dpkg
|
|
|
|
, wrapGAppsHook
|
|
|
|
, wrapQtAppsHook
|
2022-09-09 14:08:57 +00:00
|
|
|
, autoPatchelfHook
|
2021-06-28 23:13:55 +00:00
|
|
|
, alsa-lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, libtool
|
|
|
|
, nspr
|
2022-09-09 14:08:57 +00:00
|
|
|
, mesa
|
|
|
|
, libtiff
|
|
|
|
, cups
|
2020-04-24 23:36:52 +00:00
|
|
|
, xorg
|
2022-09-09 14:08:57 +00:00
|
|
|
, steam-run
|
2021-10-09 14:59:57 +00:00
|
|
|
, makeWrapper
|
2022-09-09 14:08:57 +00:00
|
|
|
, useChineseVersion ? false
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "wpsoffice";
|
2022-09-09 14:08:57 +00:00
|
|
|
version = "11.1.0.11664";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
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";
|
|
|
|
sha256 = "sha256-D2LhxBMHmQjVExa/63DHdws0V+EmOSlJzGq91jbuJHs=";
|
|
|
|
} else fetchurl {
|
|
|
|
url = "http://wdl1.pcfg.cache.wpscdn.com/wpsdl/wpsoffice/download/linux/${lib.last (lib.splitString "." version)}/wps-office_${version}.XA_amd64.deb";
|
|
|
|
sha256 = "sha256-9qZGqs4nsB9mWCJTi2x+vWmMF0sEoUYgEzLI//hijfU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2022-09-09 14:08:57 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
unpackCmd = "dpkg -x $src .";
|
|
|
|
sourceRoot = ".";
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
postUnpack = ''
|
|
|
|
# distribution is missing libkappessframework.so, so we should not let
|
2020-04-24 23:36:52 +00:00
|
|
|
# autoPatchelfHook fail on the following dead libraries
|
2022-09-09 14:08:57 +00:00
|
|
|
rm -r opt/kingsoft/wps-office/office6/addons/pdfbatchcompression
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
# Remove the following libraries because they depend on qt4
|
|
|
|
rm -r opt/kingsoft/wps-office/office6/{librpcetapi.so,librpcwpsapi.so,librpcwppapi.so,libavdevice.so.58.10.100,libmediacoder.so}
|
|
|
|
rm -r opt/kingsoft/wps-office/office6/addons/wppcapturer/libwppcapturer.so
|
|
|
|
rm -r opt/kingsoft/wps-office/office6/addons/wppencoder/libwppencoder.so
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
nativeBuildInputs = [ dpkg wrapGAppsHook wrapQtAppsHook makeWrapper autoPatchelfHook ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
buildInputs = [
|
2021-06-28 23:13:55 +00:00
|
|
|
alsa-lib
|
2022-09-09 14:08:57 +00:00
|
|
|
xorg.libXdamage
|
|
|
|
xorg.libXtst
|
2020-04-24 23:36:52 +00:00
|
|
|
libtool
|
|
|
|
nspr
|
2022-09-09 14:08:57 +00:00
|
|
|
mesa
|
|
|
|
libtiff
|
2021-10-09 14:59:57 +00:00
|
|
|
cups.lib
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
2021-10-09 14:59:57 +00:00
|
|
|
for i in wps wpp et wpspdf; do
|
|
|
|
mv $out/bin/$i $out/bin/.$i-orig
|
|
|
|
makeWrapper ${steam-run}/bin/steam-run $out/bin/$i \
|
|
|
|
--add-flags $out/bin/.$i-orig \
|
|
|
|
--argv0 $i
|
|
|
|
done
|
2022-09-09 14:08:57 +00:00
|
|
|
runHook postInstall
|
2021-10-09 14:59:57 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
dontWrapQtApps = true;
|
|
|
|
dontWrapGApps = true;
|
2022-09-09 14:08:57 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postFixup = ''
|
|
|
|
for f in "$out"/bin/*; do
|
|
|
|
echo "Wrapping $f"
|
|
|
|
wrapProgram "$f" \
|
|
|
|
"''${gappsWrapperArgs[@]}" \
|
2021-10-09 14:59:57 +00:00
|
|
|
"''${qtWrapperArgs[@]}"
|
2020-04-24 23:36:52 +00:00
|
|
|
done
|
|
|
|
'';
|
2022-09-09 14:08:57 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Office suite, formerly Kingsoft Office";
|
|
|
|
homepage = "https://www.wps.com";
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
hydraPlatforms = [ ];
|
|
|
|
license = licenses.unfreeRedistributable;
|
|
|
|
maintainers = with maintainers; [ mlatus th0rgal rewine ];
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
}
|