[mapserver-commits] r12980 - in trunk/mapserver/mapcache: . apache
lib
svn at osgeo.org
svn at osgeo.org
Tue Jan 10 12:02:53 EST 2012
Author: aboudreault
Date: 2012-01-10 09:02:53 -0800 (Tue, 10 Jan 2012)
New Revision: 12980
Modified:
trunk/mapserver/mapcache/Makefile.vc
trunk/mapserver/mapcache/apache/mod_mapcache.c
trunk/mapserver/mapcache/lib/configuration_xml.c
trunk/mapserver/mapcache/lib/dimension.c
trunk/mapserver/mapcache/lib/ezxml.c
trunk/mapserver/mapcache/lib/tileset.c
trunk/mapserver/mapcache/nmake.opt
Log:
MapCache Windows build (#4106)
Modified: trunk/mapserver/mapcache/Makefile.vc
===================================================================
--- trunk/mapserver/mapcache/Makefile.vc 2012-01-06 13:16:16 UTC (rev 12979)
+++ trunk/mapserver/mapcache/Makefile.vc 2012-01-10 17:02:53 UTC (rev 12980)
@@ -22,19 +22,20 @@
# Main mapcache library.
#
-MAPCACHE_OBJS = src\axisorder.obj src\dimension.obj src\imageio_mixed.obj src\service_wms.obj \
- src\buffer.obj src\ezxml.obj src\imageio_png.obj src\service_wmts.obj \
- src\cache_disk.obj src\lock.obj src\services.obj \
- src\cache_memcache.obj src\grid.obj src\source.obj \
- src\cache_sqlite.obj src\http.obj src\source_gdal.obj \
- src\cache_tiff.obj src\image.obj src\service_demo.obj src\source_mapserver.obj \
- src\configuration.obj src\image_error.obj src\service_kml.obj src\source_wms.obj \
- src\configuration_xml.obj src\imageio.obj src\service_tms.obj src\tileset.obj \
- src\core.obj src\imageio_jpeg.obj src\service_ve.obj src\util.obj src\strptime.obj \
+MAPCACHE_OBJS = lib\axisorder.obj lib\dimension.obj lib\imageio_mixed.obj lib\service_wms.obj \
+ lib\buffer.obj lib\ezxml.obj lib\imageio_png.obj lib\service_wmts.obj \
+ lib\cache_disk.obj lib\lock.obj lib\services.obj \
+ lib\cache_memcache.obj lib\grid.obj lib\source.obj \
+ lib\cache_sqlite.obj lib\http.obj lib\source_gdal.obj \
+ lib\cache_tiff.obj lib\image.obj lib\service_demo.obj lib\source_mapserver.obj \
+ lib\configuration.obj lib\image_error.obj lib\service_kml.obj lib\source_wms.obj \
+ lib\configuration_xml.obj lib\imageio.obj lib\service_tms.obj lib\tileset.obj \
+ lib\core.obj lib\imageio_jpeg.obj lib\service_ve.obj lib\util.obj lib\strptime.obj \
$(REGEX_OBJ)
MAPCACHE_FCGI = mapcache.exe
+MAPCACHE_APACHE = mod_mapcache.dll
MAPCACHE_SEED = mapcache_seed.exe
#
@@ -42,7 +43,7 @@
#
default: all
-all: $(MAPCACHE_LIB) $(MAPCACHE_FCGI) $(MAPCACHE_SEED)
+all: $(MAPCACHE_LIB) $(MAPCACHE_FCGI) $(MAPCACHE_APACHE) $(MAPCACHE_SEED)
$(MAPCACHE_LIB): $(MAPCACHE_OBJS)
@@ -50,11 +51,15 @@
$(MAPCACHE_FCGI): $(MAPCACHE_LIB)
- $(CC) $(CFLAGS) src\fastcgi_mapcache.c /Femapcache.exe $(LIBS)
+ $(CC) $(CFLAGS) cgi\mapcache.c /Fecgi\mapcache.exe $(LIBS)
if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
+$(MAPCACHE_APACHE): $(MAPCACHE_LIB)
+ $(CC) $(CFLAGS) apache\mod_mapcache.c /link /DLL /out:apache\mod_mapcache.dll $(LIBS)
+ if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
+
$(MAPCACHE_SEED): $(MAPCACHE_LIB)
- $(CC) $(CFLAGS) src\mapcache_seed.c /Femapcache_seed.exe $(LIBS)
+ $(CC) $(CFLAGS) util\mapcache_seed.c /Feutil\mapcache_seed.exe $(LIBS)
if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
.c.obj:
@@ -65,8 +70,12 @@
clean:
- del src\*.obj
- del $(MAPCACHE_FCGI)
+ del lib\*.obj
+ del *.obj
+ del *.exp
+ del apache\$(MAPCACHE_APACHE)
+ del cgi\$(MAPCACHE_FCGI)
+ del util\$(MAPCACHE_SEED)
del *.lib
del *.manifest
Modified: trunk/mapserver/mapcache/apache/mod_mapcache.c
===================================================================
--- trunk/mapserver/mapcache/apache/mod_mapcache.c 2012-01-06 13:16:16 UTC (rev 12979)
+++ trunk/mapserver/mapcache/apache/mod_mapcache.c 2012-01-10 17:02:53 UTC (rev 12980)
@@ -40,7 +40,10 @@
#include <ap_mpm.h>
#include <http_log.h>
#include "mapcache.h"
+
+#ifndef _WIN32
#include <unistd.h>
+#endif
#ifdef AP_NEED_SET_MUTEX_PERMS
#include "unixd.h"
@@ -72,10 +75,11 @@
void apache_context_server_log(mapcache_context *c, mapcache_log_level level, char *message, ...) {
mapcache_context_apache_server *ctx = (mapcache_context_apache_server*)c;
va_list args;
+ char *msg;
+ int ap_log_level;
va_start(args,message);
- char *msg = apr_pvsprintf(c->pool,message,args);
+ msg = apr_pvsprintf(c->pool,message,args);
va_end(args);
- int ap_log_level;
switch(level) {
case MAPCACHE_DEBUG:
ap_log_level = APLOG_DEBUG;
@@ -110,9 +114,9 @@
void apache_context_request_log(mapcache_context *c, mapcache_log_level level, char *message, ...) {
mapcache_context_apache_request *ctx = (mapcache_context_apache_request*)c;
va_list args;
+ int ap_log_level;
va_start(args,message);
va_end(args);
- int ap_log_level;
switch(level) {
case MAPCACHE_DEBUG:
ap_log_level = APLOG_DEBUG;
@@ -169,10 +173,13 @@
static mapcache_context_apache_request* apache_request_context_create(request_rec *r) {
mapcache_context_apache_request *ctx = apr_pcalloc(r->pool, sizeof(mapcache_context_apache_request));
+ mapcache_server_cfg *cfg = NULL;
+ mapcache_cfg *config = NULL;
+
ctx->ctx.ctx.pool = r->pool;
/* lookup the configuration object given the configuration file name */
- mapcache_server_cfg* cfg = ap_get_module_config(r->server->module_config, &mapcache_module);
- mapcache_cfg *config = apr_hash_get(cfg->aliases,(void*)r->filename,APR_HASH_KEY_STRING);
+ cfg = ap_get_module_config(r->server->module_config, &mapcache_module);
+ config = apr_hash_get(cfg->aliases,(void*)r->filename,APR_HASH_KEY_STRING);
ctx->ctx.ctx.config = config;
ctx->request = r;
if(is_threaded) {
@@ -194,13 +201,14 @@
static int write_http_response(mapcache_context_apache_request *ctx, mapcache_http_response *response) {
request_rec *r = ctx->request;
int rc;
+ char *timestr;
if(response->mtime) {
ap_update_mtime(r, response->mtime);
if((rc = ap_meets_conditions(r)) != OK) {
return rc;
}
- char *timestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
+ timestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
apr_rfc822_date(timestr, response->mtime);
apr_table_setn(r->headers_out, "Last-Modified", timestr);
}
@@ -229,6 +237,9 @@
static int mod_mapcache_request_handler(request_rec *r) {
apr_table_t *params;
mapcache_request *request = NULL;
+ mapcache_context_apache_request *apache_ctx = NULL;
+ mapcache_http_response *http_response = NULL;
+ mapcache_context *global_ctx = NULL;
if (!r->handler || strcmp(r->handler, "mapcache")) {
return DECLINED;
@@ -238,8 +249,8 @@
}
- mapcache_context_apache_request *apache_ctx = apache_request_context_create(r);
- mapcache_context *global_ctx = (mapcache_context*)apache_ctx;
+ apache_ctx = apache_request_context_create(r);
+ global_ctx = (mapcache_context*)apache_ctx;
params = mapcache_http_parse_param_string(global_ctx, r->args);
@@ -249,8 +260,6 @@
mapcache_core_respond_to_error(global_ctx));
}
- mapcache_http_response *http_response = NULL;
-
if(request->type == MAPCACHE_REQUEST_GET_CAPABILITIES) {
mapcache_request_get_capabilities *req_caps = (mapcache_request_get_capabilities*)request;
request_rec *original;
@@ -305,6 +314,11 @@
static int mod_mapcache_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) {
mapcache_server_cfg* cfg = ap_get_module_config(s->module_config, &mapcache_module);
server_rec *sconf;
+ apr_status_t rv;
+#if APR_HAS_FORK
+ apr_proc_t proc;
+#endif
+ mapcache_context *ctx = (mapcache_context*)apache_server_context_create(s,p);
if(!cfg) {
ap_log_error(APLOG_MARK, APLOG_CRIT, 0, s, "configuration not found in server context");
@@ -317,8 +331,6 @@
#if APR_HAS_FORK
/* fork a child process to let it accomplish post-configuration tasks with the uid of the runtime user */
- apr_proc_t proc;
- apr_status_t rv;
rv = apr_proc_fork(&proc, ptemp);
if (rv == APR_INCHILD) {
#define ap_unixd_setup_child unixd_setup_child
@@ -364,7 +376,6 @@
return APR_EGENERAL;
}
#else /* APR_HAS_FORK */
- mapcache_context *ctx = (mapcache_context*)apache_server_context_create(s,p);
for (sconf = s; sconf; sconf = sconf->next) {
mapcache_server_cfg* config = ap_get_module_config(sconf->module_config, &mapcache_module);
if(config->aliases) {
@@ -438,6 +449,7 @@
static int mapcache_hook_intercept(request_rec *r)
{
mapcache_server_cfg *sconfig = ap_get_module_config(r->server->module_config, &mapcache_module);
+ apr_hash_index_t *entry;
if (!sconfig->aliases)
return DECLINED;
@@ -445,7 +457,7 @@
if (r->uri[0] != '/' && r->uri[0])
return DECLINED;
- apr_hash_index_t *entry = apr_hash_first(r->pool,sconfig->aliases);
+ entry = apr_hash_first(r->pool,sconfig->aliases);
/* loop through the entries to find one where the alias matches */
while (entry) {
@@ -470,12 +482,12 @@
static void mod_mapcache_register_hooks(apr_pool_t *p) {
+ static const char * const p1[] = { "mod_alias.c", "mod_rewrite.c", NULL };
+ static const char * const n1[]= { "mod_userdir.c",
+ "mod_vhost_alias.c", NULL };
ap_hook_child_init(mod_mapcache_child_init, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_post_config(mod_mapcache_post_config, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_handler(mod_mapcache_request_handler, NULL, NULL, APR_HOOK_MIDDLE);
- static const char * const p1[] = { "mod_alias.c", "mod_rewrite.c", NULL };
- static const char * const n1[]= { "mod_userdir.c",
- "mod_vhost_alias.c", NULL };
ap_hook_translate_name(mapcache_hook_intercept, p1, n1, APR_HOOK_MIDDLE);
}
Modified: trunk/mapserver/mapcache/lib/configuration_xml.c
===================================================================
--- trunk/mapserver/mapcache/lib/configuration_xml.c 2012-01-06 13:16:16 UTC (rev 12979)
+++ trunk/mapserver/mapcache/lib/configuration_xml.c 2012-01-10 17:02:53 UTC (rev 12980)
@@ -789,6 +789,7 @@
void mapcache_configuration_parse_xml(mapcache_context *ctx, const char *filename, mapcache_cfg *config) {
ezxml_t doc, node;
+ const char *mode;
doc = ezxml_parse_file(filename);
if (doc == NULL) {
ctx->set_error(ctx,400, "failed to parse file %s. Is it valid XML?", filename);
@@ -805,7 +806,7 @@
ctx->set_error(ctx,400, "failed to parse file %s. first node is not <mapcache>", filename);
goto cleanup;
}
- const char *mode = ezxml_attr(doc,"mode");
+ mode = ezxml_attr(doc,"mode");
if(mode) {
if(!strcmp(mode,"combined_mirror")) {
config->mode = MAPCACHE_MODE_MIRROR_COMBINED;
Modified: trunk/mapserver/mapcache/lib/dimension.c
===================================================================
--- trunk/mapserver/mapcache/lib/dimension.c 2012-01-06 13:16:16 UTC (rev 12979)
+++ trunk/mapserver/mapcache/lib/dimension.c 2012-01-10 17:02:53 UTC (rev 12980)
@@ -146,6 +146,7 @@
static void _mapcache_dimension_regex_parse_xml(mapcache_context *ctx, mapcache_dimension *dim,
ezxml_t node) {
mapcache_dimension_regex *dimension;
+ int rc;
const char *entry = node->txt;
if(!entry || !*entry) {
ctx->set_error(ctx,400,"failed to parse dimension regex: none supplied");
Modified: trunk/mapserver/mapcache/lib/ezxml.c
===================================================================
--- trunk/mapserver/mapcache/lib/ezxml.c 2012-01-06 13:16:16 UTC (rev 12979)
+++ trunk/mapserver/mapcache/lib/ezxml.c 2012-01-10 17:02:53 UTC (rev 12980)
@@ -33,6 +33,7 @@
#else
#define EZXML_NOMMAP 1
#define snprintf _snprintf
+#define vsnprintf _vsnprintf
#endif
#include <sys/types.h>
Modified: trunk/mapserver/mapcache/lib/tileset.c
===================================================================
--- trunk/mapserver/mapcache/lib/tileset.c 2012-01-06 13:16:16 UTC (rev 12979)
+++ trunk/mapserver/mapcache/lib/tileset.c 2012-01-10 17:02:53 UTC (rev 12980)
@@ -33,6 +33,10 @@
#include <apr_file_io.h>
#include <math.h>
+#ifdef _WIN32
+#include <limits.h>
+#endif
+
char* mapcache_tileset_metatile_resource_key(mapcache_context *ctx, mapcache_metatile *mt) {
char *lockname = apr_psprintf(ctx->pool,
"%d-%d-%d-%s",
Modified: trunk/mapserver/mapcache/nmake.opt
===================================================================
--- trunk/mapserver/mapcache/nmake.opt 2012-01-06 13:16:16 UTC (rev 12979)
+++ trunk/mapserver/mapcache/nmake.opt 2012-01-10 17:02:53 UTC (rev 12980)
@@ -75,8 +75,9 @@
#APR_DIR = $(MAPCACHE_BASE)\..\..\apr-1.4.5
APR_DIR = $(MAPCACHE_BASE)\..\..\apr-dist
+# APACHE HTTPD (Only required for apache module)
+APACHE_DIR=$(MAPCACHE_BASE)\..\httpd
-
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# PNG support
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -158,8 +159,10 @@
APR_INC=-I$(APR_DIR)\include
APR_LIB=$(APR_DIR)/lib/apr-1.lib $(APR_DIR)/lib/aprutil-1.lib $(APR_DIR)/lib/libapr-1.lib $(APR_DIR)/lib/libaprutil-1.lib
+#APACHE
+APACHE_INC=-I$(APACHE_DIR)\include
+APACHE_LIB=$(APACHE_DIR)\lib\libhttpd.lib
-
# Setup REGEX object and includes
REGEX_OBJ=$(REGEX_DIR)\regex.obj
REGEX_INC=-I$(REGEX_DIR)
@@ -176,13 +179,13 @@
########################################################################
!IFNDEF EXTERNAL_LIBS
-EXTERNAL_LIBS= $(PNG_LIB) $(CURL_LIB) $(JPEG_LIB) $(APR_LIB) $(FRIBIDI_LIB) $(FCGI_LIB)
+EXTERNAL_LIBS= $(PNG_LIB) $(CURL_LIB) $(JPEG_LIB) $(APR_LIB) $(APACHE_LIB) $(FRIBIDI_LIB) $(FCGI_LIB)
!ENDIF
LIBS=$(MAPCACHE_LIB) $(EXTERNAL_LIBS)
!IFNDEF INCLUDES
-INCLUDES=$(MAPCACHE_INC) $(APR_INC) $(REGEX_INC) $(PNG_INC) $(ZLIB_INC) $(CURL_INC) $(JPEG_INC) $(FCGI_INC)
+INCLUDES=$(MAPCACHE_INC) $(APR_INC) $(APACHE_INC) $(REGEX_INC) $(PNG_INC) $(ZLIB_INC) $(CURL_INC) $(JPEG_INC) $(FCGI_INC)
!ENDIF
More information about the mapserver-commits
mailing list