git: 730d2d9c0261 - main - comms/predict: update to 2.3.1

From: Diane Bruce <db_at_FreeBSD.org>
Date: Thu, 04 Apr 2024 20:30:24 UTC
The branch main has been updated by db:

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

commit 730d2d9c0261383ff4d2cab0a6972e240234dead
Author:     Diane Bruce <db@FreeBSD.org>
AuthorDate: 2024-04-04 20:20:19 +0000
Commit:     Diane Bruce <db@FreeBSD.org>
CommitDate: 2024-04-04 20:30:18 +0000

    comms/predict: update to 2.3.1
    
    [upstream changes]
    Release 2.3.1:
    By John A. Magliacane <kd2bd@amsat.org> (05-Aug-2023):
    
    * Fixed a bug that caused the "Upcoming Passes" list in Multi-Satellite
      tracking mode to occasionally produce erroneous results if one or
      more satellites in the database had decayed from orbit.
    
    * The Vocalizer feature was modified to prevent it from being executed
      by a user keyboard command until after the current speech announcement
      has terminated.
    
    * The earthtrack compilation script was modified to prevent the
      "undefined reference" errors some users experienced during the
      linking phase of the compilation process.
    
    * All references to www.celestrak.com in the "kepupdate" script have
      been changed to celestrak.org due to the site's name change.
    
    * Several other small coding changes were made.
    
    ----------------------------------------------------------------------------
    
    [db changes]
    
    - Upstream does not come with a proper build infrastructure hence
      build is done in our port Makefile now instead of copied Makefile.
    - portlint and portfmt ran clearly as did poudriere.
    - Added earthtrack, kepupdate and moontracker binaries
      but did not add gsat which should be a separate port IMO
    
    PR:             277986
    Reported by:    Andrey Korobkov <alster@vinterdalen.se>
---
 comms/predict/Makefile                             | 38 +++++++++++++++++-----
 comms/predict/distinfo                             |  6 ++--
 comms/predict/files/Makefile                       | 30 -----------------
 .../files/patch-clients_earthtrack_earthtrack.c    | 16 +++++++++
 comms/predict/files/patch-kepupdate                | 28 ++++++++++++++++
 comms/predict/files/patch-predict.c                | 18 ++++++++++
 comms/predict/files/predict.h                      |  1 -
 comms/predict/files/vocalizer.h                    |  1 -
 comms/predict/pkg-plist                            | 17 +++++++++-
 9 files changed, 111 insertions(+), 44 deletions(-)

diff --git a/comms/predict/Makefile b/comms/predict/Makefile
index 198738463848..e15aa9ba7f5d 100644
--- a/comms/predict/Makefile
+++ b/comms/predict/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	predict
-PORTVERSION=	2.2.7
-PORTREVISION=	1
+PORTVERSION=	2.3.1
 CATEGORIES=	comms astro hamradio
 MASTER_SITES=	https://www.qsl.net/kd2bd/ \
 		LOCAL/db
@@ -10,19 +9,42 @@ COMMENT=	Satellite tracking program for amateur radio satellites
 WWW=		https://www.qsl.net/kd2bd/predict.html
 
 LICENSE=	GPLv2
-LICENSE_FILE=	${WRKSRC}/COPYING
+LICENSE_FILE=	${WRKSRC}/LICENSE
 
 LIB_DEPENDS=	libasound.so:audio/alsa-lib
 
 USES=		ncurses
-INSTALL_TARGET=	install install.man
-MAKE_ARGS=	CC="${CC}" CFLAGS="${CFLAGS}" PREFIX="${PREFIX}" STAGEDIR="${STAGEDIR}"
 
 CONFLICTS_INSTALL=	liblinear # bin/predict
 
+OPTIONS_DEFINE=	DOCS EXAMPLES
+
 post-patch:
-	@${SED} -e 's|%%PREFIX%%|${PREFIX}|g' ${FILESDIR}/predict.h > ${WRKSRC}/predict.h
-	@${SED} -e 's|%%PREFIX%%|${PREFIX}|g' ${FILESDIR}/vocalizer.h > ${WRKSRC}/vocalizer/vocalizer.h
-	@${CP} ${FILESDIR}/Makefile ${WRKSRC}/Makefile
+	@${REINPLACE_CMD} -e 's|/usr/src/predict-2.3.1/|${PREFIX}/share/predict|g' ${WRKSRC}/predict.h
+
+# I'm not building & installing clients/gsat-1 map kep_reload etc. only earthtrack
+do-build:
+	cd ${WRKSRC} && ${CC} ${CFLAGS} -I ${LOCALBASE}/include -o predict predict.c -L ${LOCALBASE}/lib -pthread -lm -lncursesw -lasound
+	cd ${WRKSRC}/clients/earthtrack && ${CC} ${CFLAGS} -o earthtrack earthtrack.c -lm
+	cd ${WRKSRC}/utils/moontracker && ${CC} ${CFLAGS} -o moontracker moontracker.c -lm
 
