Merge pull request #178289 from wineee/wps

wpsoffice: 11.1.0.9615 -> 11.1.0.11664
This commit is contained in:
Bobby Rong 2022-08-26 22:52:41 +08:00 committed by GitHub
commit 2fc3f8af09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 123 deletions

View File

@ -1,157 +1,68 @@
{ lib, stdenv { lib
, stdenv
, mkDerivation , mkDerivation
, fetchurl , fetchurl
, dpkg , dpkg
, wrapGAppsHook , wrapGAppsHook
, wrapQtAppsHook , wrapQtAppsHook
, autoPatchelfHook
, alsa-lib , alsa-lib
, atk
, bzip2
, cairo
, cups
, dbus
, expat
, ffmpeg
, fontconfig
, freetype
, gdk-pixbuf
, glib
, gperftools
, gtk2-x11
, libpng12
, libtool , libtool
, libuuid
, libxml2
, xz
, nspr , nspr
, nss , mesa
, openssl , libtiff
, pango , cups
, qt4
, qtbase
, sqlite
, unixODBC
, xorg , xorg
, zlib , steam-run
, steam
, makeWrapper , makeWrapper
, useChineseVersion ? false
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "wpsoffice"; pname = "wpsoffice";
version = "11.1.0.9615"; version = "11.1.0.11664";
src = fetchurl { src = if useChineseVersion then fetchurl {
url = "http://wdl1.pcfg.cache.wpscdn.com/wpsdl/wpsoffice/download/linux/9615/wps-office_11.1.0.9615.XA_amd64.deb"; url = "https://wps-linux-personal.wpscdn.cn/wps/download/ep/Linux2019/${lib.last (lib.splitString "." version)}/wps-office_${version}_amd64.deb";
sha256 = "0dpd4njpizclllps3qagipycfws935rhj9k5gmdhjfgsk0ns188w"; 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=";
}; };
unpackCmd = "dpkg -x $src ."; unpackCmd = "dpkg -x $src .";
sourceRoot = "."; sourceRoot = ".";
postUnpack = lib.optionalString (version == "11.1.0.9505") '' postUnpack = ''
# distribution is missing libjsapiservice.so, so we should not let # distribution is missing libkappessframework.so, so we should not let
# autoPatchelfHook fail on the following dead libraries # autoPatchelfHook fail on the following dead libraries
rm opt/kingsoft/wps-office/office6/{libjsetapi.so,libjswppapi.so,libjswpsapi.so} rm -r opt/kingsoft/wps-office/office6/addons/pdfbatchcompression
# 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
''; '';
nativeBuildInputs = [ dpkg wrapGAppsHook wrapQtAppsHook makeWrapper ]; nativeBuildInputs = [ dpkg wrapGAppsHook wrapQtAppsHook makeWrapper autoPatchelfHook ];
meta = with lib; { buildInputs = [
description = "Office suite, formerly Kingsoft Office";
homepage = "https://www.wps.com/";
platforms = [ "x86_64-linux" ];
hydraPlatforms = [];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfreeRedistributable;
maintainers = with maintainers; [ mlatus th0rgal ];
};
buildInputs = with xorg; [
alsa-lib alsa-lib
atk xorg.libXdamage
bzip2 xorg.libXtst
cairo
dbus.lib
expat
ffmpeg
fontconfig
freetype
gdk-pixbuf
glib
gperftools
gtk2-x11
libICE
libSM
libX11
libX11
libXScrnSaver
libXcomposite
libXcursor
libXdamage
libXext
libXfixes
libXi
libXrandr
libXrender
libXtst
libpng12
libtool libtool
libuuid
libxcb
libxml2
xz
nspr nspr
nss mesa
openssl libtiff
pango
qt4
qtbase
sqlite
unixODBC
zlib
cups.lib cups.lib
]; ];
dontPatchELF = true; installPhase = ''
runHook preInstall
# wpsoffice uses `/build` in its own build system making nix things there
# references to nix own build directory
noAuditTmpdir = true;
unvendoredLibraries = [
# Have to use parts of the vendored qt4
#"Qt"
"SDL2"
"bz2"
"avcodec"
"avdevice"
"avformat"
"avutil"
"swresample"
"swscale"
"jpeg"
"png"
# File saving breaks unless we are using vendored llvmPackages_8.libcxx
#"c++"
"ssl" "crypto"
"nspr"
"nss"
"odbc"
"tcmalloc" # gperftools
];
installPhase = let
steam-run = (steam.override {
extraPkgs = p: buildInputs;
}).run;
in ''
prefix=$out/opt/kingsoft/wps-office prefix=$out/opt/kingsoft/wps-office
mkdir -p $out mkdir -p $out
cp -r opt $out cp -r opt $out
cp -r usr/* $out cp -r usr/* $out
for lib in $unvendoredLibraries; do
rm -v "$prefix/office6/lib$lib"*.so{,.*}
done
for i in wps wpp et wpspdf; do for i in wps wpp et wpspdf; do
substituteInPlace $out/bin/$i \ substituteInPlace $out/bin/$i \
--replace /opt/kingsoft/wps-office $prefix --replace /opt/kingsoft/wps-office $prefix
@ -160,17 +71,18 @@ stdenv.mkDerivation rec {
substituteInPlace $i \ substituteInPlace $i \
--replace /usr/bin $out/bin --replace /usr/bin $out/bin
done done
for i in wps wpp et wpspdf; do for i in wps wpp et wpspdf; do
mv $out/bin/$i $out/bin/.$i-orig mv $out/bin/$i $out/bin/.$i-orig
makeWrapper ${steam-run}/bin/steam-run $out/bin/$i \ makeWrapper ${steam-run}/bin/steam-run $out/bin/$i \
--add-flags $out/bin/.$i-orig \ --add-flags $out/bin/.$i-orig \
--argv0 $i --argv0 $i
done done
runHook postInstall
''; '';
dontWrapQtApps = true; dontWrapQtApps = true;
dontWrapGApps = true; dontWrapGApps = true;
postFixup = '' postFixup = ''
for f in "$out"/bin/*; do for f in "$out"/bin/*; do
echo "Wrapping $f" echo "Wrapping $f"
@ -179,4 +91,13 @@ stdenv.mkDerivation rec {
"''${qtWrapperArgs[@]}" "''${qtWrapperArgs[@]}"
done done
''; '';
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 ];
};
} }

View File

@ -31762,7 +31762,10 @@ with pkgs;
worldengine-cli = python3Packages.worldengine; worldengine-cli = python3Packages.worldengine;
wpsoffice = libsForQt5.callPackage ../applications/office/wpsoffice {}; wpsoffice = libsForQt5.callPackage ../applications/office/wpsoffice { };
wpsoffice-cn = libsForQt5.callPackage ../applications/office/wpsoffice {
useChineseVersion = true;
};
wrapFirefox = callPackage ../applications/networking/browsers/firefox/wrapper.nix { }; wrapFirefox = callPackage ../applications/networking/browsers/firefox/wrapper.nix { };