Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 916780 - media-gfx/naps2 - Scan documents to PDF written in C# (New Package)
Summary: media-gfx/naps2 - Scan documents to PDF written in C# (New Package)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Default Assignee for New Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-04 05:44 UTC by ppw0
Modified: 2025-02-23 05:12 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Working ebuild for naps2-7.5.1 (naps2-7.5.1.patch,101.24 KB, patch)
2024-08-29 07:36 UTC, Axel Rasmussen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ppw0 2023-11-04 05:44:14 UTC
From [1]:
```
NAPS2 is free and open source scanning software for Windows, Mac and Linux.

Easily scan with devices from Canon, Brother, HP, Epson, Fujitsu, and more. Then save to PDF, TIFF, JPEG, or PNG with a single click.
```
The project offers .deb, .rpm, flatpak, .msi and .pkg binaries. Sources can be found in [2].

Build instructions are in [3], although I'm not sure how translatable they are to an ebuild (I'd be happy with a binary-only package).

[1] https://naps2.com
[2] https://github.com/cyanfish/naps2
[3] https://github.com/cyanfish/naps2/wiki/1.-Building-&-Development-Environment
Comment 1 Jonas Stein gentoo-dev 2023-11-05 15:01:01 UTC
https://repology.org/project/naps2/versions
Comment 2 Axel Rasmussen 2024-08-29 07:36:36 UTC
Created attachment 901527 [details, diff]
Working ebuild for naps2-7.5.1

I have a working ebuild for this pacakge (attached).

One lingering issue with it is this hack to remove libhostfxr.so in src_compile. That's necessary for the launcher script to work properly (see comment), but probably something cleaner needs to be done before this ebuild can be considered fully baked. I'll try to follow up on this and post a better version in the next few days.
Comment 3 Maciej Barć gentoo-dev 2024-08-29 08:55:15 UTC
Thanks a lot ppw0 and Axel!

I solved the issue of libhostfxr.so, as was suggested on IRC - if NETCore.App is in the package references then dotnet will copy libhostfxr.

One last thing I could not figure was which and where is the icon for the desktop file.

Will push it to Gentoo repo soon.
Comment 4 Larry the Git Cow gentoo-dev 2024-08-29 09:09:59 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c85989e2151228f85b0d7e6d325bada5e6991e78

commit c85989e2151228f85b0d7e6d325bada5e6991e78
Author:     Maciej Barć <xgqt@gentoo.org>
AuthorDate: 2024-08-29 09:07:44 +0000
Commit:     Maciej Barć <xgqt@gentoo.org>
CommitDate: 2024-08-29 09:09:57 +0000

    app-office/naps2: new package; add 7.5.1
    
    Closes: https://bugs.gentoo.org/916780
    Signed-off-by: Maciej Barć <xgqt@gentoo.org>

 app-office/naps2/Manifest           | 274 ++++++++++++++++++++++++++
 app-office/naps2/metadata.xml       |  25 +++
 app-office/naps2/naps2-7.5.1.ebuild | 371 ++++++++++++++++++++++++++++++++++++
 3 files changed, 670 insertions(+)
Comment 5 Maciej Barć gentoo-dev 2024-08-29 09:10:55 UTC
Added. Please test. Thanks in advance!
Comment 6 Axel Rasmussen 2024-08-30 05:54:45 UTC
About the icon, that can be sorted out by adding the following to src_install:

newicon -s 128 ./NAPS2.Lib/Icons/scanner-128.png com.naps2.Naps2.png

That might seem like a generic icon, but that's the one upstream uses in their .deb packages, see: https://github.com/cyanfish/naps2/blob/master/NAPS2.Tools/Project/Packaging/DebPackager.cs#L50

Other than that, I tested the ebuild on ~amd64 and it works perfectly.

I tried testing it on ~arm64 too, but csharp-gentoodotnetinfo fails to build there, for some unrelated reasons. If I get that sorted out I'll update this bug, perhaps we can mark the ebuild ~arm64 too.

Thanks Maciej for the help and work here!
Comment 7 Axel Rasmussen 2024-08-30 06:37:04 UTC
Ah, my issue with csharp-gentoodotnetinfo was caused by some unrelated issue in my environment.

The ebuild works properly on ~arm64 as well (tested on an M2 Mac Mini).
Comment 8 Larry the Git Cow gentoo-dev 2024-08-30 23:52:55 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f04d63b2c834afee524ff8753cc02d3da7eb4d7a

