[Pkg-javascript-commits] [node-mapnik] 10/11: Add patches from upstream master branch for Mapnik 3.0.12 support.
Bas Couwenberg
sebastic at debian.org
Sat Aug 6 14:57:56 UTC 2016
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository node-mapnik.
commit c6af9d82911b404d25840851f9bed2a0263ca573
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Sat Aug 6 16:30:18 2016 +0200
Add patches from upstream master branch for Mapnik 3.0.12 support.
---
debian/changelog | 1 +
...ast-to-match-value_holder-char-const-ctor.patch | 361 +++++++++++++++++++++
...ile-against-both-mapnik-3.0.12-and-before.patch | 35 ++
debian/patches/series | 2 +
4 files changed, 399 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 54af975..cff2c20 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,7 @@ node-mapnik (3.5.13+dfsg-1) UNRELEASED; urgency=medium
* Add upstream metadata.
* Add Upstream-Name & Upstream-Contact to copyright file.
* Enable verbose pre-gyp output.
+ * Add patches from upstream master branch for Mapnik 3.0.12 support.
-- Bas Couwenberg <sebastic at debian.org> Fri, 05 Aug 2016 23:41:18 +0200
diff --git a/debian/patches/0001-add-const-cast-to-match-value_holder-char-const-ctor.patch b/debian/patches/0001-add-const-cast-to-match-value_holder-char-const-ctor.patch
new file mode 100644
index 0000000..a0a8ea7
--- /dev/null
+++ b/debian/patches/0001-add-const-cast-to-match-value_holder-char-const-ctor.patch
@@ -0,0 +1,361 @@
+From a6ec507bffd3cb8e9c8dc3872be7154fdc5201b1 Mon Sep 17 00:00:00 2001
+From: artemp <artem at mapnik.org>
+Date: Tue, 26 Jul 2016 13:24:35 +0200
+Subject: add const cast to match value_holder(char const*) ctor
+
+---
+ src/mapnik_datasource.cpp | 5 +--
+ src/mapnik_map.cpp | 96 ++++++++++++++++++++--------------------
+ src/mapnik_memory_datasource.cpp | 6 +--
+ 3 files changed, 53 insertions(+), 54 deletions(-)
+
+--- a/src/mapnik_datasource.cpp
++++ b/src/mapnik_datasource.cpp
+@@ -1,4 +1,3 @@
+-
+ #include "mapnik_datasource.hpp"
+ #include "mapnik_featureset.hpp"
+ #include "utils.hpp"
+@@ -21,7 +20,7 @@ Nan::Persistent<v8::FunctionTemplate> Da
+
+ /**
+ * **`mapnik.Datasource`**
+- *
++ *
+ * A Datasource object. This is the connector from Mapnik to any kind
+ * of file, network, or database source of geographical data.
+ *
+@@ -103,7 +102,7 @@ NAN_METHOD(Datasource::New)
+ v8::Local<v8::Value> name = names->Get(i)->ToString();
+ v8::Local<v8::Value> value = options->Get(name);
+ // TODO - don't treat everything as strings
+- params[TOSTR(name)] = TOSTR(value);
++ params[TOSTR(name)] = const_cast<char const*>(TOSTR(value));
+ i++;
+ }
+
+--- a/src/mapnik_map.cpp
++++ b/src/mapnik_map.cpp
+@@ -51,7 +51,7 @@ Nan::Persistent<v8::FunctionTemplate> Ma
+
+ /**
+ * **`mapnik.Map`**
+- *
++ *
+ * A map in mapnik is an object that combines data sources and styles in
+ * a way that lets you produce styled cartographic output.
+ *
+@@ -73,13 +73,13 @@ Nan::Persistent<v8::FunctionTemplate> Ma
+ * @example
+ * var map = new mapnik.Map(25, 25, '+init=epsg:3857');
+ * console.log(map);
+- * // {
++ * // {
+ * // aspect_fix_mode: 0,
+ * // parameters: {},
+ * // background: undefined,
+ * // maximumExtent: undefined,
+ * // bufferedExtent: [ NaN, NaN, NaN, NaN ],
+- * // extent:
++ * // extent:
+ * // [ 1.7976931348623157e+308,
+ * // 1.7976931348623157e+308,
+ * // -1.7976931348623157e+308,
+@@ -87,7 +87,7 @@ Nan::Persistent<v8::FunctionTemplate> Ma
+ * // bufferSize: 0,
+ * // height: 400,
+ * // width: 600,
+- * // srs: '+init=epsg:3857'
++ * // srs: '+init=epsg:3857'
+ * // }
+ */
+ void Map::Initialize(v8::Local<v8::Object> target) {
+@@ -302,7 +302,7 @@ NAN_GETTER(Map::get_prop)
+ else
+ return;
+ }
+- else //if (a == "parameters")
++ else //if (a == "parameters")
+ {
+ v8::Local<v8::Object> ds = Nan::New<v8::Object>();
+ mapnik::parameters const& params = m->map_->get_extra_parameters();
+@@ -419,7 +419,7 @@ NAN_SETTER(Map::set_prop)
+ v8::Local<v8::Value> name = names->Get(i)->ToString();
+ v8::Local<v8::Value> a_value = obj->Get(name);
+ if (a_value->IsString()) {
+- params[TOSTR(name)] = TOSTR(a_value);
++ params[TOSTR(name)] = const_cast<char const*>(TOSTR(a_value));
+ } else if (a_value->IsNumber()) {
+ double num = a_value->NumberValue();
+ // todo - round
+@@ -440,11 +440,11 @@ NAN_SETTER(Map::set_prop)
+
+ /**
+ * Load fonts from local or external source
+- *
++ *
+ * @name loadFonts
+ * @memberof Map
+ * @instance
+- *
++ *
+ */
+ NAN_METHOD(Map::loadFonts)
+ {
+@@ -1465,8 +1465,8 @@ NAN_METHOD(Map::zoomToBox)
+ {
+ Nan::ThrowError("Must provide 4 arguments: minx,miny,maxx,maxy");
+ return;
+- }
+- else if (info[0]->IsNumber() &&
++ }
++ else if (info[0]->IsNumber() &&
+ info[1]->IsNumber() &&
+ info[2]->IsNumber() &&
+ info[3]->IsNumber())
+@@ -1827,15 +1827,15 @@ NAN_METHOD(Map::render)
+ uv_queue_work(uv_default_loop(), &closure->request, EIO_RenderGrid, (uv_after_work_cb)EIO_AfterRenderGrid);
+ }
+ #endif
+- else if (Nan::New(VectorTile::constructor)->HasInstance(obj))
++ else if (Nan::New(VectorTile::constructor)->HasInstance(obj))
+ {
+
+ vector_tile_baton_t *closure = new vector_tile_baton_t();
+
+- if (options->Has(Nan::New("image_scaling").ToLocalChecked()))
++ if (options->Has(Nan::New("image_scaling").ToLocalChecked()))
+ {
+ v8::Local<v8::Value> param_val = options->Get(Nan::New("image_scaling").ToLocalChecked());
+- if (!param_val->IsString())
++ if (!param_val->IsString())
+ {
+ delete closure;
+ Nan::ThrowTypeError("option 'image_scaling' must be a string");
+@@ -1843,7 +1843,7 @@ NAN_METHOD(Map::render)
+ }
+ std::string image_scaling = TOSTR(param_val);
+ boost::optional<mapnik::scaling_method_e> method = mapnik::scaling_method_from_string(image_scaling);
+- if (!method)
++ if (!method)
+ {
+ delete closure;
+ Nan::ThrowTypeError("option 'image_scaling' must be a string and a valid scaling method (e.g 'bilinear')");
+@@ -1852,10 +1852,10 @@ NAN_METHOD(Map::render)
+ closure->scaling_method = *method;
+ }
+
+- if (options->Has(Nan::New("image_format").ToLocalChecked()))
++ if (options->Has(Nan::New("image_format").ToLocalChecked()))
+ {
+ v8::Local<v8::Value> param_val = options->Get(Nan::New("image_format").ToLocalChecked());
+- if (!param_val->IsString())
++ if (!param_val->IsString())
+ {
+ delete closure;
+ Nan::ThrowTypeError("option 'image_format' must be a string");
+@@ -1864,10 +1864,10 @@ NAN_METHOD(Map::render)
+ closure->image_format = TOSTR(param_val);
+ }
+
+- if (options->Has(Nan::New("area_threshold").ToLocalChecked()))
++ if (options->Has(Nan::New("area_threshold").ToLocalChecked()))
+ {
+ v8::Local<v8::Value> param_val = options->Get(Nan::New("area_threshold").ToLocalChecked());
+- if (!param_val->IsNumber())
++ if (!param_val->IsNumber())
+ {
+ delete closure;
+ Nan::ThrowTypeError("option 'area_threshold' must be a number");
+@@ -1882,10 +1882,10 @@ NAN_METHOD(Map::render)
+ }
+ }
+
+- if (options->Has(Nan::New("strictly_simple").ToLocalChecked()))
++ if (options->Has(Nan::New("strictly_simple").ToLocalChecked()))
+ {
+ v8::Local<v8::Value> param_val = options->Get(Nan::New("strictly_simple").ToLocalChecked());
+- if (!param_val->IsBoolean())
++ if (!param_val->IsBoolean())
+ {
+ delete closure;
+ Nan::ThrowTypeError("option 'strictly_simple' must be a boolean");
+@@ -1894,10 +1894,10 @@ NAN_METHOD(Map::render)
+ closure->strictly_simple = param_val->BooleanValue();
+ }
+
+- if (options->Has(Nan::New("multi_polygon_union").ToLocalChecked()))
++ if (options->Has(Nan::New("multi_polygon_union").ToLocalChecked()))
+ {
+ v8::Local<v8::Value> param_val = options->Get(Nan::New("multi_polygon_union").ToLocalChecked());
+- if (!param_val->IsBoolean())
++ if (!param_val->IsBoolean())
+ {
+ delete closure;
+ Nan::ThrowTypeError("option 'multi_polygon_union' must be a boolean");
+@@ -1906,10 +1906,10 @@ NAN_METHOD(Map::render)
+ closure->multi_polygon_union = param_val->BooleanValue();
+ }
+
+- if (options->Has(Nan::New("fill_type").ToLocalChecked()))
++ if (options->Has(Nan::New("fill_type").ToLocalChecked()))
+ {
+ v8::Local<v8::Value> param_val = options->Get(Nan::New("fill_type").ToLocalChecked());
+- if (!param_val->IsNumber())
++ if (!param_val->IsNumber())
+ {
+ delete closure;
+ Nan::ThrowTypeError("option 'fill_type' must be an unsigned integer");
+@@ -1934,7 +1934,7 @@ NAN_METHOD(Map::render)
+ return;
+ }
+ closure->threading_mode = static_cast<std::launch>(param_val->IntegerValue());
+- if (closure->threading_mode != std::launch::async &&
++ if (closure->threading_mode != std::launch::async &&
+ closure->threading_mode != std::launch::deferred &&
+ closure->threading_mode != (std::launch::async | std::launch::deferred))
+ {
+@@ -1944,10 +1944,10 @@ NAN_METHOD(Map::render)
+ }
+ }
+
+- if (options->Has(Nan::New("simplify_distance").ToLocalChecked()))
++ if (options->Has(Nan::New("simplify_distance").ToLocalChecked()))
+ {
+ v8::Local<v8::Value> param_val = options->Get(Nan::New("simplify_distance").ToLocalChecked());
+- if (!param_val->IsNumber())
++ if (!param_val->IsNumber())
+ {
+ delete closure;
+ Nan::ThrowTypeError("option 'simplify_distance' must be an floating point number");
+@@ -1974,10 +1974,10 @@ NAN_METHOD(Map::render)
+ object_to_container(closure->variables,bind_opt->ToObject());
+ }
+
+- if (options->Has(Nan::New("process_all_rings").ToLocalChecked()))
++ if (options->Has(Nan::New("process_all_rings").ToLocalChecked()))
+ {
+ v8::Local<v8::Value> param_val = options->Get(Nan::New("process_all_rings").ToLocalChecked());
+- if (!param_val->IsBoolean())
++ if (!param_val->IsBoolean())
+ {
+ delete closure;
+ Nan::ThrowTypeError("option 'process_all_rings' must be a boolean");
+@@ -2003,8 +2003,8 @@ NAN_METHOD(Map::render)
+ }
+ closure->cb.Reset(info[info.Length() - 1].As<v8::Function>());
+ uv_queue_work(uv_default_loop(), &closure->request, EIO_RenderVectorTile, (uv_after_work_cb)EIO_AfterRenderVectorTile);
+- }
+- else
++ }
++ else
+ {
+ Nan::ThrowTypeError("renderable mapnik object expected");
+ return;
+@@ -2060,12 +2060,12 @@ void Map::EIO_AfterRenderVectorTile(uv_w
+ vector_tile_baton_t *closure = static_cast<vector_tile_baton_t *>(req->data);
+ closure->m->release();
+
+- if (closure->error)
++ if (closure->error)
+ {
+ v8::Local<v8::Value> argv[1] = { Nan::Error(closure->error_name.c_str()) };
+ Nan::MakeCallback(Nan::GetCurrentContext()->Global(), Nan::New(closure->cb), 1, argv);
+- }
+- else
++ }
++ else
+ {
+ v8::Local<v8::Value> argv[2] = { Nan::Null(), closure->d->handle() };
+ Nan::MakeCallback(Nan::GetCurrentContext()->Global(), Nan::New(closure->cb), 2, argv);
+@@ -2144,18 +2144,18 @@ void Map::EIO_AfterRenderGrid(uv_work_t*
+
+ struct agg_renderer_visitor
+ {
+- agg_renderer_visitor(mapnik::Map const& m,
+- mapnik::request const& req,
++ agg_renderer_visitor(mapnik::Map const& m,
++ mapnik::request const& req,
+ mapnik::attributes const& vars,
+- double scale_factor,
+- unsigned offset_x,
+- unsigned offset_y,
++ double scale_factor,
++ unsigned offset_x,
++ unsigned offset_y,
+ double scale_denominator)
+ : m_(m),
+ req_(req),
+ vars_(vars),
+- scale_factor_(scale_factor),
+- offset_x_(offset_x),
++ scale_factor_(scale_factor),
++ offset_x_(offset_x),
+ offset_y_(offset_y),
+ scale_denominator_(scale_denominator) {}
+
+@@ -2164,7 +2164,7 @@ struct agg_renderer_visitor
+ mapnik::agg_renderer<mapnik::image_rgba8> ren(m_,req_,vars_,pixmap,scale_factor_,offset_x_,offset_y_);
+ ren.apply(scale_denominator_);
+ }
+-
++
+ template <typename T>
+ void operator() (T &)
+ {
+@@ -2190,10 +2190,10 @@ void Map::EIO_RenderImage(uv_work_t* req
+ mapnik::Map const& map = *closure->m->map_;
+ mapnik::request m_req(map.width(),map.height(),map.get_current_extent());
+ m_req.set_buffer_size(closure->buffer_size);
+- agg_renderer_visitor visit(map,
+- m_req,
+- closure->variables,
+- closure->scale_factor,
++ agg_renderer_visitor visit(map,
++ m_req,
++ closure->variables,
++ closure->scale_factor,
+ closure->offset_x,
+ closure->offset_y,
+ closure->scale_denominator);
+@@ -2467,9 +2467,9 @@ NAN_METHOD(Map::renderSync)
+ double scale_denominator = 0.0;
+ int buffer_size = 0;
+
+- if (info.Length() >= 1)
++ if (info.Length() >= 1)
+ {
+- if (!info[0]->IsObject())
++ if (!info[0]->IsObject())
+ {
+ Nan::ThrowTypeError("first argument is optional, but if provided must be an object, eg. {format: 'pdf'}");
+ return;
+--- a/src/mapnik_memory_datasource.cpp
++++ b/src/mapnik_memory_datasource.cpp
+@@ -95,7 +95,7 @@ NAN_METHOD(MemoryDatasource::New)
+ }
+ else
+ {
+- params[TOSTR(name)] = TOSTR(value);
++ params[TOSTR(name)] = const_cast<char const*>(TOSTR(value));
+ }
+ i++;
+ }
+@@ -134,7 +134,7 @@ NAN_METHOD(MemoryDatasource::describe)
+ {
+ MemoryDatasource* d = Nan::ObjectWrap::Unwrap<MemoryDatasource>(info.Holder());
+ v8::Local<v8::Object> description = Nan::New<v8::Object>();
+- if (d->datasource_)
++ if (d->datasource_)
+ {
+ node_mapnik::describe_datasource(description,d->datasource_);
+ }
+@@ -164,7 +164,7 @@ NAN_METHOD(MemoryDatasource::featureset)
+ info.GetReturnValue().Set(Featureset::NewInstance(fs));
+ }
+ }
+-
++
+ // Even if there is an empty query, a featureset is still created
+ // therefore it should be impossible to reach this point in the code.
+ /* LCOV_EXCL_START */
diff --git a/debian/patches/0001-compile-against-both-mapnik-3.0.12-and-before.patch b/debian/patches/0001-compile-against-both-mapnik-3.0.12-and-before.patch
new file mode 100644
index 0000000..9224627
--- /dev/null
+++ b/debian/patches/0001-compile-against-both-mapnik-3.0.12-and-before.patch
@@ -0,0 +1,35 @@
+From 741ad319e1360144c3796ca1ce876d6a352ab41e Mon Sep 17 00:00:00 2001
+From: Dane Springmeyer <dane at mapbox.com>
+Date: Wed, 3 Aug 2016 17:16:10 -0700
+Subject: compile against both mapnik >= 3.0.12 and before
+
+---
+ src/mapnik_palette.cpp | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/src/mapnik_palette.cpp
++++ b/src/mapnik_palette.cpp
+@@ -94,7 +94,11 @@ NAN_METHOD(Palette::ToString)
+
+ const std::vector<mapnik::rgb>& colors = p->palette();
+ std::size_t length = colors.size();
++#if MAPNIK_VERSION >= 300012
++ const std::vector<unsigned>& alpha = p->alpha_table();
++#else
+ const std::vector<unsigned>& alpha = p->alphaTable();
++#endif
+ std::size_t alphaLength = alpha.size();
+
+ std::ostringstream str("");
+@@ -122,7 +126,11 @@ NAN_METHOD(Palette::ToBuffer)
+
+ const std::vector<mapnik::rgb>& colors = p->palette();
+ std::size_t length = colors.size();
++#if MAPNIK_VERSION >= 300012
++ const std::vector<unsigned>& alpha = p->alpha_table();
++#else
+ const std::vector<unsigned>& alpha = p->alphaTable();
++#endif
+ std::size_t alphaLength = alpha.size();
+
+ char palette[256 * 4];
diff --git a/debian/patches/series b/debian/patches/series
index 5561177..c3aed59 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,5 @@
test_disable_raster_layer.patch
nodejs.patch
spelling-errors.patch
+0001-compile-against-both-mapnik-3.0.12-and-before.patch
+0001-add-const-cast-to-match-value_holder-char-const-ctor.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/node-mapnik.git
More information about the Pkg-javascript-commits
mailing list