Github messages for voidlinux
 help / color / mirror / Atom feed
From: subnut <subnut@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] mongoose: update to 7.6
Date: Tue, 29 Mar 2022 06:59:54 +0200	[thread overview]
Message-ID: <20220329045954.nasdJ8fWJmhztwUavPT4ZonbhvtpM5tFxT8FeJ2NxBI@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-36395@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1241 bytes --]

There is an updated pull request by subnut against master on the void-packages repository

https://github.com/subnut/void-packages mongoose
https://github.com/void-linux/void-packages/pull/36395

mongoose: update to 7.6
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)
<!-- 
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/36395.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-mongoose-36395.patch --]
[-- Type: text/x-diff, Size: 10956 bytes --]

From 537f02376d7ed1235e05a460bd4c3dc099fe705b Mon Sep 17 00:00:00 2001
From: Subhaditya Nath <sn03.general@gmail.com>
Date: Mon, 28 Mar 2022 19:49:52 +0530
Subject: [PATCH] mongoose: update to 7.6

---
 srcpkgs/mongoose/patches/add-makefile.patch |  50 -------
 srcpkgs/mongoose/patches/fix-makefile.patch |  52 +++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 149 ++++++++++++++++++++
 srcpkgs/mongoose/template                   |  30 +++-
 4 files changed, 224 insertions(+), 57 deletions(-)
 delete mode 100644 srcpkgs/mongoose/patches/add-makefile.patch
 create mode 100644 srcpkgs/mongoose/patches/fix-makefile.patch
 create mode 100644 srcpkgs/mongoose/patches/fix-tests.patch