commit f04d63b2c834afee524ff8753cc02d3da7eb4d7a
Author:     Maciej Barć <xgqt@gentoo.org>
AuthorDate: 2024-08-30 08:34:19 +0000
Commit:     Maciej Barć <xgqt@gentoo.org>
CommitDate: 2024-08-30 23:52:52 +0000

    app-office/naps2: install com.naps2.Naps2 icon
    
    Bug: https://bugs.gentoo.org/916780
    Bug: https://github.com/cyanfish/naps2/discussions/443
    Signed-off-by: Maciej Barć <xgqt@gentoo.org>

 app-office/naps2/{naps2-7.5.1.ebuild => naps2-7.5.1-r1.ebuild} | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Comment 9 ppw0 2024-09-27 11:36:01 UTC
One thing I've noticed is that the running application (not the shortcut) doesn't have its own icon (only the "generic binary" one).
Comment 10 Maciej Barć gentoo-dev 2024-09-27 11:39:05 UTC
(In reply to ppw0 from comment #9)
> One thing I've noticed is that the running application (not the shortcut)
> doesn't have its own icon (only the "generic binary" one).

Hmm, no idea what could be causing this but it might be a upstream code issue.

Does it work otherwise on other systems?

(I think we are talking about how the icon would show up on the window decoration. For task bar it shows fine.)
Comment 11 ppw0 2024-09-28 06:38:31 UTC
(In reply to Maciej Barć from comment #10)
> (In reply to ppw0 from comment #9)
> > One thing I've noticed is that the running application (not the shortcut)
> > doesn't have its own icon (only the "generic binary" one).
> 
> Hmm, no idea what could be causing this but it might be a upstream code
> issue.
> 
> Does it work otherwise on other systems?
> 
> (I think we are talking about how the icon would show up on the window
> decoration. For task bar it shows fine.)

No, I do mean the taskbar. Well, it's a GNOME extension. Maybe it's something to do with GNOME, I don't know. I have only one Gentoo machine so I can't test it on other systems that easily.

Also, I keep getting this after scanning a document:

System.ComponentModel.Win32Exception (13): An error occurred trying to start process '/usr/share/naps2-7.5.1/_linux/tesseract' with working directory '/home/ppw'. Permission denied
   at bool System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, string resolvedFilename, string[] argv, string[] envp, string cwd, bool setCredentials, uint userId, uint groupId, uint[] groups, out int stdinFd, out int stdoutFd, out int stderrFd, bool usesTerminal, bool throwOnNoExec)
   at bool System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at Process System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at async Task<OcrResult> NAPS2.Ocr.TesseractOcrEngine.ProcessImage(ScanningContext scanningContext, string imagePath, OcrParams ocrParams, CancellationToken cancelToken) in /var/tmp/portage/app-office/naps2-7.5.1-r1/work/naps2-7.5.1/NAPS2.Sdk/Ocr/TesseractOcrEngine.cs:line 99
Comment 12 Maciej Barć gentoo-dev 2024-09-28 09:31:37 UTC
(In reply to ppw0 from comment #11)
> System.ComponentModel.Win32Exception (13): An error occurred trying to start
> process '/usr/share/naps2-7.5.1/_linux/tesseract' with working directory
> '/home/ppw'. Permission denied

Well, THAT IS a bug, I will work on that.
Comment 13 Larry the Git Cow gentoo-dev 2024-09-28 15:00:50 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=501f57bed5e038b5782f1cdbfb3bfc3a2168122d

commit 501f57bed5e038b5782f1cdbfb3bfc3a2168122d
Author:     Maciej Barć <xgqt@gentoo.org>
AuthorDate: 2024-09-28 12:55:31 +0000
Commit:     Maciej Barć <xgqt@gentoo.org>
CommitDate: 2024-09-28 15:00:35 +0000

    app-office/naps2: fix permissions
    
    Bug: https://bugs.gentoo.org/916780
    Signed-off-by: Maciej Barć <xgqt@gentoo.org>

 app-office/naps2/{naps2-7.5.1-r1.ebuild => naps2-7.5.1-r2.ebuild} | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 14 ppw0 2025-02-23 03:49:43 UTC
Why is media-fonts/noto-cjk a hard dep in this?
Comment 15 Axel Rasmussen 2025-02-23 05:12:03 UTC
media-fonts/noto-cjk is listed as a dep because upstream claims it is a prerequisite here: https://github.com/cyanfish/naps2/wiki/1.-Building-&-Development-Environment#getting-started

Now, will the package build fine / gracefully degrade without it? Perhaps. :) But I haven't tested it. Feel free to try without it and if it works without it we could drop it or add a USE flag or something.