git: f84754e16bd3 - main - astro/astroterm: New port

From: Wen Heping <wen_at_FreeBSD.org>
Date: Thu, 13 Feb 2025 07:28:21 UTC
The branch main has been updated by wen:

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

commit f84754e16bd3d8b03acdcae27c9f89f5e814adcf
Author:     Wen Heping <wen@FreeBSD.org>
AuthorDate: 2025-02-13 07:26:23 +0000
Commit:     Wen Heping <wen@FreeBSD.org>
CommitDate: 2025-02-13 07:26:23 +0000

    astro/astroterm: New port
    
    astroterm is a terminal-based star map written in C. It displays the real-time
    positions of stars, planets, constellations, and more, all within your terminal
    and no telescope required! Configure sky views by date, time, and location with
    precise ASCII-rendered visuals.
    PR:             284690
    Reported by:    nxjoseph@protonmail.com
---
 astro/Makefile                              |  1 +
 astro/astroterm/Makefile                    | 30 +++++++++++++++++++++++++++++
 astro/astroterm/distinfo                    |  5 +++++
 astro/astroterm/files/patch-src_stopwatch.c | 20 +++++++++++++++++++
 astro/astroterm/pkg-descr                   |  4 ++++
 5 files changed, 60 insertions(+)

diff --git a/astro/Makefile b/astro/Makefile
index ccf65dd974e9..19d7971cd25b 100644
--- a/astro/Makefile
+++ b/astro/Makefile
@@ -3,6 +3,7 @@
     SUBDIR += R-cran-maptools
     SUBDIR += accrete
     SUBDIR += astrometry
+    SUBDIR += astroterm
     SUBDIR += calcmysky
     SUBDIR += celestia
     SUBDIR += celestia-gtk
diff --git a/astro/astroterm/Makefile b/astro/astroterm/Makefile
new file mode 100644
index 000000000000..1b4c6959a950
--- /dev/null
+++ b/astro/astroterm/Makefile
@@ -0,0 +1,30 @@
+PORTNAME=	astroterm
+DISTVERSIONPREFIX=	v
+DISTVERSION=	1.0.7
+CATEGORIES=	astro
+MASTER_SITES=	https://web.archive.org/web/20231007085824if_/http://tdc-www.harvard.edu/catalogs/:DATA
+DISTFILES=	BSC5:DATA
+DIST_SUBDIR=	${PORTNAME}-${DISTVERSION}
+EXTRACT_ONLY=	${DISTNAME}${EXTRACT_SUFX}
+
+MAINTAINER=	nxjoseph@protonmail.com
+COMMENT=	Explore stars, planets, constellations, and more in your terminal!
+WWW=		https://github.com/da-luce/astroterm
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	xxd:sysutils/xxd
+LIB_DEPENDS=	libargtable2.so:devel/argtable
+
+USES=		compiler meson ncurses ninja pkgconfig
+USE_GITHUB=	yes
+GH_ACCOUNT=	da-luce
+
+PLIST_FILES=	bin/${PORTNAME}
+
+post-extract:
+	${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/BSC5 \
+		${WRKSRC}/data/bsc5
+
+.include <bsd.port.mk>
diff --git a/astro/astroterm/distinfo b/astro/astroterm/distinfo
new file mode 100644
index 000000000000..7dd77a8b1d08
--- /dev/null
+++ b/astro/astroterm/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1739416073
+SHA256 (astroterm-1.0.7/BSC5) = e471d02eaf4eecb61c12f879a1cb6432ba9d7b68a9a8c5654a1eb42a0c8cc340
+SIZE (astroterm-1.0.7/BSC5) = 291548
+SHA256 (astroterm-1.0.7/da-luce-astroterm-v1.0.7_GH0.tar.gz) = 3b8b1597afb31d1cb8ad54030b5766652b4d3f42f0a3d510bbc3191c0c6a4aa5
+SIZE (astroterm-1.0.7/da-luce-astroterm-v1.0.7_GH0.tar.gz) = 20463291
diff --git a/astro/astroterm/files/patch-src_stopwatch.c b/astro/astroterm/files/patch-src_stopwatch.c
new file mode 100644
index 000000000000..3097f52da4de
--- /dev/null
+++ b/astro/astroterm/files/patch-src_stopwatch.c
@@ -0,0 +1,20 @@
+--- src/stopwatch.c.orig	2025-02-09 19:38:25 UTC
++++ src/stopwatch.c
+@@ -34,7 +34,7 @@ int sw_gettime(struct SwTimestamp *stamp)
+ #elif defined(__APPLE__) && defined(__MACH__)
+     // Apple OSX and iOS (Darwin)
+ 
+-    unsigned long long tick = clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW);
++    unsigned long long tick = clock_gettime_nsec_np(CLOCK_MONOTONIC);
+     if (tick == 0)
+     {
+         return -1;
+@@ -47,7 +47,7 @@ int sw_gettime(struct SwTimestamp *stamp)
+     // Available on some POSIX systems (preferable to gettimeofday() below)
+ 
+     struct timespec tick;
+-    int check = clock_gettime(CLOCK_MONOTONIC_RAW, &tick);
++    int check = clock_gettime(CLOCK_MONOTONIC, &tick);
+     if (check == -1)
+     {
+         return -1;
diff --git a/astro/astroterm/pkg-descr b/astro/astroterm/pkg-descr
new file mode 100644
index 000000000000..5cfc98268b34
--- /dev/null
+++ b/astro/astroterm/pkg-descr
@@ -0,0 +1,4 @@
+astroterm is a terminal-based star map written in C. It displays the real-time
+positions of stars, planets, constellations, and more, all within your terminal
+and no telescope required! Configure sky views by date, time, and location with
+precise ASCII-rendered visuals.