2022-08-26 13:14:46 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-04-14 06:01:25 +00:00
|
|
|
, fetchurl
|
2020-04-14 06:11:36 +00:00
|
|
|
, dpkg
|
2020-04-14 06:18:27 +00:00
|
|
|
, wrapGAppsHook
|
2020-04-14 06:11:36 +00:00
|
|
|
, wrapQtAppsHook
|
2022-08-26 13:14:46 +00:00
|
|
|
, autoPatchelfHook
|
2021-06-10 02:57:09 +00:00
|
|
|
, alsa-lib
|
2020-04-14 06:11:36 +00:00
|
|
|
, libtool
|
|
|
|
, nspr
|
2022-08-26 13:14:46 +00:00
|
|
|
, mesa
|
|
|
|
, libtiff
|
|
|
|
, cups
|
2023-05-03 05:49:38 +00:00
|
|
|
, udev
|
2020-04-14 06:01:25 +00:00
|
|
|
, xorg
|
2021-06-09 03:42:03 +00:00
|
|
|
, makeWrapper
|
2022-08-26 13:14:46 +00:00
|
|
|
, useChineseVersion ? false
|
2020-04-14 06:01:25 +00:00
|
|
|
}:
|
2017-06-04 11:47:27 +00:00
|
|
|
|
2020-06-07 21:11:08 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-13 21:52:01 +00:00
|
|
|
pname = "wpsoffice";
|
2023-05-01 19:08:34 +00:00
|
|
|
version = "11.1.0.11698";
|
2016-02-23 15:36:54 +00:00
|
|
|
|
2022-08-26 13:14:46 +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";
|
2023-05-01 19:08:34 +00:00
|
|
|
sha256 = "sha256-m7BOE2IF2m75mV/4X3HY9UJcidL0S0biqkidddp4LbQ=";
|
2022-08-26 13:14:46 +00:00
|
|
|
} else fetchurl {
|
2023-03-04 18:10:29 +00:00
|
|
|
url = "https://wdl1.pcfg.cache.wpscdn.com/wpsdl/wpsoffice/download/linux/${lib.last (lib.splitString "." version)}/wps-office_${version}.XA_amd64.deb";
|
2023-05-01 19:08:34 +00:00
|
|
|
sha256 = "sha256-spqxQK/xTE8yFPmGbSbrDY1vSxkan2kwAWpCWIExhgs=";
|
2016-02-23 15:36:54 +00:00
|
|
|
};
|
2022-08-26 13:14:46 +00:00
|
|
|
|
2019-12-02 16:23:52 +00:00
|
|
|
unpackCmd = "dpkg -x $src .";
|
|
|
|
sourceRoot = ".";
|
|
|
|
|
2022-08-26 13:14:46 +00:00
|
|
|
postUnpack = ''
|
|
|
|
# distribution is missing libkappessframework.so, so we should not let
|
2020-04-14 06:11:36 +00:00
|
|
|
# autoPatchelfHook fail on the following dead libraries
|
2022-08-26 13:14:46 +00:00
|
|
|
rm -r opt/kingsoft/wps-office/office6/addons/pdfbatchcompression
|
2020-04-14 06:11:36 +00:00
|
|
|
|
2022-08-26 13:14:46 +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
|
|
|
|
'';
|
2017-11-11 10:16:20 +00:00
|
|
|
|
2022-08-26 13:14:46 +00:00
|
|
|
nativeBuildInputs = [ dpkg wrapGAppsHook wrapQtAppsHook makeWrapper autoPatchelfHook ];
|
2016-02-23 15:36:54 +00:00
|
|
|
|
2022-08-26 13:14:46 +00:00
|
|
|
buildInputs = [
|
2021-06-10 02:57:09 +00:00
|
|
|
alsa-lib
|
2022-08-26 13:14:46 +00:00
|
|
|
xorg.libXdamage
|
|
|
|
xorg.libXtst
|
2020-04-14 23:08:25 +00:00
|
|
|
libtool
|
2020-04-14 06:11:36 +00:00
|
|
|
nspr
|
2022-08-26 13:14:46 +00:00
|
|
|
mesa
|
|
|
|
libtiff
|
2023-05-03 05:49:38 +00:00
|
|
|
udev
|
2016-02-23 15:36:54 +00:00
|
|
|
];
|
|
|
|
|
2023-05-03 05:49:38 +00:00
|
|
|
runtimeDependencies = [
|
|
|
|
cups.lib
|
|
|
|
];
|
2023-05-03 03:40:15 +00:00
|
|
|
|
2022-08-26 13:14:46 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2017-06-04 11:47:27 +00:00
|
|
|
prefix=$out/opt/kingsoft/wps-office
|
2019-12-02 16:23:52 +00:00
|
|
|
mkdir -p $out
|
|
|
|
cp -r opt $out
|
|
|
|
cp -r usr/* $out
|
|
|
|
for i in wps wpp et wpspdf; do
|
|
|
|
substituteInPlace $out/bin/$i \
|
2017-06-04 11:47:27 +00:00
|
|
|
--replace /opt/kingsoft/wps-office $prefix
|
|
|
|
done
|
2019-12-02 16:23:52 +00:00
|
|
|
for i in $out/share/applications/*;do
|
|
|
|
substituteInPlace $i \
|
2020-04-14 06:48:00 +00:00
|
|
|
--replace /usr/bin $out/bin
|
2019-12-02 16:23:52 +00:00
|
|
|
done
|
2022-08-26 13:14:46 +00:00
|
|
|
runHook postInstall
|
2021-06-09 03:42:03 +00:00
|
|
|
'';
|
2020-04-14 06:18:27 +00:00
|
|
|
|
|
|
|
dontWrapQtApps = true;
|
|
|
|
dontWrapGApps = true;
|
2022-08-26 13:14:46 +00:00
|
|
|
|
2023-01-25 10:33:32 +00:00
|
|
|
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}
|
2023-05-03 05:49:38 +00:00
|
|
|
# dlopen dependency
|
|
|
|
patchelf --add-needed libudev.so.1 $out/opt/kingsoft/wps-office/office6/addons/cef/libcef.so
|
2023-01-25 10:33:32 +00:00
|
|
|
'';
|
|
|
|
|
2020-04-14 06:18:27 +00:00
|
|
|
postFixup = ''
|
|
|
|
for f in "$out"/bin/*; do
|
|
|
|
echo "Wrapping $f"
|
|
|
|
wrapProgram "$f" \
|
|
|
|
"''${gappsWrapperArgs[@]}" \
|
2021-06-09 03:42:03 +00:00
|
|
|
"''${qtWrapperArgs[@]}"
|
2020-04-14 06:18:27 +00:00
|
|
|
done
|
|
|
|
'';
|
2022-08-26 13:14:46 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Office suite, formerly Kingsoft Office";
|
|
|
|
homepage = "https://www.wps.com";
|
|
|
|
platforms = [ "x86_64-linux" ];
|
2023-04-03 08:52:32 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
2022-08-26 13:14:46 +00:00
|
|
|
hydraPlatforms = [ ];
|
|
|
|
license = licenses.unfreeRedistributable;
|
|
|
|
maintainers = with maintainers; [ mlatus th0rgal rewine ];
|
|
|
|
};
|
2020-04-01 01:11:51 +00:00
|
|
|
}
|