Created attachment 257216 [details] Patch for adding math/pcalc to ports This is a new port for pcalc which is a command line calculator developed by Peter Glen and Mike Frysinger. For more information about the software, you can visit: - https://vapier.github.io/pcalc/ - https://github.com/vapier/pcalc
Hi, https://docs.freebsd.org/en/books/porters-handbook/book/#makefile-master_sites-github Review "Table 5" Review "Example 16" do-test section --> TEST_TARGET= check https://docs.freebsd.org/en/books/porters-handbook/book/#make-test Why are we installing AUTHORS and COPYING? Why override do-install? EXAMPLE, README, SYNTAX should be defined as DOCS Best regards, Daniel
Created attachment 257239 [details] patch-math_pcalc.diff By installing AUTHORS and COPYING, I was mimicking what other ports do. My system has 41 packages that installed AUTHORS and 32 that installed either LICENSE or COPYING. I'm indifferent to installing them. As for overriding do-install, that seemed cleaner than patching pcalc's Makefile for such a simple installation and is consistent with other ports. I think using ${INSTALL_PROGRAM} via do-install was cleaner than patching Makefile and running ${STRIPCMD} in post-install. I'm unsure how to handle the PORTDOCS in the plist, if at all. Generating pkg-plist produces, bin/pcalc %%PORTDOCS%%%%DOCSDIR%%/EXAMPLE %%PORTDOCS%%%%DOCSDIR%%/README.md %%PORTDOCS%%%%DOCSDIR%%/SYNTAX.md which causes `make check-plist` to fail. // Paco
(In reply to Paco Pascal from comment #2) I would argue that it's incorrect ;) https://docs.freebsd.org/en/books/porters-handbook/book/#install-documentation Explains PORTDOCS (you're looking for PORTDOCS=) Rule of thumb, do not try to outsmart the framework and/or over-engineer your port. If the binary ends up in the correct path just strip the binary as Porters Handbook suggests (search for STRIP_CMD) Best regards, Daniel
Created attachment 257242 [details] patch-math_pcalc.diff
(In reply to Daniel Engberg from comment #3) I hope this last patch is sufficient. 🤞 // Paco
Committed, thanks!
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=1f1b52823126722ceb9cd8c0275dbf563cef9f5a commit 1f1b52823126722ceb9cd8c0275dbf563cef9f5a Author: Paco Pascal <me@pacopascal.com> AuthorDate: 2025-02-21 06:24:54 +0000 Commit: Yuri Victorovich <yuri@FreeBSD.org> CommitDate: 2025-02-21 07:04:34 +0000 math/pcalc: New port: Command line util for doing hex/dec/oct/bin math quickly PR: 284557 math/Makefile | 1 + math/pcalc/Makefile (new) | 31 +++++++++++++++++++++++++++++++ math/pcalc/distinfo (new) | 3 +++ math/pcalc/files/patch-Makefile (new) | 24 ++++++++++++++++++++++++ math/pcalc/pkg-descr (new) | 10 ++++++++++ 5 files changed, 69 insertions(+)
pcalc sounds interesting, but its main selling point does not sound very appealing to me :-) E.g.: $ echo $((0x1234 + 0x20)) 4692 $ echo $((0x1234 % 0x20)) 20 $ printf '%#x\n' $((0x1234 % 0x20)) 0x14 $ echo $((0x10 + 010 + 10)) 34 $ echo $((0x10 + 010 + 10 + 0b10)) 36 Shell itself can do quite a bit of math already.
(In reply to Andriy Gapon from comment #8) pcalc can also compute functions like exp(), sin().
There's also math/quich
(In reply to Yuri Victorovich from comment #9) So can bc(1).
(In reply to Robert Clausecker from comment #11) $ bc -e "sin(0.001)" Runtime error: undefined function: sin() 0: (main)
(In reply to Yuri Victorovich from comment #12) Seriously? I guess you could try to read the man page of tools before concluding that they don't work...
pcalc isn't going to end world hunger but it's a third party tool I've had in my environments for decades. It's something I reach for when I need it. There's plenty of alternatives, but pcalc provides better UI (in my opinion) for knocking out hex/bin values quickly. For the sake of argument, in bc I can do the following to get the values of 1 to 10 in binary bc -e "obase=2; $(seq -s ';' 1 10)" In pcalc, it's just, pcalc `seq 1 10` That's cleaner to call from acme, emacs, or some other tool that has a shell frontend. It's less featureful than bc, but sometimes less is more. And now I can automate it's installation easier with a "pkg install pcalc". Thank you.
(In reply to Yuri Victorovich from comment #12) And I'm pretty sure Yuri is trolling. He knows it's: bc -l -e 'sin(0.001)'