A new port: www/mongoose

This commit is contained in:
Sergey Matveychuk 2014-08-04 14:25:43 +00:00
parent 709c6474c5
commit cb907fc9d3
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=364013
6 changed files with 205 additions and 0 deletions

View file

@ -539,6 +539,7 @@
SUBDIR += mohawk
SUBDIR += moinmoin
SUBDIR += monast
SUBDIR += mongoose
SUBDIR += mongrel2
SUBDIR += moodle24
SUBDIR += moodle25

89
www/mongoose/Makefile Normal file
View file

@ -0,0 +1,89 @@
# Created by: Boris Lytochkin (lytboris@gmail.com)
# $FreeBSD$
PORTNAME= mongoose
PORTVERSION= 5.3
CATEGORIES= www
MAINTAINER= lytboris@gmail.com
COMMENT= Small, fast, embeddable web server with CGI, SSL, Authorization
LICENSE= GPLv2
USE_GITHUB= yes
GH_ACCOUNT= cesanta
GH_TAGNAME= ${GH_COMMIT}
GH_COMMIT= 30a7965
USES= gmake dos2unix
ALL_TARGET= server
MAKE_ENV= LIBS=-lpthread
BUILD_WRKSRC= ${WRKSRC}/examples
USE_RC_SUBR= mongoose
NO_OPTIONS_SORT= YES
FS_DESC=Filesystem options
OPTIONS_MONGOOSE=AUTH CGI DAV DIRECTORY_LISTING LOGGING SSI
OPTIONS_NS=SSL IPV6 DEBUG
OPTIONS_DEFINE=${OPTIONS_MONGOOSE} ${OPTIONS_NS} DEBUG_HEXDUMP THREADS
OPTIONS_DEFAULT=${OPTIONS_DEFINE:NDEBUG*}
POPEN_DESC= Enable process execute in SSI
CGI_DESC= Enable CGI
AUTH_DESC= Enable authentication
DAV_DESC= Enable DAV (requires DIRECTORY_LISTING)
DIRECTORY_LISTING_DESC= Enable directory listing
LOGGING_DESC= Enable logging
SSI_DESC= Enable SSI
THREADS_DESC= Enable threads
SSL_DESC= Enable SSL
IPV6_DESC= Enable IPv6 support
DEBUG_DESC= Build with debug enabled
DEBUG_HEXDUMP_DESC= Enable hexdump of sent and received traffic
.include <bsd.port.options.mk>
CFLAGS_EXTRA=
.for FLAG in ${OPTIONS_MONGOOSE}
. if !${PORT_OPTIONS:M${FLAG}}
CFLAGS_EXTRA+=-DMONGOOSE_NO_${FLAG}
. endif
.endfor
.for FLAG in ${OPTIONS_NS}
. if ${PORT_OPTIONS:M${FLAG}}
CFLAGS_EXTRA+=-DNS_ENABLE_${FLAG}
. endif
.endfor
.if !${PORT_OPTIONS:MTHREADS}
CFLAGS_EXTRA+=-DNS_DISABLE_THREADS -DMONGOOSE_NO_THREADS
.endif
.if ${PORT_OPTIONS:MDEBUG_HEXDUMP}
CFLAGS_EXTRA+=-DNS_ENABLE_HEXDUMP
.endif
.if ${PORT_OPTIONS:MSSL}
USE_OPENSSL= YES
CFLAGS_EXTRA+= -lssl
.endif
.if !empty(PORT_OPTIONS:MDAV) && empty(PORT_OPTIONS:MDIRECTORY_LISTING)
BROKEN= DAV requires DIRECTORY_LISTING
.endif
MAKE_ENV+= CFLAGS_EXTRA="-DMONGOOSE_NO_WEBSOCKET ${CFLAGS_EXTRA}"
PLIST_FILES= bin/mongoose
do-install:
${MV} ${BUILD_WRKSRC}/server ${BUILD_WRKSRC}/mongoose
${INSTALL_PROGRAM} ${BUILD_WRKSRC}/mongoose ${STAGEDIR}${PREFIX}/bin
.include <bsd.port.mk>

2
www/mongoose/distinfo Normal file
View file

