Bug 280340 - [NEW PORT] math/quich: a terminal calculator
Summary: [NEW PORT] math/quich: a terminal calculator
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Daniel Engberg
URL:
Keywords:
Depends on: 280602
Blocks:
  Show dependency treegraph
 
Reported: 2024-07-17 21:50 UTC by gatekeeper
Modified: 2024-08-24 02:55 UTC (History)
1 user (show)

See Also:


Attachments
git patch (1.77 KB, patch)
2024-07-17 21:50 UTC, gatekeeper
no flags Details | Diff
git patch (3.67 KB, patch)
2024-07-18 20:10 UTC, gatekeeper
no flags Details | Diff
git patch (3.71 KB, patch)
2024-07-18 20:30 UTC, gatekeeper
no flags Details | Diff
Patch for quich (3.32 KB, patch)
2024-08-04 09:30 UTC, Daniel Engberg
no flags Details | Diff
Patch for quich v2 (1.69 KB, patch)
2024-08-04 12:58 UTC, Daniel Engberg
no flags Details | Diff
git patch (2.17 KB, patch)
2024-08-06 22:36 UTC, gatekeeper
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description gatekeeper 2024-07-17 21:50:09 UTC
Created attachment 252132 [details]
git patch

Quich is a simple terminal calculator, and is available from here: https://github.com/Usbac/quich.
I would like to propose to add this program to the ports collection.
Comment 1 Daniel Engberg freebsd_committer freebsd_triage 2024-07-18 18:23:41 UTC
Having a quick look at the source code it seems like you can unbundle (lib)linenoise.
https://docs.freebsd.org/en/books/porters-handbook/book/#bundled-libs-practices
Comment 2 gatekeeper 2024-07-18 20:10:04 UTC
Created attachment 252148 [details]
git patch

Awesome! Thank you for the comments. I have made sure that the program compiles with liblinenoise as a dependency (see attachment). This library (linenoise) is already available in the ports tree, so there is no need to create it; however linenoise is missing an SONAME - that could be added to linenoise, but I guess that should be a separate bug report...
Comment 3 gatekeeper 2024-07-18 20:30:58 UTC
Created attachment 252149 [details]
git patch

... and now also with tests :-)
Comment 4 Daniel Engberg freebsd_committer freebsd_triage 2024-07-20 07:31:23 UTC
Uhm... is it intentional to not link with (lib)m with the patch?
Comment 5 gatekeeper 2024-07-20 11:04:33 UTC
(In reply to Daniel Engberg from comment #4)

quich is already linking against libm; see here in the compiled file:
.build/quich:
	libm.so.5 => /lib/libm.so.5 (0x15766118000)
	liblinenoise.so => /usr/local/lib/liblinenoise.so (0x15767656000)
	libc.so.7 => /lib/libc.so.7 (0x15766f75000)
	[vdso] (0x15765310000)

I was thinking that you might be referring to the patch for the Makefile, but it is linking to libm... the patch just adds liblinenoise (and does not remote libm) to both quich and quich_test. After applying the patch, the Makefile looks like this (for quich):

target_link_libraries(quich m)
target_link_libraries(quich linenoise)

I was also wondering if you were referring to a missing LIB_DEPENDS on the port's Makefile, but I cannot find any other example in the ports tree that does this; Since libm is part of base, I guess that this is not needed and your comment is not referring to this... right?

So... sorry, I am not sure what you are referring to - can you please elaborate a bit more? :-)

Thanks for taking the time to review.
Comment 6 Daniel Engberg freebsd_committer freebsd_triage 2024-07-20 21:24:19 UTC
Hi,

Sorry misread patch file, I'll have a look at it more closely in the next following days.

Patch looks good having a quick glance at it, thanks!

Best regards,
Daniel
Comment 7 gatekeeper 2024-08-03 17:44:50 UTC
(In reply to Daniel Engberg from comment #6)
Hi Daniel,

did you have a chance to look at the patch?
Is it OK, or should I still improve some aspect?

Thanks!
Comment 8 Daniel Engberg freebsd_committer freebsd_triage 2024-08-04 00:18:48 UTC
I have patch that's ~95% done makes this less hacky, just need the other PR merged or at least approved.
Comment 9 Daniel Engberg freebsd_committer freebsd_triage 2024-08-04 09:30:14 UTC
Created attachment 252493 [details]
Patch for quich

Use pkgconfig to determine (lib)linenoise instead of hardcoding it
Comment 10 Daniel Engberg freebsd_committer freebsd_triage 2024-08-04 12:58:39 UTC
Created attachment 252498 [details]
Patch for quich v2

Use upstream PR
Comment 11 Daniel Engberg freebsd_committer freebsd_triage 2024-08-04 12:59:16 UTC
Source: https://github.com/Usbac/quich/pull/21
Comment 12 gatekeeper 2024-08-06 22:36:01 UTC
Created attachment 252572 [details]
git patch

Hi Daniel
Sorry it took a bit longer than expected to answer.
I have validated your proposed changes - all looks good.
Only (minor/cosmetic) changes I made were to make portclippy happy :-)
Comment 13 commit-hook freebsd_committer freebsd_triage 2024-08-14 00:26:39 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7b157ac5264d8767e48759d362801c9ead26710a

commit 7b157ac5264d8767e48759d362801c9ead26710a
Author:     Tiago Gasiba <tiago.gasiba@gmail.com>
AuthorDate: 2024-08-14 00:12:04 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2024-08-14 00:19:05 +0000

    math/quich: New port: Terminal based advanced calculator

    A calculator that supports various functions such as sqrt, abs, log
    sin, cos, tan, asin, acos, atan, rand, round, floor and ceil.
    It also allows adjustable output, variables etc

    https://github.com/Usbac/quich

    PR:             280340

 math/Makefile              |  1 +
 math/quich/Makefile (new)  | 32 ++++++++++++++++++++++++++++++++
 math/quich/distinfo (new)  |  5 +++++
 math/quich/pkg-descr (new) |  3 +++
 4 files changed, 41 insertions(+)