Skip to contentSkip to conversation

mongoose: bump to version 5.3

PATCH New Davide Viti 2 participants 4 messages May 12, 2014 – May 26, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 mongoose: bump to version 5.3

From: Davide Viti <[email protected]>

---
Changes v1 -> v2:
- rebase
- update license to GPLv2 (Will Wagner)

Original patch content:

Mongoose has changed quite drastically in the last months. Here is a list of changes which had to be applied:

- Bump version from 3.7 to 5.3
- use tarball download via github helper iso git clone
- need largefile support
- compilation takes place into "examples"
- weberver source is now "server.c"
- adapt to new command line options
- SSL support now controlled via NS_ENABLE_SSL

I'd appreciate some feedback in particular on the SSL change: the old NO_SSL_DL and NO_SSL macros have been removed and the only SSL-related macro is now NS_ENABLE_SSL.

regards,
Davide

 package/mongoose/Config.in   |    5 +++--
 package/mongoose/S85mongoose |    2 +-
 package/mongoose/mongoose.mk |   17 +++++++----------
 3 files changed, 11 insertions(+), 13 deletions(-)
package/mongoose/Config.in +3 -2
index 35723de..2526112 100644
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_MONGOOSE
 	bool "mongoose"
+	depends on BR2_LARGEFILE
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_USE_MMU # fork()
 	help
@@ -7,6 +8,6 @@ config BR2_PACKAGE_MONGOOSE
 
 	  https://github.com/valenok/mongoose
 
-comment "mongoose needs a toolchain w/ threads"
+comment "mongoose needs a toolchain w/ threads, largefile"
 	depends on BR2_USE_MMU
-	depends on !BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_LARGEFILE
package/mongoose/S85mongoose +1 -1
index dc042d0..98e537f 100755
@@ -10,7 +10,7 @@ NAME=mongoose
 DESC="Mongoose HTTP server"
 
 DAEMON=`which mongoose`
-OPTIONS="-num_threads 3 -document_root /var/www -listening_ports 80"
+OPTIONS="-document_root /var/www -listening_port 80"
 
 [ -e /etc/default/mongoose ] && . /etc/default/mongoose
 
package/mongoose/mongoose.mk +7 -10
index d928dd8..a7164bb 100644
@@ -4,10 +4,9 @@
 #
 ################################################################################
 
-MONGOOSE_VERSION = 3.7
-MONGOOSE_SOURCE = mongoose-$(MONGOOSE_VERSION).tgz
-MONGOOSE_SITE = https://mongoose.googlecode.com/files
-MONGOOSE_LICENSE = MIT
+MONGOOSE_VERSION = 5.3
+MONGOOSE_SITE = $(call github,cesanta,mongoose,$(MONGOOSE_VERSION))
+MONGOOSE_LICENSE = GPLv2
 MONGOOSE_LICENSE_FILES = LICENSE
 
 MONGOOSE_CFLAGS = $(TARGET_CFLAGS) $(TARGET_LDFLAGS)
@@ -15,18 +14,16 @@ MONGOOSE_CFLAGS = $(TARGET_CFLAGS) $(TARGET_LDFLAGS)
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
 MONGOOSE_DEPENDENCIES += openssl
 # directly linked
-MONGOOSE_CFLAGS += -DNO_SSL_DL -lssl -lcrypto -lz
-else
-MONGOOSE_CFLAGS += -DNO_SSL
+MONGOOSE_CFLAGS += -DNS_ENABLE_SSL -lssl -lcrypto -lz
 endif
 
 define MONGOOSE_BUILD_CMDS
-	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D) \
-		linux COPT="$(MONGOOSE_CFLAGS)"
+	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D)/examples \
+		COPT="$(MONGOOSE_CFLAGS)"
 endef
 
 define MONGOOSE_INSTALL_TARGET_CMDS
-	$(INSTALL) -D -m 755 $(@D)/mongoose $(TARGET_DIR)/usr/sbin/mongoose
+	$(INSTALL) -D -m 755 $(@D)/examples/server $(TARGET_DIR)/usr/sbin/mongoose
 	$(INSTALL) -D -m 755 package/mongoose/S85mongoose \
 		$(TARGET_DIR)/etc/init.d/S85mongoose
 endef
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v2 2/2 mongoose: optionally provide shared library

