pdfstudio/pdfstudioviewer: improve package naming schemes and add/upgrade to 2022.0.2

This commit is contained in:
Philipp Woelfel 2022-09-25 01:33:26 -06:00
parent c1339f7f5b
commit 2c203ec12a
4 changed files with 77 additions and 47 deletions

View File

@ -1,11 +1,13 @@
{ pname
, program
, src
, year
, version
, desktopName
, longDescription
, buildFHSUserEnv
, extraBuildInputs ? []
, extraBuildInputs ? [ ]
, jdk
, stdenv
, lib
, dpkg
@ -14,7 +16,6 @@
, autoPatchelfHook
, sane-backends
, cups
, jdk11
}:
let
thisPackage = stdenv.mkDerivation rec {
@ -23,7 +24,6 @@ let
buildInputs = [
sane-backends #for libsane.so.1
jdk11
] ++ extraBuildInputs;
nativeBuildInputs = [
@ -34,33 +34,33 @@ let
desktopItems = [
(makeDesktopItem {
name = "${pname}${year}";
name = "${pname}";
desktopName = desktopName;
genericName = "View and edit PDF files";
exec = "${pname} %f";
icon = "${pname}${year}";
icon = "${pname}";
comment = "Views and edits PDF files";
mimeTypes = [ "application/pdf" ];
categories = [ "Office" ];
})
];
unpackCmd = "dpkg-deb -x $src ./${pname}-${version}";
unpackCmd = "dpkg-deb -x $src ./${program}-${version}";
dontBuild = true;
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}"
substituteInPlace opt/${program}${year}/${program}${year} --replace "# INSTALL4J_JAVA_HOME_OVERRIDE=" "INSTALL4J_JAVA_HOME_OVERRIDE=${jdk.out}"
substituteInPlace opt/${program}${year}/updater --replace "# INSTALL4J_JAVA_HOME_OVERRIDE=" "INSTALL4J_JAVA_HOME_OVERRIDE=${jdk.out}"
'';
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,share/pixmaps}
rm -rf opt/${pname}${year}/jre
cp -r opt/${pname}${year} $out/share/
ln -s $out/share/${pname}${year}/.install4j/${pname}${year}.png $out/share/pixmaps/
ln -s $out/share/${pname}${year}/${pname}${year} $out/bin/${pname}
rm -rf opt/${program}${year}/jre
cp -r opt/${program}${year} $out/share/
ln -s $out/share/${program}${year}/.install4j/${program}${year}.png $out/share/pixmaps/${pname}.png
ln -s $out/share/${program}${year}/${program}${year} $out/bin/
runHook postInstall
'';
@ -74,7 +74,7 @@ buildFHSUserEnv {
cups
thisPackage
];
runScript = pname;
runScript = "${program}${year}";
# link desktop item and icon into FHS user environment
extraInstallCommands = ''

View File

