Hi ports --

Attached is a patch to allow collectd to work with the new libmicrohttpd.

Build tests ok on my machine with the new libmicrohttpd; I don't know
how to use this so that's as far as I got.

While here, I added --disable-werror to CONFIGURE_ARGS. -Werror is on
and while it was helpful for finding where to tweak collectd, I don't
think we want this on.

OK?

~Brian
Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/collectd/Makefile,v
retrieving revision 1.71
diff -u -p -r1.71 Makefile
--- Makefile    24 May 2022 18:51:25 -0000      1.71
+++ Makefile    1 Jun 2022 23:22:43 -0000
@@ -30,7 +30,7 @@ PKGNAME-redis =               collectd-redis-$V
 PKGNAME-prometheus =   collectd-prometheus-$V
 PKGNAME-ping =         collectd-ping-$V
 CATEGORIES =           sysutils
-REVISION-main =                1
+REVISION-main =                2
 REVISION-memcachec =   1
 REVISION-mqtt =                0
 REVISION-mysql =       1
@@ -141,7 +141,8 @@ LIBTOOL_FLAGS =     --tag=disable-static
 CONFIGURE_ARGS +=--with-librrd=${LOCALBASE} \
                --with-libstatgrab=${LOCALBASE} \
                --with-libnetsnmp=${LOCALBASE} \
-               --enable-all-plugins=no
+               --enable-all-plugins=no \
+               --disable-werror
 
 # no, varnishapi.h not in our varnish package
 #              --with-libvarnish=${LOCALBASE}
Index: patches/patch-src_write_prometheus_c
===================================================================
RCS file: patches/patch-src_write_prometheus_c
diff -N patches/patch-src_write_prometheus_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_write_prometheus_c        1 Jun 2022 23:22:43 -0000
@@ -0,0 +1,36 @@
+https://github.com/collectd/collectd/commit/3e6b6af50af45814efa40e99952d5c1ee6856bfe
+
+Index: src/write_prometheus.c
+--- src/write_prometheus.c.orig
++++ src/write_prometheus.c
+@@ -51,6 +51,12 @@
+   "encoding=delimited"
+ #define CONTENT_TYPE_TEXT "text/plain; version=0.0.4"
+ 
++#if MHD_VERSION >= 0x00097002
++#define MHD_RESULT enum MHD_Result
++#else
++#define MHD_RESULT int
++#endif
++
+ static c_avl_tree_t *metrics;
+ static pthread_mutex_t metrics_lock = PTHREAD_MUTEX_INITIALIZER;
+ 
+@@ -225,7 +231,7 @@ static void format_text(ProtobufCBuffer *buffer) {
+ 
+ /* http_handler is the callback called by the microhttpd library. It 
essentially
+  * handles all HTTP request aspects and creates an HTTP response. */
+-static int http_handler(void *cls, struct MHD_Connection *connection,
++static MHD_RESULT http_handler(void *cls, struct MHD_Connection *connection,
+                         const char *url, const char *method,
+                         const char *version, const char *upload_data,
+                         size_t *upload_data_size, void **connection_state) {
+@@ -267,7 +273,7 @@ static int http_handler(void *cls, struct MHD_Connecti
+   MHD_add_response_header(res, MHD_HTTP_HEADER_CONTENT_TYPE,
+                           want_proto ? CONTENT_TYPE_PROTO : 
CONTENT_TYPE_TEXT);
+ 
+-  int status = MHD_queue_response(connection, MHD_HTTP_OK, res);
++  MHD_RESULT status = MHD_queue_response(connection, MHD_HTTP_OK, res);
+ 
+   MHD_destroy_response(res);
+   PROTOBUF_C_BUFFER_SIMPLE_CLEAR(&simple);

Reply via email to