git: 1f1b52823126 - main - math/pcalc: New port: Command line util for doing hex/dec/oct/bin math quickly
Date: Fri, 21 Feb 2025 07:04:37 UTC
The branch main has been updated by yuri:
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 | 31 +++++++++++++++++++++++++++++++
math/pcalc/distinfo | 3 +++
math/pcalc/files/patch-Makefile | 24 ++++++++++++++++++++++++
math/pcalc/pkg-descr | 10 ++++++++++
5 files changed, 69 insertions(+)
diff --git a/math/Makefile b/math/Makefile
index eb554da4be4e..d12761d67496 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -873,6 +873,7 @@
SUBDIR += paritwine
SUBDIR += parmetis
SUBDIR += parmgridgen
+ SUBDIR += pcalc
SUBDIR += pdal
SUBDIR += pear-Math_BigInteger
SUBDIR += pear-Math_Combinatorics
diff --git a/math/pcalc/Makefile b/math/pcalc/Makefile
new file mode 100644
index 000000000000..9951dd1e6d45
--- /dev/null
+++ b/math/pcalc/Makefile
@@ -0,0 +1,31 @@
+PORTNAME= pcalc
+DISTVERSIONPREFIX= v
+DISTVERSION= 5
+CATEGORIES= math
+
+MAINTAINER= me@pacopascal.com
+COMMENT= Command line util for doing hex/dec/oct/bin math quickly
+WWW= https://vapier.github.io/pcalc/
+
+LICENSE= GPLv2
+LICENSE_FILE= ${WRKSRC}/COPYING
+
+USES= bison gmake
+USE_GITHUB= yes
+GH_ACCOUNT= vapier
+
+PORTDOCS= EXAMPLE README.md SYNTAX.md
+OPTIONS_DEFINE= DOCS
+
+PLIST_FILES= bin/pcalc
+
+TEST_TARGET= check
+
+post-install:
+ @${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/pcalc
+
+do-install-DOCS-on:
+ @${MKDIR} ${STAGEDIR}${DOCSDIR}
+ cd ${WRKSRC} && ${INSTALL_MAN} ${PORTDOCS} ${STAGEDIR}${DOCSDIR}
+
+.include <bsd.port.mk>
diff --git a/math/pcalc/distinfo b/math/pcalc/distinfo
new file mode 100644
index 000000000000..a5aedb753cd1
--- /dev/null
+++ b/math/pcalc/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1738694896
+SHA256 (vapier-pcalc-v5_GH0.tar.gz) = 6a557bdb315ae4552e58efd80b94b372e4e10199e80148fe796dc325750302c8
+SIZE (vapier-pcalc-v5_GH0.tar.gz) = 26563
diff --git a/math/pcalc/files/patch-Makefile b/math/pcalc/files/patch-Makefile
new file mode 100644
index 000000000000..1cf450c6cc57
--- /dev/null
+++ b/math/pcalc/files/patch-Makefile
@@ -0,0 +1,24 @@
+--- Makefile.orig 2022-02-23 04:42:33 UTC
++++ Makefile
+@@ -23,6 +23,8 @@ pcalc: LDFLAGS += $(CFLAGS)
+ pcalc: $(OBJS)
+ pcalc: LDFLAGS += $(CFLAGS)
+
++$(OBJS): pcalc.c
++
+ pcalc.c: pcalc.y
+ $(YACC) -o $@ $<
+
+@@ -39,10 +41,10 @@ INSTALL = install
+ $(MAKE) -C ptest check
+
+ INSTALL = install
+-BINDIR = /usr/bin
++BINDIR = /usr/local/bin
+ DESTDIR =
+ install:
+- $(INSTALL) -m 755 -D pcalc $(DESTDIR)$(BINDIR)/pcalc
++ $(INSTALL) -m 755 -D $(DESTDIR)$(BINDIR) pcalc $(DESTDIR)$(BINDIR)/pcalc
+
+ dist pack: distclean
+ rm -rf pcalc-$(VERSION)
diff --git a/math/pcalc/pkg-descr b/math/pcalc/pkg-descr
new file mode 100644
index 000000000000..305818142288
--- /dev/null
+++ b/math/pcalc/pkg-descr
@@ -0,0 +1,10 @@
+A programmer's command line calculator for doing hex/dec/oct/bin math
+quickly.
+
+Features:
+ - Full math parser, parentheses, add, sub, mult, div, exponential
+ - Automatic conversion between HEX DEC OCT BIN numbers
+ - Mixing different bases in one expression
+ - Definable variables
+ - Math constants (E PI ...)
+ - Built in math functions (sin/cos/sqrt ...)