diff --git a/srcpkgs/mongoose/patches/add-makefile.patch b/srcpkgs/mongoose/patches/add-makefile.patch
deleted file mode 100644
index fd0b21095472..000000000000
--- a/srcpkgs/mongoose/patches/add-makefile.patch
+++ /dev/null
@@ -1,50 +0,0 @@
---- /dev/null
-+++ b/Makefile
-@@ -0,0 +1,47 @@
-+PROG		= mongoose
-+LIB         = lib$(PROG).so.0
-+
-+ifndef PREFIX
-+  PREFIX=/usr/local
-+endif
-+
-+ifndef DOCDIR
-+	DOCDIR=$(PREFIX)/share/$(PROG)/doc
-+endif
-+
-+CPPFLAGS+=-DMONGOOSE_ENABLE_THREADS -DMG_ENABLE_SSL
-+CFLAGS+=-fPIC -c -Wall
-+LDFLAGS+=-shared -lssl -pthread -lcrypto
-+
-+SRCS=mongoose.c
-+OBJS=mongoose.o
-+INCLUDE=.
-+
-+all: $(LIB)
-+
-+$(LIB): $(OBJS)
-+	$(CC) $(OBJS) $(LDFLAGS) -o $(LIB)
-+
-+$(OBJS): $(SRCS)
-+	$(CC) $(CPPFLAGS) $(CFLAGS) -I$(INCLUDE) $(SRCS) -o $(OBJS)
-+
-+install: 
-+	install -d $(DESTDIR)$(PREFIX)/include
-+	install -m644 mongoose.h $(DESTDIR)$(PREFIX)/include
-+	install -d $(DESTDIR)$(PREFIX)/lib
-+	ln -sf $(LIB) $(LIB).0; cp -a $(LIB).0 $(DESTDIR)$(PREFIX)/lib
-+	ln -sf $(LIB) libmongoose.so; cp -a libmongoose.so $(DESTDIR)$(PREFIX)/lib
-+	install -m755 $(LIB) $(DESTDIR)$(PREFIX)/lib
-+	install -dm755 $(DESTDIR)$(DOCDIR)
-+	cp -a examples $(DESTDIR)$(DOCDIR)
-+	cp -a docs/* $(DESTDIR)$(DOCDIR)/
-+
-+	
-+test:
-+	$(MAKE) -C test/
-+clean:
-+	rm -f $(OBJS) $(LIB)
-+	$(MAKE) -C test/ clean
-+
-+.PHONY: clean test all
-+
diff --git a/srcpkgs/mongoose/patches/fix-makefile.patch b/srcpkgs/mongoose/patches/fix-makefile.patch
new file mode 100644
index 000000000000..c67267330619
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,52 @@
+diff --git a/Makefile b/Makefile.new
+index 823550db..85330b70 100644
+--- a/Makefile
++++ b/Makefile.new
+@@ -2,7 +2,7 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ HDRS = $(wildcard src/*.h)
+ DEFS ?= -DMG_MAX_HTTP_HEADERS=7 -DMG_ENABLE_LINES -DMG_ENABLE_PACKED_FS=1
+ WARN ?= -W -Wall -Werror -Wshadow -Wdouble-promotion -fno-common -Wconversion -Wundef
+-OPTS ?= -O3 -g3
++OPTS ?= -O3 -g3 -fPIC
+ INCS ?= -Isrc -I.
+ CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
+ SSL ?= MBEDTLS
+@@ -19,12 +19,12 @@ VERSION ?= $(shell cut -d'"' -f2 src/version.h)
+ ifeq "$(SSL)" "MBEDTLS"
+ MBEDTLS ?= /usr
+ CFLAGS  += -DMG_ENABLE_MBEDTLS=1 -I$(MBEDTLS)/include -I/usr/include
+-LDFLAGS ?= -L$(MBEDTLS)/lib -lmbedtls -lmbedcrypto -lmbedx509
++LDFLAGS += -L$(MBEDTLS)/lib -lmbedtls -lmbedcrypto -lmbedx509
+ endif
+ ifeq "$(SSL)" "OPENSSL"
+ OPENSSL ?= /usr
+ CFLAGS  += -DMG_ENABLE_OPENSSL=1 -I$(OPENSSL)/include
+-LDFLAGS ?= -L$(OPENSSL)/lib -lssl -lcrypto
++LDFLAGS += -L$(OPENSSL)/lib -lssl -lcrypto
+ endif
+ 
+ all: mg_prefix unamalgamated unpacked test test++ arm examples vc98 vc2017 mingw mingw++ linux linux++ fuzz
+@@ -108,15 +108,20 @@ linux++: CC = g++
+ linux++: WARN += -Wno-missing-field-initializers
+ linux++: linux
+ 
+-linux-libs: CFLAGS += -fPIC
+-linux-libs: mongoose.o
+-	$(CC) mongoose.o $(LDFLAGS) -shared -o libmongoose.so.$(VERSION)
++.PHONY: linux-libs
++linux-libs: libmongoose.a libmongoose.so.$(VERSION)
++libmongoose.a: mongoose.o
+ 	$(AR) rcs libmongoose.a mongoose.o
++libmongoose.so.$(VERSION): mongoose.o
++	$(CC) mongoose.o $(LDFLAGS) -shared -o libmongoose.so.$(VERSION)
+ 
+ install: linux-libs
+ 	install -Dm644 libmongoose.a libmongoose.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib
+ 	ln -s libmongoose.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libmongoose.so
+ 	install -Dm644 mongoose.h $(DESTDIR)$(PREFIX)/include/mongoose.h
++	install -dm755 $(DESTDIR)$(PREFIX)/share/mongoose/doc
++	cp -a examples $(DESTDIR)$(PREFIX)/share/mongoose/doc
++	cp -a docs/*   $(DESTDIR)$(PREFIX)/share/mongoose/doc/
+ 
+ 
+ uninstall:
diff --git a/srcpkgs/mongoose/patches/fix-tests.patch b/srcpkgs/mongoose/patches/fix-tests.patch
new file mode 100644
index 000000000000..00181fc77bed
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-tests.patch
@@ -0,0 +1,149 @@
+Tests should not need to connect to the internet
+
+--- a/test/unit_test.c
++++ b/test/unit_test.c
+@@ -291,67 +291,6 @@ static void test_sntp(void) {
+   ASSERT(mg_sntp_parse(NULL, 0) == -1);
+ }
+ 
+-static void mqtt_cb(struct mg_connection *c, int ev, void *evd, void *fnd) {
+-  char *buf = (char *) fnd;
+-  if (ev == MG_EV_MQTT_OPEN) {
+-    buf[0] = *(int *) evd == 0 ? 'X' : 'Y';
+-  } else if (ev == MG_EV_MQTT_MSG) {
+-    struct mg_mqtt_message *mm = (struct mg_mqtt_message *) evd;
+-    sprintf(buf + 1, "%.*s/%.*s", (int) mm->topic.len, mm->topic.ptr,
+-            (int) mm->data.len, mm->data.ptr);
+-  }
+-  (void) c;
+-}
+-
+-static void test_mqtt(void) {
+-  char buf[50] = {0};
+-  struct mg_mgr mgr;
+-  struct mg_str topic = mg_str("x/f12"), data = mg_str("hi");
+-  struct mg_connection *c;
+-  struct mg_mqtt_opts opts;
+-  // const char *url = "mqtt://mqtt.eclipse.org:1883";
+-  const char *url = "mqtt://broker.hivemq.com:1883";
+-  int i;
+-  mg_mgr_init(&mgr);
+-
+-  {
+-    uint8_t bad[] = " \xff\xff\xff\xff ";
+-    struct mg_mqtt_message mm;
+-    mg_mqtt_parse(bad, sizeof(bad), &mm);
+-  }
+-
+-  // Connect with empty client ID
+-  c = mg_mqtt_connect(&mgr, url, NULL, mqtt_cb, buf);
+-  for (i = 0; i < 200 && buf[0] == 0; i++) mg_mgr_poll(&mgr, 10);
+-  ASSERT(buf[0] == 'X');
+-  mg_mqtt_sub(c, topic, 1);
+-  mg_mqtt_pub(c, topic, data, 1, false);
+-  for (i = 0; i < 300 && buf[1] == 0; i++) mg_mgr_poll(&mgr, 10);
+-  // LOG(LL_INFO, ("[%s]", buf));
+-  ASSERT(strcmp(buf, "Xx/f12/hi") == 0);
+-
+-  // Set params
+-  memset(buf, 0, sizeof(buf));
+-  memset(&opts, 0, sizeof(opts));
+-  opts.clean = true;
+-  opts.will_qos = 1;
+-  opts.will_retain = true;
+-  opts.keepalive = 20;
+-  opts.client_id = mg_str("mg_client");
+-  opts.will_topic = mg_str("mg_will_topic");
+-  opts.will_message = mg_str("mg_will_messsage");
+-  c = mg_mqtt_connect(&mgr, url, &opts, mqtt_cb, buf);
+-  for (i = 0; i < 300 && buf[0] == 0; i++) mg_mgr_poll(&mgr, 10);
+-  ASSERT(buf[0] == 'X');
+-  mg_mqtt_sub(c, topic, 1);
+-  mg_mqtt_pub(c, topic, data, 1, false);
+-  for (i = 0; i < 500 && buf[1] == 0; i++) mg_mgr_poll(&mgr, 10);
+-  ASSERT(strcmp(buf, "Xx/f12/hi") == 0);
+-
+-  mg_mgr_free(&mgr);
+-  ASSERT(mgr.conns == NULL);
+-}
+-
+ static void eh1(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
+   struct mg_tls_opts *topts = (struct mg_tls_opts *) fn_data;
+   if (ev == MG_EV_ACCEPT && topts != NULL) mg_tls_init(c, topts);
+@@ -750,63 +689,6 @@ static void test_tls(void) {
+ #endif
+ }
+ 
+-static void f3(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
+-  int *ok = (int *) fn_data;
+-  // LOG(LL_INFO, ("%d", ev));
+-  if (ev == MG_EV_CONNECT) {
+-    // c->is_hexdumping = 1;
+-    mg_printf(c, "GET / HTTP/1.0\r\nHost: %s\r\n\r\n",
+-              c->peer.is_ip6 ? "ipv6.google.com" : "cesanta.com");
+-  } else if (ev == MG_EV_HTTP_MSG) {
+-    struct mg_http_message *hm = (struct mg_http_message *) ev_data;
+-    // LOG(LL_INFO, ("-->[%.*s]", (int) hm->message.len, hm->message.ptr));
+-    // ASSERT(mg_vcmp(&hm->method, "HTTP/1.1") == 0);
+-    // ASSERT(mg_vcmp(&hm->uri, "301") == 0);
+-    *ok = atoi(hm->uri.ptr);
+-  } else if (ev == MG_EV_CLOSE) {
+-    if (*ok == 0) *ok = 888;
+-  } else if (ev == MG_EV_ERROR) {
+-    if (*ok == 0) *ok = 777;
+-  }
+-}
+-
+-static void test_http_client(void) {
+-  struct mg_mgr mgr;
+-  struct mg_connection *c;
+-  int i, ok = 0;
+-  mg_mgr_init(&mgr);
+-  c = mg_http_connect(&mgr, "http://cesanta.com", f3, &ok);
+-  ASSERT(c != NULL);
+-  for (i = 0; i < 500 && ok <= 0; i++) mg_mgr_poll(&mgr, 10);
+-  ASSERT(ok == 301);
+-  c->is_closing = 1;
+-  mg_mgr_poll(&mgr, 0);
+-  ok = 0;
+-#if MG_ENABLE_MBEDTLS || MG_ENABLE_OPENSSL
+-  {
+-    struct mg_tls_opts opts = {.ca = "./test/data/ca.pem"};
+-    c = mg_http_connect(&mgr, "https://cesanta.com", f3, &ok);
+-    ASSERT(c != NULL);
+-    mg_tls_init(c, &opts);
+-    for (i = 0; i < 500 && ok <= 0; i++) mg_mgr_poll(&mgr, 10);
+-    ASSERT(ok == 200);
+-  }
+-#endif
+-
+-#if MG_ENABLE_IPV6
+-  ok = 0;
+-  // ipv6.google.com does not have IPv4 address, only IPv6, therefore
+-  // it is guaranteed to hit IPv6 resolution path.
+-  c = mg_http_connect(&mgr, "http://ipv6.google.com", f3, &ok);
+-  ASSERT(c != NULL);
+-  for (i = 0; i < 500 && ok <= 0; i++) mg_mgr_poll(&mgr, 10);
+-  ASSERT(ok == 200);
+-#endif
+-
+-  mg_mgr_free(&mgr);
+-  ASSERT(mgr.conns == NULL);
+-}
+-
+ static void f4(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
+   if (ev == MG_EV_HTTP_MSG) {
+     struct mg_http_message *hm = (struct mg_http_message *) ev_data;
+@@ -1680,11 +1562,9 @@ int main(void) {
+   test_ws();
+   test_ws_fragmentation();
+   test_http_server();
+-  test_http_client();
+   test_http_no_content_length();
+   test_http_pipeline();
+   test_http_range();
+-  test_mqtt();
+   printf("SUCCESS. Total tests: %d\n", s_num_tests);
+   return EXIT_SUCCESS;
+ }
+
diff --git a/srcpkgs/mongoose/template b/srcpkgs/mongoose/template
index eddadc647333..a47a6b08fb4b 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,38 @@
 # Template file for 'mongoose'
 pkgname=mongoose
-version=6.18
-revision=4
+version=7.6
+revision=1
 build_style=gnu-makefile
-make_use_env=compliant
+make_use_env=yes
+make_check_target=test
+make_build_target=linux-libs
 makedepends="openssl-devel"
-short_desc="Easy to use Web server"
-maintainer="Orphaned <orphan@voidlinux.org>"
+checkdepends="openssl-devel libsanitizer-devel"
+short_desc="Embedded Networking Library for TCP,UDP,HTTP,MQTT,WebSocket and SSL/TLS"
+maintainer="Subhaditya Nath <sn03.general@gmail.com>"
 license="GPL-2.0-only"
-homepage="https://cesanta.com/"
+homepage="https://mongoose.ws/"
 distfiles="https://github.com/cesanta/mongoose/archive/${version}.tar.gz"
-checksum=f5c10346abc9c72f7cac7885d853ca064fb09aad57580433941a8fd7a3543769
+checksum=1ef09d971b6de1a6317c109980d6fb5a9c19b39efef2506d6b76869644b3dafa
+
+export SSL=OPENSSL
+
+pre_build() {
+	export EXTRA="${CFLAGS}"
+	unset CFLAGS
+}
+
+pre_check() {
+	export EXTRA="${CFLAGS}"
+	unset CFLAGS
+}
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }

  parent reply	other threads:[~2022-03-29  4:59 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28 18:23 [PR PATCH] " subnut
2022-03-28 18:30 ` subnut
2022-03-28 18:31 ` subnut
2022-03-28 18:49 ` [PR REVIEW] " ahesford
2022-03-28 18:49 ` ahesford
2022-03-28 18:49 ` ahesford
2022-03-28 18:49 ` ahesford
2022-03-28 19:42 ` [PR PATCH] [Updated] " subnut
2022-03-28 19:44 ` [PR REVIEW] " subnut
2022-03-28 19:45 ` subnut
2022-03-28 20:17 ` Johnnynator
2022-03-29  2:16 ` subnut
2022-03-29  2:16 ` subnut
2022-03-29  3:39 ` [PR PATCH] [Updated] " subnut
2022-03-29  4:59 ` subnut [this message]
2022-03-29  5:21 ` subnut
2022-03-29  5:22 ` subnut
2022-03-29  5:32 ` subnut
2022-03-29  5:35 ` subnut
2022-03-29  6:05 ` subnut
2022-03-29  6:11 ` subnut
2022-03-29  6:15 ` [PR REVIEW] " subnut
2022-03-29  6:29 ` [PR PATCH] [Updated] " subnut
2022-03-29  6:36 ` subnut
2022-03-29  6:37 ` subnut
2022-03-29  6:38 ` subnut
2022-03-29  8:58 ` [PR REVIEW] " ahesford
2022-03-29  8:58 ` ahesford
2022-03-29 11:36 ` subnut
2022-03-29 12:07 ` ahesford
2022-03-29 12:21 ` [PR PATCH] [Updated] " subnut
2022-03-29 12:22 ` subnut
2022-03-29 12:37 ` subnut
2022-03-29 12:38 ` [PR REVIEW] " subnut
2022-03-29 12:47 ` [PR PATCH] [Updated] " subnut
2022-03-29 18:29 ` [PR REVIEW] " 0x5c
2022-03-29 18:57 ` subnut
2022-03-29 19:07 ` ahesford
2022-03-29 19:29 ` ahesford
2022-03-30  3:51 ` [PR PATCH] [Updated] " subnut
2022-03-30  4:03 ` [PR REVIEW] " subnut
2022-03-30  4:07 ` subnut
2022-03-30 15:10 ` [PR PATCH] [Updated] " subnut
2022-03-30 15:14 ` [PR REVIEW] " ahesford
2022-03-30 15:15 ` [PR PATCH] [Updated] " subnut
2022-03-30 15:19 ` subnut
2022-03-30 15:19 ` subnut
2022-03-30 15:50 ` subnut
2022-03-30 15:55 ` subnut
2022-03-30 15:55 ` subnut
2022-03-30 15:57 ` subnut
2022-03-30 16:11 ` subnut
2022-03-31 10:31 ` [PR REVIEW] " ahesford
2022-03-31 10:31 ` ahesford
2022-03-31 11:52 ` [PR PATCH] [Updated] " subnut
2022-03-31 11:54 ` subnut
2022-03-31 12:14 ` [PR PATCH] [Closed]: " ahesford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220329045954.nasdJ8fWJmhztwUavPT4ZonbhvtpM5tFxT8FeJ2NxBI@z \
    --to=subnut@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).