From de39e20ac54cc2540817ee84516bed228d694098 Mon Sep 17 00:00:00 2001 From: Tee KOBAYASHI Date: Tue, 15 Mar 2022 17:33:30 +0900 Subject: [PATCH] new package: predict --- packages/predict/build.sh | 67 +++++++++++++++++++ .../clients-kep_reload-kep_reload.c.patch | 10 +++ packages/predict/predict-g1yyh.c.patch | 53 +++++++++++++++ packages/predict/predict.c.patch | 29 ++++++++ packages/predict/predict.h.patch | 5 ++ .../utils-fodtrack-0.1-fodtrack.c.patch | 13 ++++ .../utils-moontracker-moontracker.c.patch | 16 +++++ 7 files changed, 193 insertions(+) create mode 100644 packages/predict/build.sh create mode 100644 packages/predict/clients-kep_reload-kep_reload.c.patch create mode 100644 packages/predict/predict-g1yyh.c.patch create mode 100644 packages/predict/predict.c.patch create mode 100644 packages/predict/predict.h.patch create mode 100644 packages/predict/utils-fodtrack-0.1-fodtrack.c.patch create mode 100644 packages/predict/utils-moontracker-moontracker.c.patch diff --git a/packages/predict/build.sh b/packages/predict/build.sh new file mode 100644 index 000000000..b07c33bcb --- /dev/null +++ b/packages/predict/build.sh @@ -0,0 +1,67 @@ +TERMUX_PKG_HOMEPAGE=https://www.qsl.net/kd2bd/predict.html +TERMUX_PKG_DESCRIPTION="Track and predict passes of satellites in Earth orbit" +TERMUX_PKG_LICENSE="GPL-2.0" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=2.2.3 +TERMUX_PKG_SRCURL=https://ftp-osl.osuosl.org/pub/gentoo/distfiles/predict_${TERMUX_PKG_VERSION}.orig.tar.gz +TERMUX_PKG_SHA256=47b7c185f1cf4d318b6b31a22a533c03c4a3f57394839df036367c7cdf2dd7ff +TERMUX_PKG_DEPENDS="ncurses, ncurses-ui-libs" +TERMUX_PKG_GROUPS="science" +TERMUX_PKG_BUILD_IN_SRC=true + +termux_step_post_get_source() { + termux_download \ + "https://ftp-osl.osuosl.org/pub/gentoo/distfiles/predict_2.2.3-3.1.diff.gz" \ + $TERMUX_PKG_CACHEDIR/predict_2.2.3-3.1.diff.gz \ + 60c00a542c399e69dba154cc0827ea15f33dae61547f3604b8c232e9d26d06df + zcat $TERMUX_PKG_CACHEDIR/predict_2.2.3-3.1.diff.gz | patch --silent -p1 + cat debian/patches/*.diff | patch --silent -p1 + + ln -sfT fodtrack-0.1 utils/fodtrack +} + +termux_step_pre_configure() { + LDFLAGS+=" -lm" +} + +termux_step_configure() { + : +} + +termux_step_make() { + local p + for p in predict{,-g1yyh}; do + ${CC} ${CFLAGS} ${CPPFLAGS} ${p}.c -o ${p} ${LDFLAGS} \ + -lncursesw -lmenu + done + local d + for d in clients/kep_reload utils/{fodtrack,geosat,moontracker}; do + p=$(basename ${d}) + pushd ${d} + ${CC} ${CFLAGS} ${CPPFLAGS} ${p}.c -o ${p} ${LDFLAGS} + popd + done +} + +termux_step_make_install() { + install -Dm700 -t $TERMUX_PREFIX/bin predict{,-g1yyh} + local d + for d in clients/kep_reload utils/{fodtrack,geosat,moontracker}; do + local p=$(basename ${d}) + install -Dm700 -t $TERMUX_PREFIX/bin ${d}/${p} + done + install -Dm600 -t $TERMUX_PREFIX/etc utils/fodtrack/fodtrack.conf + install -Dm600 -t $TERMUX_PREFIX/share/man/man1 \ + docs/man/predict.1 \ + debian/{kep_reload,moontracker}.1 + local p + for p in geosat predict-g1yyh; do + install -Dm600 -T debian/${p}.man \ + $TERMUX_PREFIX/share/man/man1/${p}.1 + done + install -Dm600 -t $TERMUX_PREFIX/share/man/man5 \ + utils/fodtrack/fodtrack.conf.5 + install -Dm600 -t $TERMUX_PREFIX/share/man/man8 \ + utils/fodtrack/fodtrack.8 + install -Dm600 -t $TERMUX_PREFIX/share/predict/default default/* +} diff --git a/packages/predict/clients-kep_reload-kep_reload.c.patch b/packages/predict/clients-kep_reload-kep_reload.c.patch new file mode 100644 index 000000000..7aa8e504e --- /dev/null +++ b/packages/predict/clients-kep_reload-kep_reload.c.patch @@ -0,0 +1,10 @@ +--- a/clients/kep_reload/kep_reload.c ++++ b/clients/kep_reload/kep_reload.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + #include + #include + #include diff --git a/packages/predict/predict-g1yyh.c.patch b/packages/predict/predict-g1yyh.c.patch new file mode 100644 index 000000000..ab6cb67d9 --- /dev/null +++ b/packages/predict/predict-g1yyh.c.patch @@ -0,0 +1,53 @@ +--- a/predict-g1yyh.c ++++ b/predict-g1yyh.c +@@ -35,7 +35,6 @@ + + #include + #include +-#include + #include + #include + #include +@@ -2031,7 +2030,7 @@ + exit(-1); + } + +- if ((type=SOCK_STREAM && listen(s,qlen))<0) { ++ if (type==SOCK_STREAM && listen(sd,qlen)<0) { + bailout("Listen fail"); + exit(-1); + } +@@ -2264,7 +2263,7 @@ + /* Send request to predict with output + directed to a temporary file under /tmp */ + +- strcpy(tempname,"/tmp/XXXXXX\0"); ++ strcpy(tempname,"@TERMUX_PREFIX@/tmp/XXXXXX\0"); + i=mkstemp(tempname); + + sprintf(buff,"%s -f %s -t %s -q %s -o %s\n",predict_name,satname,tlefile,qthfile,tempname); +@@ -2309,7 +2308,7 @@ + /* Send request to predict with output + directed to a temporary file under /tmp */ + +- strcpy(tempname,"/tmp/XXXXXX\0"); ++ strcpy(tempname,"@TERMUX_PREFIX@/tmp/XXXXXX\0"); + i=mkstemp(tempname); + + sprintf(buff,"%s -p %s -t %s -q %s -o %s\n",predict_name, satname,tlefile,qthfile,tempname); +@@ -3301,12 +3300,12 @@ + /* Read the system clock and return the number + * of days since 31Dec79 00:00:00 UTC (daynum 0) */ + +- struct timeb tptr; ++ struct timespec tptr; + int x; + +- x=ftime(&tptr); ++ x=clock_gettime(CLOCK_REALTIME, &tptr); + +- return ((((double)tptr.time+0.001*(double)tptr.millitm)/86400.0)-3651.0); ++ return ((((double)tptr.tv_sec+0.000000001*(double)tptr.tv_nsec)/86400.0)-3651.0); + } + + char *Daynum2String(daynum, stlen, stfmt) diff --git a/packages/predict/predict.c.patch b/packages/predict/predict.c.patch new file mode 100644 index 000000000..72d5d9b7c --- /dev/null +++ b/packages/predict/predict.c.patch @@ -0,0 +1,29 @@ +--- a/predict.c ++++ b/predict.c +@@ -2027,7 +2027,7 @@ + exit(-1); + } + +- if ((type=SOCK_STREAM && listen(s,qlen))<0) ++ if (type==SOCK_STREAM && listen(sd,qlen)<0) + { + bailout("Listen fail"); + exit(-1); +@@ -2283,7 +2283,7 @@ + /* Send request to predict with output + directed to a temporary file under /tmp */ + +- strcpy(tempname,"/tmp/XXXXXX\0"); ++ strcpy(tempname,"@TERMUX_PREFIX@/tmp/XXXXXX\0"); + i=mkstemp(tempname); + + sprintf(buff,"%s -f %s -t %s -q %s -o %s\n",predict_name,satname,tlefile,qthfile,tempname); +@@ -2330,7 +2330,7 @@ + /* Send request to predict with output + directed to a temporary file under /tmp */ + +- strcpy(tempname,"/tmp/XXXXXX\0"); ++ strcpy(tempname,"@TERMUX_PREFIX@/tmp/XXXXXX\0"); + i=mkstemp(tempname); + + sprintf(buff,"%s -p %s -t %s -q %s -o %s\n",predict_name, satname,tlefile,qthfile,tempname); diff --git a/packages/predict/predict.h.patch b/packages/predict/predict.h.patch new file mode 100644 index 000000000..4b9c420c7 --- /dev/null +++ b/packages/predict/predict.h.patch @@ -0,0 +1,5 @@ +--- a/predict.h ++++ b/predict.h +@@ -1 +1 @@ +-char *predictpath={"/usr/lib/predict/"}, soundcard=1, *version={"2.2.3"}; ++char *predictpath={"@TERMUX_PREFIX@/share/predict/"}, soundcard=0, *version={"2.2.3"}; diff --git a/packages/predict/utils-fodtrack-0.1-fodtrack.c.patch b/packages/predict/utils-fodtrack-0.1-fodtrack.c.patch new file mode 100644 index 000000000..00aa299f7 --- /dev/null +++ b/packages/predict/utils-fodtrack-0.1-fodtrack.c.patch @@ -0,0 +1,13 @@ +--- a/utils/fodtrack-0.1/fodtrack.c ++++ b/utils/fodtrack-0.1/fodtrack.c +@@ -20,8 +20,8 @@ + #define false 0 + #define true 1 + +-#define PSEUDODEVICEFILE "/tmp/fodtrackdevice" +-#define CONFIGFILE "/etc/fodtrack.conf" ++#define PSEUDODEVICEFILE "@TERMUX_PREFIX@/tmp/fodtrackdevice" ++#define CONFIGFILE "@TERMUX_PREFIX@/etc/fodtrack.conf" + + static int fodtrackfd; + static int azimuthcorrection; diff --git a/packages/predict/utils-moontracker-moontracker.c.patch b/packages/predict/utils-moontracker-moontracker.c.patch new file mode 100644 index 000000000..cb8ef0dd1 --- /dev/null +++ b/packages/predict/utils-moontracker-moontracker.c.patch @@ -0,0 +1,16 @@ +--- a/utils/moontracker/moontracker.c ++++ b/utils/moontracker/moontracker.c +@@ -23,11 +23,12 @@ + #include + #include + #include ++#include + #include + #include + #include + +-char callsign[20], output[20]; ++char callsign[20], output[21]; + int qthalt, pid; + double qthlat, qthlong, moon_az, moon_el, moonrise, + PI=3.141592653589793, TWOPI=6.28318530717958623,