From: Davide Viti <[email protected]>

---
Changes v1 -> v2:
- rebase
- add dot at the end of help messages

Original patch content:
mongoose package can provide a webserver and, optionally, a shared
library: this is what Centos, among other distros, is doing.

It's now possible to include in the build both the mongoose executable and libmongoose.so

Not too sure how should be handled the situation where mongoose is select and neither the webserver nor libmongoose.so are not selected

I'd also appreciate some feedback on the shared library compilation flags

regards,
Davide

 package/mongoose/Config.in   |   14 ++++++++++++++
 package/mongoose/mongoose.mk |   32 +++++++++++++++++++++++++++++---
 2 files changed, 43 insertions(+), 3 deletions(-)
package/mongoose/Config.in +14 -0
index 2526112..2b93ab8 100644
@@ -8,6 +8,20 @@ config BR2_PACKAGE_MONGOOSE
 
 	  https://github.com/valenok/mongoose
 
+if BR2_PACKAGE_MONGOOSE
+
+config BR2_PACKAGE_MONGOOSE_INSTALL_WEBSERVER
+	bool "Install standalone webserver"
+	help
+	  Install mongoose webserver.
+
+config BR2_PACKAGE_MONGOOSE_INSTALL_SHARED_LIBRARY
+	bool "Install shared library"
+	help
+	  Install shared library.
+
+endif
+
 comment "mongoose needs a toolchain w/ threads, largefile"
 	depends on BR2_USE_MMU
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_LARGEFILE
package/mongoose/mongoose.mk +29 -3
index a7164bb..3628c0c 100644
@@ -8,6 +8,7 @@ MONGOOSE_VERSION = 5.3
 MONGOOSE_SITE = $(call github,cesanta,mongoose,$(MONGOOSE_VERSION))
 MONGOOSE_LICENSE = GPLv2
 MONGOOSE_LICENSE_FILES = LICENSE
+MONGOOSE_INSTALL_STAGING = YES
 
 MONGOOSE_CFLAGS = $(TARGET_CFLAGS) $(TARGET_LDFLAGS)
 
@@ -17,15 +18,40 @@ MONGOOSE_DEPENDENCIES += openssl
 MONGOOSE_CFLAGS += -DNS_ENABLE_SSL -lssl -lcrypto -lz
 endif
 
+ifeq ($(BR2_PACKAGE_MONGOOSE_INSTALL_SHARED_LIBRARY),y)
+define MONGOOSE_INSTALL_SHARED_LIBRARY_CMDS
+	$(INSTALL) -D -m 755 $(@D)/libmongoose.so $(TARGET_DIR)/usr/lib
+endef
+
+define MONGOOSE_INSTALL_STAGING_SHARED_LIBRARY_CMDS
+	$(INSTALL) -D -m 755 $(@D)/libmongoose.so $(STAGING_DIR)/usr/lib
+	$(INSTALL) -D -m 644 $(@D)/mongoose.h $(STAGING_DIR)/usr/include
+endef
+
+endif
+
+ifeq ($(BR2_PACKAGE_MONGOOSE_INSTALL_WEBSERVER),y)
+define MONGOOSE_INSTALL_WEBSERVER_CMDS
+        $(INSTALL) -D -m 755 $(@D)/mongoose $(TARGET_DIR)/usr/sbin
+        $(INSTALL) -D -m 755 package/mongoose/S85mongoose \
+		$(TARGET_DIR)/etc/init.d
+endef
+endif
+
 define MONGOOSE_BUILD_CMDS
 	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D)/examples \
 		COPT="$(MONGOOSE_CFLAGS)"
+	$(TARGET_CC) $(@D)/mongoose.c -shared -fpic \
+		-o $(@D)/libmongoose.so -pthread -ldl
 endef
 
 define MONGOOSE_INSTALL_TARGET_CMDS
