Skip to contentSkip to conversation

mongoose: provide libmongoose.a static library

PATCH New Davide Viti 2 participants 2 messages May 27, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 mongoose: provide libmongoose.a static library

The package provides a webserver and, eventually, a library: this is what Centos, among other distros, is doing.

---
- unconditionally create static rather than shared library (Peter Korsgaard)
- honour $(MONGOOSE_CFLAGS) when building mongoose.c (Peter Korsgaard)
- don't exceed 80 columns in mongoose.mk
- install libmongoose.a as 644 rather than 755
- update github URL in Config.in

 package/mongoose/Config.in   |  2 +-
 package/mongoose/mongoose.mk | 13 +++++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)
package/mongoose/Config.in +1 -1
index 2526112..8060942 100644
@@ -6,7 +6,7 @@ config BR2_PACKAGE_MONGOOSE
 	help
 	  Mongoose is a small and easy to use web server
 
-	  https://github.com/valenok/mongoose
+	  https://github.com/cesanta/mongoose
 
 comment "mongoose needs a toolchain w/ threads, largefile"
 	depends on BR2_USE_MMU
package/mongoose/mongoose.mk +11 -2
index 75a4d3f..bb1bed3 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)
 
@@ -20,12 +21,20 @@ endif
 define MONGOOSE_BUILD_CMDS
 	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D)/examples \
 		CFLAGS_EXTRA="$(MONGOOSE_CFLAGS)" server
+	$(TARGET_CC) -c $(@D)/mongoose.c $(MONGOOSE_CFLAGS) -o $(@D)/mongoose.o
+	$(TARGET_AR) rcs $(@D)/libmongoose.a $(@D)/mongoose.o
 endef
 
 define MONGOOSE_INSTALL_TARGET_CMDS
-	$(INSTALL) -D -m 755 $(@D)/examples/server $(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
+		$(TARGET_DIR)/etc/init.d
+endef
+
+define MONGOOSE_INSTALL_STAGING_CMDS
+	$(INSTALL) -D -m 644 $(@D)/libmongoose.a $(STAGING_DIR)/usr/lib
+	$(INSTALL) -D -m 644 $(@D)/mongoose.h $(STAGING_DIR)/usr/include
 endef
 
 $(eval $(generic-package))
Signature · 1 line
2.0.0.rc0
#1 lore raw

PATCH v3 1/1 mongoose: provide libmongoose.a static library

Quoted 48 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

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

The package provides a webserver and, eventually, a library: this is what Centos, among other distros, is doing.

---
- unconditionally create static rather than shared library (Peter Korsgaard)
- honour $(MONGOOSE_CFLAGS) when building mongoose.c (Peter Korsgaard)
- don't exceed 80 columns in mongoose.mk
- install libmongoose.a as 644 rather than 755
- update github URL in Config.in

 package/mongoose/Config.in   |  2 +-
 package/mongoose/mongoose.mk | 13 +++++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)
package/mongoose/Config.in +1 -1
index 2526112..8060942 100644
@@ -6,7 +6,7 @@ config BR2_PACKAGE_MONGOOSE
 	help
 	  Mongoose is a small and easy to use web server
 
-	  https://github.com/valenok/mongoose
+	  https://github.com/cesanta/mongoose
 
 comment "mongoose needs a toolchain w/ threads, largefile"
 	depends on BR2_USE_MMU
package/mongoose/mongoose.mk +2 -0
index 75a4d3f..bb1bed3 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)
 
@@ -20,12 +21,20 @@ endif
 define MONGOOSE_BUILD_CMDS
 	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D)/examples \
 		CFLAGS_EXTRA="$(MONGOOSE_CFLAGS)" server
+	$(TARGET_CC) -c $(@D)/mongoose.c $(MONGOOSE_CFLAGS) -o $(@D)/mongoose.o

package/mongoose/mongoose.mk endif · line 32

Quoted 10 lines
package/mongoose/mongoose.mk +4 -2
+	$(TARGET_AR) rcs $(@D)/libmongoose.a $(@D)/mongoose.o
 endef
 
 define MONGOOSE_INSTALL_TARGET_CMDS
-	$(INSTALL) -D -m 755 $(@D)/examples/server $(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
+		$(TARGET_DIR)/etc/init.d

This is wrong. install -D creates the needed destination directories, but you need to specify the destination file name. If the init.d directory doesn't exist yet, then you end up with an init.d file with the content of S85mongoose.

package/mongoose/mongoose.mk endif · line 37

Quoted 5 lines
package/mongoose/mongoose.mk +5 -0
+endef
+
+define MONGOOSE_INSTALL_STAGING_CMDS
+	$(INSTALL) -D -m 644 $(@D)/libmongoose.a $(STAGING_DIR)/usr/lib
+	$(INSTALL) -D -m 644 $(@D)/mongoose.h $(STAGING_DIR)/usr/include

Same comment as for S85mongoose.

Committed with these fixes to next, thanks.

Signature · 1 line
Bye, Peter Korsgaard