nixpkgs/pkgs/applications/misc/pdfstudio/default.nix

88 lines
2.3 KiB
Nix
Raw Normal View History

2022-01-20 20:08:23 +00:00
{ stdenv
, lib
, fetchurl
, libgccjit
, dpkg
, makeDesktopItem
, copyDesktopItems
, autoPatchelfHook
, sane-backends
, jdk11
}:
2021-12-19 09:58:15 +00:00
2022-01-20 20:08:23 +00:00
# See also package 'pdfstudioviewer'
# Differences are ${pname}, Download directory name (PDFStudio / PDFStudioViewer),
# sha256, and libgccjit (not needed for PDFStudioViewer)
let year = "2021";
in
stdenv.mkDerivation rec {
2021-12-19 09:58:15 +00:00
pname = "pdfstudio";
2022-01-20 20:08:23 +00:00
version = "${year}.1.2";
strictDeps = true;
2021-12-19 09:58:15 +00:00
src = fetchurl {
2022-01-20 20:08:23 +00:00
url = "https://download.qoppa.com/${pname}/v${year}/PDFStudio_v${
builtins.replaceStrings [ "." ] [ "_" ] version
}_linux64.deb";
2022-01-12 23:33:56 +00:00
sha256 = "1188ll2qz58rr2slavqxisbz4q3fdzidpasb1p33926z0ym3rk45";
2021-12-19 09:58:15 +00:00
};
2022-01-20 20:08:23 +00:00
buildInputs = [
libgccjit #for libstdc++.so.6 and libgomp.so.1
sane-backends #for libsane.so.1
jdk11
];
2021-12-19 09:58:15 +00:00
nativeBuildInputs = [
autoPatchelfHook
dpkg
copyDesktopItems
];
2022-01-20 20:08:23 +00:00
desktopItems = [
(makeDesktopItem {
name = "${pname}${year}";
desktopName = "PDF Studio";
genericName = "View and edit PDF files";
exec = "${pname} %f";
icon = "${pname}${year}";
comment = "Views and edits PDF files";
mimeType = "application/pdf";
categories = "Office";
type = "Application";
terminal = false;
})
];
2021-12-19 09:58:15 +00:00
unpackPhase = "dpkg-deb -x $src .";
dontBuild = true;
2022-01-20 20:08:23 +00:00
postPatch = ''
substituteInPlace opt/${pname}${year}/${pname}${year} --replace "# INSTALL4J_JAVA_HOME_OVERRIDE=" "INSTALL4J_JAVA_HOME_OVERRIDE=${jdk11.out}"
substituteInPlace opt/${pname}${year}/updater --replace "# INSTALL4J_JAVA_HOME_OVERRIDE=" "INSTALL4J_JAVA_HOME_OVERRIDE=${jdk11.out}"
'';
2021-12-19 09:58:15 +00:00
installPhase = ''
runHook preInstall
mkdir -p $out/bin
mkdir -p $out/share
mkdir -p $out/share/pixmaps
cp -r opt/${pname}${year} $out/share/
2022-01-20 20:08:23 +00:00
rm -rf $out/share/${pname}${year}/jre
2021-12-19 09:58:15 +00:00
ln -s $out/share/${pname}${year}/.install4j/${pname}${year}.png $out/share/pixmaps/
2022-01-20 20:08:23 +00:00
ln -s $out/share/${pname}${year}/${pname}${year} $out/bin/${pname}
2021-12-19 09:58:15 +00:00
2021-12-19 23:14:32 +00:00
runHook postInstall
2021-12-19 09:58:15 +00:00
'';
meta = with lib; {
homepage = "https://www.qoppa.com/pdfstudio/";
description = "An easy to use, full-featured PDF editing software";
license = licenses.unfree;
platforms = platforms.linux;
2022-01-20 20:08:23 +00:00
mainProgram = pname;
2021-12-19 09:58:15 +00:00
maintainers = [ maintainers.pwoelfel ];
};
}