Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] mongoose: update to 7.6
@ 2022-03-28 18:23 subnut
  2022-03-28 18:30 ` subnut
                   ` (55 more replies)
  0 siblings, 56 replies; 57+ messages in thread
From: subnut @ 2022-03-28 18:23 UTC (permalink / raw)
  To: ml

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

There is a new 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: 3494 bytes --]

From e2bc33fb824bcc404856c1d9665ae2f1bc211276 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/template                   | 29 ++++++++----
 2 files changed, 20 insertions(+), 59 deletions(-)
 delete mode 100644 srcpkgs/mongoose/patches/add-makefile.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/template b/srcpkgs/mongoose/template
index eddadc647333..8e7f2219e437 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,31 @@
 # Template file for 'mongoose'
 pkgname=mongoose
-version=6.18
-revision=4
+version=7.6
+revision=1
 build_style=gnu-makefile
-make_use_env=compliant
-makedepends="openssl-devel"
-short_desc="Easy to use Web server"
-maintainer="Orphaned <orphan@voidlinux.org>"
+makedepends="$(vopt_if openssl openssl-devel mbedtls-devel)"
+short_desc="Embedded Networking Library with 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
+
+make_use_env=yes
+make_build_target=linux-libs
+make_check_target=test
+make_check=no # CBA for now
+
+build_options=openssl
+desc_option_openssl="Use OpenSSL instead of MbedTLS for SSL"
+export SSL="$(vopt_if openssl OPENSSL MBEDTLS)"
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }
@@ -24,6 +33,8 @@ mongoose-devel_package() {
 mongoose-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
-		vmove usr/share
+		vmkdir usr/share/mongoose
+		vcopy docs usr/share/mongoose
+		vcopy examples usr/share/mongoose
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
@ 2022-03-28 18:30 ` subnut
  2022-03-28 18:31 ` subnut
                   ` (54 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-28 18:30 UTC (permalink / raw)
  To: ml

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

New comment by subnut on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#issuecomment-1080998712

Comment:
## xbps-src doesn't include `libmbedtls` in dependencies. WHY SO?

### `libmongoose.so` refers to symbols of `libmbedtls.so`
```
$ c99 -O1  -lmongoose  simple_web_server.c   -o simple_web_server
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_set_hostname'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_x509_crt_free'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_setup'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_x509_crl_parse'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_conf_own_cert'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_set_bio'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_conf_authmode'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_x509_crt_parse'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_config_defaults'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_x509_crl_free'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_init'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_read'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_x509_crl_init'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_config_init'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_pk_init'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_config_free'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_conf_rng'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_pk_free'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_conf_ca_chain'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_write'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_x509_crt_init'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_free'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_pk_parse_key'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_handshake'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_conf_dbg'
collect2: error: ld returned 1 exit status
```
```
$ c99 -o simple_web_server simple_web_server.c -lmongoose -lmbedtls
$ echo $?
0
```

#### `simpleHTTPserver.c`
```c
#include <mongoose.h>

static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
  struct mg_http_serve_opts opts = {.root_dir = "."};   // Serve local dir
  if (ev == MG_EV_HTTP_MSG) mg_http_serve_dir(c, ev_data, &opts);
}

int main(int argc, char *argv[]) {
  struct mg_mgr mgr;
  mg_mgr_init(&mgr);                                        // Init manager
  mg_http_listen(&mgr, "http://localhost:8000", fn, &mgr);  // Setup listener
  for (;;) mg_mgr_poll(&mgr, 1000);                         // Event loop
  mg_mgr_free(&mgr);                                        // Cleanup
  return 0;
}
```

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
  2022-03-28 18:30 ` subnut
@ 2022-03-28 18:31 ` subnut
  2022-03-28 18:49 ` [PR REVIEW] " ahesford
                   ` (53 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-28 18:31 UTC (permalink / raw)
  To: ml

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

New comment by subnut on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#issuecomment-1081000224

Comment:
## `objdump` output
```
$  objdump -p /usr/lib/libmongoose.so

/usr/lib/libmongoose.so:     file format elf64-x86-64

Program Header:
    LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**12
         filesz 0x00000000000040a0 memsz 0x00000000000040a0 flags r--
    LOAD off    0x0000000000005000 vaddr 0x0000000000005000 paddr 0x0000000000005000 align 2**12
         filesz 0x000000000000dbf9 memsz 0x000000000000dbf9 flags r-x
    LOAD off    0x0000000000013000 vaddr 0x0000000000013000 paddr 0x0000000000013000 align 2**12
         filesz 0x0000000000004da8 memsz 0x0000000000004da8 flags r--
    LOAD off    0x0000000000018898 vaddr 0x0000000000019898 paddr 0x0000000000019898 align 2**12
         filesz 0x0000000000000c38 memsz 0x0000000000000c70 flags rw-
 DYNAMIC off    0x00000000000188a8 vaddr 0x00000000000198a8 paddr 0x00000000000198a8 align 2**3
         filesz 0x00000000000001e0 memsz 0x00000000000001e0 flags rw-
    NOTE off    0x0000000000000238 vaddr 0x0000000000000238 paddr 0x0000000000000238 align 2**2
         filesz 0x0000000000000024 memsz 0x0000000000000024 flags r--
EH_FRAME off    0x0000000000015288 vaddr 0x0000000000015288 paddr 0x0000000000015288 align 2**2
         filesz 0x00000000000005a4 memsz 0x00000000000005a4 flags r--
   STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**4
         filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
   RELRO off    0x0000000000018898 vaddr 0x0000000000019898 paddr 0x0000000000019898 align 2**0
         filesz 0x0000000000000768 memsz 0x0000000000000768 flags r--

Dynamic Section:
  NEEDED               libc.so.6
  INIT                 0x0000000000005000
  FINI                 0x0000000000012bf0
  INIT_ARRAY           0x0000000000019898
  INIT_ARRAYSZ         0x0000000000000008
  FINI_ARRAY           0x00000000000198a0
  FINI_ARRAYSZ         0x0000000000000008
  GNU_HASH             0x0000000000000260
  STRTAB               0x0000000000001ae8
  SYMTAB               0x0000000000000678
  STRSZ                0x0000000000000b57
  SYMENT               0x0000000000000018
  PLTGOT               0x0000000000019a88
  PLTRELSZ             0x0000000000000f78
  PLTREL               0x0000000000000007
  JMPREL               0x0000000000003128
  RELA                 0x0000000000002888
  RELASZ               0x00000000000008a0
  RELAENT              0x0000000000000018
  BIND_NOW             0x0000000000000000
  FLAGS_1              0x0000000000000001
  VERNEED              0x00000000000027f8
  VERNEEDNUM           0x0000000000000001
  VERSYM               0x0000000000002640
  RELACOUNT            0x0000000000000055

Version References:
  required from libc.so.6:
    0x0d696913 0x00 09 GLIBC_2.3
    0x0d696917 0x00 08 GLIBC_2.7
    0x06969194 0x00 07 GLIBC_2.14
    0x06969195 0x00 06 GLIBC_2.15
    0x0d696914 0x00 05 GLIBC_2.4
    0x06969197 0x00 04 GLIBC_2.17
    0x09691a75 0x00 03 GLIBC_2.2.5
    0x09691974 0x00 02 GLIBC_2.3.4

```

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (2 preceding siblings ...)
  2022-03-28 18:49 ` [PR REVIEW] " ahesford
