On Tue, Jan 09, 2018 at 09:19:45PM +0100, Joerg Jung wrote:
> please find below an update to blink-0.98a. This drops most of the
> patches as upstreamed (thanks to bluhm).
Looks good to me portwise, couldn't run-test it, though.
Updated diff below dropping unneeded V and DISTNAME due to GH_*.
HOMEPAGE has HTTPS.
diff --git a/misc/blink1/Makefile b/misc/blink1/Makefile
index 177de02761c..537d8d8ecb9 100644
--- a/misc/blink1/Makefile
+++ b/misc/blink1/Makefile
@@ -2,15 +2,16 @@
COMMENT = software tools for blink(1) LED notification light
-V = 1.98
-DISTNAME = ${GH_PROJECT}-${V}
+GH_ACCOUNT = todbot
+GH_PROJECT = blink1
+GH_TAGNAME = v1.98a
SO_V = 0.1
SHARED_LIBS = blink1 ${SO_V}
CATEGORIES = misc
-HOMEPAGE = http://blink1.thingm.com/
+HOMEPAGE = https://blink1.thingm.com/
MAINTAINER = Joerg Jung <[email protected]>
@@ -19,10 +20,6 @@ PERMIT_PACKAGE_CDROM = Yes
WANTLIB += c pthread usb
-GH_ACCOUNT = todbot
-GH_PROJECT = blink1
-GH_TAGNAME = v${V}
-
LIB_DEPENDS = devel/libusb-compat
MAKE_FLAGS = CC="${CC}" USBLIB_TYPE=HIDDATA \
diff --git a/misc/blink1/distinfo b/misc/blink1/distinfo
index e93930819cb..7f137927225 100644
--- a/misc/blink1/distinfo
+++ b/misc/blink1/distinfo
@@ -1,2 +1,2 @@
-SHA256 (blink1-1.98.tar.gz) = K7+ISMPGVquPsBA1/TEQOjIfvuIBZGkc9n43BsS1CxY=
-SIZE (blink1-1.98.tar.gz) = 29439933
+SHA256 (blink1-1.98a.tar.gz) = sMsN8zlejocXA2OUII+tKCW9GmmAJCuULjKR6fv5DP4=
+SIZE (blink1-1.98a.tar.gz) = 29503155
diff --git a/misc/blink1/patches/patch-commandline_Makefile
b/misc/blink1/patches/patch-commandline_Makefile
index bf323912116..7c15530161b 100644
--- a/misc/blink1/patches/patch-commandline_Makefile
+++ b/misc/blink1/patches/patch-commandline_Makefile
@@ -1,90 +1,46 @@
$OpenBSD: patch-commandline_Makefile,v 1.2 2015/12/23 10:53:53 bluhm Exp $
-
-todo: submit to upstream
-
---- commandline/Makefile.orig Wed Sep 9 03:06:56 2015
-+++ commandline/Makefile Wed Dec 23 11:33:08 2015
-@@ -113,9 +113,13 @@ ifeq "$(UNAME)" "FreeBSD"
- OS=freebsd
- endif
-
-+ifeq "$(UNAME)" "OpenBSD"
-+ OS=openbsd
-+endif
+Index: commandline/Makefile
+--- commandline/Makefile.orig
++++ commandline/Makefile
+@@ -124,7 +124,8 @@ endif
+ # allow overriding of GIT_TAG & BLINK1_VERSION on commandline for automated
builds
MACH_TYPE:="$(strip $(shell uname -m))"
--GIT_TAG:="$(strip $(shell git tag 2>&1 | tail -1 | cut -f1 -d' '))"
-+#GIT_TAG:="$(strip $(shell git tag 2>&1 | tail -1 | cut -f1 -d' '))"
+-GIT_TAG?="$(strip $(shell git tag 2>&1 | tail -1 | cut -f1 -d' '))"
++#GIT_TAG?="$(strip $(shell git tag 2>&1 | tail -1 | cut -f1 -d' '))"
+GIT_TAG:=${GH_TAGNAME}
# deal with case of no git or no git tags, check for presence of "v" (i.e.
"v1.93")
ifneq ($(findstring v,$(GIT_TAG)), v)
GIT_TAG:="v0"
-@@ -278,6 +282,37 @@ INCLOCATION ?= $(PREFIX)/include
-
- endif
+@@ -289,7 +290,7 @@ endif
-+################# OpenBSD
###################################################
-+ifeq "$(OS)" "openbsd"
+ ################# OpenBSD
###################################################
+ ifeq "$(OS)" "openbsd"
+-LIBTARGET = libblink1.so
+LIBTARGET = libblink1.so.${SO_V}
-+# was blink1-lib.so
-+
-+ifeq "$(USBLIB_TYPE)" "HIDAPI"
-+CFLAGS += -DUSE_HIDAPI
-+CFLAGS += -I./hidapi/hidapi
-+OBJS = ./hidapi/libusb/hid.o
-+CFLAGS += `pkg-config libusb-1.0 --cflags` -I/usr/local/include -fPIC
-+LIBS += `pkg-config libusb-1.0 --libs` -L/usr/local/lib -lpthread -liconv
-+endif
-+
-+ifeq "$(USBLIB_TYPE)" "HIDDATA"
-+CFLAGS += -DUSE_HIDDATA
-+OBJS = ./hiddata.o
-+CFLAGS += `pkg-config libusb --cflags` -fPIC
-+LIBS += `pkg-config libusb --libs`
-+endif
-+
-+LIBFLAGS = -shared -o $(LIBTARGET) $(LIBS)
-+EXE=
-+
-+#INSTALL = install
-+PREFIX ?= /usr/local
-+EXELOCATION ?= $(PREFIX)/bin
-+LIBLOCATION ?= $(PREFIX)/lib
-+INCLOCATION ?= $(PREFIX)/include
-+
-+endif
-+
- ################# WRT Linux ################################################
- ifeq "$(OS)" "wrtlinux"
- LIBTARGET = libblink1.so
-@@ -371,7 +406,7 @@ endif
+ # was blink1-lib.so
+
+ ifeq "$(USBLIB_TYPE)" "HIDAPI"
+@@ -411,7 +412,7 @@ endif
- #CFLAGS += -O -Wall -std=gnu99 -I ../hardware/firmware
- CFLAGS += -std=gnu99
+ #CFLAGS += -O -Wall -std=gnu99 -I ../hardware/firmware
+ CFLAGS += -std=gnu99
-CFLAGS += -g
+#CFLAGS += -g
CFLAGS += -DBLINK1_VERSION=\"$(BLINK1_VERSION)\"
- OBJS += blink1-lib.o
-@@ -389,6 +424,7 @@ help:
- @echo "make OS=windows ... build Windows blink1-lib and blink1-tool"
- @echo "make OS=linux ... build Linux blink1-lib and blink1-tool"
- @echo "make OS=freebsd ... build FreeBSD blink1-lib and blink1-tool"
-+ @echo "make OS=openbsd ... build OpenBSD blink1-lib and blink1-tool"
- @echo "make OS=macosx ... build Mac OS X blink1-lib and blink1-tool"
- @echo "make OS=wrt ... build OpenWrt blink1-lib and blink1-tool"
- @echo "make OS=wrtcross... build for OpenWrt using cross-compiler"
-@@ -409,7 +445,7 @@ $(OBJS): %.o: %.c
+ OBJS += blink1-lib.o
+@@ -451,7 +452,7 @@ $(OBJS): %.o: %.c
blink1-tool: $(OBJS) blink1-tool.o
$(CC) $(CFLAGS) -c blink1-tool.c -o blink1-tool.o
-- $(CC) $(CFLAGS) $(EXEFLAGS) -g $(OBJS) $(LIBS) blink1-tool.o -o
blink1-tool$(EXE)
-+ $(CC) $(CFLAGS) $(EXEFLAGS) $(OBJS) $(LIBS) blink1-tool.o -o
blink1-tool$(EXE)
+- $(CC) $(CFLAGS) $(EXEFLAGS) -g $(OBJS) $(LIBS) blink1-tool.o -o
blink1-tool$(EXE)
++ $(CC) $(CFLAGS) $(EXEFLAGS) $(OBJS) $(LIBS) blink1-tool.o -o
blink1-tool$(EXE)
- # FIXME: verify we don't need MONGOOSE_LIBS and pthread & dl are avilable
everywhere
blink1-tiny-server: $(OBJS) server/blink1-tiny-server.c
-@@ -428,9 +464,9 @@ package: lib blink1-tool
- @#mkdir -f builds && cp blink1-tool-$(PKGOKS).zip builds
+ # $(CC) $(CFLAGS) -DMG_ENABLE_THREADS -I. -I./server/mongoose -c
server/blink1-tiny-server.c -o blink1-tiny-server.o
+@@ -473,9 +474,9 @@ package-tiny-server: blink1-tiny-server
+ zip blink1-tiny-server-$(PKGOS).zip blink1-tiny-server$(EXE)
install: all
- $(INSTALL) blink1-tool$(EXE) $(DESTDIR)$(EXELOCATION)/blink1-tool$(EXE)
diff --git a/misc/blink1/patches/patch-commandline_blink1-lib-lowlevel-hidapi_h
b/misc/blink1/patches/patch-commandline_blink1-lib-lowlevel-hidapi_h
deleted file mode 100644
index fb5a7380235..00000000000
--- a/misc/blink1/patches/patch-commandline_blink1-lib-lowlevel-hidapi_h
+++ /dev/null
@@ -1,34 +0,0 @@
-$OpenBSD: patch-commandline_blink1-lib-lowlevel-hidapi_h,v 1.1 2015/12/23
10:53:53 bluhm Exp $
---- commandline/blink1-lib-lowlevel-hidapi.h.orig Wed Sep 9 03:06:56 2015
-+++ commandline/blink1-lib-lowlevel-hidapi.h Wed Dec 23 00:00:26 2015
-@@ -20,8 +20,10 @@ int blink1_enumerateByVidPid(int vid, int pid)
- if( (cur_dev->vendor_id != 0 && cur_dev->product_id != 0) &&
- (cur_dev->vendor_id == vid && cur_dev->product_id == pid) ) {
- if( cur_dev->serial_number != NULL ) { // can happen if not root
-- strcpy( blink1_infos[p].path, cur_dev->path );
-- sprintf( blink1_infos[p].serial, "%ls",
cur_dev->serial_number);
-+ strncpy( blink1_infos[p].path, cur_dev->path,
-+ sizeof(blink1_infos[p].path));
-+ snprintf(blink1_infos[p].serial,
sizeof(blink1_infos[p].serial),
-+ "%ls", cur_dev->serial_number);
- //wcscpy( blink1_infos[p].serial, cur_dev->serial_number );
- //uint32_t sn = wcstol( cur_dev->serial_number, NULL, 16);
- uint32_t serialnum = strtol( blink1_infos[p].serial, NULL,
16);
-@@ -104,7 +106,7 @@ blink1_device* blink1_openById( uint32_t i )
- LOG("blink1_openById: %d \n", i );
- if( i > blink1_max_devices ) { // then i is a serial number not an array
index
- char serialstr[serialstrmax];
-- sprintf( serialstr, "%X", i); // convert to wchar_t*
-+ snprintf(serialstr, sizeof(serialstr), "%X", i); // convert to
wchar_t*
- return blink1_openBySerial( serialstr );
- }
- else {
-@@ -189,7 +191,7 @@ char *blink1_error_msg(int errCode)
- case USBOPEN_ERR_NOTFOUND: return "The specified device was not
found";
- case USBOPEN_ERR_IO: return "Communication error with device";
- default:
-- sprintf(buf, "Unknown USB error %d", errCode);
-+ snprintf(buf, sizeof(buf), "Unknown USB error %d", errCode);
- return buf;
- }
- */
diff --git
a/misc/blink1/patches/patch-commandline_blink1-lib-lowlevel-hiddata_h
b/misc/blink1/patches/patch-commandline_blink1-lib-lowlevel-hiddata_h
deleted file mode 100644
index 8bd9e874ebf..00000000000
--- a/misc/blink1/patches/patch-commandline_blink1-lib-lowlevel-hiddata_h
+++ /dev/null
@@ -1,42 +0,0 @@
-$OpenBSD: patch-commandline_blink1-lib-lowlevel-hiddata_h,v 1.1 2015/12/23
10:53:53 bluhm Exp $
---- commandline/blink1-lib-lowlevel-hiddata.h.orig Wed Sep 9 03:06:56 2015
-+++ commandline/blink1-lib-lowlevel-hiddata.h Wed Dec 23 00:00:37 2015
-@@ -15,7 +15,7 @@ char *blink1_error_msg(int errCode)
- case USBOPEN_ERR_NOTFOUND: return "The specified device was not
found";
- case USBOPEN_ERR_IO: return "Communication error with device";
- default:
-- sprintf(buffer, "Unknown USB error %d", errCode);
-+ snprintf(buffer, sizeof(buffer), "Unknown USB error %d", errCode);
- return buffer;
- }
- return NULL; /* not reached */
-@@ -46,8 +46,10 @@ int blink1_enumerateByVidPid(int vid, int pid)
- if( (cur_dev->vendor_id != 0 && cur_dev->product_id != 0) &&
- (cur_dev->vendor_id == vid && cur_dev->product_id == pid) ) {
- if( cur_dev->serial_number != NULL ) { // can happen if not root
-- strcpy( blink1_infos[p].path, cur_dev->path );
-- sprintf( blink1_infos[p].serial, "%ls",
cur_dev->serial_number);
-+ strncpy( blink1_infos[p].path, cur_dev->path,
-+ sizeof(blink1_infos[p].path));
-+ snprintf(blink1_infos[p].serial,
sizeof(blink1_infos[p].serial),
-+ "%ls", cur_dev->serial_number);
- //wcscpy( blink1_infos[p].serial, cur_dev->serial_number );
- //uint32_t sn = wcstol( cur_dev->serial_number, NULL, 16);
- uint32_t serialnum = strtol( blink1_infos[p].serial, NULL,
16);
-@@ -136,7 +138,7 @@ blink1_device* blink1_openById( uint32_t i )
- {
- if( i > blink1_max_devices ) { // then i is a serial number not array
index
- char serialstr[serialstrmax];
-- sprintf( serialstr, "%X", i); // convert to wchar_t*
-+ snprintf(serialstr, sizeof(serialstr), "%X", i); // convert to
wchar_t*
- return blink1_openBySerial( serialstr );
- }
- else {
-@@ -154,6 +156,7 @@ blink1_device* blink1_open(void)
- LOG("blink1_open\n");
- if( rc != USBOPEN_SUCCESS ) {
- LOG("cannot open: \n");
-+ static_dev = NULL;
- }
- return static_dev;
- }
diff --git a/misc/blink1/patches/patch-commandline_blink1-lib_c
b/misc/blink1/patches/patch-commandline_blink1-lib_c
deleted file mode 100644
index a6f534a0b4c..00000000000
--- a/misc/blink1/patches/patch-commandline_blink1-lib_c
+++ /dev/null
@@ -1,12 +0,0 @@
-$OpenBSD: patch-commandline_blink1-lib_c,v 1.1 2015/12/23 10:53:54 bluhm Exp $
---- commandline/blink1-lib.c.orig Wed Sep 9 03:06:56 2015
-+++ commandline/blink1-lib.c Wed Dec 23 00:00:26 2015
-@@ -102,7 +102,7 @@ int blink1_getCacheIndexById( uint32_t i )
- {
- if( i > blink1_max_devices ) { // then i is a serial number not an array
index
- char serialstr[serialstrmax];
-- sprintf( serialstr, "%X", i); // convert to wchar_t*
-+ snprintf(serialstr, sizeof(serialstr), "%X", i); // convert to
wchar_t*
- return blink1_getCacheIndexBySerial( serialstr );
- }
- return i;
diff --git a/misc/blink1/patches/patch-commandline_blink1-tool_c
b/misc/blink1/patches/patch-commandline_blink1-tool_c
deleted file mode 100644
index 93e3cad151a..00000000000
--- a/misc/blink1/patches/patch-commandline_blink1-tool_c
+++ /dev/null
@@ -1,22 +0,0 @@
-$OpenBSD: patch-commandline_blink1-tool_c,v 1.1 2015/12/23 10:53:54 bluhm Exp $
---- commandline/blink1-tool.c.orig Wed Sep 9 03:06:56 2015
-+++ commandline/blink1-tool.c Wed Dec 23 00:00:26 2015
-@@ -509,7 +509,7 @@ int main(int argc, char** argv)
- dev = blink1_openById( deviceIds[0] );
- rc = blink1_getVersion(dev);
- blink1_close(dev);
-- sprintf(verbuf, ", fw version: %d", rc);
-+ snprintf(verbuf, sizeof(verbuf), ", fw version: %d", rc);
- }
- msg("blink1-tool version: %s%s\n",BLINK1_VERSION,verbuf);
- exit(0);
-@@ -741,7 +741,8 @@ int main(int argc, char** argv)
- do_rand =1;
- }
- char ledstr[16];
-- sprintf(ledstr, "#%2.2x%2.2x%2.2x", rgbbuf.r,rgbbuf.g,rgbbuf.b);
-+ snprintf(ledstr, sizeof(ledstr), "#%2.2x%2.2x%2.2x",
-+ rgbbuf.r,rgbbuf.g,rgbbuf.b);
- msg("chase effect %d to %d (with %d leds), color %s, ",
- led_start, led_end, chase_length,
- ((do_rand) ? "random" : ledstr));