-	$(INSTALL) -D -m 755 $(@D)/examples/server $(TARGET_DIR)/usr/sbin/mongoose
-	$(INSTALL) -D -m 755 package/mongoose/S85mongoose \
-		$(TARGET_DIR)/etc/init.d/S85mongoose
+	$(MONGOOSE_INSTALL_SHARED_LIBRARY_CMDS)
+	$(MONGOOSE_INSTALL_WEBSERVER_CMDS)
+endef
+
+define MONGOOSE_INSTALL_STAGING_CMDS
+	$(MONGOOSE_INSTALL_STAGING_SHARED_LIBRARY_CMDS)
 endef
 
 $(eval $(generic-package))
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH v2 2/2 mongoose: optionally provide shared library

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Davide" == Davide Viti <[email protected]> writes:

Hi,

Quoted 11 lines

From: Davide Viti <[email protected]>

---
Changes v1 -> v2:
- rebase
- add dot at the end of help messages

Original patch content:
mongoose package can provide a webserver and, optionally, a shared
library: this is what Centos, among other distros, is doing.

Quoted 8 lines

It's now possible to include in the build both the mongoose executable and libmongoose.so

Not too sure how should be handled the situation where mongoose is select and neither the webserver nor libmongoose.so are not selected

I'd also appreciate some feedback on the shared library compilation flags

Most of this should go above the '---' line so it becomes part of the commit description.

Why a shared library and not a static one? If upstream doesn't officially support shared libraries (and versioning of it), then I think it makes more sense to build a static library instead, especially for something like this you most likely are not going to use from a lot of different applications in your rootfs.

Quoted 17 lines

regards,
Davide

 package/mongoose/Config.in   |   14 ++++++++++++++
 package/mongoose/mongoose.mk |   32 +++++++++++++++++++++++++++++---
 2 files changed, 43 insertions(+), 3 deletions(-)
package/mongoose/Config.in +2 -0
index 2526112..2b93ab8 100644
@@ -8,6 +8,20 @@ config BR2_PACKAGE_MONGOOSE
 
 	  https://github.com/valenok/mongoose
 
+if BR2_PACKAGE_MONGOOSE
+

package/mongoose/Config.in config BR2_PACKAGE_MONGOOSE · line 22

Quoted 10 lines
package/mongoose/Config.in +10 -0
+config BR2_PACKAGE_MONGOOSE_INSTALL_WEBSERVER
+	bool "Install standalone webserver"
+	help
+	  Install mongoose webserver.
+
+config BR2_PACKAGE_MONGOOSE_INSTALL_SHARED_LIBRARY
+	bool "Install shared library"
+	help
+	  Install shared library.
+

Are these options really needed? The webserver is tiny and the library only requires a single .c file to be built, so I think we should just unconditionally build/install both. If you really want to save the ~50k from your rootfs you can always remove it in your post build script.

Quoted 36 lines
package/mongoose/Config.in +2 -0
+endif
+
 comment "mongoose needs a toolchain w/ threads, largefile"
 	depends on BR2_USE_MMU
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_LARGEFILE
package/mongoose/mongoose.mk +16 -0
index a7164bb..3628c0c 100644
@@ -8,6 +8,7 @@ MONGOOSE_VERSION = 5.3
 MONGOOSE_SITE = $(call github,cesanta,mongoose,$(MONGOOSE_VERSION))
 MONGOOSE_LICENSE = GPLv2
 MONGOOSE_LICENSE_FILES = LICENSE
+MONGOOSE_INSTALL_STAGING = YES
 
 MONGOOSE_CFLAGS = $(TARGET_CFLAGS) $(TARGET_LDFLAGS)
 
@@ -17,15 +18,40 @@ MONGOOSE_DEPENDENCIES += openssl
 MONGOOSE_CFLAGS += -DNS_ENABLE_SSL -lssl -lcrypto -lz
 endif
 
+ifeq ($(BR2_PACKAGE_MONGOOSE_INSTALL_SHARED_LIBRARY),y)
+define MONGOOSE_INSTALL_SHARED_LIBRARY_CMDS
+	$(INSTALL) -D -m 755 $(@D)/libmongoose.so $(TARGET_DIR)/usr/lib
+endef
+
+define MONGOOSE_INSTALL_STAGING_SHARED_LIBRARY_CMDS
+	$(INSTALL) -D -m 755 $(@D)/libmongoose.so $(STAGING_DIR)/usr/lib
+	$(INSTALL) -D -m 644 $(@D)/mongoose.h $(STAGING_DIR)/usr/include
+endef
+
+endif
+
+ifeq ($(BR2_PACKAGE_MONGOOSE_INSTALL_WEBSERVER),y)
+define MONGOOSE_INSTALL_WEBSERVER_CMDS
+        $(INSTALL) -D -m 755 $(@D)/mongoose $(TARGET_DIR)/usr/sbin

