Add package for mongoose web server
PATCH 1/1 Add package for mongoose web server
--- package/Config.in | 1 + package/mongoose/Config.in | 13 ++++++ package/mongoose/mongoose-3.3-init-file.patch | 44 ++++++++++++++++++++ package/mongoose/mongoose-3.3-no-auth.patch | 55 +++++++++++++++++++++++++ package/mongoose/mongoose.mk | 38 +++++++++++++++++ 5 files changed, 151 insertions(+), 0 deletions(-) create mode 100644 package/mongoose/Config.in create mode 100644 package/mongoose/mongoose-3.3-init-file.patch create mode 100644 package/mongoose/mongoose-3.3-no-auth.patch create mode 100644 package/mongoose/mongoose.mk
package/Config.in +1 -0
@@ -603,6 +603,7 @@ source "package/linphone/Config.in" source "package/lrzsz/Config.in" source "package/macchanger/Config.in" source "package/mii-diag/Config.in" +source "package/mongoose/Config.in" source "package/mrouted/Config.in" source "package/msmtp/Config.in" source "package/mutt/Config.in"
package/mongoose/Config.in new file +13 -0
@@ -0,0 +1,13 @@ +config BR2_PACKAGE_MONGOOSE + bool "mongoose wen server" + help + Mongoose small web server + + https://github.com/valenok/mongoose + +config BR2_PACKAGE_MONGOOSE_NO_PUT_AUTH + bool "Disable PUT authorization" + depends on BR2_PACKAGE_MONGOOSE + default n + help + Sometimes you don't need PUT authorization.
package/mongoose/mongoose-3.3-init-file.patch new file +44 -0
44 lines not on this page · raw message
package/mongoose/mongoose-3.3-no-auth.patch new file +55 -0
55 lines not on this page · raw message
package/mongoose/mongoose.mk new file +38 -0
@@ -0,0 +1,38 @@ +# Package for mongoose web server. +# This has been patched with an extension to allow PUT with no authorization. +# +MONGOOSE_VERSION = 3.3 +MONGOOSE_SITE = http://github.com/valenok/mongoose/tarball/master +MONGOOSE_LICENSE = MIT +MONGOOSE_LICENSE_FILES = COPYING +MONGOOSE_INSTALL_STAGING = YES +MONGOOSE_INSTALL_TARGET = YES + +MONGOOSE_OPTIONAL_DEFINES = -DNO_SSL +ifeq ($(BR2_PACKAGE_MONGOOSE_NO_PUT_AUTH),y) +MONGOOSE_OPTIONAL_DEFINES += -DNO_PUT_AUTH +endif + +define MONGOOSE_BUILD_CMDS + $(MAKE) CC="$(TARGET_CC)" LD="$TARGETLD)" -C $(@D) linux COPT="$(MONGOOSE_OPTIONAL_DEFINES)" +endef + +define MONGOOSE_INSTALL_STAGING_CMDS + $(INSTALL) -d $(STAGING_DIR)/sbin + $(INSTALL) -d $(STAGING_DIR)/etc + $(INSTALL) -d $(STAGING_DIR)/etc/init.d + $(INSTALL) -D -m 755 $(@D)/mongoose $(STAGING_DIR)/sbin/mongoose + $(INSTALL) -D -m 755 $(@D)/mongoose.init $(STAGING_DIR)/etc/init.d/mongoose +endef + +define MONGOOSE_INSTALL_TARGET_CMDS + $(INSTALL) -d $(TARGET_DIR)/sbin + $(INSTALL) -d $(TARGET_DIR)/etc + $(INSTALL) -d $(TARGET_DIR)/etc/init.d + $(INSTALL) -D -m 755 $(@D)/mongoose $(TARGET_DIR)/sbin/mongoose + $(INSTALL) -D -m 755 $(@D)/mongoose.init $(TARGET_DIR)/etc/init.d/mongoose +endef + + +$(eval $(generic-package)) +
Signature · 1 line
1.7.1
PATCH 1/1 Add package for mongoose web server
Hi Charles,
Quoted 1 line · Charles Manning
Signed-off-by Charles Manning<[email protected]>
[snip]
package/mongoose/Config.in line 2
Quoted 8 lines
package/mongoose/Config.in new file +2
-0@@ -0,0 +1,13 @@ +config BR2_PACKAGE_MONGOOSE + bool "mongoose wen server"
All other web servers just give their name, so:
bool "mongoose"
Missing:
depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_USE_WCHAR
package/mongoose/Config.in line 11
Quoted 9 lines
package/mongoose/Config.in new file +9
-0+ help + Mongoose small web server + + https://github.com/valenok/mongoose + +config BR2_PACKAGE_MONGOOSE_NO_PUT_AUTH + bool "Disable PUT authorization" + depends on BR2_PACKAGE_MONGOOSE + default n
default n is redundant because it is the default.
I prefer package-specific extra options to be wrapped in a if...endif
instead of using 'depends on'.
Quoted 2 lines
package/mongoose/Config.in new file +2
-0+ help + Sometimes you don't need PUT authorization.
[snip]
Quoted 6 lines
package/mongoose/mongoose-3.3-no-auth.patch new file +0
-0
package/mongoose/mongoose-3.3-no-auth.patch line 8
Quoted 8 lines
package/mongoose/mongoose-3.3-no-auth.patch new file +8
-0@@ -0,0 +1,55 @@ +From db714636f86d79be33ffe8f2408c8731b5969208 Mon Sep 17 00:00:00 2001 +From: Charles Manning<[email protected]> +Date: Mon, 10 Dec 2012 10:14:20 +1300 +Subject: [PATCH] Add NO_PUT_AUTH option to allow put with not authorization + +Sometimes you really don't want the security. + +Signed-off-by: Charles Manning<[email protected]>
Although this is a useful addition, it's really a new feature and not
a cross-compilation fix. We normally don't include new features in buildroot patches.
Could you upstream this patch? Sergey is pretty quick with accepting patches.
[snip]
package/mongoose/mongoose.mk line 3
Quoted 9 lines
package/mongoose/mongoose.mk new file +3
-0@@ -0,0 +1,38 @@ +# Package for mongoose web server. +# This has been patched with an extension to allow PUT with no authorization. +#
Although on the last buildroot developer meeting some doubts were voices
about its usefulness, the rule is still that the .mk file should have the following header:
#############################################################
#
# mongoose # #############################################################
package/mongoose/mongoose.mk line 8
Quoted 5 lines
package/mongoose/mongoose.mk new file +5
-0+MONGOOSE_VERSION = 3.3 +MONGOOSE_SITE = http://github.com/valenok/mongoose/tarball/master +MONGOOSE_LICENSE = MIT +MONGOOSE_LICENSE_FILES = COPYING +MONGOOSE_INSTALL_STAGING = YES
Why install in staging? You're not installing libraries or headers.
That said, mongoose is often used as an embedded web server, so it
would be useful to have the option to:
- install the library and include file in staging;
- not install the executable and init script to target.
But it's OK if you're not ready to do this; in that case, just
remove the INSTALL_STAGING line.
package/mongoose/mongoose.mk line 9
Quoted 1 line
package/mongoose/mongoose.mk new file +1
-0+MONGOOSE_INSTALL_TARGET = YES
This is the default.
package/mongoose/mongoose.mk line 11
Quoted 2 lines
package/mongoose/mongoose.mk new file +2
-0+ +MONGOOSE_OPTIONAL_DEFINES = -DNO_SSL
Ideally, SSL should be enabled if BR2_PACKAGE_OPENSSL is y.
Adding support for HAVE_MD5, NDEBUG, NO_CGI and USE_LUA would also be
nice.
package/mongoose/mongoose.mk line 13
Quoted 2 lines
package/mongoose/mongoose.mk new file +2
-0+ifeq ($(BR2_PACKAGE_MONGOOSE_NO_PUT_AUTH),y) +MONGOOSE_OPTIONAL_DEFINES += -DNO_PUT_AUTH
If the patch is removed then obviously this should also be removed.
package/mongoose/mongoose.mk line 17
Quoted 4 lines
package/mongoose/mongoose.mk new file +4
-0+endif + +define MONGOOSE_BUILD_CMDS + $(MAKE) CC="$(TARGET_CC)" LD="$TARGETLD)" -C $(@D) linux COPT="$(MONGOOSE_OPTIONAL_DEFINES)"
Missing ( in $(TARGET_LD). But the Makefile doesn't use LD so it's
redundant.
TARGET_CFLAGS and TARGET_LDFLAGS should also be passed - but mongoose'sMakefile doesn't support that. Your options are:
- Patch the Makefile to use CFLAGS += instead of CFLAGS =; if you do that, also rename LINFLAGS to LDFLAGS, and use += instead of = for that as well. And of course upstream this patch.
- Add TARGET_CFLAGS to COPT. You could also ad TARGET_LDFLAGS because there is anyway no object file compilation, but it's not ideal. If you leave out TARGET_LDFLAGS it's not such a big deal anyway because it's not often used.
- Don't use the Makefile, but just run:
cd $(@D); $(TARGET_CC) $(TARGET_CFLAGS) mongoose.c main.c \ $(TARGET_LDFLAGS) -ldl -pthread
package/mongoose/mongoose.mk line 25
Quoted 8 lines
package/mongoose/mongoose.mk new file +8
-0+endef + +define MONGOOSE_INSTALL_STAGING_CMDS + $(INSTALL) -d $(STAGING_DIR)/sbin + $(INSTALL) -d $(STAGING_DIR)/etc + $(INSTALL) -d $(STAGING_DIR)/etc/init.d + $(INSTALL) -D -m 755 $(@D)/mongoose $(STAGING_DIR)/sbin/mongoose + $(INSTALL) -D -m 755 $(@D)/mongoose.init $(STAGING_DIR)/etc/init.d/mongoose
Neither of these should be installed in staging. As I said earlier, it does
make sense to install the header and the .so.
package/mongoose/mongoose.mk line 31
Quoted 6 lines
package/mongoose/mongoose.mk new file +6
-0+endef + +define MONGOOSE_INSTALL_TARGET_CMDS + $(INSTALL) -d $(TARGET_DIR)/sbin + $(INSTALL) -d $(TARGET_DIR)/etc + $(INSTALL) -d $(TARGET_DIR)/etc/init.d
The install -D below already creates the directories, so these three are redundant.
package/mongoose/mongoose.mk line 38
Quoted 7 lines
package/mongoose/mongoose.mk new file +7
-0+ $(INSTALL) -D -m 755 $(@D)/mongoose $(TARGET_DIR)/sbin/mongoose + $(INSTALL) -D -m 755 $(@D)/mongoose.init $(TARGET_DIR)/etc/init.d/mongoose +endef + + +$(eval $(generic-package)) +
Redundant empty line.
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286540 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
PATCH 1/1 Add package for mongoose web server
In reply to Charles ManningQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Charles" == Charles Manning <[email protected]> writes:
Charles> Signed-off-by: Charles Manning <[email protected]> Charles> ---
Charles> package/Config.in | 1 + Charles> package/mongoose/Config.in | 13 ++++++ Charles> package/mongoose/mongoose-3.3-init-file.patch | 44 ++++++++++++++++++++ Charles> package/mongoose/mongoose-3.3-no-auth.patch | 55 +++++++++++++++++++++++++ Charles> package/mongoose/mongoose.mk | 38 +++++++++++++++++
Hi,
I fixed up a number of issues here (see below) and committed, thanks.
A lot of the issues were also pointed out by Arnout in his review.
Charles> 5 files changed, 151 insertions(+), 0 deletions(-) Charles> create mode 100644 package/mongoose/Config.in Charles> create mode 100644 package/mongoose/mongoose-3.3-init-file.patch Charles> create mode 100644 package/mongoose/mongoose-3.3-no-auth.patch Charles> create mode 100644 package/mongoose/mongoose.mk
Charles> diff --git a/package/Config.in b/package/Config.in Charles> index 5ba1f05..a3d2590 100644
Charles> --- a/package/Config.in
Charles> +++ b/package/Config.in
Charles> @@ -603,6 +603,7 @@ source "package/linphone/Config.in"
Charles> source "package/lrzsz/Config.in" Charles> source "package/macchanger/Config.in" Charles> source "package/mii-diag/Config.in" Charles> +source "package/mongoose/Config.in" Charles> source "package/mrouted/Config.in" Charles> source "package/msmtp/Config.in" Charles> source "package/mutt/Config.in"
Charles> diff --git a/package/mongoose/Config.in b/package/mongoose/Config.in Charles> new file mode 100644
Charles> index 0000000..39806f9
Charles> --- /dev/null
Charles> +++ b/package/mongoose/Config.in
Charles> @@ -0,0 +1,13 @@
Charles> +config BR2_PACKAGE_MONGOOSE
It needs threads support in toolchain.
Charles> + bool "mongoose wen server"
I simply made this "mongoose"
Charles> + help
Charles> + Mongoose small web server
Charles> +
Charles> + https://github.com/valenok/mongoose
Charles> +
Charles> +config BR2_PACKAGE_MONGOOSE_NO_PUT_AUTH
Charles> + bool "Disable PUT authorization"
Charles> + depends on BR2_PACKAGE_MONGOOSE
Charles> + default n
Charles> + help
Charles> + Sometimes you don't need PUT authorization.
We really don't want to carry feature patches in buildroot, so I've dropped the patch and this option.
Charles> diff --git a/package/mongoose/mongoose-3.3-init-file.patch b/package/mongoose/mongoose-3.3-init-file.patch
This should just be a file in package/mongoose, instead of a patch adding it in the build directory.
Charles> +++ b/package/mongoose/mongoose.mk
Charles> @@ -0,0 +1,38 @@
Charles> +# Package for mongoose web server.
Charles> +# This has been patched with an extension to allow PUT with no authorization.
I've changed this to use our normal file header.
Charles> +#
Charles> +MONGOOSE_VERSION = 3.3
Charles> +MONGOOSE_SITE = http://github.com/valenok/mongoose/tarball/master
This doesn't seem to download the real 3.3 version, so I've changed it to the google code download location.
Charles> +MONGOOSE_LICENSE = MIT
Charles> +MONGOOSE_LICENSE_FILES = COPYING
Charles> +MONGOOSE_INSTALL_STAGING = YES
Charles> +MONGOOSE_INSTALL_TARGET = YES
INSTALL_TARGET defaults to yes, and installing the webserver to staging doesn't make much sense. I know mongoose can be embedded in applications, but this is done by copying mongoose.{c,h} into your project, not by linking to a library.
Charles> +
Charles> +MONGOOSE_OPTIONAL_DEFINES = -DNO_SSL Charles> +ifeq ($(BR2_PACKAGE_MONGOOSE_NO_PUT_AUTH),y) Charles> +MONGOOSE_OPTIONAL_DEFINES += -DNO_PUT_AUTH Charles> +endif
Charles> +
Charles> +define MONGOOSE_BUILD_CMDS
Charles> + $(MAKE) CC="$(TARGET_CC)" LD="$TARGETLD)" -C $(@D) linux COPT="$(MONGOOSE_OPTIONAL_DEFINES)"
It is TARGET_LD, not TARGETLD.
We should also ensure TARGET_CFLAGS and TARGET_LDFLAGS are used, so I've added those to COPTS (and called the variable MONGOOSE_CFLAGS).
Charles> +endef
Charles> +
Charles> +define MONGOOSE_INSTALL_STAGING_CMDS
Charles> + $(INSTALL) -d $(STAGING_DIR)/sbin
Charles> + $(INSTALL) -d $(STAGING_DIR)/etc
Charles> + $(INSTALL) -d $(STAGING_DIR)/etc/init.d
Charles> + $(INSTALL) -D -m 755 $(@D)/mongoose $(STAGING_DIR)/sbin/mongoose
Charles> + $(INSTALL) -D -m 755 $(@D)/mongoose.init $(STAGING_DIR)/etc/init.d/mongoose
Charles> +endef
This can be dropped.
Charles> +
Charles> +define MONGOOSE_INSTALL_TARGET_CMDS
Charles> + $(INSTALL) -d $(TARGET_DIR)/sbin
Charles> + $(INSTALL) -d $(TARGET_DIR)/etc
Charles> + $(INSTALL) -d $(TARGET_DIR)/etc/init.d
Charles> + $(INSTALL) -D -m 755 $(@D)/mongoose $(TARGET_DIR)/sbin/mongoose
Charles> + $(INSTALL) -D -m 755 $(@D)/mongoose.init $(TARGET_DIR)/etc/init.d/mongoose
Charles> +endef
install -D creates the needed directories, so all the -d lines can be dropped. As mentioned above, the init script should just be a file in package/mongoose, and be copied to etc/init.d/SXXmongoose, where XX is a number. To match E.G. tinyhttpd I've used XX = 85.
Charles> +
Charles> +$(eval $(generic-package))
Charles> +
No empty line after generic-package.
Signature · 1 line
Bye, Peter Korsgaard