blob: 4c83d67f7cda77e5361b4c2eda313e119e38bd1e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
{ stdenv, fetchurl
, libX11, glib, xorg, fontconfig, freetype
, zlib, libpng12, libICE, libXrender, cups }:
let
bits = if stdenv.hostPlatform.system == "x86_64-linux" then "x86_64"
else "x86";
version = "10.1.0.5672";
in stdenv.mkDerivation rec{
name = "wpsoffice-${version}";
src = fetchurl {
name = "${name}.tar.xz";
url = "http://kdl.cc.ksosoft.com/wps-community/download/a21/wps-office_${version}~a21_${bits}.tar.xz";
sha256 = if bits == "x86_64" then
"0mi3n9kplf82gd0g2m0np957agy53p4g1qh81pbban49r4n0ajcz" else
"1dk400ap5qwdhjvn8lnk602f5akayr391fkljxdkrpn5xac01m97";
};
meta = {
description = "Office program originally named Kingsoft Office";
homepage = http://wps-community.org/;
platforms = [ "i686-linux" "x86_64-linux" ];
hydraPlatforms = [];
license = stdenv.lib.licenses.unfreeRedistributable;
};
libPath = stdenv.lib.makeLibraryPath [
libX11
libpng12
glib
xorg.libSM
xorg.libXext
fontconfig
zlib
freetype
libICE
cups
libXrender
];
dontPatchELF = true;
# wpsoffice uses `/build` in its own build system making nix things there
# references to nix own build directory
noAuditTmpdir = true;
installPhase = ''
prefix=$out/opt/kingsoft/wps-office
mkdir -p $prefix
cp -r . $prefix
# Avoid forbidden reference error due use of patchelf
rm -r $PWD
mkdir $out/bin
for i in wps wpp et; do
patchelf \
--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
'';
}
|