@ 2022-03-28 18:49 ` ahesford
  2022-03-28 18:49 ` ahesford
                   ` (51 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: ahesford @ 2022-03-28 18:49 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r836742820

Comment:
Did the installation process change so that, after installation, `usr/share` contains no docs?

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
  2022-03-28 18:30 ` subnut
  2022-03-28 18:31 ` subnut
@ 2022-03-28 18:49 ` ahesford
  2022-03-28 18:49 ` ahesford
                   ` (52 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: ahesford @ 2022-03-28 18:49 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r836739922

Comment:
There's no need for a build option. Without a compelling need for mbedtls, you should probably just favor OpenSSL since it will generally already be present on users' systems. If there is a good case to be made for mbedtls, do that instead. Defer the build option until somebody explicitly needs something different than a sensible default.

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (3 preceding siblings ...)
  2022-03-28 18:49 ` ahesford
@ 2022-03-28 18:49 ` ahesford
  2022-03-28 18:49 ` ahesford
                   ` (50 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: ahesford @ 2022-03-28 18:49 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r836741264

Comment:
1. "CBA" isn't really a good reason to skip checks.
2. If there is a valid reason to skip checks, there is no value in defining `make_check_target` above.

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (4 preceding siblings ...)
  2022-03-28 18:49 ` ahesford
@ 2022-03-28 18:49 ` ahesford
  2022-03-28 19:42 ` [PR PATCH] [Updated] " subnut
                   ` (49 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: ahesford @ 2022-03-28 18:49 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r836740566

Comment:
Drop this space so `xlint` will consider the variables below in the lint check.

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (5 preceding siblings ...)
  2022-03-28 18:49 ` ahesford
@ 2022-03-28 19:42 ` subnut
  2022-03-28 19:44 ` [PR REVIEW] " subnut
                   ` (48 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-28 19:42 UTC (permalink / raw)
  To: ml

[-- 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: 4455 bytes --]

From 225e1ff89bc1c1cfe9bb48325eba5fe0631f9183 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/Fix-LDFLAGS.patch  | 17 +++++++
 srcpkgs/mongoose/patches/add-makefile.patch | 50 ---------------------
 srcpkgs/mongoose/template                   | 29 ++++++++----
 3 files changed, 38 insertions(+), 58 deletions(-)
 create mode 100644 srcpkgs/mongoose/patches/Fix-LDFLAGS.patch
 delete mode 100644 srcpkgs/mongoose/patches/add-makefile.patch

diff --git a/srcpkgs/mongoose/patches/Fix-LDFLAGS.patch b/srcpkgs/mongoose/patches/Fix-LDFLAGS.patch
new file mode 100644
index 000000000000..91c19f40d393
--- /dev/null
+++ b/srcpkgs/mongoose/patches/Fix-LDFLAGS.patch
@@ -0,0 +1,17 @@
+--- a/Makefile
++++ b/Makefile
+@@ -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
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/template b/srcpkgs/mongoose/template
index eddadc647333..1bf0facdfed2 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,33 @@
 # 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_check_args="SSL=OPENSSL"
+make_build_target=linux-libs
+make_build_args="SSL=OPENSSL"
 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
+
+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"
 	}
 }
@@ -24,6 +35,8 @@ mongoose-devel_package() {
 mongoose-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
-		vmove usr/share
+		vmkdir usr/share/mongoose
+		vcopy docs usr/share/mongoose
+		vcopy examples usr/share/mongoose
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (6 preceding siblings ...)
  2022-03-28 19:42 ` [PR PATCH] [Updated] " subnut
@ 2022-03-28 19:44 ` subnut
  2022-03-28 19:45 ` subnut
                   ` (47 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-28 19:44 UTC (permalink / raw)
  To: ml

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

New review comment by subnut on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r836787217

Comment:
That's why I marked this as draft. I'll be fixing it.

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (7 preceding siblings ...)
  2022-03-28 19:44 ` [PR REVIEW] " subnut
@ 2022-03-28 19:45 ` subnut
  2022-03-28 20:17 ` Johnnynator
                   ` (46 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-28 19:45 UTC (permalink / raw)
  To: ml

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

New review comment by subnut on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r836787867

Comment:
Previously, there was no Makefile at all!  
We hand-rolled our own, and it did the same steps.

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (8 preceding siblings ...)
  2022-03-28 19:45 ` subnut
@ 2022-03-28 20:17 ` Johnnynator
  2022-03-29  2:16 ` subnut
                   ` (45 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: Johnnynator @ 2022-03-28 20:17 UTC (permalink / raw)
  To: ml

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

New comment by Johnnynator on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#issuecomment-1081097494

Comment:
A patch like the following should stop make attempting to recompile everything in do_install.
```diff
@@ -108,9 +108,12 @@
 linux++: WARN += -Wno-missing-field-initializers
 linux++: linux
 
-linux-libs: CFLAGS += -fPIC
-linux-libs: mongoose.o
+CFLAGS += -fPIC
+.PHONY: linux-libs
+linux-libs: libmongoose.a libmongoose.so.$(VERSION)
+libmongoose.so.$(VERSION): mongoose.o
        $(CC) mongoose.o $(LDFLAGS) -shared -o libmongoose.so.$(VERSION)
+libmongoose.a: mongoose.o
        $(AR) rcs libmongoose.a mongoose.o
 
 install: linux-libs
```

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (9 preceding siblings ...)
  2022-03-28 20:17 ` Johnnynator
@ 2022-03-29  2:16 ` subnut
  2022-03-29  2:16 ` subnut
                   ` (44 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29  2:16 UTC (permalink / raw)
  To: ml

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

New comment by subnut on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#issuecomment-1081000224

Comment:
## `objdump` output
```
$  objdump -p /usr/lib/libmongoose.so

/usr/lib/libmongoose.so:     file format elf64-x86-64

Program Header:
    LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**12
         filesz 0x00000000000040a0 memsz 0x00000000000040a0 flags r--
    LOAD off    0x0000000000005000 vaddr 0x0000000000005000 paddr 0x0000000000005000 align 2**12
         filesz 0x000000000000dbf9 memsz 0x000000000000dbf9 flags r-x
    LOAD off    0x0000000000013000 vaddr 0x0000000000013000 paddr 0x0000000000013000 align 2**12
         filesz 0x0000000000004da8 memsz 0x0000000000004da8 flags r--
    LOAD off    0x0000000000018898 vaddr 0x0000000000019898 paddr 0x0000000000019898 align 2**12
         filesz 0x0000000000000c38 memsz 0x0000000000000c70 flags rw-
 DYNAMIC off    0x00000000000188a8 vaddr 0x00000000000198a8 paddr 0x00000000000198a8 align 2**3
         filesz 0x00000000000001e0 memsz 0x00000000000001e0 flags rw-
    NOTE off    0x0000000000000238 vaddr 0x0000000000000238 paddr 0x0000000000000238 align 2**2
         filesz 0x0000000000000024 memsz 0x0000000000000024 flags r--
EH_FRAME off    0x0000000000015288 vaddr 0x0000000000015288 paddr 0x0000000000015288 align 2**2
         filesz 0x00000000000005a4 memsz 0x00000000000005a4 flags r--
   STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**4
         filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
   RELRO off    0x0000000000018898 vaddr 0x0000000000019898 paddr 0x0000000000019898 align 2**0
         filesz 0x0000000000000768 memsz 0x0000000000000768 flags r--

Dynamic Section:
  NEEDED               libc.so.6
  INIT                 0x0000000000005000
  FINI                 0x0000000000012bf0
  INIT_ARRAY           0x0000000000019898
  INIT_ARRAYSZ         0x0000000000000008
  FINI_ARRAY           0x00000000000198a0
  FINI_ARRAYSZ         0x0000000000000008
  GNU_HASH             0x0000000000000260
  STRTAB               0x0000000000001ae8
  SYMTAB               0x0000000000000678
  STRSZ                0x0000000000000b57
  SYMENT               0x0000000000000018
  PLTGOT               0x0000000000019a88
  PLTRELSZ             0x0000000000000f78
  PLTREL               0x0000000000000007
  JMPREL               0x0000000000003128
  RELA                 0x0000000000002888
  RELASZ               0x00000000000008a0
  RELAENT              0x0000000000000018
  BIND_NOW             0x0000000000000000
  FLAGS_1              0x0000000000000001
  VERNEED              0x00000000000027f8
  VERNEEDNUM           0x0000000000000001
  VERSYM               0x0000000000002640
  RELACOUNT            0x0000000000000055

Version References:
  required from libc.so.6:
    0x0d696913 0x00 09 GLIBC_2.3
    0x0d696917 0x00 08 GLIBC_2.7
    0x06969194 0x00 07 GLIBC_2.14
    0x06969195 0x00 06 GLIBC_2.15
    0x0d696914 0x00 05 GLIBC_2.4
    0x06969197 0x00 04 GLIBC_2.17
    0x09691a75 0x00 03 GLIBC_2.2.5
    0x09691974 0x00 02 GLIBC_2.3.4

```

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (10 preceding siblings ...)
  2022-03-29  2:16 ` subnut
@ 2022-03-29  2:16 ` subnut
  2022-03-29  3:39 ` [PR PATCH] [Updated] " subnut
                   ` (43 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29  2:16 UTC (permalink / raw)
  To: ml

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

New comment by subnut on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#issuecomment-1080998712

Comment:
## xbps-src doesn't include `libmbedtls` in dependencies. WHY SO?

### `libmongoose.so` refers to symbols of `libmbedtls.so`
```
$ c99 -O1  -lmongoose  simple_web_server.c   -o simple_web_server
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_set_hostname'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_x509_crt_free'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_setup'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_x509_crl_parse'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_conf_own_cert'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_set_bio'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_conf_authmode'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_x509_crt_parse'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_config_defaults'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_x509_crl_free'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_init'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_read'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_x509_crl_init'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_config_init'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_pk_init'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_config_free'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_conf_rng'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_pk_free'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_conf_ca_chain'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_write'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_x509_crt_init'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_free'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_pk_parse_key'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_handshake'
/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/10.2.1/../../../../lib64/libmongoose.so: undefined reference to `mbedtls_ssl_conf_dbg'
collect2: error: ld returned 1 exit status
```
```
$ c99 -o simple_web_server simple_web_server.c -lmongoose -lmbedtls
$ echo $?
0
```

#### `simpleHTTPserver.c`
```c
#include <mongoose.h>

static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
  struct mg_http_serve_opts opts = {.root_dir = "."};   // Serve local dir
  if (ev == MG_EV_HTTP_MSG) mg_http_serve_dir(c, ev_data, &opts);
}

int main(int argc, char *argv[]) {
  struct mg_mgr mgr;
  mg_mgr_init(&mgr);                                        // Init manager
  mg_http_listen(&mgr, "http://localhost:8000", fn, &mgr);  // Setup listener
  for (;;) mg_mgr_poll(&mgr, 1000);                         // Event loop
  mg_mgr_free(&mgr);                                        // Cleanup
  return 0;
}
```

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (11 preceding siblings ...)
  2022-03-29  2:16 ` subnut
@ 2022-03-29  3:39 ` subnut
  2022-03-29  4:59 ` subnut
                   ` (42 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29  3:39 UTC (permalink / raw)
  To: ml

[-- 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: 5651 bytes --]

From 086a1b77503abdf16f67ede23f7aed7f8ddd76d7 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/template                   | 30 +++++++++---
 3 files changed, 75 insertions(+), 57 deletions(-)
 delete mode 100644 srcpkgs/mongoose/patches/add-makefile.patch
 create mode 100644 srcpkgs/mongoose/patches/fix-makefile.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/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"
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (12 preceding siblings ...)
  2022-03-29  3:39 ` [PR PATCH] [Updated] " subnut
@ 2022-03-29  4:59 ` subnut
  2022-03-29  5:21 ` subnut
                   ` (41 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29  4:59 UTC (permalink / raw)
  To: ml

[-- 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"
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (13 preceding siblings ...)
  2022-03-29  4:59 ` subnut
@ 2022-03-29  5:21 ` subnut
  2022-03-29  5:22 ` subnut
                   ` (40 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29  5:21 UTC (permalink / raw)
  To: ml

[-- 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 ce2194cf153d627733f52f38e602bc40e436e55d 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"
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (14 preceding siblings ...)
  2022-03-29  5:21 ` subnut
@ 2022-03-29  5:22 ` subnut
  2022-03-29  5:32 ` subnut
                   ` (39 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29  5:22 UTC (permalink / raw)
  To: ml

[-- 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: 11871 bytes --]

From 0dcb9478e48f08299457325d04885b683212496d 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 |  67 +++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 149 ++++++++++++++++++++
 srcpkgs/mongoose/template                   |  34 ++++-
 4 files changed, 243 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..ec83123d6293
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,67 @@
+--- a/Makefile
++++ b/Makefile
+@@ -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
+@@ -10,6 +10,7 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++SANITIZE ?= -fsanitize=address,undefined
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +20,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
+@@ -59,7 +60,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,15 +109,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:
+ 	rm -rf $(DESTDIR)$(PREFIX)/lib/libmongoose.a $(DESTDIR)$(PREFIX)/lib/libmongoose.so.$(VERSION) $(DESTDIR)$(PREFIX)/include/mongoose.h $(DESTDIR)$(PREFIX)/lib/libmongoose.so
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..5ece06bf400a 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,42 @@
 # 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"
+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
+case "$XBPS_TARGET_MACHINE" in
+	*-musl)	 export SANITIZE ;;
+	*) 	 checkdepends+=" libsanitizer-devel" ;;
+esac
+
+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"
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (15 preceding siblings ...)
  2022-03-29  5:22 ` subnut
@ 2022-03-29  5:32 ` subnut
  2022-03-29  5:35 ` subnut
                   ` (38 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29  5:32 UTC (permalink / raw)
  To: ml

[-- 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: 11871 bytes --]

From dc780de2407ee2965af2ce0b3a29e359fd14429a 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 |  67 +++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 149 ++++++++++++++++++++
 srcpkgs/mongoose/template                   |  34 ++++-
 4 files changed, 243 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..ec83123d6293
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,67 @@
+--- a/Makefile
++++ b/Makefile
+@@ -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
+@@ -10,6 +10,7 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++SANITIZE ?= -fsanitize=address,undefined
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +20,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
+@@ -59,7 +60,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,15 +109,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:
+ 	rm -rf $(DESTDIR)$(PREFIX)/lib/libmongoose.a $(DESTDIR)$(PREFIX)/lib/libmongoose.so.$(VERSION) $(DESTDIR)$(PREFIX)/include/mongoose.h $(DESTDIR)$(PREFIX)/lib/libmongoose.so
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..5ece06bf400a 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,42 @@
 # 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"
+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
+case "$XBPS_TARGET_MACHINE" in
+	*-musl)	 export SANITIZE ;;
+	*) 	 checkdepends+=" libsanitizer-devel" ;;
+esac
+
+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"
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (16 preceding siblings ...)
  2022-03-29  5:32 ` subnut
@ 2022-03-29  5:35 ` subnut
  2022-03-29  6:05 ` subnut
                   ` (37 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29  5:35 UTC (permalink / raw)
  To: ml

[-- 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: 11907 bytes --]

From 4c5dad030fc6745b2ec0076adf6ba41e57ea6cde 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 |  69 +++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 149 ++++++++++++++++++++
 srcpkgs/mongoose/template                   |  34 ++++-
 4 files changed, 245 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..422b927b2212
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,69 @@
+--- a/Makefile
++++ b/Makefile
+@@ -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) $(CFLAGS)
+ SSL ?= MBEDTLS
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq ($(NO_SANITIZE), 1)
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +20,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
+@@ -59,7 +60,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,15 +109,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:
+ 	rm -rf $(DESTDIR)$(PREFIX)/lib/libmongoose.a $(DESTDIR)$(PREFIX)/lib/libmongoose.so.$(VERSION) $(DESTDIR)$(PREFIX)/include/mongoose.h $(DESTDIR)$(PREFIX)/lib/libmongoose.so
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..5ece06bf400a 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,42 @@
 # 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"
+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
+case "$XBPS_TARGET_MACHINE" in
+	*-musl)	 export SANITIZE ;;
+	*) 	 checkdepends+=" libsanitizer-devel" ;;
+esac
+
+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"
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (17 preceding siblings ...)
  2022-03-29  5:35 ` subnut
@ 2022-03-29  6:05 ` subnut
  2022-03-29  6:11 ` subnut
                   ` (36 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29  6:05 UTC (permalink / raw)
  To: ml

[-- 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: 11774 bytes --]

From f2df061c9f65908b4489752c684c77d6144f936c 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 |  67 +++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 149 ++++++++++++++++++++
 srcpkgs/mongoose/template                   |  26 +++-
 4 files changed, 235 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..1160dfb5dd20
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,67 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +20,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
+@@ -59,7 +60,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,15 +109,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:
+ 	rm -rf $(DESTDIR)$(PREFIX)/lib/libmongoose.a $(DESTDIR)$(PREFIX)/lib/libmongoose.so.$(VERSION) $(DESTDIR)$(PREFIX)/include/mongoose.h $(DESTDIR)$(PREFIX)/lib/libmongoose.so
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..ec609b725144 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,34 @@
 # 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"
+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
+
+CFLAGS='-fPIC'
+export SSL='OPENSSL'
+case "$XBPS_TARGET_MACHINE" in
+	*-musl)	make_check_args="NO_SANITIZE=1"	# libsanitizer-devel unavailable
+		CFLAGS+=" -Wno-error" ;;	# FD(c_) macro is broken
+	*)	checkdepends+=" libsanitizer-devel" ;;
+esac
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (18 preceding siblings ...)
  2022-03-29  6:05 ` subnut
@ 2022-03-29  6:11 ` subnut
  2022-03-29  6:15 ` [PR REVIEW] " subnut
                   ` (35 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29  6:11 UTC (permalink / raw)
  To: ml

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

New comment by subnut on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#issuecomment-1081443269

Comment:
Tests pass on actual machines.

Maybe GitHub action runners disallow listening on ports?

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (19 preceding siblings ...)
  2022-03-29  6:11 ` subnut
@ 2022-03-29  6:15 ` subnut
  2022-03-29  6:29 ` [PR PATCH] [Updated] " subnut
                   ` (34 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29  6:15 UTC (permalink / raw)
  To: ml

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

New review comment by subnut on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r837090982

Comment:
fixed.

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (20 preceding siblings ...)
  2022-03-29  6:15 ` [PR REVIEW] " subnut
@ 2022-03-29  6:29 ` subnut
  2022-03-29  6:36 ` subnut
                   ` (33 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29  6:29 UTC (permalink / raw)
  To: ml

[-- 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: 13174 bytes --]

From f2df061c9f65908b4489752c684c77d6144f936c 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 1/2] mongoose: update to 7.6

---
 srcpkgs/mongoose/patches/add-makefile.patch |  50 -------
 srcpkgs/mongoose/patches/fix-makefile.patch |  67 +++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 149 ++++++++++++++++++++
 srcpkgs/mongoose/template                   |  26 +++-
 4 files changed, 235 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..1160dfb5dd20
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,67 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +20,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
+@@ -59,7 +60,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,15 +109,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:
+ 	rm -rf $(DESTDIR)$(PREFIX)/lib/libmongoose.a $(DESTDIR)$(PREFIX)/lib/libmongoose.so.$(VERSION) $(DESTDIR)$(PREFIX)/include/mongoose.h $(DESTDIR)$(PREFIX)/lib/libmongoose.so
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..ec609b725144 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,34 @@
 # 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"
+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
+
+CFLAGS='-fPIC'
+export SSL='OPENSSL'
+case "$XBPS_TARGET_MACHINE" in
+	*-musl)	make_check_args="NO_SANITIZE=1"	# libsanitizer-devel unavailable
+		CFLAGS+=" -Wno-error" ;;	# FD(c_) macro is broken
+	*)	checkdepends+=" libsanitizer-devel" ;;
+esac
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }

From 1ae09aa871634b61ef3684a5252db99418d0431d Mon Sep 17 00:00:00 2001
From: Subhaditya Nath <sn03.general@gmail.com>
Date: Tue, 29 Mar 2022 12:00:11 +0530
Subject: [PATCH 2/2] TEMP CI CHECK

---
 srcpkgs/mongoose/patches/fix-tests.patch | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/mongoose/patches/fix-tests.patch b/srcpkgs/mongoose/patches/fix-tests.patch
index 00181fc77bed..ddb87707fbbe 100644
--- a/srcpkgs/mongoose/patches/fix-tests.patch
+++ b/srcpkgs/mongoose/patches/fix-tests.patch
@@ -70,6 +70,15 @@ Tests should not need to connect to the internet
  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);
+@@ -719,7 +658,7 @@ static void test_http_server(void) {
+ 
+ #if MG_ENABLE_IPV6
+   {
+-    const char *url6 = "http://[::1]:12346";
++    const char *url6 = "http://[::1]:12347";
+     ASSERT(mg_http_listen(&mgr, url6, eh1, NULL) != NULL);
+     ASSERT(fetch(&mgr, buf, url6, "GET /a.txt HTTP/1.0\n\n") == 200);
+     ASSERT(cmpbody(buf, "hello\n") == 0);
 @@ -750,63 +689,6 @@ static void test_tls(void) {
  #endif
  }
@@ -146,4 +155,3 @@ Tests should not need to connect to the internet
    printf("SUCCESS. Total tests: %d\n", s_num_tests);
    return EXIT_SUCCESS;
  }
-

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (21 preceding siblings ...)
  2022-03-29  6:29 ` [PR PATCH] [Updated] " subnut
@ 2022-03-29  6:36 ` subnut
  2022-03-29  6:37 ` subnut
                   ` (32 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29  6:36 UTC (permalink / raw)
  To: ml

[-- 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: 11774 bytes --]

From f2df061c9f65908b4489752c684c77d6144f936c 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 |  67 +++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 149 ++++++++++++++++++++
 srcpkgs/mongoose/template                   |  26 +++-
 4 files changed, 235 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..1160dfb5dd20
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,67 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +20,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
+@@ -59,7 +60,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,15 +109,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:
+ 	rm -rf $(DESTDIR)$(PREFIX)/lib/libmongoose.a $(DESTDIR)$(PREFIX)/lib/libmongoose.so.$(VERSION) $(DESTDIR)$(PREFIX)/include/mongoose.h $(DESTDIR)$(PREFIX)/lib/libmongoose.so
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..ec609b725144 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,34 @@
 # 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"
+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
+
+CFLAGS='-fPIC'
+export SSL='OPENSSL'
+case "$XBPS_TARGET_MACHINE" in
+	*-musl)	make_check_args="NO_SANITIZE=1"	# libsanitizer-devel unavailable
+		CFLAGS+=" -Wno-error" ;;	# FD(c_) macro is broken
+	*)	checkdepends+=" libsanitizer-devel" ;;
+esac
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (22 preceding siblings ...)
  2022-03-29  6:36 ` subnut
@ 2022-03-29  6:37 ` subnut
  2022-03-29  6:38 ` subnut
                   ` (31 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29  6:37 UTC (permalink / raw)
  To: ml

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

New comment by subnut on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#issuecomment-1081443269

Comment:
Tests pass on actual machines.

Maybe GitHub action runners disallow listening on ports?

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (23 preceding siblings ...)
  2022-03-29  6:37 ` subnut
@ 2022-03-29  6:38 ` subnut
  2022-03-29  8:58 ` [PR REVIEW] " ahesford
                   ` (30 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29  6:38 UTC (permalink / raw)
  To: ml

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

New comment by subnut on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#issuecomment-1081460835

Comment:
GitHub's CI runners don't support ipv6 **at all**.  
Not even local loopback.

That's why the tests are failing.  
It's failing while trying to listen on `[::1]:12346`, which is ipv6.

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (25 preceding siblings ...)
  2022-03-29  8:58 ` [PR REVIEW] " ahesford
@ 2022-03-29  8:58 ` ahesford
  2022-03-29 11:36 ` subnut
                   ` (28 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: ahesford @ 2022-03-29  8:58 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r837228858

Comment:
Why patch the Makefile to install the docs? Just do it in the template. Patching here increases the chance that the patch will break with the next update.

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (24 preceding siblings ...)
  2022-03-29  6:38 ` subnut
@ 2022-03-29  8:58 ` ahesford
  2022-03-29  8:58 ` ahesford
                   ` (29 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: ahesford @ 2022-03-29  8:58 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r837227546

Comment:
If you're commenting out the `test_mqtt` and `test_http_client` here, you shouldn't need to remove all of the functions above. 

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (26 preceding siblings ...)
  2022-03-29  8:58 ` ahesford
@ 2022-03-29 11:36 ` subnut
  2022-03-29 12:07 ` ahesford
                   ` (27 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29 11:36 UTC (permalink / raw)
  To: ml

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

New review comment by subnut on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r837370776

Comment:
It complains _function defined but not used_

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (27 preceding siblings ...)
  2022-03-29 11:36 ` subnut
@ 2022-03-29 12:07 ` ahesford
  2022-03-29 12:21 ` [PR PATCH] [Updated] " subnut
                   ` (26 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: ahesford @ 2022-03-29 12:07 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r837395650

Comment:
Is that a hard failure, or a warning? It shouldn't prevent compilation. 

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (28 preceding siblings ...)
  2022-03-29 12:07 ` ahesford
@ 2022-03-29 12:21 ` subnut
  2022-03-29 12:22 ` subnut
                   ` (25 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29 12:21 UTC (permalink / raw)
  To: ml

[-- 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: 11662 bytes --]

From 9e0d27f8ebd7dbe89ab709a9bae99ce0226999ce 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 |  59 ++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 149 ++++++++++++++++++++
 srcpkgs/mongoose/template                   |  36 +++--
 4 files changed, 236 insertions(+), 58 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..d829ea8adc8c
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,59 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +22,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
+@@ -59,7 +62,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,10 +111,12 @@ 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
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..8609b9199ebc 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,40 @@
 # 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"
+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
+CFLAGS+=" -fPIC"
+
+case "$XBPS_TARGET_MACHINE" in
+	*-musl) CFLAGS+=" -Wno-error" ;;	# FD(c_) macro is broken
+		make_check_args="NO_SANITIZE=1"	# libsanitizer-devel unavailable
+	*)	checkdepends+=" libsanitizer-devel" ;;
+esac
+
+# GitHub CI runner doesn't support IPv6, causing tests to fail
+if [ "$CI" = true ]; then
+	make_check_args="IPV6=0"
+fi
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }
@@ -24,6 +42,8 @@ mongoose-devel_package() {
 mongoose-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
-		vmove usr/share
+		mkdir "share/${sourcepkg}/doc"
+		vcopy examples "share/${sourcepkg}/doc"
+		vcopy "docs/*" "share/${sourcepkg}/doc"
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (29 preceding siblings ...)
  2022-03-29 12:21 ` [PR PATCH] [Updated] " subnut
@ 2022-03-29 12:22 ` subnut
  2022-03-29 12:37 ` subnut
                   ` (24 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29 12:22 UTC (permalink / raw)
  To: ml

[-- 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: 11662 bytes --]

From fb46877130d8908e27b16b580fb069ec36fb97ed 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 |  59 ++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 149 ++++++++++++++++++++
 srcpkgs/mongoose/template                   |  36 +++--
 4 files changed, 236 insertions(+), 58 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..d829ea8adc8c
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,59 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +22,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
+@@ -59,7 +62,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,10 +111,12 @@ 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
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..ee520f109006 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,40 @@
 # 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"
+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
+CFLAGS+=" -fPIC"
+
+case "$XBPS_TARGET_MACHINE" in
+	*-musl)	make_check_args="NO_SANITIZE=1"	# libsanitizer-devel unavailable
+		CFLAGS+=" -Wno-error" ;;	# FD(c_) macro is broken
+	*)	checkdepends+=" libsanitizer-devel" ;;
+esac
+
+# GitHub CI runner doesn't support IPv6, causing tests to fail
+if [ "$CI" = true ]; then
+	make_check_args="IPV6=0"
+fi
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }
@@ -24,6 +42,8 @@ mongoose-devel_package() {
 mongoose-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
-		vmove usr/share
+		mkdir "share/${sourcepkg}/doc"
+		vcopy examples "share/${sourcepkg}/doc"
+		vcopy "docs/*" "share/${sourcepkg}/doc"
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (30 preceding siblings ...)
  2022-03-29 12:22 ` subnut
@ 2022-03-29 12:37 ` subnut
  2022-03-29 12:38 ` [PR REVIEW] " subnut
                   ` (23 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29 12:37 UTC (permalink / raw)
  To: ml

[-- 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: 11709 bytes --]

From f764b7834fa3ffbc5c739458319bd0e73cadbeef 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 |  59 ++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 149 ++++++++++++++++++++
 srcpkgs/mongoose/template                   |  36 +++--
 4 files changed, 236 insertions(+), 58 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..d829ea8adc8c
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,59 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +22,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
+@@ -59,7 +62,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,10 +111,12 @@ 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
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..db464ece4b26 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,40 @@
 # 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"
+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
+CFLAGS+=" -fPIC"
+
+case "$XBPS_TARGET_MACHINE" in
+	*-musl)	make_check_args="NO_SANITIZE=1"	# libsanitizer-devel unavailable
+		CFLAGS+=" -Wno-error" ;;	# FD(c_) macro is broken
+	*)	checkdepends+=" libsanitizer-devel" ;;
+esac
+
+# GitHub CI runner doesn't support IPv6, causing tests to fail
+if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
+	make_check_args="IPV6=0"
+fi
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }
@@ -24,6 +42,8 @@ mongoose-devel_package() {
 mongoose-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
-		vmove usr/share
+		vmkdir "usr/share/${sourcepkg}/doc"
+		vcopy examples "usr/share/${sourcepkg}/doc"
+		vcopy "docs/*" "usr/share/${sourcepkg}/doc"
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (31 preceding siblings ...)
  2022-03-29 12:37 ` subnut
@ 2022-03-29 12:38 ` subnut
  2022-03-29 12:47 ` [PR PATCH] [Updated] " subnut
                   ` (22 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29 12:38 UTC (permalink / raw)
  To: ml

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

New review comment by subnut on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r837423926

Comment:
hard failure, because of `-Werror`

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (32 preceding siblings ...)
  2022-03-29 12:38 ` [PR REVIEW] " subnut
@ 2022-03-29 12:47 ` subnut
  2022-03-29 18:29 ` [PR REVIEW] " 0x5c
                   ` (21 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29 12:47 UTC (permalink / raw)
  To: ml

[-- 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: 11729 bytes --]

From 22a5edb9fdebc41a00c3862fff77aca0900a7f29 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 |  59 ++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 149 ++++++++++++++++++++
 srcpkgs/mongoose/template                   |  36 +++--
 4 files changed, 236 insertions(+), 58 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..d829ea8adc8c
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,59 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +22,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
+@@ -59,7 +62,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,10 +111,12 @@ 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
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..07f8bc631b72 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,40 @@
 # 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"
+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
+CFLAGS+=" -fPIC"
+
+case "$XBPS_TARGET_MACHINE" in
+	*-musl) CFLAGS+=" -Wno-error=sign-conversion"	# FD(c_) macro is broken
+		make_check_args+=" NO_SANITIZE=1" ;;	# libsanitizer-devel unavailable
+	*)	checkdepends+=" libsanitizer-devel" ;;
+esac
+
+# GitHub CI runner doesn't support IPv6, causing tests to fail
+if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
+	make_check_args+=" IPV6=0"
+fi
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }
@@ -24,6 +42,8 @@ mongoose-devel_package() {
 mongoose-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
-		vmove usr/share
+		vmkdir "usr/share/${sourcepkg}/doc"
+		vcopy examples "usr/share/${sourcepkg}/doc"
+		vcopy "docs/*" "usr/share/${sourcepkg}/doc"
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (33 preceding siblings ...)
  2022-03-29 12:47 ` [PR PATCH] [Updated] " subnut
@ 2022-03-29 18:29 ` 0x5c
  2022-03-29 18:57 ` subnut
                   ` (20 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: 0x5c @ 2022-03-29 18:29 UTC (permalink / raw)
  To: ml

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

New review comment by 0x5c on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r837785343

Comment:
Is there a reason those are not vmove? 

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (34 preceding siblings ...)
  2022-03-29 18:29 ` [PR REVIEW] " 0x5c
@ 2022-03-29 18:57 ` subnut
  2022-03-29 19:07 ` ahesford
                   ` (19 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-29 18:57 UTC (permalink / raw)
  To: ml

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

New review comment by subnut on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r837807529

Comment:
What should be the vmove command?

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (35 preceding siblings ...)
  2022-03-29 18:57 ` subnut
@ 2022-03-29 19:07 ` ahesford
  2022-03-29 19:29 ` ahesford
                   ` (18 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: ahesford @ 2022-03-29 19:07 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r837815868

Comment:
`vmove` copies files relative to `${DESTDIR}` into `${PKGDESTDIR}` and is used to move installation products from a main package to its subpackages; `vcopy` copies files relative to the current working directory into `${PKGDESTDIR}` and is the right thing to do here.

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (36 preceding siblings ...)
  2022-03-29 19:07 ` ahesford
@ 2022-03-29 19:29 ` ahesford
  2022-03-30  3:51 ` [PR PATCH] [Updated] " subnut
                   ` (17 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: ahesford @ 2022-03-29 19:29 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r837838437

Comment:
Add `make_check_args="WARN="` above `make_check_target=test` and you can drop most of the patch.

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (37 preceding siblings ...)
  2022-03-29 19:29 ` ahesford
@ 2022-03-30  3:51 ` subnut
  2022-03-30  4:03 ` [PR REVIEW] " subnut
                   ` (16 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-30  3:51 UTC (permalink / raw)
  To: ml

[-- 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: 7310 bytes --]

From 757da06c6419a0657e2f6542bb1a36e9949b2069 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 | 59 +++++++++++++++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 17 ++++++
 srcpkgs/mongoose/template                   | 41 +++++++++++---
 4 files changed, 109 insertions(+), 58 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..d829ea8adc8c
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,59 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +22,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
+@@ -59,7 +62,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,10 +111,12 @@ 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
diff --git a/srcpkgs/mongoose/patches/fix-tests.patch b/srcpkgs/mongoose/patches/fix-tests.patch
new file mode 100644
index 000000000000..8b25527492d5
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-tests.patch
@@ -0,0 +1,17 @@
+Skip tests that want to connect to the internet
+
+--- a/test/unit_test.c
++++ b/test/unit_test.c
+@@ -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..c9e41c4f7a2e 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,45 @@
 # 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"
+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
+CFLAGS+=" -fPIC"
+
+case "$XBPS_TARGET_MACHINE" in
+	*-musl) CFLAGS+=" -Wno-error=sign-conversion"	# FD(c_) macro is broken
+		make_check_args+=" NO_SANITIZE=1" ;;	# libsanitizer-devel unavailable
+	*)	checkdepends+=" libsanitizer-devel" ;;
+esac
+
+# GitHub CI runner doesn't support IPv6, causing tests to fail
+if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
+	make_check_args+=" IPV6=0"
+fi
+
+pre_check() {
+	# -Wunused-function -Werror and fix-tests.patch are enemies
+	CFLAGS+=" -Wno-error=unused-function"
+}
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }
@@ -24,6 +47,8 @@ mongoose-devel_package() {
 mongoose-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
-		vmove usr/share
+		vmkdir "usr/share/${sourcepkg}/doc"
+		vcopy examples "usr/share/${sourcepkg}/doc"
+		vcopy "docs/*" "usr/share/${sourcepkg}/doc"
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (38 preceding siblings ...)
  2022-03-30  3:51 ` [PR PATCH] [Updated] " subnut
@ 2022-03-30  4:03 ` subnut
  2022-03-30  4:07 ` subnut
                   ` (15 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-30  4:03 UTC (permalink / raw)
  To: ml

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

New review comment by subnut on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r838096456

Comment:
I dunno... it just bothers me to silence all warnings, even those that we didn't cause. :sweat_smile: 

Case in hand - building on musl causes this error to pop up -
https://github.com/void-linux/void-packages/runs/5748101481?check_suite_focus=true#step%3A7%3A54=

This error isn't present on glibc, so my guess is upstream has never tested on musl.  
If we disable all warnings, we won't be able to see these messages, and those message may show some errors that could develop to major problems.


^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (39 preceding siblings ...)
  2022-03-30  4:03 ` [PR REVIEW] " subnut
@ 2022-03-30  4:07 ` subnut
  2022-03-30 15:10 ` [PR PATCH] [Updated] " subnut
                   ` (14 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-30  4:07 UTC (permalink / raw)
  To: ml

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

New review comment by subnut on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r838097489

Comment:
@ahesford I've added `CFLAGS+=" -Wno-error=unused-function"` to `pre_check()` in the latest commit, and pruned the `fix-tests.patch`. 

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (40 preceding siblings ...)
  2022-03-30  4:07 ` subnut
@ 2022-03-30 15:10 ` subnut
  2022-03-30 15:14 ` [PR REVIEW] " ahesford
                   ` (13 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-30 15:10 UTC (permalink / raw)
  To: ml

[-- 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: 8819 bytes --]

From 757da06c6419a0657e2f6542bb1a36e9949b2069 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 1/2] mongoose: update to 7.6

---
 srcpkgs/mongoose/patches/add-makefile.patch | 50 -----------------
 srcpkgs/mongoose/patches/fix-makefile.patch | 59 +++++++++++++++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 17 ++++++
 srcpkgs/mongoose/template                   | 41 +++++++++++---
 4 files changed, 109 insertions(+), 58 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..d829ea8adc8c
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,59 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +22,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
+@@ -59,7 +62,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,10 +111,12 @@ 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
diff --git a/srcpkgs/mongoose/patches/fix-tests.patch b/srcpkgs/mongoose/patches/fix-tests.patch
new file mode 100644
index 000000000000..8b25527492d5
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-tests.patch
@@ -0,0 +1,17 @@
+Skip tests that want to connect to the internet
+
+--- a/test/unit_test.c
++++ b/test/unit_test.c
+@@ -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..c9e41c4f7a2e 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,45 @@
 # 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"
+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
+CFLAGS+=" -fPIC"
+
+case "$XBPS_TARGET_MACHINE" in
+	*-musl) CFLAGS+=" -Wno-error=sign-conversion"	# FD(c_) macro is broken
+		make_check_args+=" NO_SANITIZE=1" ;;	# libsanitizer-devel unavailable
+	*)	checkdepends+=" libsanitizer-devel" ;;
+esac
+
+# GitHub CI runner doesn't support IPv6, causing tests to fail
+if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
+	make_check_args+=" IPV6=0"
+fi
+
+pre_check() {
+	# -Wunused-function -Werror and fix-tests.patch are enemies
+	CFLAGS+=" -Wno-error=unused-function"
+}
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }
@@ -24,6 +47,8 @@ mongoose-devel_package() {
 mongoose-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
-		vmove usr/share
+		vmkdir "usr/share/${sourcepkg}/doc"
+		vcopy examples "usr/share/${sourcepkg}/doc"
+		vcopy "docs/*" "usr/share/${sourcepkg}/doc"
 	}
 }

From 99eae49db7a7d9a6e69b16147f00fc39dce4545c Mon Sep 17 00:00:00 2001
From: Subhaditya Nath <sn03.general@gmail.com>
Date: Wed, 30 Mar 2022 20:41:15 +0530
Subject: [PATCH 2/2] TEMP

---
 srcpkgs/mongoose/template | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/mongoose/template b/srcpkgs/mongoose/template
index c9e41c4f7a2e..a079b9913dda 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -19,8 +19,7 @@ export SSL=OPENSSL
 CFLAGS+=" -fPIC"
 
 case "$XBPS_TARGET_MACHINE" in
-	*-musl) CFLAGS+=" -Wno-error=sign-conversion"	# FD(c_) macro is broken
-		make_check_args+=" NO_SANITIZE=1" ;;	# libsanitizer-devel unavailable
+	*-musl)	make_check_args+=" NO_SANITIZE=1" ;;	# libsanitizer-devel not available
 	*)	checkdepends+=" libsanitizer-devel" ;;
 esac
 
@@ -29,6 +28,20 @@ if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
 	make_check_args+=" IPV6=0"
 fi
 
+post_extract() {
+	echo YAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+	false
+	# GCC falsely flags musl's FD_SET macro as -Wsign-conversion
+	#	https://github.com/cesanta/mongoose/issues/1501#issuecomment-1082750154
+	#	https://inbox.vuxu.org/musl/20200803174707.GF6949@brightrain.aerifal.cx/T/
+	vsed -i src/sock.c -e '/[[:space:]]FD_SET(/{i\
+#pragma GCC push\
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+p;i\
+#pragma GCC pop
+}'
+}
+
 pre_check() {
 	# -Wunused-function -Werror and fix-tests.patch are enemies
 	CFLAGS+=" -Wno-error=unused-function"

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (41 preceding siblings ...)
  2022-03-30 15:10 ` [PR PATCH] [Updated] " subnut
@ 2022-03-30 15:14 ` ahesford
  2022-03-30 15:15 ` [PR PATCH] [Updated] " subnut
                   ` (12 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: ahesford @ 2022-03-30 15:14 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r838667223

Comment:
Appending to variables like `CFLAGS` at the top level is not a good idea because the template is sourced multiple times and the arguments can be repeated. Just set
```sh
CFLAGS="-fPIC"
```
instead. Better still, disable the `unused-function` error here and save the `pre_check` definition:
```sh
CFLAGS="-fPIC -Wno-error=unused-function"
```

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (42 preceding siblings ...)
  2022-03-30 15:14 ` [PR REVIEW] " ahesford
@ 2022-03-30 15:15 ` subnut
  2022-03-30 15:19 ` subnut
                   ` (11 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-30 15:15 UTC (permalink / raw)
  To: ml

[-- 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: 8847 bytes --]

From 757da06c6419a0657e2f6542bb1a36e9949b2069 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 1/2] mongoose: update to 7.6

---
 srcpkgs/mongoose/patches/add-makefile.patch | 50 -----------------
 srcpkgs/mongoose/patches/fix-makefile.patch | 59 +++++++++++++++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 17 ++++++
 srcpkgs/mongoose/template                   | 41 +++++++++++---
 4 files changed, 109 insertions(+), 58 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..d829ea8adc8c
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,59 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +22,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
+@@ -59,7 +62,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,10 +111,12 @@ 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
diff --git a/srcpkgs/mongoose/patches/fix-tests.patch b/srcpkgs/mongoose/patches/fix-tests.patch
new file mode 100644
index 000000000000..8b25527492d5
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-tests.patch
@@ -0,0 +1,17 @@
+Skip tests that want to connect to the internet
+
+--- a/test/unit_test.c
++++ b/test/unit_test.c
+@@ -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..c9e41c4f7a2e 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,45 @@
 # 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"
+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
+CFLAGS+=" -fPIC"
+
+case "$XBPS_TARGET_MACHINE" in
+	*-musl) CFLAGS+=" -Wno-error=sign-conversion"	# FD(c_) macro is broken
+		make_check_args+=" NO_SANITIZE=1" ;;	# libsanitizer-devel unavailable
+	*)	checkdepends+=" libsanitizer-devel" ;;
+esac
+
+# GitHub CI runner doesn't support IPv6, causing tests to fail
+if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
+	make_check_args+=" IPV6=0"
+fi
+
+pre_check() {
+	# -Wunused-function -Werror and fix-tests.patch are enemies
+	CFLAGS+=" -Wno-error=unused-function"
+}
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }
@@ -24,6 +47,8 @@ mongoose-devel_package() {
 mongoose-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
-		vmove usr/share
+		vmkdir "usr/share/${sourcepkg}/doc"
+		vcopy examples "usr/share/${sourcepkg}/doc"
+		vcopy "docs/*" "usr/share/${sourcepkg}/doc"
 	}
 }

From f83a1f4065697cb2ad6c27e3571d07a8ff8b7db2 Mon Sep 17 00:00:00 2001
From: Subhaditya Nath <sn03.general@gmail.com>
Date: Wed, 30 Mar 2022 20:41:15 +0530
Subject: [PATCH 2/2] TEMP

---
 srcpkgs/mongoose/template | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/mongoose/template b/srcpkgs/mongoose/template
index c9e41c4f7a2e..d6ba82746a99 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -19,8 +19,7 @@ export SSL=OPENSSL
 CFLAGS+=" -fPIC"
 
 case "$XBPS_TARGET_MACHINE" in
-	*-musl) CFLAGS+=" -Wno-error=sign-conversion"	# FD(c_) macro is broken
-		make_check_args+=" NO_SANITIZE=1" ;;	# libsanitizer-devel unavailable
+	*-musl)	make_check_args+=" NO_SANITIZE=1" ;;	# libsanitizer-devel not available
 	*)	checkdepends+=" libsanitizer-devel" ;;
 esac
 
@@ -29,6 +28,22 @@ if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
 	make_check_args+=" IPV6=0"
 fi
 
+post_extract() {
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# GCC falsely flags musl's FD_SET macro as -Wsign-conversion
+			#	https://github.com/cesanta/mongoose/issues/1501#issuecomment-1082750154
+			#	https://inbox.vuxu.org/musl/20200803174707.GF6949@brightrain.aerifal.cx/T/
+			vsed -i src/sock.c -e '
+/[[:space:]]FD_SET(/{i\
+#pragma GCC diagnostic push\
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+p;i\
+#pragma GCC diagnostic pop
+}'
+	esac
+}
+
 pre_check() {
 	# -Wunused-function -Werror and fix-tests.patch are enemies
 	CFLAGS+=" -Wno-error=unused-function"

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (43 preceding siblings ...)
  2022-03-30 15:15 ` [PR PATCH] [Updated] " subnut
@ 2022-03-30 15:19 ` subnut
  2022-03-30 15:19 ` subnut
                   ` (10 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-30 15:19 UTC (permalink / raw)
  To: ml

[-- 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: 9053 bytes --]

From 757da06c6419a0657e2f6542bb1a36e9949b2069 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 1/2] mongoose: update to 7.6

---
 srcpkgs/mongoose/patches/add-makefile.patch | 50 -----------------
 srcpkgs/mongoose/patches/fix-makefile.patch | 59 +++++++++++++++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 17 ++++++
 srcpkgs/mongoose/template                   | 41 +++++++++++---
 4 files changed, 109 insertions(+), 58 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..d829ea8adc8c
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,59 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +22,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
+@@ -59,7 +62,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,10 +111,12 @@ 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
diff --git a/srcpkgs/mongoose/patches/fix-tests.patch b/srcpkgs/mongoose/patches/fix-tests.patch
new file mode 100644
index 000000000000..8b25527492d5
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-tests.patch
@@ -0,0 +1,17 @@
+Skip tests that want to connect to the internet
+
+--- a/test/unit_test.c
++++ b/test/unit_test.c
+@@ -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..c9e41c4f7a2e 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,45 @@
 # 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"
+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
+CFLAGS+=" -fPIC"
+
+case "$XBPS_TARGET_MACHINE" in
+	*-musl) CFLAGS+=" -Wno-error=sign-conversion"	# FD(c_) macro is broken
+		make_check_args+=" NO_SANITIZE=1" ;;	# libsanitizer-devel unavailable
+	*)	checkdepends+=" libsanitizer-devel" ;;
+esac
+
+# GitHub CI runner doesn't support IPv6, causing tests to fail
+if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
+	make_check_args+=" IPV6=0"
+fi
+
+pre_check() {
+	# -Wunused-function -Werror and fix-tests.patch are enemies
+	CFLAGS+=" -Wno-error=unused-function"
+}
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }
@@ -24,6 +47,8 @@ mongoose-devel_package() {
 mongoose-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
-		vmove usr/share
+		vmkdir "usr/share/${sourcepkg}/doc"
+		vcopy examples "usr/share/${sourcepkg}/doc"
+		vcopy "docs/*" "usr/share/${sourcepkg}/doc"
 	}
 }

From b7872798e68569629edbb3c2b11a097263baaa1c Mon Sep 17 00:00:00 2001
From: Subhaditya Nath <sn03.general@gmail.com>
Date: Wed, 30 Mar 2022 20:41:15 +0530
Subject: [PATCH 2/2] TEMP

---
 srcpkgs/mongoose/template | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/srcpkgs/mongoose/template b/srcpkgs/mongoose/template
index c9e41c4f7a2e..f07d02a34050 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -18,17 +18,33 @@ checksum=1ef09d971b6de1a6317c109980d6fb5a9c19b39efef2506d6b76869644b3dafa
 export SSL=OPENSSL
 CFLAGS+=" -fPIC"
 
-case "$XBPS_TARGET_MACHINE" in
-	*-musl) CFLAGS+=" -Wno-error=sign-conversion"	# FD(c_) macro is broken
-		make_check_args+=" NO_SANITIZE=1" ;;	# libsanitizer-devel unavailable
-	*)	checkdepends+=" libsanitizer-devel" ;;
-esac
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	# libsanitizer-devel not available
+	make_check_args+=" NO_SANITIZE=1"
+else
+	checkdepends+=" libsanitizer-devel"
+fi
 
 # GitHub CI runner doesn't support IPv6, causing tests to fail
 if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
 	make_check_args+=" IPV6=0"
 fi
 
+post_extract() {
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+			# GCC falsely flags musl's FD_SET macro as -Wsign-conversion
+			#	https://github.com/cesanta/mongoose/issues/1501#issuecomment-1082750154
+			#	https://inbox.vuxu.org/musl/20200803174707.GF6949@brightrain.aerifal.cx/T/
+			vsed -i src/sock.c -e '
+/[[:space:]]FD_SET(/{i\
+#pragma GCC diagnostic push\
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+p;i\
+#pragma GCC diagnostic pop
+}'
+	fi
+}
+
 pre_check() {
 	# -Wunused-function -Werror and fix-tests.patch are enemies
 	CFLAGS+=" -Wno-error=unused-function"

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (44 preceding siblings ...)
  2022-03-30 15:19 ` subnut
@ 2022-03-30 15:19 ` subnut
  2022-03-30 15:50 ` subnut
                   ` (9 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-30 15:19 UTC (permalink / raw)
  To: ml

[-- 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: 9053 bytes --]

From 757da06c6419a0657e2f6542bb1a36e9949b2069 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 1/2] mongoose: update to 7.6

---
 srcpkgs/mongoose/patches/add-makefile.patch | 50 -----------------
 srcpkgs/mongoose/patches/fix-makefile.patch | 59 +++++++++++++++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 17 ++++++
 srcpkgs/mongoose/template                   | 41 +++++++++++---
 4 files changed, 109 insertions(+), 58 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..d829ea8adc8c
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,59 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +22,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
+@@ -59,7 +62,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,10 +111,12 @@ 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
diff --git a/srcpkgs/mongoose/patches/fix-tests.patch b/srcpkgs/mongoose/patches/fix-tests.patch
new file mode 100644
index 000000000000..8b25527492d5
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-tests.patch
@@ -0,0 +1,17 @@
+Skip tests that want to connect to the internet
+
+--- a/test/unit_test.c
++++ b/test/unit_test.c
+@@ -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..c9e41c4f7a2e 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,45 @@
 # 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"
+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
+CFLAGS+=" -fPIC"
+
+case "$XBPS_TARGET_MACHINE" in
+	*-musl) CFLAGS+=" -Wno-error=sign-conversion"	# FD(c_) macro is broken
+		make_check_args+=" NO_SANITIZE=1" ;;	# libsanitizer-devel unavailable
+	*)	checkdepends+=" libsanitizer-devel" ;;
+esac
+
+# GitHub CI runner doesn't support IPv6, causing tests to fail
+if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
+	make_check_args+=" IPV6=0"
+fi
+
+pre_check() {
+	# -Wunused-function -Werror and fix-tests.patch are enemies
+	CFLAGS+=" -Wno-error=unused-function"
+}
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }
@@ -24,6 +47,8 @@ mongoose-devel_package() {
 mongoose-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
-		vmove usr/share
+		vmkdir "usr/share/${sourcepkg}/doc"
+		vcopy examples "usr/share/${sourcepkg}/doc"
+		vcopy "docs/*" "usr/share/${sourcepkg}/doc"
 	}
 }

From e74bf491bb745bf16857a99afb0f40849302f6fc Mon Sep 17 00:00:00 2001
From: Subhaditya Nath <sn03.general@gmail.com>
Date: Wed, 30 Mar 2022 20:41:15 +0530
Subject: [PATCH 2/2] TEMP

---
 srcpkgs/mongoose/template | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/srcpkgs/mongoose/template b/srcpkgs/mongoose/template
index c9e41c4f7a2e..f07d02a34050 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -18,17 +18,33 @@ checksum=1ef09d971b6de1a6317c109980d6fb5a9c19b39efef2506d6b76869644b3dafa
 export SSL=OPENSSL
 CFLAGS+=" -fPIC"
 
-case "$XBPS_TARGET_MACHINE" in
-	*-musl) CFLAGS+=" -Wno-error=sign-conversion"	# FD(c_) macro is broken
-		make_check_args+=" NO_SANITIZE=1" ;;	# libsanitizer-devel unavailable
-	*)	checkdepends+=" libsanitizer-devel" ;;
-esac
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	# libsanitizer-devel not available
+	make_check_args+=" NO_SANITIZE=1"
+else
+	checkdepends+=" libsanitizer-devel"
+fi
 
 # GitHub CI runner doesn't support IPv6, causing tests to fail
 if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
 	make_check_args+=" IPV6=0"
 fi
 
+post_extract() {
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+			# GCC falsely flags musl's FD_SET macro as -Wsign-conversion
+			#	https://github.com/cesanta/mongoose/issues/1501#issuecomment-1082750154
+			#	https://inbox.vuxu.org/musl/20200803174707.GF6949@brightrain.aerifal.cx/T/
+			vsed -i src/sock.c -e '
+/[[:space:]]FD_SET(/{i\
+#pragma GCC diagnostic push\
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+p;i\
+#pragma GCC diagnostic pop
+}'
+	fi
+}
+
 pre_check() {
 	# -Wunused-function -Werror and fix-tests.patch are enemies
 	CFLAGS+=" -Wno-error=unused-function"

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (45 preceding siblings ...)
  2022-03-30 15:19 ` subnut
@ 2022-03-30 15:50 ` subnut
  2022-03-30 15:55 ` subnut
                   ` (8 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-30 15:50 UTC (permalink / raw)
  To: ml

[-- 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: 9550 bytes --]

From 757da06c6419a0657e2f6542bb1a36e9949b2069 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 1/2] mongoose: update to 7.6

---
 srcpkgs/mongoose/patches/add-makefile.patch | 50 -----------------
 srcpkgs/mongoose/patches/fix-makefile.patch | 59 +++++++++++++++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 17 ++++++
 srcpkgs/mongoose/template                   | 41 +++++++++++---
 4 files changed, 109 insertions(+), 58 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..d829ea8adc8c
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,59 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +22,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
+@@ -59,7 +62,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,10 +111,12 @@ 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
diff --git a/srcpkgs/mongoose/patches/fix-tests.patch b/srcpkgs/mongoose/patches/fix-tests.patch
new file mode 100644
index 000000000000..8b25527492d5
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-tests.patch
@@ -0,0 +1,17 @@
+Skip tests that want to connect to the internet
+
+--- a/test/unit_test.c
++++ b/test/unit_test.c
+@@ -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..c9e41c4f7a2e 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,45 @@
 # 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"
+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
+CFLAGS+=" -fPIC"
+
+case "$XBPS_TARGET_MACHINE" in
+	*-musl) CFLAGS+=" -Wno-error=sign-conversion"	# FD(c_) macro is broken
+		make_check_args+=" NO_SANITIZE=1" ;;	# libsanitizer-devel unavailable
+	*)	checkdepends+=" libsanitizer-devel" ;;
+esac
+
+# GitHub CI runner doesn't support IPv6, causing tests to fail
+if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
+	make_check_args+=" IPV6=0"
+fi
+
+pre_check() {
+	# -Wunused-function -Werror and fix-tests.patch are enemies
+	CFLAGS+=" -Wno-error=unused-function"
+}
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }
@@ -24,6 +47,8 @@ mongoose-devel_package() {
 mongoose-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
-		vmove usr/share
+		vmkdir "usr/share/${sourcepkg}/doc"
+		vcopy examples "usr/share/${sourcepkg}/doc"
+		vcopy "docs/*" "usr/share/${sourcepkg}/doc"
 	}
 }

From c8fdf1f8a63dba8462754977a9f02323e9f4c419 Mon Sep 17 00:00:00 2001
From: Subhaditya Nath <sn03.general@gmail.com>
Date: Wed, 30 Mar 2022 20:41:15 +0530
Subject: [PATCH 2/2] TEMP

---
 srcpkgs/mongoose/template | 41 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 36 insertions(+), 5 deletions(-)

diff --git a/srcpkgs/mongoose/template b/srcpkgs/mongoose/template
index c9e41c4f7a2e..6d1797315cc9 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -18,17 +18,48 @@ checksum=1ef09d971b6de1a6317c109980d6fb5a9c19b39efef2506d6b76869644b3dafa
 export SSL=OPENSSL
 CFLAGS+=" -fPIC"
 
-case "$XBPS_TARGET_MACHINE" in
-	*-musl) CFLAGS+=" -Wno-error=sign-conversion"	# FD(c_) macro is broken
-		make_check_args+=" NO_SANITIZE=1" ;;	# libsanitizer-devel unavailable
-	*)	checkdepends+=" libsanitizer-devel" ;;
-esac
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	# libsanitizer-devel is currenly not available on musl
+	make_check_args+=" NO_SANITIZE=1"
+else
+	checkdepends+=" libsanitizer-devel"
+fi
 
 # GitHub CI runner doesn't support IPv6, causing tests to fail
 if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
 	make_check_args+=" IPV6=0"
 fi
 
+post_extract() {
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		# GCC falsely flags musl's FD_{SET,ISSET,CLR} macros as -Wsign-conversion
+		#	https://github.com/cesanta/mongoose/issues/1501#issuecomment-1082750154
+		#	https://inbox.vuxu.org/musl/20200803174707.GF6949@brightrain.aerifal.cx/T/
+		vsed -i src/sock.c -e '
+/[[:space:]]FD_SET(/b label
+/[[:space:]]FD_ISSET(/b label
+/[[:space:]]FD_CLR(/b label
+b
+:label
+i\
+#pragma GCC diagnostic push\
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+p
+i\
+#pragma GCC diagnostic pop
+d'
+		# What the above sed script does -
+		# Searches for FD_{SET,ISSET,CLR}
+		# - If found, jump to the line after :label
+		# - If not found, go to the end of the script (print current line as-is)
+		# :label
+		# - [i] Insert the two #pragma lines
+		# - [p] Insert the current line
+		# - [i] Insert the remaining #pragma line
+		# - [d] Proceed to the next line of input
+	fi
+}
+
 pre_check() {
 	# -Wunused-function -Werror and fix-tests.patch are enemies
 	CFLAGS+=" -Wno-error=unused-function"

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (46 preceding siblings ...)
  2022-03-30 15:50 ` subnut
@ 2022-03-30 15:55 ` subnut
  2022-03-30 15:55 ` subnut
                   ` (7 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-30 15:55 UTC (permalink / raw)
  To: ml

[-- 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: 9797 bytes --]

From 757da06c6419a0657e2f6542bb1a36e9949b2069 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 1/2] mongoose: update to 7.6

---
 srcpkgs/mongoose/patches/add-makefile.patch | 50 -----------------
 srcpkgs/mongoose/patches/fix-makefile.patch | 59 +++++++++++++++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 17 ++++++
 srcpkgs/mongoose/template                   | 41 +++++++++++---
 4 files changed, 109 insertions(+), 58 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..d829ea8adc8c
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,59 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +22,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
+@@ -59,7 +62,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,10 +111,12 @@ 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
diff --git a/srcpkgs/mongoose/patches/fix-tests.patch b/srcpkgs/mongoose/patches/fix-tests.patch
new file mode 100644
index 000000000000..8b25527492d5
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-tests.patch
@@ -0,0 +1,17 @@
+Skip tests that want to connect to the internet
+
+--- a/test/unit_test.c
++++ b/test/unit_test.c
+@@ -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..c9e41c4f7a2e 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,45 @@
 # 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"
+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
+CFLAGS+=" -fPIC"
+
+case "$XBPS_TARGET_MACHINE" in
+	*-musl) CFLAGS+=" -Wno-error=sign-conversion"	# FD(c_) macro is broken
+		make_check_args+=" NO_SANITIZE=1" ;;	# libsanitizer-devel unavailable
+	*)	checkdepends+=" libsanitizer-devel" ;;
+esac
+
+# GitHub CI runner doesn't support IPv6, causing tests to fail
+if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
+	make_check_args+=" IPV6=0"
+fi
+
+pre_check() {
+	# -Wunused-function -Werror and fix-tests.patch are enemies
+	CFLAGS+=" -Wno-error=unused-function"
+}
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }
@@ -24,6 +47,8 @@ mongoose-devel_package() {
 mongoose-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
-		vmove usr/share
+		vmkdir "usr/share/${sourcepkg}/doc"
+		vcopy examples "usr/share/${sourcepkg}/doc"
+		vcopy "docs/*" "usr/share/${sourcepkg}/doc"
 	}
 }

From e0e742fd07fd4311c3cd39fbbfdabbe03af7a70a Mon Sep 17 00:00:00 2001
From: Subhaditya Nath <sn03.general@gmail.com>
Date: Wed, 30 Mar 2022 20:41:15 +0530
Subject: [PATCH 2/2] TEMP

---
 srcpkgs/mongoose/template | 45 ++++++++++++++++++++++++++++++---------
 1 file changed, 35 insertions(+), 10 deletions(-)

diff --git a/srcpkgs/mongoose/template b/srcpkgs/mongoose/template
index c9e41c4f7a2e..569a4cf5c961 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -14,24 +14,49 @@ license="GPL-2.0-only"
 homepage="https://mongoose.ws/"
 distfiles="https://github.com/cesanta/mongoose/archive/${version}.tar.gz"
 checksum=1ef09d971b6de1a6317c109980d6fb5a9c19b39efef2506d6b76869644b3dafa
-
+CFLAGS="-fPIC -Wno-error=unused-function" # fix-tests.patch causes unused-function
 export SSL=OPENSSL
-CFLAGS+=" -fPIC"
 
-case "$XBPS_TARGET_MACHINE" in
-	*-musl) CFLAGS+=" -Wno-error=sign-conversion"	# FD(c_) macro is broken
-		make_check_args+=" NO_SANITIZE=1" ;;	# libsanitizer-devel unavailable
-	*)	checkdepends+=" libsanitizer-devel" ;;
-esac
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	# libsanitizer-devel is currenly not available on musl
+	make_check_args+=" NO_SANITIZE=1"
+else
+	checkdepends+=" libsanitizer-devel"
+fi
 
 # GitHub CI runner doesn't support IPv6, causing tests to fail
 if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
 	make_check_args+=" IPV6=0"
 fi
 
-pre_check() {
-	# -Wunused-function -Werror and fix-tests.patch are enemies
-	CFLAGS+=" -Wno-error=unused-function"
+post_extract() {
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		# GCC falsely flags musl's FD_{SET,ISSET,CLR} macros as -Wsign-conversion
+		#	https://github.com/cesanta/mongoose/issues/1501#issuecomment-1082750154
+		#	https://inbox.vuxu.org/musl/20200803174707.GF6949@brightrain.aerifal.cx/T/
+		vsed -i src/sock.c -e '
+/[[:space:]]FD_SET(/b label
+/[[:space:]]FD_ISSET(/b label
+/[[:space:]]FD_CLR(/b label
+b
+:label
+i\
+#pragma GCC diagnostic push\
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+p
+i\
+#pragma GCC diagnostic pop
+d'
+		# What the above sed script does -
+		# Searches for FD_{SET,ISSET,CLR}
+		# - If found, jump to the line after :label
+		# - If not found, go to the end of the script (print current line as-is)
+		# :label
+		# - [i] Insert the two #pragma lines
+		# - [p] Insert the current line
+		# - [i] Insert the remaining #pragma line
+		# - [d] Proceed to the next line of input
+	fi
 }
 
 mongoose-devel_package() {

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (47 preceding siblings ...)
  2022-03-30 15:55 ` subnut
@ 2022-03-30 15:55 ` subnut
  2022-03-30 15:57 ` subnut
                   ` (6 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-30 15:55 UTC (permalink / raw)
  To: ml

[-- 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: 9797 bytes --]

From 757da06c6419a0657e2f6542bb1a36e9949b2069 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 1/2] mongoose: update to 7.6

---
 srcpkgs/mongoose/patches/add-makefile.patch | 50 -----------------
 srcpkgs/mongoose/patches/fix-makefile.patch | 59 +++++++++++++++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 17 ++++++
 srcpkgs/mongoose/template                   | 41 +++++++++++---
 4 files changed, 109 insertions(+), 58 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..d829ea8adc8c
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,59 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +22,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
+@@ -59,7 +62,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,10 +111,12 @@ 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
diff --git a/srcpkgs/mongoose/patches/fix-tests.patch b/srcpkgs/mongoose/patches/fix-tests.patch
new file mode 100644
index 000000000000..8b25527492d5
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-tests.patch
@@ -0,0 +1,17 @@
+Skip tests that want to connect to the internet
+
+--- a/test/unit_test.c
++++ b/test/unit_test.c
+@@ -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..c9e41c4f7a2e 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,45 @@
 # 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"
+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
+CFLAGS+=" -fPIC"
+
+case "$XBPS_TARGET_MACHINE" in
+	*-musl) CFLAGS+=" -Wno-error=sign-conversion"	# FD(c_) macro is broken
+		make_check_args+=" NO_SANITIZE=1" ;;	# libsanitizer-devel unavailable
+	*)	checkdepends+=" libsanitizer-devel" ;;
+esac
+
+# GitHub CI runner doesn't support IPv6, causing tests to fail
+if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
+	make_check_args+=" IPV6=0"
+fi
+
+pre_check() {
+	# -Wunused-function -Werror and fix-tests.patch are enemies
+	CFLAGS+=" -Wno-error=unused-function"
+}
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }
@@ -24,6 +47,8 @@ mongoose-devel_package() {
 mongoose-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
-		vmove usr/share
+		vmkdir "usr/share/${sourcepkg}/doc"
+		vcopy examples "usr/share/${sourcepkg}/doc"
+		vcopy "docs/*" "usr/share/${sourcepkg}/doc"
 	}
 }

From 540290c8a205d211dc3478e3713cd8db4a905f54 Mon Sep 17 00:00:00 2001
From: Subhaditya Nath <sn03.general@gmail.com>
Date: Wed, 30 Mar 2022 20:41:15 +0530
Subject: [PATCH 2/2] TEMP

---
 srcpkgs/mongoose/template | 45 ++++++++++++++++++++++++++++++---------
 1 file changed, 35 insertions(+), 10 deletions(-)

diff --git a/srcpkgs/mongoose/template b/srcpkgs/mongoose/template
index c9e41c4f7a2e..569a4cf5c961 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -14,24 +14,49 @@ license="GPL-2.0-only"
 homepage="https://mongoose.ws/"
 distfiles="https://github.com/cesanta/mongoose/archive/${version}.tar.gz"
 checksum=1ef09d971b6de1a6317c109980d6fb5a9c19b39efef2506d6b76869644b3dafa
-
+CFLAGS="-fPIC -Wno-error=unused-function" # fix-tests.patch causes unused-function
 export SSL=OPENSSL
-CFLAGS+=" -fPIC"
 
-case "$XBPS_TARGET_MACHINE" in
-	*-musl) CFLAGS+=" -Wno-error=sign-conversion"	# FD(c_) macro is broken
-		make_check_args+=" NO_SANITIZE=1" ;;	# libsanitizer-devel unavailable
-	*)	checkdepends+=" libsanitizer-devel" ;;
-esac
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	# libsanitizer-devel is currenly not available on musl
+	make_check_args+=" NO_SANITIZE=1"
+else
+	checkdepends+=" libsanitizer-devel"
+fi
 
 # GitHub CI runner doesn't support IPv6, causing tests to fail
 if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
 	make_check_args+=" IPV6=0"
 fi
 
-pre_check() {
-	# -Wunused-function -Werror and fix-tests.patch are enemies
-	CFLAGS+=" -Wno-error=unused-function"
+post_extract() {
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		# GCC falsely flags musl's FD_{SET,ISSET,CLR} macros as -Wsign-conversion
+		#	https://github.com/cesanta/mongoose/issues/1501#issuecomment-1082750154
+		#	https://inbox.vuxu.org/musl/20200803174707.GF6949@brightrain.aerifal.cx/T/
+		vsed -i src/sock.c -e '
+/[[:space:]]FD_SET(/b label
+/[[:space:]]FD_ISSET(/b label
+/[[:space:]]FD_CLR(/b label
+b
+:label
+i\
+#pragma GCC diagnostic push\
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+p
+i\
+#pragma GCC diagnostic pop
+d'
+		# What the above sed script does -
+		# Searches for FD_{SET,ISSET,CLR}
+		# - If found, jump to the line after :label
+		# - If not found, go to the end of the script (print current line as-is)
+		# :label
+		# - [i] Insert the two #pragma lines
+		# - [p] Insert the current line
+		# - [i] Insert the remaining #pragma line
+		# - [d] Proceed to the next line of input
+	fi
 }
 
 mongoose-devel_package() {

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (48 preceding siblings ...)
  2022-03-30 15:55 ` subnut
@ 2022-03-30 15:57 ` subnut
  2022-03-30 16:11 ` subnut
                   ` (5 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-30 15:57 UTC (permalink / raw)
  To: ml

[-- 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: 8140 bytes --]

From cddea5bcf3239fd05f8f115ffba5ceae079370d7 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 | 59 ++++++++++++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 17 ++++++
 srcpkgs/mongoose/template                   | 66 ++++++++++++++++++---
 4 files changed, 134 insertions(+), 58 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..d829ea8adc8c
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,59 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +22,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
+@@ -59,7 +62,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,10 +111,12 @@ 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
diff --git a/srcpkgs/mongoose/patches/fix-tests.patch b/srcpkgs/mongoose/patches/fix-tests.patch
new file mode 100644
index 000000000000..8b25527492d5
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-tests.patch
@@ -0,0 +1,17 @@
+Skip tests that want to connect to the internet
+
+--- a/test/unit_test.c
++++ b/test/unit_test.c
+@@ -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..569a4cf5c961 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,70 @@
 # 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"
+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
+CFLAGS="-fPIC -Wno-error=unused-function" # fix-tests.patch causes unused-function
+export SSL=OPENSSL
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	# libsanitizer-devel is currenly not available on musl
+	make_check_args+=" NO_SANITIZE=1"
+else
+	checkdepends+=" libsanitizer-devel"
+fi
+
+# GitHub CI runner doesn't support IPv6, causing tests to fail
+if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
+	make_check_args+=" IPV6=0"
+fi
+
+post_extract() {
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		# GCC falsely flags musl's FD_{SET,ISSET,CLR} macros as -Wsign-conversion
+		#	https://github.com/cesanta/mongoose/issues/1501#issuecomment-1082750154
+		#	https://inbox.vuxu.org/musl/20200803174707.GF6949@brightrain.aerifal.cx/T/
+		vsed -i src/sock.c -e '
+/[[:space:]]FD_SET(/b label
+/[[:space:]]FD_ISSET(/b label
+/[[:space:]]FD_CLR(/b label
+b
+:label
+i\
+#pragma GCC diagnostic push\
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+p
+i\
+#pragma GCC diagnostic pop
+d'
+		# What the above sed script does -
+		# Searches for FD_{SET,ISSET,CLR}
+		# - If found, jump to the line after :label
+		# - If not found, go to the end of the script (print current line as-is)
+		# :label
+		# - [i] Insert the two #pragma lines
+		# - [p] Insert the current line
+		# - [i] Insert the remaining #pragma line
+		# - [d] Proceed to the next line of input
+	fi
+}
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }
@@ -24,6 +72,8 @@ mongoose-devel_package() {
 mongoose-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
-		vmove usr/share
+		vmkdir "usr/share/${sourcepkg}/doc"
+		vcopy examples "usr/share/${sourcepkg}/doc"
+		vcopy "docs/*" "usr/share/${sourcepkg}/doc"
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (49 preceding siblings ...)
  2022-03-30 15:57 ` subnut
@ 2022-03-30 16:11 ` subnut
  2022-03-31 10:31 ` [PR REVIEW] " ahesford
                   ` (4 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-30 16:11 UTC (permalink / raw)
  To: ml

[-- 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: 7445 bytes --]

From 1ac4e8687a9d967c5bb7a50f0402a066bd937b10 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 | 59 +++++++++++++++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 17 ++++++
 srcpkgs/mongoose/template                   | 41 +++++++++++---
 4 files changed, 109 insertions(+), 58 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..d829ea8adc8c
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,59 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +22,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
+@@ -59,7 +62,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,10 +111,12 @@ 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
diff --git a/srcpkgs/mongoose/patches/fix-tests.patch b/srcpkgs/mongoose/patches/fix-tests.patch
new file mode 100644
index 000000000000..8b25527492d5
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-tests.patch
@@ -0,0 +1,17 @@
+Skip tests that want to connect to the internet
+
+--- a/test/unit_test.c
++++ b/test/unit_test.c
+@@ -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..15f6de1507a8 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,45 @@
 # 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"
+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
+CFLAGS="-fPIC -Wno-error=sign-conversion -Wno-error=unused-function"
+# -Wno-error=unused-function	fix-tests.patch
+# -Wno-error=sign-conversion	GCC falsely flags musl FD_{SET,ISSET,CLR}
+#	https://inbox.vuxu.org/musl/20200803174707.GF6949@brightrain.aerifal.cx/T/
+
+
+# used in Makefile
+export SSL=OPENSSL
+
+# libsanitizer-devel is currenly not available on musl
+if [ "$XBPS_TARGET_LIBC" = musl ]
+then make_check_args+=" NO_SANITIZE=1"	# fix-makefile.patch adds NO_SANITIZE
+else checkdepends+=" libsanitizer-devel"
+fi
+
+# GitHub CI runner doesn't support IPv6, causing tests to fail
+if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
+	make_check_args+=" IPV6=0"
+fi
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }
@@ -24,6 +47,8 @@ mongoose-devel_package() {
 mongoose-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
-		vmove usr/share
+		vmkdir "usr/share/${sourcepkg}/doc"
+		vcopy examples "usr/share/${sourcepkg}/doc"
+		vcopy "docs/*" "usr/share/${sourcepkg}/doc"
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (50 preceding siblings ...)
  2022-03-30 16:11 ` subnut
@ 2022-03-31 10:31 ` ahesford
  2022-03-31 10:31 ` ahesford
                   ` (3 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: ahesford @ 2022-03-31 10:31 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r839443408

Comment:
Make the style of this block consistent with other tests in templates:
- `then` on same line as `if`
- `else` on its own line
- test bodies indented with a single tab

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR REVIEW] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (51 preceding siblings ...)
  2022-03-31 10:31 ` [PR REVIEW] " ahesford
@ 2022-03-31 10:31 ` ahesford
  2022-03-31 11:52 ` [PR PATCH] [Updated] " subnut
                   ` (2 subsequent siblings)
  55 siblings, 0 replies; 57+ messages in thread
From: ahesford @ 2022-03-31 10:31 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/36395#discussion_r839443408

Comment:
Make the style of this block consistent with other tests in templates:
- `then` on same line as `if`
- `else` on its own line
- conditional blocks indented with a single tab

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (52 preceding siblings ...)
  2022-03-31 10:31 ` ahesford
@ 2022-03-31 11:52 ` subnut
  2022-03-31 11:54 ` subnut
  2022-03-31 12:14 ` [PR PATCH] [Closed]: " ahesford
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-31 11:52 UTC (permalink / raw)
  To: ml

[-- 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: 7464 bytes --]

From e5d0fe088bbb73a669fa74e6a526f1e462a589f2 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 | 59 +++++++++++++++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 17 ++++++
 srcpkgs/mongoose/template                   | 42 ++++++++++++---
 4 files changed, 110 insertions(+), 58 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..d829ea8adc8c
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,59 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +22,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
+@@ -59,7 +62,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,10 +111,12 @@ 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
diff --git a/srcpkgs/mongoose/patches/fix-tests.patch b/srcpkgs/mongoose/patches/fix-tests.patch
new file mode 100644
index 000000000000..8b25527492d5
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-tests.patch
@@ -0,0 +1,17 @@
+Skip tests that want to connect to the internet
+
+--- a/test/unit_test.c
++++ b/test/unit_test.c
+@@ -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..6b7f1c4fc6bb 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,46 @@
 # 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"
+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
+CFLAGS="-fPIC -Wno-error=sign-conversion -Wno-error=unused-function"
+# -Wno-error=unused-function	fix-tests.patch
+# -Wno-error=sign-conversion	GCC falsely flags musl FD_{SET,ISSET,CLR}
+#	https://inbox.vuxu.org/musl/20200803174707.GF6949@brightrain.aerifal.cx/T/
+
+# used in Makefile
+export SSL=OPENSSL
+
+# libsanitizer-devel is currenly not available on musl
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	make_check_args+=" NO_SANITIZE=1"
+	# NO_SANITIZE option is added by fix-makefile.patch
+else
+	checkdepends+=" libsanitizer-devel"
+fi
+
+# GitHub CI runner doesn't support IPv6, causing tests to fail
+if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
+	make_check_args+=" IPV6=0"
+fi
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }
@@ -24,6 +48,8 @@ mongoose-devel_package() {
 mongoose-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
-		vmove usr/share
+		vmkdir "usr/share/${sourcepkg}/doc"
+		vcopy examples "usr/share/${sourcepkg}/doc"
+		vcopy "docs/*" "usr/share/${sourcepkg}/doc"
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Updated] mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (53 preceding siblings ...)
  2022-03-31 11:52 ` [PR PATCH] [Updated] " subnut
@ 2022-03-31 11:54 ` subnut
  2022-03-31 12:14 ` [PR PATCH] [Closed]: " ahesford
  55 siblings, 0 replies; 57+ messages in thread
From: subnut @ 2022-03-31 11:54 UTC (permalink / raw)
  To: ml

[-- 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: 7464 bytes --]

From f2ad227cb38fe40b17636e159355c521b8f4e365 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 | 59 +++++++++++++++++++++
 srcpkgs/mongoose/patches/fix-tests.patch    | 17 ++++++
 srcpkgs/mongoose/template                   | 42 ++++++++++++---
 4 files changed, 110 insertions(+), 58 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..d829ea8adc8c
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-makefile.patch
@@ -0,0 +1,59 @@
+--- a/Makefile
++++ b/Makefile
+@@ -5,5 +5,5 @@ SRCS = mongoose.c test/unit_test.c test/packed_fs.c
+ OPTS ?= -O3 -g3
+ INCS ?= -Isrc -I.
+-CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
++CFLAGS := $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(CFLAGS)
+ SSL ?= MBEDTLS
+ CWD ?= $(realpath $(CURDIR))
+@@ -10,6 +10,9 @@ CWD ?= $(realpath $(CURDIR))
+ DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
+ VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
+ IPV6 ?= 1
++ifneq "$(NO_SANITIZE)" "1"
++SANITIZE = -fsanitize=address,undefined
++endif
+ ASAN_OPTIONS ?=
+ EXAMPLES := $(wildcard examples/*)
+ PREFIX ?= /usr/local
+@@ -19,12 +22,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
+@@ -59,7 +62,7 @@ fuzz: fuzzer
+ 	$(RUN) ./fuzzer
+ 
+ # make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
+-test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
++test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) $(SANITIZE)
+ test: mongoose.h  Makefile $(SRCS)
+ 	$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
+ 	ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
+@@ -108,10 +111,12 @@ 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
diff --git a/srcpkgs/mongoose/patches/fix-tests.patch b/srcpkgs/mongoose/patches/fix-tests.patch
new file mode 100644
index 000000000000..8b25527492d5
--- /dev/null
+++ b/srcpkgs/mongoose/patches/fix-tests.patch
@@ -0,0 +1,17 @@
+Skip tests that want to connect to the internet
+
+--- a/test/unit_test.c
++++ b/test/unit_test.c
+@@ -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..5e8b5b35a846 100644
--- a/srcpkgs/mongoose/template
+++ b/srcpkgs/mongoose/template
@@ -1,22 +1,46 @@
 # 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"
+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
+CFLAGS="-fPIC -Wno-error=sign-conversion -Wno-error=unused-function"
+# -Wno-error=unused-function	fix-tests.patch
+# -Wno-error=sign-conversion	GCC falsely flags musl FD_{SET,ISSET,CLR}
+#	https://inbox.vuxu.org/musl/20200803174707.GF6949@brightrain.aerifal.cx/T/
+
+# used in Makefile
+export SSL=OPENSSL
+
+# libsanitizer-devel is currenly not available on musl
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	# NO_SANITIZE option is added by fix-makefile.patch
+	make_check_args+=" NO_SANITIZE=1"
+else
+	checkdepends+=" libsanitizer-devel"
+fi
+
+# GitHub CI runner doesn't support IPv6, causing tests to fail
+if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
+	make_check_args+=" IPV6=0"
+fi
 
 mongoose-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove "usr/lib/*.a"
 		vmove "usr/lib/*.so"
 	}
 }
@@ -24,6 +48,8 @@ mongoose-devel_package() {
 mongoose-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
-		vmove usr/share
+		vmkdir "usr/share/${sourcepkg}/doc"
+		vcopy examples "usr/share/${sourcepkg}/doc"
+		vcopy "docs/*" "usr/share/${sourcepkg}/doc"
 	}
 }

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PR PATCH] [Closed]: mongoose: update to 7.6
  2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 subnut
                   ` (54 preceding siblings ...)
  2022-03-31 11:54 ` subnut
@ 2022-03-31 12:14 ` ahesford
  55 siblings, 0 replies; 57+ messages in thread
From: ahesford @ 2022-03-31 12:14 UTC (permalink / raw)
  To: ml

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

There's a closed pull request on the void-packages repository

mongoose: update to 7.6
https://github.com/void-linux/void-packages/pull/36395

Description:
<!-- 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
-->


^ permalink raw reply	[flat|nested] 57+ messages in thread

end of thread, other threads:[~2022-03-31 12:14 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28 18:23 [PR PATCH] mongoose: update to 7.6 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
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

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).