lol

naps2: 7.5.3 -> 8.2.1

Update NAPS2 from version 7.5.3 to version 8.2.1.

Release notes:
https://github.com/cyanfish/naps2/blob/master/CHANGELOG.md
https://github.com/cyanfish/naps2/releases/tag/v8.2.1

Change to File Permissions:
The file `$out/lib/naps2/_linux/tesseract` was present in v7.5.3, but
for OCR in the NAPS2 binary to work the file needs to be executable.
This has been implemented in this commit.
(_linux is _linuxarm on aarch64-linux)

Application of Patch 01-donate-button.patch:
The following upstream commit https://github.com/cyanfish/naps2/commit/13aab9806b20c7bca23811f48f3d0cd32fbc2139
changed the format of the Donate Button in the About Dialog form from
an image to text. The setting of the font can fail if the font is not
installed and thus the dialog is not shown. As such, try to update the
font and if it fails, fallback to the originally set font.

Application of Patch 02-button-dpi.patch:
When attempting to use the "Email PDF" button, the setting of the font
to be dpi aware can fail if the font is not installed and thus the
dialog is not shown. As such, try to update the font and if it fails,
fallback to the originally set font.

Removal of postPatch:
The patch is no longer required.

+82 -17
+14
pkgs/by-name/na/naps2/01-donate-button.patch
···
··· 1 + diff --git a/NAPS2.Lib/EtoForms/Ui/AboutForm.cs b/NAPS2.Lib/EtoForms/Ui/AboutForm.cs 2 + --- a/NAPS2.Lib/EtoForms/Ui/AboutForm.cs 3 + +++ b/NAPS2.Lib/EtoForms/Ui/AboutForm.cs 4 + @@ -26,8 +26,8 @@ public class AboutForm : EtoDialogBase 5 + _donateButton = C.Button(UiStrings.Donate, () => ProcessHelper.OpenUrl(DONATE_URL)); 6 + _donateButton.BackgroundColor = Color.FromRgb(0xfeda96); 7 + _donateButton.TextColor = Color.FromRgb(0x1b464e); 8 + - _donateButton.Font = new Font(_donateButton.Font.Family, _donateButton.Font.Size * 11 / 10, 9 + - FontStyle.Italic | FontStyle.Bold); 10 + + try { _donateButton.Font = new Font(_donateButton.Font.Family, _donateButton.Font.Size * 11 / 10, 11 + + FontStyle.Italic | FontStyle.Bold); } catch {}; 12 + EtoPlatform.Current.ConfigureDonateButton(_donateButton); 13 + 14 + _enableDebugLogging.Checked = config.Get(c => c.EnableDebugLogging);
+14
pkgs/by-name/na/naps2/02-button-dpi.patch
···
··· 1 + diff --git a/NAPS2.Lib/EtoForms/Layout/C.cs b/NAPS2.Lib/EtoForms/Layout/C.cs 2 + --- a/NAPS2.Lib/EtoForms/Layout/C.cs 3 + +++ b/NAPS2.Lib/EtoForms/Layout/C.cs 4 + @@ -121,8 +121,8 @@ public static class C 5 + if (flags.HasFlag(ButtonFlags.LargeText)) 6 + { 7 + var baseFontSize = button.Font.Size; 8 + - EtoPlatform.Current.AttachDpiDependency(button, 9 + - _ => button.Font = new Font(button.Font.Family, baseFontSize * 4 / 3)); 10 + + EtoPlatform.Current.AttachDpiDependency(button, _ => { 11 + + try { button.Font = new Font(button.Font.Family, baseFontSize * 4 / 3); } catch {}}); 12 + } 13 + EtoPlatform.Current.ConfigureImageButton(button, flags); 14 + return button;
+36 -6
pkgs/by-name/na/naps2/deps.json
··· 161 }, 162 { 163 "pname": "Microsoft.NETCore.Platforms", 164 "version": "1.1.1", 165 "hash": "sha256-8hLiUKvy/YirCWlFwzdejD2Db3DaXhHxT7GSZx/znJg=" 166 }, ··· 173 "pname": "Microsoft.NETCore.Targets", 174 "version": "1.1.0", 175 "hash": "sha256-0AqQ2gMS8iNlYkrD+BxtIg7cXMnr9xZHtKAuN4bjfaQ=" 176 }, 177 { 178 "pname": "Microsoft.NETCore.Targets", ··· 196 }, 197 { 198 "pname": "NAPS2.NTwain", 199 - "version": "1.0.0", 200 - "hash": "sha256-jXpUVhX8c9CutPJH5Q2JvJjPBRrV6gI0yI/mA8PgDSE=" 201 }, 202 { 203 "pname": "NAPS2.Pdfium.Binaries", 204 - "version": "1.1.0", 205 - "hash": "sha256-mg88JinIvTJZHtaPoEQbVsL5PBO5iUiNMvcQ4M2c2GY=" 206 }, 207 { 208 "pname": "NAPS2.PdfSharp", ··· 211 }, 212 { 213 "pname": "NAPS2.Tesseract.Binaries", 214 - "version": "1.2.0", 215 - "hash": "sha256-4rtFr6ydc+LRgYK7asVRnMSigI2iwU2poG6TJ52eKlQ=" 216 }, 217 { 218 "pname": "NAPS2.Wia", ··· 391 }, 392 { 393 "pname": "runtime.native.System.Security.Cryptography.OpenSsl", 394 "version": "4.3.2", 395 "hash": "sha256-xqF6LbbtpzNC9n1Ua16PnYgXHU0LvblEROTfK4vIxX8=" 396 }, ··· 463 "pname": "runtime.unix.System.Runtime.Extensions", 464 "version": "4.3.0", 465 "hash": "sha256-l8S9gt6dk3qYG6HYonHtdlYtBKyPb29uQ6NDjmrt3V4=" 466 }, 467 { 468 "pname": "SharpZipLib", ··· 476 }, 477 { 478 "pname": "SixLabors.Fonts", 479 "version": "1.0.1", 480 "hash": "sha256-fox6f9Z5xunVXiy71KTSkb0DirMN00tuUlChyp96kiI=" 481 }, ··· 578 "pname": "System.Private.Uri", 579 "version": "4.3.0", 580 "hash": "sha256-fVfgcoP4AVN1E5wHZbKBIOPYZ/xBeSIdsNF+bdukIRM=" 581 }, 582 { 583 "pname": "System.Reflection",
··· 161 }, 162 { 163 "pname": "Microsoft.NETCore.Platforms", 164 + "version": "1.1.0", 165 + "hash": "sha256-FeM40ktcObQJk4nMYShB61H/E8B7tIKfl9ObJ0IOcCM=" 166 + }, 167 + { 168 + "pname": "Microsoft.NETCore.Platforms", 169 "version": "1.1.1", 170 "hash": "sha256-8hLiUKvy/YirCWlFwzdejD2Db3DaXhHxT7GSZx/znJg=" 171 }, ··· 178 "pname": "Microsoft.NETCore.Targets", 179 "version": "1.1.0", 180 "hash": "sha256-0AqQ2gMS8iNlYkrD+BxtIg7cXMnr9xZHtKAuN4bjfaQ=" 181 + }, 182 + { 183 + "pname": "Microsoft.NETCore.Targets", 184 + "version": "1.1.3", 185 + "hash": "sha256-WLsf1NuUfRWyr7C7Rl9jiua9jximnVvzy6nk2D2bVRc=" 186 }, 187 { 188 "pname": "Microsoft.NETCore.Targets", ··· 206 }, 207 { 208 "pname": "NAPS2.NTwain", 209 + "version": "1.0.1", 210 + "hash": "sha256-WSU/KBDz2zcnoYMH/38UsOMVB9+mOIJkqfKVzT58bGE=" 211 }, 212 { 213 "pname": "NAPS2.Pdfium.Binaries", 214 + "version": "1.2.0", 215 + "hash": "sha256-wbOjJzCnTm+hN4uQEY8glfeuL1R8WEYQm1/obZ9tLmM=" 216 }, 217 { 218 "pname": "NAPS2.PdfSharp", ··· 221 }, 222 { 223 "pname": "NAPS2.Tesseract.Binaries", 224 + "version": "1.4.0", 225 + "hash": "sha256-cX+0nD7hLroL2pyRsB2mAErHLuG04B7fcm273BQpL5E=" 226 }, 227 { 228 "pname": "NAPS2.Wia", ··· 401 }, 402 { 403 "pname": "runtime.native.System.Security.Cryptography.OpenSsl", 404 + "version": "4.3.0", 405 + "hash": "sha256-Jy01KhtcCl2wjMpZWH+X3fhHcVn+SyllWFY8zWlz/6I=" 406 + }, 407 + { 408 + "pname": "runtime.native.System.Security.Cryptography.OpenSsl", 409 "version": "4.3.2", 410 "hash": "sha256-xqF6LbbtpzNC9n1Ua16PnYgXHU0LvblEROTfK4vIxX8=" 411 }, ··· 478 "pname": "runtime.unix.System.Runtime.Extensions", 479 "version": "4.3.0", 480 "hash": "sha256-l8S9gt6dk3qYG6HYonHtdlYtBKyPb29uQ6NDjmrt3V4=" 481 + }, 482 + { 483 + "pname": "SharpZipLib", 484 + "version": "1.3.3", 485 + "hash": "sha256-HWEQTKh9Ktwg/zIl079dAiH+ob2ShWFAqLgG6XgIMr4=" 486 }, 487 { 488 "pname": "SharpZipLib", ··· 496 }, 497 { 498 "pname": "SixLabors.Fonts", 499 + "version": "1.0.0-beta17", 500 + "hash": "sha256-KnHduFn5h/mtHCpCFKg+ZIZi6fKjz2H2sqTIzwXCqOI=" 501 + }, 502 + { 503 + "pname": "SixLabors.Fonts", 504 "version": "1.0.1", 505 "hash": "sha256-fox6f9Z5xunVXiy71KTSkb0DirMN00tuUlChyp96kiI=" 506 }, ··· 603 "pname": "System.Private.Uri", 604 "version": "4.3.0", 605 "hash": "sha256-fVfgcoP4AVN1E5wHZbKBIOPYZ/xBeSIdsNF+bdukIRM=" 606 + }, 607 + { 608 + "pname": "System.Private.Uri", 609 + "version": "4.3.2", 610 + "hash": "sha256-jB2+W3tTQ6D9XHy5sEFMAazIe1fu2jrENUO0cb48OgU=" 611 }, 612 { 613 "pname": "System.Reflection",
+18 -11
pkgs/by-name/na/naps2/package.nix
··· 14 15 buildDotnetModule rec { 16 pname = "naps2"; 17 - version = "7.5.3"; 18 19 src = fetchFromGitHub { 20 owner = "cyanfish"; 21 repo = "naps2"; 22 tag = "v${version}"; 23 - hash = "sha256-vX+ZyCQsYqJjgYaufWJRnzX8retiFK5QHSP40bbBaCc="; 24 }; 25 26 projectFile = "NAPS2.App.Gtk/NAPS2.App.Gtk.csproj"; 27 nugetDeps = ./deps.json; 28 29 - postPatch = '' 30 - substituteInPlace NAPS2.Images.Gtk/NAPS2.Images.Gtk.csproj \ 31 - --replace-fail TargetFramework TargetFrameworks \ 32 - ''; 33 - 34 dotnetFlags = [ 35 - "-p:TargetFrameworks=net8" 36 - "-p:EnablePreviewFeatures=true" 37 ]; 38 39 executables = [ "naps2" ]; 40 41 - dotnet-sdk = dotnetCorePackages.sdk_8_0; 42 - dotnet-runtime = dotnetCorePackages.runtime_8_0; 43 44 nativeBuildInputs = [ wrapGAppsHook3 ]; 45 ··· 60 install -D NAPS2.Lib/Icons/scanner-64-rev2.png $out/share/icons/hicolor/64x64/apps/com.naps2.Naps2.png 61 install -D NAPS2.Lib/Icons/scanner-72-rev1.png $out/share/icons/hicolor/72x72/apps/com.naps2.Naps2.png 62 install -D NAPS2.Lib/Icons/scanner-128.png $out/share/icons/hicolor/128x128/apps/com.naps2.Naps2.png 63 ''; 64 65 meta = {
··· 14 15 buildDotnetModule rec { 16 pname = "naps2"; 17 + version = "8.2.1"; 18 19 src = fetchFromGitHub { 20 owner = "cyanfish"; 21 repo = "naps2"; 22 tag = "v${version}"; 23 + hash = "sha256-1OPFWmy9eDRnMJjYdzYubgfde7MNix8ZsSuN2ZHsvco="; 24 }; 25 26 + patches = [ 27 + ./01-donate-button.patch 28 + ./02-button-dpi.patch 29 + ]; 30 + 31 projectFile = "NAPS2.App.Gtk/NAPS2.App.Gtk.csproj"; 32 nugetDeps = ./deps.json; 33 34 dotnetFlags = [ 35 + "-p:TargetFrameworks=net9" 36 ]; 37 38 executables = [ "naps2" ]; 39 40 + dotnet-sdk = dotnetCorePackages.sdk_9_0; 41 + dotnet-runtime = dotnetCorePackages.runtime_9_0; 42 43 nativeBuildInputs = [ wrapGAppsHook3 ]; 44 ··· 59 install -D NAPS2.Lib/Icons/scanner-64-rev2.png $out/share/icons/hicolor/64x64/apps/com.naps2.Naps2.png 60 install -D NAPS2.Lib/Icons/scanner-72-rev1.png $out/share/icons/hicolor/72x72/apps/com.naps2.Naps2.png 61 install -D NAPS2.Lib/Icons/scanner-128.png $out/share/icons/hicolor/128x128/apps/com.naps2.Naps2.png 62 + case "${stdenv.hostPlatform.system}" in 63 + x86_64-linux) 64 + chmod a+x $out/lib/naps2/_linux/tesseract 65 + ;; 66 + aarch64-linux) 67 + chmod a+x $out/lib/naps2/_linuxarm/tesseract 68 + ;; 69 + esac 70 ''; 71 72 meta = {