2021-02-20 07:58:42 +01:00
|
|
|
{ lib, stdenv, autoPatchelfHook, makeDesktopItem, makeWrapper, copyDesktopItems
|
2019-08-30 17:37:58 +02:00
|
|
|
|
|
|
|
# Dynamic Libraries
|
|
|
|
, curl, libGL, libX11, libXext, libXmu, libXrandr, libXrender
|
|
|
|
|
2019-10-20 19:36:35 +02:00
|
|
|
# For fixing up execution of /bin/ls, which is necessary for
|
|
|
|
# product unlocking.
|
2020-10-17 07:35:52 +02:00
|
|
|
, coreutils, libredirect
|
2019-10-20 19:36:35 +02:00
|
|
|
|
2020-10-17 08:12:23 +02:00
|
|
|
# Extra utilities used by the SoftMaker applications.
|
2020-11-24 16:29:28 +01:00
|
|
|
, gnugrep, util-linux, which
|
2020-10-17 08:12:23 +02:00
|
|
|
|
2019-08-30 17:37:58 +02:00
|
|
|
, pname, version, edition, suiteName, src, archive
|
|
|
|
|
|
|
|
, ...
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
desktopItems = import ./desktop_items.nix {
|
|
|
|
inherit makeDesktopItem pname suiteName;
|
|
|
|
};
|
|
|
|
shortEdition = builtins.substring 2 2 edition;
|
2020-07-21 08:13:31 +02:00
|
|
|
in stdenv.mkDerivation {
|
|
|
|
inherit pname src;
|
|
|
|
|
|
|
|
version = "${edition}.${version}";
|
|
|
|
|
2019-08-30 17:37:58 +02:00
|
|
|
nativeBuildInputs = [
|
|
|
|
autoPatchelfHook
|
2020-11-27 13:44:18 +01:00
|
|
|
copyDesktopItems
|
2019-08-30 17:37:58 +02:00
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
curl
|
|
|
|
libGL
|
|
|
|
libX11
|
|
|
|
libXext
|
|
|
|
libXmu
|
|
|
|
libXrandr
|
|
|
|
libXrender
|
|
|
|
stdenv.cc.cc.lib
|
|
|
|
];
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
dontConfigure = true;
|
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
runHook preUnpack
|
|
|
|
|
|
|
|
mkdir installer
|
|
|
|
tar -C installer -xf ${src}
|
|
|
|
mkdir ${pname}
|
|
|
|
tar -C ${pname} -xf installer/${archive}
|
|
|
|
|
|
|
|
runHook postUnpack
|
|
|
|
'';
|
|
|
|
|
2020-10-17 07:35:52 +02:00
|
|
|
installPhase = let
|
|
|
|
# SoftMaker/FreeOffice collects some system information upon
|
|
|
|
# unlocking the product. But in doing so, it attempts to execute
|
|
|
|
# /bin/ls. If the execve syscall fails, the whole unlock
|
|
|
|
# procedure fails. This works around that by rewriting /bin/ls
|
|
|
|
# to the proper path.
|
|
|
|
#
|
2020-10-17 08:12:23 +02:00
|
|
|
# In addition, it expects some common utilities (which, whereis)
|
|
|
|
# to be in the path.
|
|
|
|
#
|
2020-10-17 07:35:52 +02:00
|
|
|
# SoftMaker Office restarts itself upon some operations, such
|
|
|
|
# changing the theme and unlocking. Unfortunately, we do not
|
|
|
|
# have control over its environment then and it will fail
|
|
|
|
# with an error.
|
2020-10-17 08:12:23 +02:00
|
|
|
extraWrapperArgs = ''
|
2020-10-17 07:35:52 +02:00
|
|
|
--set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
|
2020-10-17 08:12:23 +02:00
|
|
|
--set NIX_REDIRECTS "/bin/ls=${coreutils}/bin/ls" \
|
2021-01-15 06:42:41 +01:00
|
|
|
--prefix PATH : "${lib.makeBinPath [ coreutils gnugrep util-linux which ]}"
|
2020-10-17 07:35:52 +02:00
|
|
|
'';
|
|
|
|
in ''
|
2019-08-30 17:37:58 +02:00
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out/share
|
|
|
|
cp -r ${pname} $out/share/${pname}${edition}
|
|
|
|
|
|
|
|
# Wrap rather than symlinking, so that the programs can determine
|
|
|
|
# their resource path.
|
|
|
|
mkdir -p $out/bin
|
2020-10-17 07:35:52 +02:00
|
|
|
makeWrapper $out/share/${pname}${edition}/planmaker $out/bin/${pname}-planmaker \
|
2020-10-17 08:12:23 +02:00
|
|
|
${extraWrapperArgs}
|
2020-10-17 07:35:52 +02:00
|
|
|
makeWrapper $out/share/${pname}${edition}/presentations $out/bin/${pname}-presentations \
|
2020-10-17 08:12:23 +02:00
|
|
|
${extraWrapperArgs}
|
2020-10-17 07:35:52 +02:00
|
|
|
makeWrapper $out/share/${pname}${edition}/textmaker $out/bin/${pname}-textmaker \
|
2020-10-17 08:12:23 +02:00
|
|
|
${extraWrapperArgs}
|
2019-08-30 17:37:58 +02:00
|
|
|
|
|
|
|
for size in 16 32 48 64 96 128 256 512 1024; do
|
|
|
|
mkdir -p $out/share/icons/hicolor/''${size}x''${size}/apps
|
|
|
|
|
|
|
|
for app in pml prl tml; do
|
|
|
|
ln -s $out/share/${pname}${edition}/icons/''${app}_''${size}.png \
|
|
|
|
$out/share/icons/hicolor/''${size}x''${size}/apps/${pname}-''${app}.png
|
|
|
|
done
|
|
|
|
|
|
|
|
mkdir -p $out/share/icons/hicolor/''${size}x''${size}/mimetypes
|
|
|
|
|
|
|
|
for mimetype in pmd prd tmd; do
|
|
|
|
ln -s $out/share/${pname}${edition}/icons/''${mimetype}_''${size}.png \
|
|
|
|
$out/share/icons/hicolor/''${size}x''${size}/mimetypes/application-x-''${mimetype}.png
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
2019-11-19 22:15:05 +01:00
|
|
|
# freeoffice 973 misses the 96x96 application icons, giving broken symbolic links
|
|
|
|
# remove broken symbolic links
|
|
|
|
find $out -xtype l -ls -exec rm {} \;
|
|
|
|
|
2019-08-30 17:37:58 +02:00
|
|
|
# Add mime types
|
|
|
|
install -D -t $out/share/mime/packages ${pname}/mime/softmaker-*office*${shortEdition}.xml
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2020-11-27 13:44:18 +01:00
|
|
|
desktopItems = builtins.attrValues desktopItems;
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2019-08-30 17:37:58 +02:00
|
|
|
description = "An office suite with a word processor, spreadsheet and presentation program";
|
|
|
|
homepage = "https://www.softmaker.com/";
|
|
|
|
license = licenses.unfree;
|
2021-07-03 12:07:30 +02:00
|
|
|
maintainers = with maintainers; [ ];
|
2019-08-30 17:37:58 +02:00
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
};
|
|
|
|
}
|