+do-install:
+	${MKDIR} ${STAGEDIR}${DATADIR}/default
+.for f in predict.db predict.qth predict.tle
+	${INSTALL_DATA} ${WRKSRC}/default/$f ${STAGEDIR}${DATADIR}/default
+.endfor
+	${MKDIR} ${STAGEDIR}${DATADIR}/vocalizer
+	cd ${WRKSRC}/vocalizer && ${COPYTREE_SHARE} . ${STAGEDIR}${DATADIR}/vocalizer
+	${MKDIR} ${STAGEDIR}${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/docs/pdf/predict.pdf ${STAGEDIR}${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/docs/html/predict.html ${STAGEDIR}${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/docs/text/predict.txt ${STAGEDIR}${DOCSDIR}
+	${INSTALL_MAN} ${WRKSRC}/docs/man/predict.1 ${STAGEDIR}${PREFIX}/share/man/man1
+	${INSTALL_PROGRAM} ${WRKSRC}/predict ${STAGEDIR}${PREFIX}/bin/
+	${INSTALL_PROGRAM} ${WRKSRC}/clients/earthtrack/earthtrack ${STAGEDIR}${PREFIX}/bin/
+	${RLN} ${STAGEDIR}${PREFIX}/bin/earthtrack ${STAGEDIR}${PREFIX}/bin/earthtrack2
+	${INSTALL_PROGRAM} ${WRKSRC}/utils/moontracker/moontracker ${STAGEDIR}${PREFIX}/bin/moontracker
+	${INSTALL_SCRIPT} ${WRKSRC}/kepupdate ${STAGEDIR}${PREFIX}/bin
+	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
+	cd ${WRKSRC}/clients/&& ${COPYTREE_SHARE} samples ${STAGEDIR}${EXAMPLESDIR}
 .include <bsd.port.mk>
diff --git a/comms/predict/distinfo b/comms/predict/distinfo
index 15937eb28da9..e9e87d87afe9 100644
--- a/comms/predict/distinfo
+++ b/comms/predict/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1602533134
-SHA256 (predict-2.2.7.tar.gz) = bc4e828209996daefa591aad2e27320786f86b4da949df6a8c3f167ab035fd71
-SIZE (predict-2.2.7.tar.gz) = 1887048
+TIMESTAMP = 1711552091
+SHA256 (predict-2.3.1.tar.gz) = 3ea626cadf1edf984e49e91891f9fd5cb38f6d83c5cd6e6693e8aecb2d289056
+SIZE (predict-2.3.1.tar.gz) = 2010530
diff --git a/comms/predict/files/Makefile b/comms/predict/files/Makefile
deleted file mode 100644
index a6882e222993..000000000000
--- a/comms/predict/files/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-default:	all
-all:		predict vocalizer/vocalizer
-
-LIBS = ${LDFLAGS} -pthread -lm -lncursesw
-predict:	predict.c predict.h
-		${CC} ${CFLAGS} -o predict predict.c ${LIBS}
-
-vocalizer/vocalizer:	vocalizer/vocalizer.c vocalizer/vocalizer.h
-		${CC} ${CFLAGS} -I${LOCALBASE}/include -o vocalizer/vocalizer vocalizer/vocalizer.c -L${LOCALBASE}/lib ${LIBS} -lasound
-
-clean:
-	rm -f *.o predict *core *~ \#* *.txt vocalizer/vocalizer
-
-install:
-	mkdir -p ${STAGEDIR}${PREFIX}/share/predict/
-	mkdir ${STAGEDIR}${PREFIX}/share/predict/default
-	mkdir ${STAGEDIR}${PREFIX}/share/predict/vocalizer
-	install -m 0644 default/predict.db ${STAGEDIR}${PREFIX}/share/predict/default
-	install -m 0644 default/predict.qth ${STAGEDIR}${PREFIX}/share/predict/default
-	install -m 0644 default/predict.tle ${STAGEDIR}${PREFIX}/share/predict/default
-	install -m 0644 vocalizer/*.wav ${STAGEDIR}${PREFIX}/share/predict/vocalizer
-	install predict ${STAGEDIR}${PREFIX}/bin
-	strip ${STAGEDIR}${PREFIX}/bin/predict
-	install vocalizer/vocalizer ${STAGEDIR}${PREFIX}/bin
-	strip ${STAGEDIR}${PREFIX}/bin/vocalizer
-
-install.man:
-	install -m 0644  docs/man/predict.1 ${STAGEDIR}${PREFIX}/share/man/man1
-
-.PHONY:	clean build
diff --git a/comms/predict/files/patch-clients_earthtrack_earthtrack.c b/comms/predict/files/patch-clients_earthtrack_earthtrack.c
new file mode 100644
index 000000000000..a377d10f9a40
--- /dev/null
+++ b/comms/predict/files/patch-clients_earthtrack_earthtrack.c
@@ -0,0 +1,16 @@
+--- clients/earthtrack/earthtrack.c.orig	2023-06-10 19:16:02 UTC
++++ clients/earthtrack/earthtrack.c
+@@ -53,13 +53,6 @@ FILE	*markerfd=NULL, *greatarcfd=NULL;
+ 	HALFPI=1.570796326794896, deg2rad=1.74532925199e-02;
+ FILE	*markerfd=NULL, *greatarcfd=NULL;
+ 
+-void handler(void)
+-{
+-	/* This is a function that is called when the response function
+-	   times out.  This is in case the server fails to respond. */
+-
+-	signal(SIGALRM,handler);
+-}
+ 
+ int connectsock(char *host, char *service, char *protocol)
+ {
diff --git a/comms/predict/files/patch-kepupdate b/comms/predict/files/patch-kepupdate
new file mode 100644
index 000000000000..4eecf9d367df
--- /dev/null
+++ b/comms/predict/files/patch-kepupdate
@@ -0,0 +1,28 @@
+--- kepupdate.orig	2024-03-27 16:31:40 UTC
++++ kepupdate
+@@ -1,20 +1,19 @@
+-#!/bin/bash
++#!/bin/sh
+ #
+ # Invoke as kepupdate -q in crontab scripts to keep the update "quiet".
+ #
+  
+ dir=$HOME/.predict
+ 
+-wget -qr https://www.amsat.org/tle/current/nasabare.txt -O $dir/amateur.txt
+-wget -qr https://celestrak.org/NORAD/elements/visual.txt -O $dir/visual.txt
+-wget -qr https://celestrak.org/NORAD/elements/weather.txt -O $dir/weather.txt
++fetch https://www.amsat.org/tle/current/nasabare.txt -o $dir/amateur.txt
++fetch https://celestrak.org/NORAD/elements/visual.txt -o $dir/visual.txt
++fetch https://celestrak.org/NORAD/elements/weather.txt -o $dir/weather.txt
+ 
+ cat $dir/amateur.txt $dir/visual.txt $dir/weather.txt > $dir/keps.tle
+ 
+ if [ -e $dir/keps.tle ]; then
+ 	predict -u $dir/keps.tle
+-
+-	if [[ $1 != "-q" ]] && [[ $1 != "-quiet" ]] && [[ $1 != "--quiet" ]]; then
++	if [ $1 ] && [ $1 != "-q" ] && [ $1 != "-quiet" ] && [ $1 != "--quiet" ]; then
+ 		echo "PREDICT's Keps have been updated!"
+ 	fi
+ fi
diff --git a/comms/predict/files/patch-predict.c b/comms/predict/files/patch-predict.c
new file mode 100644
index 000000000000..aa2b5f72d56e
--- /dev/null
+++ b/comms/predict/files/patch-predict.c
@@ -0,0 +1,18 @@
+--- predict.c.orig	2023-08-05 15:33:14 UTC
++++ predict.c
+@@ -30,6 +30,7 @@
+ #include <assert.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
++#include <sys/stat.h>
+ #include <netinet/in.h>
+ #include <netdb.h>
+ #include <unistd.h>
+@@ -6839,7 +6840,6 @@ void NewUser (void)
+ 
+ void NewUser (void)
+ {
+-	int *mkdir();
+ 
+ 	Banner();
+ 	attrset(COLOR_PAIR(3)|A_BOLD);
diff --git a/comms/predict/files/predict.h b/comms/predict/files/predict.h
deleted file mode 100644
index e0d913cbd353..000000000000
--- a/comms/predict/files/predict.h
+++ /dev/null
@@ -1 +0,0 @@
-char *predictpath={"%%PREFIX%%/share/predict/"}, soundcard=1, *version={"2.2.3"};
diff --git a/comms/predict/files/vocalizer.h b/comms/predict/files/vocalizer.h
deleted file mode 100644
index 1cf9ae955aab..000000000000
--- a/comms/predict/files/vocalizer.h
+++ /dev/null
@@ -1 +0,0 @@
-char *path={"%%PREFIX%%/share/predict/vocalizer/"};
diff --git a/comms/predict/pkg-plist b/comms/predict/pkg-plist
index e1f52a00d213..0807913db502 100644
--- a/comms/predict/pkg-plist
+++ b/comms/predict/pkg-plist
@@ -1,9 +1,24 @@
+bin/earthtrack
+bin/earthtrack2
+bin/kepupdate
+bin/moontracker
 bin/predict
-bin/vocalizer
+%%PORTDOCS%%%%DOCSDIR%%/predict.html
+%%PORTDOCS%%%%DOCSDIR%%/predict.pdf
+%%PORTDOCS%%%%DOCSDIR%%/predict.txt
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/samples/README
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/samples/build
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/samples/demo-i
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/samples/demo-i.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/samples/demo.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/samples/perl/README
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/samples/perl/demo.pl
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/samples/perl/kenwood_d700.pl
 share/man/man1/predict.1.gz
 %%DATADIR%%/default/predict.db
 %%DATADIR%%/default/predict.qth
 %%DATADIR%%/default/predict.tle
+%%DATADIR%%/vocalizer/alarm.wav
 %%DATADIR%%/vocalizer/approaching.wav
 %%DATADIR%%/vocalizer/azimuth.wav
 %%DATADIR%%/vocalizer/eclipse.wav