@ -0,0 +1,2 @@
SHA256 (mongoose-5.3.tar.gz) = 3ced399521edfa75a020f2b9457c5b4ba40c518139bb5237c1d88e4b2c85de16
SIZE (mongoose-5.3.tar.gz) = 109908

View file

@ -0,0 +1,39 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: mongoose
# REQUIRE: daemon
# Define these mongoose_* variables in one of these files:
# /etc/rc.conf
# /etc/rc.conf.local
# /etc/rc.conf.d/mongoose
#
# mongoose_enable Set to "YES" to run mongoose.
# mongoose_flags Flags passed to mongoose, see mongoose --help
. /etc/rc.subr
name="mongoose"
rcvar=mongoose_enable
command="%%PREFIX%%/bin/mongoose"
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#
mongoose_enable=${mongoose_enable-"NO"}
mongoose_flags=${mongoose_flags-"/var/empty"}
mongoose_pidfile=${mongoose_pidfile-"/var/run/mongoose"}
start_cmd="mongoose_start"
load_rc_config $name
mongoose_start () {
echo "Starting mongoose."
/usr/sbin/daemon -p $mongoose_pidfile $command $mongoose_flags >/dev/null 2>&1
}
run_rc_command "$1"

View file

@ -0,0 +1,65 @@
--- mongoose.c
+++ mongoose.c
@@ -1162,19 +1162,6 @@ typedef pid_t process_id_t;
#define MONGOOSE_IDLE_TIMEOUT_SECONDS 30
#endif
-#ifdef MONGOOSE_NO_SOCKETPAIR
-#define MONGOOSE_NO_CGI
-#endif
-
-#ifdef MONGOOSE_NO_FILESYSTEM
-#define MONGOOSE_NO_AUTH
-#define MONGOOSE_NO_CGI
-#define MONGOOSE_NO_DAV
-#define MONGOOSE_NO_DIRECTORY_LISTING
-#define MONGOOSE_NO_LOGGING
-#define MONGOOSE_NO_SSI
-#endif
-
struct vec {
const char *ptr;
int len;
--- mongoose.h
+++ mongoose.h
@@ -22,6 +22,40 @@
#define MONGOOSE_VERSION "5.4"
+#ifdef MONGOOSE_NO_SOCKETPAIR
+#ifndef MONGOOSE_NO_CGI
+#define MONGOOSE_NO_CGI
+#endif
+#endif
+
+#ifdef MONGOOSE_NO_FILESYSTEM
+#ifndef MONGOOSE_NO_AUTH
+#define MONGOOSE_NO_AUTH
+#endif
+#ifndef MONGOOSE_NO_CGI
+#define MONGOOSE_NO_CGI
+#endif
+#ifndef MONGOOSE_NO_DAV
+#define MONGOOSE_NO_DAV
+#endif
+#ifndef MONGOOSE_NO_DIRECTORY_LISTING
+#define MONGOOSE_NO_DIRECTORY_LISTING
+#endif
+#ifndef MONGOOSE_NO_LOGGING
+#define MONGOOSE_NO_LOGGING
+#endif
+#ifndef MONGOOSE_NO_SSI
+#define MONGOOSE_NO_SSI
+#endif
+#endif
+
+// DAV requires MONGOOSE_NO_DIRECTORY_LISTING
+#ifndef MONGOOSE_NO_DAV
+#ifdef MONGOOSE_NO_DIRECTORY_LISTING
+#undef MONGOOSE_NO_DIRECTORY_LISTING
+#endif
+#endif
+
#include <stdio.h> // required for FILE
#include <stddef.h> // required for size_t

9
www/mongoose/pkg-descr Normal file
View file

@ -0,0 +1,9 @@
Mongoose is a small, fast and easy to use web server. It supports
CGI, SSI, SSL, Digest auth, Websocket, WEbDAV, Resumed download, URL
rewrite, file blacklist. Having SHTTPD as a predecessor, another
feature of mongoose is the ability to embed it into existing C/C++
applications. Embedded API is very clean and simple.
Mongoose has small memory footprint. Use it when other
web servers like Apache are too heavy for your tasks.
WWW: https://github.com/cesanta/mongoose