@ -1,42 +1,69 @@
{ program ? "pdfstudioviewer"
# For upstream versions, download links, and change logs see https://www.qoppa.com/pdfstudio/versions
#
# PDF Studio license is for a specific year, so we need different packages for different years.
# All versions of PDF Studio Viewer are free, so we package only the latest year.
# Thus, packages are pdfstudioviewer, pdfstudio2021, pdfstudio2022, etc.
# Variables:
# - program is either "pdfstudio" or "pdfstudioviewer", defaults to "pdfstudio".
# - year identifies the year portion of the version, defaults to most recent year.
# - pname is either "pdfstudio${year}" or "pdfstudioviewer".
{ program ? "pdfstudio"
, year ? "2022"
, fetchurl
, libgccjit
, callPackage
, jdk11
, jdk17
}:
let makeurl = { pname, year, version }: "https://download.qoppa.com/${pname}/v${year}/${
builtins.replaceStrings [ "pdfstudio" "viewer" "." ] [ "PDFStudio" "Viewer" "_" ] "${pname}_v${version}"
}_linux64.deb";
let
longDescription = ''
PDF Studio is an easy to use, full-featured PDF editing software. This is the standard/pro edition, which requires a license. For the free PDF Studio Viewer see the package pdfstudioviewer.
'';
pname = if (program == "pdfstudio") then "${program}${year}" else program;
desktopName =
if (program == "pdfstudio")
then "PDF Studio ${year}"
else "PDF Studio Viewer";
dot2dash = str: builtins.replaceStrings [ "." ] [ "_" ] str;
in
{
pdfstudio = callPackage ./common.nix rec {
pname = program;
year = "2021";
version = "${year}.2.0";
desktopName = "PDF Studio";
longDescription = ''
PDF Studio is an easy to use, full-featured PDF editing software. This is the standard/pro edition, which requires a license. For the free PDF Studio Viewer see the package pdfstudioviewer.
'';
extraBuildInputs = [
libgccjit #for libstdc++.so.6 and libgomp.so.1
];
src = fetchurl {
url = makeurl { inherit pname year version; };
sha256 = "sha256-wQgVWz2kS+XkrqvCAUishizfDrCwGyVDAAU4Yzj4uYU=";
};
};
pdfstudioviewer = callPackage ./common.nix rec {
pname = program;
year = "2021";
version = "${year}.2.0";
desktopName = "PDF Studio Viewer";
inherit desktopName pname program year;
version = "${year}.0.2";
longDescription = ''
PDF Studio Viewer is an easy to use, full-featured PDF editing software. This is the free edition. For the standard/pro edition, see the package pdfstudio.
'';
src = fetchurl {
url = makeurl { inherit pname year version; };
sha256 = "sha256-RjVfl3wRK4bqNwSZr2R0CNx4urHTL0QLmKdogEnySWU=";
url = "https://web.archive.org/web/20220909093140/https://download.qoppa.com/pdfstudioviewer/PDFStudioViewer_linux64.deb";
sha256 = "sha256-za+a5vGkINLFvFoZdnB++4VGE9rfdfZf5HFNw/Af1AA=";
};
jdk = jdk11;
};
}.${program}
pdfstudio2021 = callPackage ./common.nix rec {
inherit desktopName longDescription pname program year;
version = "${year}.2.0";
src = fetchurl {
url = "https://download.qoppa.com/pdfstudio/v${year}/PDFStudio_v${dot2dash version}_linux64.deb";
sha256 = "sha256-wQgVWz2kS+XkrqvCAUishizfDrCwGyVDAAU4Yzj4uYU=";
};
extraBuildInputs = [
libgccjit #for libstdc++.so.6 and libgomp.so.1
];
jdk = jdk11;
};
pdfstudio2022 = callPackage ./common.nix rec {
inherit desktopName longDescription pname program year;
version = "${year}.0.2";
src = fetchurl {
url = "https://download.qoppa.com/pdfstudio/v${year}/PDFStudio_v${dot2dash version}_linux64_adoptium17.deb";
sha256 = "sha256-fWZXCyizP++pkmC+UpgCzGvb0QrNs4RI6iC4ZBL8hLE=";
};
extraBuildInputs = [
libgccjit #for libstdc++.so.6 and libgomp.so.1
];
jdk = jdk17;
};
}.${pname}

View File

@ -842,6 +842,7 @@ mapAliases ({
pbis-open = throw "pbis-open has been removed, because it is no longer maintained upstream"; # added 2021-12-15
pdf-redact-tools = throw "pdf-redact-tools has been removed from nixpkgs because the upstream has abandoned the project"; # Added 2022-01-01
pdfmod = throw "pdfmod has been removed"; # Added 2022-01-15
pdfstudio = throw "'pdfstudio' has been replaced with 'pdfstudio<year>', where '<year>' is the year from the PDF Studio version number, because each license is specific to a given year"; # Added 2022-09-04
peach = asouldocs; # Added 2022-08-28
pentablet-driver = xp-pen-g430-driver; # Added 2022-06-23
perlXMLParser = throw "'perlXMLParser' has been renamed to/replaced by 'perlPackages.XMLParser'"; # Converted to throw 2022-02-22

View File

@ -26593,14 +26593,16 @@ with pkgs;
foxitreader = libsForQt512.callPackage ../applications/misc/foxitreader { };
pdfstudio = import ../applications/misc/pdfstudio {
program = "pdfstudio";
inherit callPackage fetchurl libgccjit;
pdfstudio2021 = callPackage ../applications/misc/pdfstudio {
year = "2021";
};
pdfstudioviewer = import ../applications/misc/pdfstudio {
pdfstudio2022 = callPackage ../applications/misc/pdfstudio {
year = "2022";
};
pdfstudioviewer = callPackage ../applications/misc/pdfstudio {
program = "pdfstudioviewer";
inherit callPackage fetchurl libgccjit;
};
aeolus = callPackage ../applications/audio/aeolus { };