aboutsummaryrefslogtreecommitdiffstats
path: root/comms/chu
diff options
context:
space:
mode:
authormiwi <miwi@FreeBSD.org>2006-09-20 04:09:27 +0800
committermiwi <miwi@FreeBSD.org>2006-09-20 04:09:27 +0800
commitf14d788b3e0e4df257078db4e45ac5999ae03578 (patch)
tree7e678ee04dad11eddfc068d8cebe0d9ec8cd3ebc /comms/chu
parent8bd74278d9db1a4a9d8d46f3fdfbf0799cfb982d (diff)
downloadfreebsd-ports-gnome-f14d788b3e0e4df257078db4e45ac5999ae03578.tar.gz
freebsd-ports-gnome-f14d788b3e0e4df257078db4e45ac5999ae03578.tar.zst
freebsd-ports-gnome-f14d788b3e0e4df257078db4e45ac5999ae03578.zip
CHU is a time-standard shortwave radio station operated by National
Research Council Canada (NRC). This software uses signals from radio station CHU to set and frequency discipline the system clock on a Linux (FreeBSD) based system. WWW: http://www.rossi.com/chu/ PR: ports/103369 Submitted by: Diane Bruce <db(at)db.net>
Diffstat (limited to 'comms/chu')
-rw-r--r--comms/chu/Makefile56
-rw-r--r--comms/chu/distinfo3
-rw-r--r--comms/chu/files/patch-chu.c76
-rw-r--r--comms/chu/pkg-descr8
-rw-r--r--comms/chu/pkg-plist9
5 files changed, 152 insertions, 0 deletions
diff --git a/comms/chu/Makefile b/comms/chu/Makefile
new file mode 100644
index 000000000000..8460c7cfdedc
--- /dev/null
+++ b/comms/chu/Makefile
@@ -0,0 +1,56 @@
+# New ports collection makefile for: chu
+# Date created: September 16 2006
+# Whom: Diane Bruce <db@db.net>
+#
+# $FreeBSD$
+#
+
+PORTNAME= chu
+PORTVERSION= 0.1.29
+CATEGORIES= comms hamradio
+MASTER_SITES= ${MASTER_SITE_SUNSITE} \
+ http://www.rossi.com/chu/
+MASTER_SITE_SUBDIR= system/admin/time
+
+MAINTAINER= db@db.net
+COMMENT= Synchronise computer clock to CHU radio station
+
+MAN8= chu.8
+
+do-extract:
+ @${RM} -rf ${WRKDIR}
+ @${MKDIR} ${WRKDIR}
+ @${MKDIR} ${WRKSRC}
+ @for f in ${EXTRACT_ONLY}; do \
+ if ! (cd ${WRKSRC} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$f ${EXTRACT_AFTER_ARGS});\
+ then \
+ exit 1; \
+ fi \
+ done
+ ${EXTRACT_CMD} -d ${WRKSRC}/testsignal.gz
+
+post-patch:
+ ${REINPLACE_CMD} -e 's|/etc/chu|${PREFIX}/etc/chu|g' ${WRKSRC}/chu.c ${WRKSRC}/chu.8
+ ${REINPLACE_CMD} -e 's|/sbin/chu|${PREFIX}/sbin/chu|g' ${WRKSRC}/chu.8
+ @${REINPLACE_CMD} -e 's|gcc -O2|${CC} ${CFLAGS}|g' ${WRKSRC}/Makefile
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/chu ${PREFIX}/sbin
+ ${MKDIR} ${DATADIR}
+ ${INSTALL_DATA} ${WRKSRC}/testsignal ${DATADIR}
+ ${INSTALL_MAN} ${WRKSRC}/chu.8 ${PREFIX}/man/man8
+.if !defined(NOPORTDOCS)
+ ${MKDIR} ${DOCSDIR}
+.for d in ${WRKSRC}/COPYING \
+ ${WRKSRC}/TESTING \
+ ${WRKSRC}/chu.html \
+ ${WRKSRC}/chuman.html \
+ ${WRKSRC}/ntp.html
+ ${INSTALL_DATA} ${WRKSRC}/${d} ${DOCSDIR}
+.endfor
+ @${ECHO} ""
+ @${ECHO} "chu docs installed in ${DOCSDIR}"
+ @${ECHO} ""
+.endif
+
+.include <bsd.port.mk>
diff --git a/comms/chu/distinfo b/comms/chu/distinfo
new file mode 100644
index 000000000000..b388ab45b1d4
--- /dev/null
+++ b/comms/chu/distinfo
@@ -0,0 +1,3 @@
+MD5 (chu-0.1.29.tar.gz) = d8bc38f64d386240dd445993a1a646e3
+SHA256 (chu-0.1.29.tar.gz) = ac791bb2c9f80ec393f8cc7ddb833974e1f3b03960a73a206011256f4a4e8e72
+SIZE (chu-0.1.29.tar.gz) = 44441
diff --git a/comms/chu/files/patch-chu.c b/comms/chu/files/patch-chu.c
new file mode 100644
index 000000000000..ea631aa7b04e
--- /dev/null
+++ b/comms/chu/files/patch-chu.c
@@ -0,0 +1,76 @@
+--- chu.c.orig Wed Mar 17 11:42:18 1999
++++ chu.c Mon Sep 18 17:46:42 2006
+@@ -20,15 +20,21 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <math.h>
++#include <errno.h>
++#include <sys/types.h>
+ #include <sys/time.h>
+ #include <sys/resource.h>
+ #include <unistd.h>
+
+-#define USE_TIMEX
++#define ADJTIME
++#undef USE_TIMEX
++#define USE_ADJTIME
++
++#ifdef ADJTIME
+ #ifdef USE_TIMEX
+ #include <sys/timex.h>
+ #endif
+-
++#endif
+ #define SAMPLE_RATE 8000
+ #define SAMPLES 512
+ #define OVERLAP 50
+@@ -389,6 +395,21 @@
+ }
+ }
+
++#ifdef USE_ADJTIME
++void
++do_adjtime(int microsec)
++{
++ struct timeval delta;
++ int status;
++
++ printf("do_adjtime adjustment: %d\n", microsec);
++ delta.tv_sec = 0;
++ delta.tv_usec = microsec;
++ status = adjtime(&delta, NULL);
++ printf("do_adjtime status: %d\n", status);
++}
++#endif
++
+ #ifdef USE_TIMEX
+ void timex_adjustment(int microsec)
+ {
+@@ -462,7 +483,8 @@
+ adjtimex(&t);
+ offset = t.offset;
+ #endif
+-
++#ifdef USE_ADJTIME
++#endif
+ return (double) offset;
+ }
+
+@@ -655,12 +677,17 @@
+ tv.tv_usec += 1000000;
+ }
+
++#ifdef ADJTIME
+ #ifdef USE_TIMEX
+ if (fabs(d) < ((double)MAXPHASE))
+ {
+ timex_adjustment((int)-d);
+ }
++#else
++ if (fabs(d) < ((double)1000000))
++ do_adjtime((int)-d);
+ else
++#endif
+ #endif
+ {
+ printf("standard adjustment ");
diff --git a/comms/chu/pkg-descr b/comms/chu/pkg-descr
new file mode 100644
index 000000000000..cc1865888f41
--- /dev/null
+++ b/comms/chu/pkg-descr
@@ -0,0 +1,8 @@
+CHU is a time-standard shortwave radio station operated by National
+Research Council Canada (NRC). This software uses signals from radio
+station CHU to set and frequency discipline the system clock on a
+Linux (FreeBSD) based system.
+
+WWW: http://www.rossi.com/chu/
+
+- Diane Bruce, VA3DB <db@db.net>
diff --git a/comms/chu/pkg-plist b/comms/chu/pkg-plist
new file mode 100644
index 000000000000..a1a5a34257b6
--- /dev/null
+++ b/comms/chu/pkg-plist
@@ -0,0 +1,9 @@
+sbin/chu
+%%DATADIR%%/testsignal
+%%PORTDOCS%%%%DOCSDIR%%/COPYING
+%%PORTDOCS%%%%DOCSDIR%%/chu.html
+%%PORTDOCS%%%%DOCSDIR%%/chuman.html
+%%PORTDOCS%%%%DOCSDIR%%/ntp.html
+%%PORTDOCS%%%%DOCSDIR%%/TESTING
+@dirrm %%DATADIR%%
+%%PORTDOCS%%@dirrm %%DOCSDIR%%