diff options
author | martin <martin@pkgsrc.org> | 2019-01-16 14:43:22 +0000 |
---|---|---|
committer | martin <martin@pkgsrc.org> | 2019-01-16 14:43:22 +0000 |
commit | bc5766a4f34720b822c6301059a6395c4e05624f (patch) | |
tree | ad4b2639dcbbd43445ab1a968fa7f5e0edf310cd /misc | |
parent | 920e132e694eba6eed904c402e987b8c6d4ba51e (diff) | |
download | pkgsrc-bc5766a4f34720b822c6301059a6395c4e05624f.tar.gz |
Add a variant of the "sunwait" program, used to calculate sunset and
sunrise (usefull in semi automatic astro-photography or home automation).
With big help from leonardo.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/sunwait/DESCR | 5 | ||||
-rw-r--r-- | misc/sunwait/Makefile | 14 | ||||
-rw-r--r-- | misc/sunwait/PLIST | 2 | ||||
-rw-r--r-- | misc/sunwait/distinfo | 9 | ||||
-rw-r--r-- | misc/sunwait/patches/patch-Makefile | 44 | ||||
-rw-r--r-- | misc/sunwait/patches/patch-sunriset.cpp | 15 | ||||
-rw-r--r-- | misc/sunwait/patches/patch-sunwait.cpp | 15 |
7 files changed, 104 insertions, 0 deletions
diff --git a/misc/sunwait/DESCR b/misc/sunwait/DESCR new file mode 100644 index 00000000000..5907e73bd51 --- /dev/null +++ b/misc/sunwait/DESCR @@ -0,0 +1,5 @@ +Sunwait is a small program for calculating sunrise and sunset, +as well as civil, nautical and astronimical twilight. + +It has features that make it usefull for home automation +tasks. diff --git a/misc/sunwait/Makefile b/misc/sunwait/Makefile new file mode 100644 index 00000000000..6d1d21c4f64 --- /dev/null +++ b/misc/sunwait/Makefile @@ -0,0 +1,14 @@ +# $NetBSD: Makefile,v 1.1 2019/01/16 14:43:22 martin Exp $ + +DISTNAME= sunwait-0.8 +CATEGORIES= misc +MASTER_SITES= ${MASTER_SITE_GITHUB:=klada/} + +MAINTAINER= martin@NetBSD.org +HOMEPAGE= https://github.com/klada/sunwait +COMMENT= Calculate sunrise, sunset and twilight +LICENSE= gnu-gpl-v2 + +USE_LANGUAGES+= c++11 + +.include "../../mk/bsd.pkg.mk" diff --git a/misc/sunwait/PLIST b/misc/sunwait/PLIST new file mode 100644 index 00000000000..7289aa77502 --- /dev/null +++ b/misc/sunwait/PLIST @@ -0,0 +1,2 @@ +@comment $NetBSD: PLIST,v 1.1 2019/01/16 14:43:22 martin Exp $ +bin/sunwait diff --git a/misc/sunwait/distinfo b/misc/sunwait/distinfo new file mode 100644 index 00000000000..7690ae2c395 --- /dev/null +++ b/misc/sunwait/distinfo @@ -0,0 +1,9 @@ +$NetBSD: distinfo,v 1.1 2019/01/16 14:43:22 martin Exp $ + +SHA1 (sunwait-0.8.tar.gz) = eed1453e288d03d200d4f74634324a343434f426 +RMD160 (sunwait-0.8.tar.gz) = ffad86c063eac4952141016fde056056d44963b4 +SHA512 (sunwait-0.8.tar.gz) = 974aec925e08d42f6b9d617cd033ab21af314b04a0bab100f9b473e038df7eb65a86de2240ef2d5308af5385c929607d591c6f7b738925622e38040af6368166 +Size (sunwait-0.8.tar.gz) = 20302 bytes +SHA1 (patch-Makefile) = 63276adb2587a251d9bb896ec82cd5ba6b3d6c07 +SHA1 (patch-sunriset.cpp) = 759aa1f2c0301f8fab3a264167d25a077ed205ee +SHA1 (patch-sunwait.cpp) = cf5b2251a4b0de5e95cdbd06a432824b623df42b diff --git a/misc/sunwait/patches/patch-Makefile b/misc/sunwait/patches/patch-Makefile new file mode 100644 index 00000000000..6e21da2f29c --- /dev/null +++ b/misc/sunwait/patches/patch-Makefile @@ -0,0 +1,44 @@ +$NetBSD: patch-Makefile,v 1.1 2019/01/16 14:43:22 martin Exp $ + +- Use CC instead of C to specify the C compiler and do not hardcode gcc +- Honors user's {C,LD}FLAGS +- Make the install target more flexible + +--- Makefile.orig 2015-09-20 14:07:55.000000000 +0000 ++++ Makefile +@@ -5,23 +5,29 @@ + # + + +-C=gcc +-CFLAGS=-c -Wall +-LDFLAGS= -lm -lstdc++ ++CC=c++ ++CFLAGS+=-c -Wall -D__linux__ ++LDFLAGS+= -lm -lstdc++ + SOURCES=sunwait.cpp sunriset.cpp print.cpp sunwait.h sunriset.h print.h + OBJECTS=$(SOURCES:.cpp=.o) + EXECUTABLE=sunwait + ++PREFIX?= /usr ++ ++INSTALL_PROGRAM?= install -m 755 ++INSTALL_PROGRAM_DIR?= install -d -m 755 ++ + all: $(SOURCES) $(EXECUTABLE) + + $(EXECUTABLE): $(OBJECTS) +- $(C) $(OBJECTS) -o $@ $(LDFLAGS) ++ $(CC) $(OBJECTS) -o $@ $(LDFLAGS) + + .cpp.o: +- $(C) $(CFLAGS) $< -o $@ ++ $(CC) $(CFLAGS) $< -o $@ + + clean: + rm -f *.o sunwait + + install: +- install -D -m 755 sunwait $(DESTDIR)/usr/bin/sunwait ++ ${INSTALL_PROGRAM_DIR} $(DESTDIR)$(PREFIX)/bin ++ ${INSTALL_PROGRAM} sunwait $(DESTDIR)$(PREFIX)/bin/sunwait diff --git a/misc/sunwait/patches/patch-sunriset.cpp b/misc/sunwait/patches/patch-sunriset.cpp new file mode 100644 index 00000000000..f3c56b0309d --- /dev/null +++ b/misc/sunwait/patches/patch-sunriset.cpp @@ -0,0 +1,15 @@ +$NetBSD: patch-sunriset.cpp,v 1.1 2019/01/16 14:43:22 martin Exp $ + +Use fabs() instead of integer abs() for double values. + +--- sunriset.cpp.orig 2015-09-20 16:07:55.000000000 +0200 ++++ sunriset.cpp 2018-07-19 14:17:06.794662715 +0200 +@@ -92,7 +92,7 @@ + /* compute the diurnal arc that the sun traverses to reach the specified altitide altit: */ + double cost = (sind(altitude) - sind(pRun->latitude) * sind(sdec)) / (cosd(pRun->latitude) * cosd(sdec)); + +- if (abs(cost) < 1.0) ++ if (fabs(cost) < 1.0) + diurnalArc = 2*acosd(cost)/15.0; /* Diurnal arc, hours */ + else if (cost>=1.0) + diurnalArc = 0.0; // Polar Night diff --git a/misc/sunwait/patches/patch-sunwait.cpp b/misc/sunwait/patches/patch-sunwait.cpp new file mode 100644 index 00000000000..c8ab4fec16d --- /dev/null +++ b/misc/sunwait/patches/patch-sunwait.cpp @@ -0,0 +1,15 @@ +$NetBSD: patch-sunwait.cpp,v 1.1 2019/01/16 14:43:22 martin Exp $ + +Fix typo that causes a warning from newer gcc. + +--- sunwait.cpp.orig 2015-09-20 16:07:55.000000000 +0200 ++++ sunwait.cpp 2018-07-19 14:15:25.334426961 +0200 +@@ -661,7 +661,7 @@ + if (pRun->debug == ONOFF_ON) printf ("Debug: argv[%d]: >%s<\n", i, arg); + + // Strip any hyphen from arguments, but not negative signs of numbers +- if (arg[0] == '-' && arg[1] != '\0' && !isdigit(arg[1])) *arg++; ++ if (arg[0] == '-' && arg[1] != '\0' && !isdigit(arg[1])) arg++; + + // Normal help or version info + if (!strcmp (arg, "v") || |