aboutsummaryrefslogtreecommitdiff
path: root/graphics/mapnik
diff options
context:
space:
mode:
authorSunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org>2015-07-09 16:05:06 +0000
committerSunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org>2015-07-09 16:05:06 +0000
commitef0fa466719d39a212ca85c3ad81a0869aa1de38 (patch)
tree3696b52be42d9c77512c96e06a4e32ed668dd751 /graphics/mapnik
parent2ffcf208a839988e2efe9de03c8cefad1c40d1ca (diff)
downloadports-ef0fa466719d39a212ca85c3ad81a0869aa1de38.tar.gz
ports-ef0fa466719d39a212ca85c3ad81a0869aa1de38.zip
Notes
Diffstat (limited to 'graphics/mapnik')
-rw-r--r--graphics/mapnik/Makefile2
-rw-r--r--graphics/mapnik/files/patch-plugins-input-ogr-ogr_datasource.cpp54
-rw-r--r--graphics/mapnik/files/patch-plugins-input-ogr-ogr_datasource.hpp13
-rw-r--r--graphics/mapnik/files/patch-plugins-input-ogr-ogr_layer_ptr.hpp59
4 files changed, 127 insertions, 1 deletions
diff --git a/graphics/mapnik/Makefile b/graphics/mapnik/Makefile
index 639a985cf05e..15b8eecc32d4 100644
--- a/graphics/mapnik/Makefile
+++ b/graphics/mapnik/Makefile
@@ -4,7 +4,7 @@
PORTNAME= mapnik
PORTVERSION= 2.2.0
DISTVERSIONPREFIX= v
-PORTREVISION= 14
+PORTREVISION= 15
CATEGORIES= graphics geography
MASTER_SITES= http://mapnik.s3.amazonaws.com/dist/v${PORTVERSION}/
diff --git a/graphics/mapnik/files/patch-plugins-input-ogr-ogr_datasource.cpp b/graphics/mapnik/files/patch-plugins-input-ogr-ogr_datasource.cpp
new file mode 100644
index 000000000000..b4a36f55ae95
--- /dev/null
+++ b/graphics/mapnik/files/patch-plugins-input-ogr-ogr_datasource.cpp
@@ -0,0 +1,54 @@
+Obtained from: https://github.com/mapnik/mapnik/commit/f68291c5b47b5189d967dba01542262f2013da53
+ https://github.com/mapnik/mapnik/commit/f0821d897f66c31755f7012b68191a2ec7a060fb
+
+--- plugins/input/ogr/ogr_datasource.cpp.orig 2013-06-04 01:35:27 UTC
++++ plugins/input/ogr/ogr_datasource.cpp
+@@ -72,7 +72,11 @@ ogr_datasource::~ogr_datasource()
+ {
+ // free layer before destroying the datasource
+ layer_.free_layer();
++#if GDAL_VERSION_MAJOR >= 2
++ GDALClose(( GDALDatasetH) dataset_);
++#else
+ OGRDataSource::DestroyDataSource (dataset_);
++#endif
+ }
+
+ void ogr_datasource::init(mapnik::parameters const& params)
+@@ -82,6 +86,7 @@ void ogr_datasource::init(mapnik::parame
+ #endif
+
+ // initialize ogr formats
++ // NOTE: in GDAL >= 2.0 this is the same as GDALAllRegister()
+ OGRRegisterAll();
+
+ boost::optional<std::string> file = params.get<std::string>("file");
+@@ -112,17 +117,26 @@ void ogr_datasource::init(mapnik::parame
+
+ if (! driver.empty())
+ {
++#if GDAL_VERSION_MAJOR >= 2
++ unsigned int nOpenFlags = GDAL_OF_READONLY | GDAL_OF_VECTOR;
++ const char* papszAllowedDrivers[] = { driver.c_str(), NULL };
++ dataset_ = static_cast<gdal_dataset_type>(GDALOpenEx(dataset_name_.c_str(),nOpenFlags,papszAllowedDrivers,NULL,NULL));
++#else
+ OGRSFDriver * ogr_driver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(driver.c_str());
+ if (ogr_driver && ogr_driver != NULL)
+ {
+ dataset_ = ogr_driver->Open((dataset_name_).c_str(), FALSE);
+ }
+-
++#endif
+ }
+ else
+ {
+ // open ogr driver
+- dataset_ = OGRSFDriverRegistrar::Open((dataset_name_).c_str(), FALSE);
++#if GDAL_VERSION_MAJOR >= 2
++ dataset_ = static_cast<gdal_dataset_type>(OGROpen(dataset_name_.c_str(), FALSE, NULL));
++#else
++ dataset_ = OGRSFDriverRegistrar::Open(dataset_name_.c_str(), FALSE);
++#endif
+ }
+
+ if (! dataset_)
diff --git a/graphics/mapnik/files/patch-plugins-input-ogr-ogr_datasource.hpp b/graphics/mapnik/files/patch-plugins-input-ogr-ogr_datasource.hpp
new file mode 100644
index 000000000000..2e5499117a43
--- /dev/null
+++ b/graphics/mapnik/files/patch-plugins-input-ogr-ogr_datasource.hpp
@@ -0,0 +1,13 @@
+Obtained from: https://github.com/mapnik/mapnik/commit/f68291c5b47b5189d967dba01542262f2013da53
+
+--- plugins/input/ogr/ogr_datasource.hpp.orig
++++ plugins/input/ogr/ogr_datasource.hpp
+@@ -63,7 +63,7 @@ class ogr_datasource : public mapnik::datasource
+ mapnik::datasource::datasource_t type_;
+ std::string dataset_name_;
+ std::string index_name_;
+- OGRDataSource* dataset_;
++ gdal_dataset_type dataset_;
+ ogr_layer_ptr layer_;
+ std::string layer_name_;
+ mapnik::layer_descriptor desc_;
diff --git a/graphics/mapnik/files/patch-plugins-input-ogr-ogr_layer_ptr.hpp b/graphics/mapnik/files/patch-plugins-input-ogr-ogr_layer_ptr.hpp
new file mode 100644
index 000000000000..48027289f658
--- /dev/null
+++ b/graphics/mapnik/files/patch-plugins-input-ogr-ogr_layer_ptr.hpp
@@ -0,0 +1,59 @@
+Obtained from: https://github.com/mapnik/mapnik/commit/f68291c5b47b5189d967dba01542262f2013da53
+ https://github.com/mapnik/mapnik/commit/f0821d897f66c31755f7012b68191a2ec7a060fb
+
+--- plugins/input/ogr/ogr_layer_ptr.hpp.orig
++++ plugins/input/ogr/ogr_layer_ptr.hpp
+@@ -29,9 +29,16 @@
+ // stl
+ #include <stdexcept>
+
+-// ogr
++// gdal
++#include <gdal_version.h>
+ #include <ogrsf_frmts.h>
+
++#if GDAL_VERSION_MAJOR >= 2
++typedef GDALDataset* gdal_dataset_type;
++#else
++typedef OGRDataSource* gdal_dataset_type;
++#endif
++
+ class ogr_layer_ptr
+ {
+ public:
+@@ -62,7 +69,7 @@ class ogr_layer_ptr
+ is_valid_ = false;
+ }
+
+- void layer_by_name(OGRDataSource* const datasource,
++ void layer_by_name(gdal_dataset_type const datasource,
+ std::string const& layer_name)
+ {
+ free_layer();
+@@ -84,7 +91,7 @@ class ogr_layer_ptr
+ #endif
+ }
+
+- void layer_by_index(OGRDataSource* const datasource,
++ void layer_by_index(gdal_dataset_type const datasource,
+ int layer_index)
+ {
+ free_layer();
+@@ -110,7 +117,7 @@ class ogr_layer_ptr
+ #endif
+ }
+
+- void layer_by_sql(OGRDataSource* const datasource,
++ void layer_by_sql(gdal_dataset_type const datasource,
+ std::string const& layer_sql)
+ {
+ free_layer();
+@@ -179,7 +186,7 @@ class ogr_layer_ptr
+ }
+ #endif
+
+- OGRDataSource* datasource_;
++ gdal_dataset_type datasource_;
+ OGRLayer* layer_;
+ std::string layer_name_;
+ bool owns_layer_;