package/mongoose/mongoose.mk MONGOOSE_DEPENDENCIES += openssl · line 45

Quoted 10 lines
package/mongoose/mongoose.mk +7 -0
+        $(INSTALL) -D -m 755 package/mongoose/S85mongoose \
+		$(TARGET_DIR)/etc/init.d
+endef
+endif
+
 define MONGOOSE_BUILD_CMDS
 	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D)/examples \
 		COPT="$(MONGOOSE_CFLAGS)"
+	$(TARGET_CC) $(@D)/mongoose.c -shared -fpic \
+		-o $(@D)/libmongoose.so -pthread -ldl

It should also use MONGOOSE_CFLAGS to ensure it gets built with openssl support if present like the example server.

Care to send an opdated patch fixing these issues?

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH v2 1/2 mongoose: bump to version 5.3

In reply to Davide Viti
Quoted 24 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Davide" == Davide Viti <[email protected]> writes:

From: Davide Viti <[email protected]>

---
Changes v1 -> v2:
- rebase
- update license to GPLv2 (Will Wagner)

Original patch content:

Mongoose has changed quite drastically in the last months. Here is a list of changes which had to be applied:

- Bump version from 3.7 to 5.3
- use tarball download via github helper iso git clone
- need largefile support
- compilation takes place into "examples"
- weberver source is now "server.c"
- adapt to new command line options
- SSL support now controlled via NS_ENABLE_SSL

Quoted 3 lines

I'd appreciate some feedback in particular on the SSL change: the old NO_SSL_DL and NO_SSL macros have been removed and the only SSL-related macro is now NS_ENABLE_SSL.

Most of this should go above the '---' line so it becomes part of the commit message.

Quoted 20 lines

+++ b/package/mongoose/mongoose.mk

package/mongoose/mongoose.mk +3 -5
@@ -4,10 +4,9 @@
 #
 ################################################################################
 
-MONGOOSE_VERSION = 3.7
-MONGOOSE_SOURCE = mongoose-$(MONGOOSE_VERSION).tgz
-MONGOOSE_SITE = https://mongoose.googlecode.com/files
-MONGOOSE_LICENSE = MIT
+MONGOOSE_VERSION = 5.3
+MONGOOSE_SITE = $(call github,cesanta,mongoose,$(MONGOOSE_VERSION))
+MONGOOSE_LICENSE = GPLv2
 MONGOOSE_LICENSE_FILES = LICENSE
 
 MONGOOSE_CFLAGS = $(TARGET_CFLAGS) $(TARGET_LDFLAGS)
@@ -15,18 +14,16 @@ MONGOOSE_CFLAGS = $(TARGET_CFLAGS) $(TARGET_LDFLAGS)
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
 MONGOOSE_DEPENDENCIES += openssl
 # directly linked
-MONGOOSE_CFLAGS += -DNO_SSL_DL -lssl -lcrypto -lz

package/mongoose/mongoose.mk MONGOOSE_CFLAGS = $(TARGET_CFLAGS) $(TARGET_LDFLAGS) · line 22

Quoted 10 lines
package/mongoose/mongoose.mk +3 -4
-else
-MONGOOSE_CFLAGS += -DNO_SSL
+MONGOOSE_CFLAGS += -DNS_ENABLE_SSL -lssl -lcrypto -lz
 endif
 
 define MONGOOSE_BUILD_CMDS
-	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D) \
-		linux COPT="$(MONGOOSE_CFLAGS)"
+	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D)/examples \
+		COPT="$(MONGOOSE_CFLAGS)"

COPT is not used anywhere in examples/Makefile. It seems like it now uses CFLAGS_EXTRA.

As we are only installing the "server" example, it doesn't make sense to build the other examples.

Committed with these fixes to next, thanks.

Signature · 1 line
Bye, Peter Korsgaard