nixpkgs/pkgs/applications/office/wpsoffice/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

108 lines
2.6 KiB
Nix
Raw Normal View History

2022-08-26 13:14:46 +00:00
{ lib
, stdenv
, fetchurl
, dpkg
2022-08-26 13:14:46 +00:00
, autoPatchelfHook
, alsa-lib
, at-spi2-core
, libtool
, libxkbcommon
, nspr
2022-08-26 13:14:46 +00:00
, mesa
, libtiff
, udev
, gtk3
, qtbase
, xorg
, cups
, pango
2022-08-26 13:14:46 +00:00
, useChineseVersion ? false
}:
2017-06-04 11:47:27 +00:00
stdenv.mkDerivation rec {
2019-08-13 21:52:01 +00:00
pname = "wpsoffice";
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";
sha256 = "sha256-m7BOE2IF2m75mV/4X3HY9UJcidL0S0biqkidddp4LbQ=";
2022-08-26 13:14:46 +00:00
} else fetchurl {
url = "https://wdl1.pcfg.cache.wpscdn.com/wpsdl/wpsoffice/download/linux/${lib.last (lib.splitString "." version)}/wps-office_${version}.XA_amd64.deb";
sha256 = "sha256-spqxQK/xTE8yFPmGbSbrDY1vSxkan2kwAWpCWIExhgs=";
2016-02-23 15:36:54 +00:00
};
2022-08-26 13:14:46 +00:00
unpackCmd = "dpkg -x $src .";
sourceRoot = ".";
nativeBuildInputs = [
dpkg
autoPatchelfHook
];
2016-02-23 15:36:54 +00:00
2022-08-26 13:14:46 +00:00
buildInputs = [
alsa-lib
at-spi2-core
libtool
libxkbcommon
nspr
2022-08-26 13:14:46 +00:00
mesa
libtiff
udev
gtk3
qtbase
xorg.libXdamage
xorg.libXtst
xorg.libXv
2016-02-23 15:36:54 +00:00
];
dontWrapQtApps = true;
runtimeDependencies = map lib.getLib [
cups
pango
];
2023-05-03 03:40:15 +00:00
autoPatchelfIgnoreMissingDeps = [
# distribution is missing libkappessframework.so
"libkappessframework.so"
# qt4 support is deprecated
"libQtCore.so.4"
"libQtNetwork.so.4"
"libQtXml.so.4"
];
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
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
for i in $out/share/applications/*;do
substituteInPlace $i \
--replace /usr/bin $out/bin
done
2022-08-26 13:14:46 +00:00
runHook postInstall
2021-06-09 03:42:03 +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,addons/pdfbatchcompression/libpdfbatchcompressionapp.so}
# dlopen dependency
patchelf --add-needed libudev.so.1 $out/opt/kingsoft/wps-office/office6/addons/cef/libcef.so
'';
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 ];
};
}