wpsoffice: cleanup and i686 version

This commit is contained in:
gnidorah 2017-06-04 14:47:27 +03:00
parent ad7bee4eb4
commit 4def9b8f42
1 changed files with 46 additions and 23 deletions

View File

@ -1,32 +1,38 @@
{stdenv, fetchurl, unzip, libX11, libcxxabi, glib, xorg, qt4, fontconfig, phonon, freetype, zlib, libpng12, libICE, libXrender, cups, lib}: { stdenv, fetchurl, fetchFromGitHub
, libX11, glib, xorg, fontconfig, freetype
, zlib, libpng12, libICE, libXrender, cups }:
let
bits = if stdenv.system == "x86_64-linux" then "x86_64"
else "x86";
stdenv.mkDerivation rec{
name = "wpsoffice-${version}";
version = "10.1.0.5672"; version = "10.1.0.5672";
in stdenv.mkDerivation rec{
name = "wpsoffice-${version}";
src = fetchurl { src = fetchurl {
name = "${name}.tar.gz"; name = "${name}.tar.xz";
url = "http://kdl.cc.ksosoft.com/wps-community/download/a21/wps-office_10.1.0.5672~a21_x86_64.tar.xz"; url = "http://kdl.cc.ksosoft.com/wps-community/download/a21/wps-office_${version}~a21_${bits}.tar.xz";
sha1 = "7e9b17572ed5cea50af24f01457f726fc558a515"; sha256 = if bits == "x86_64" then
"0mi3n9kplf82gd0g2m0np957agy53p4g1qh81pbban49r4n0ajcz" else
"1dk400ap5qwdhjvn8lnk602f5akayr391fkljxdkrpn5xac01m97";
}; };
meta = { meta = {
description = "Office program originally named Kingsoft Office"; description = "Office program originally named Kingsoft Office";
homepage = http://wps-community.org/; homepage = http://wps-community.org/;
platforms = [ "x86_64-linux" ]; platforms = [ "i686-linux" "x86_64-linux" ];
# Binary for i686 is also available if someone can package it hydraPlatforms = [];
license = lib.licenses.unfreeRedistributable; license = stdenv.lib.licenses.unfreeRedistributable;
}; };
libPath = stdenv.lib.makeLibraryPath [ libPath = stdenv.lib.makeLibraryPath [
libX11 libX11
libcxxabi
libpng12 libpng12
glib glib
xorg.libSM xorg.libSM
xorg.libXext xorg.libXext
fontconfig fontconfig
phonon
zlib zlib
freetype freetype
libICE libICE
@ -34,19 +40,36 @@ stdenv.mkDerivation rec{
libXrender libXrender
]; ];
phases = [ "unpackPhase" "installPhase" ]; dontPatchELF = true;
installPhase = '' installPhase = ''
cp -r . "$out" prefix=$out/opt/kingsoft/wps-office
chmod +x "$out/office6/wpp" mkdir -p $prefix
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) --force-rpath --set-rpath "$out/office6:$libPath" "$out/office6/wpp" cp -r . $prefix
chmod +x "$out/office6/wps"
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) --force-rpath --set-rpath "$out/office6:$libPath" "$out/office6/wps" # Avoid forbidden reference error due use of patchelf
chmod +x "$out/office6/et" rm -r $PWD
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) --force-rpath --set-rpath "$out/office6:$libPath" "$out/office6/et"
mkdir -p "$out/bin/" mkdir $out/bin
ln -s "$out/office6/wpp" "$out/bin/wpspresentation" for i in wps wpp et; do
ln -s "$out/office6/wps" "$out/bin/wpswriter" patchelf \
ln -s "$out/office6/et" "$out/bin/wpsspreadsheets" --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--force-rpath --set-rpath "$prefix/office6:$libPath" \
$prefix/office6/$i
substitute $prefix/$i $out/bin/$i \
--replace /opt/kingsoft/wps-office $prefix
chmod +x $out/bin/$i
substituteInPlace $prefix/resource/applications/wps-office-$i.desktop \
--replace /usr/bin $out/bin
done
# China fonts
mkdir -p $prefix/resource/fonts/wps-office $out/etc/fonts/conf.d
ln -s $prefix/fonts/* $prefix/resource/fonts/wps-office
ln -s $prefix/fontconfig/*.conf $out/etc/fonts/conf.d
ln -s $prefix/resource $out/share
''; '';
} }