Skip to content

Commit

Permalink
use steam-run to launch wps
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninlives committed Jun 9, 2021
1 parent dca55d9 commit f9d95f3
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions pkgs/applications/office/wpsoffice/default.nix
@@ -1,7 +1,6 @@
{ lib, stdenv
, mkDerivation
, fetchurl
, autoPatchelfHook
, dpkg
, wrapGAppsHook
, wrapQtAppsHook
Expand Down Expand Up @@ -34,6 +33,8 @@
, unixODBC
, xorg
, zlib
, steam
, makeWrapper
}:

stdenv.mkDerivation rec {
Expand All @@ -53,7 +54,7 @@ stdenv.mkDerivation rec {
rm opt/kingsoft/wps-office/office6/{libjsetapi.so,libjswppapi.so,libjswpsapi.so}
'';

nativeBuildInputs = [ autoPatchelfHook dpkg wrapGAppsHook wrapQtAppsHook ];
nativeBuildInputs = [ dpkg wrapGAppsHook wrapQtAppsHook makeWrapper ];

meta = with lib; {
description = "Office suite, formerly Kingsoft Office";
Expand Down Expand Up @@ -107,6 +108,7 @@ stdenv.mkDerivation rec {
sqlite
unixODBC
zlib
cups.lib
];

dontPatchELF = true;
Expand Down Expand Up @@ -137,7 +139,12 @@ stdenv.mkDerivation rec {
"tcmalloc" # gperftools
];

installPhase = ''
installPhase = let
steam-run = (steam.override {
extraPkgs = p: buildInputs;
nativeOnly = true;
}).run;
in ''
prefix=$out/opt/kingsoft/wps-office
mkdir -p $out
cp -r opt $out
Expand All @@ -153,11 +160,14 @@ stdenv.mkDerivation rec {
substituteInPlace $i \
--replace /usr/bin $out/bin
done
'';
runtimeLibPath = lib.makeLibraryPath [
cups.lib
];
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
'';

dontWrapQtApps = true;
dontWrapGApps = true;
Expand All @@ -166,8 +176,7 @@ stdenv.mkDerivation rec {
echo "Wrapping $f"
wrapProgram "$f" \
"''${gappsWrapperArgs[@]}" \
"''${qtWrapperArgs[@]}" \
--suffix LD_LIBRARY_PATH : "$runtimeLibPath"
"''${qtWrapperArgs[@]}"
done
'';
}

0 comments on commit f9d95f3

Please sign in to comment.