diff --git a/.gitignore b/.gitignore index e69de29..86217d8 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/mapnik-1.0.0.tgz diff --git a/nodejs-mapnik-geojson.patch b/nodejs-mapnik-geojson.patch new file mode 100644 index 0000000..28fde87 --- /dev/null +++ b/nodejs-mapnik-geojson.patch @@ -0,0 +1,31 @@ +commit 4cf5badf98a28bf51d148e87a2ee68279ebf5199 +Author: Tom Hughes +Date: Fri Jul 5 19:06:05 2013 +0100 + + Remove the GeoJSON test as Fedora's mapnik doesn't have the geojson plugin + +diff --git a/test/unicode-loading.test.js b/test/unicode-loading.test.js +index 6abc42f..7b6f974 100644 +--- a/test/unicode-loading.test.js ++++ b/test/unicode-loading.test.js +@@ -106,13 +106,6 @@ describe('Handling unicode paths, filenames, and data', function(){ + assert.ok(ds); + }); + +- it('open json with unicode name', function(){ +- var filepath = './test/data/你好_points.geojson'; +- assert.ok(existsSync(filepath)); +- var ds = new mapnik.Datasource({type:'geojson',file:filepath}); +- assert.ok(ds); +- }); +- + it('open sqlite with unicode name', function(){ + var filepath = './test/data/你好_points.sqlite'; + assert.ok(existsSync(filepath)); +@@ -120,4 +113,4 @@ describe('Handling unicode paths, filenames, and data', function(){ + assert.ok(ds); + }); + +-}); +\ No newline at end of file ++}); diff --git a/nodejs-mapnik-precision.patch b/nodejs-mapnik-precision.patch new file mode 100644 index 0000000..a3fc763 --- /dev/null +++ b/nodejs-mapnik-precision.patch @@ -0,0 +1,42 @@ +commit 900b7909ffbe62a25d03c759582c8c9ea2a90616 +Author: Tom Hughes +Date: Fri Jul 5 19:19:25 2013 +0100 + + Workaround precision issues + +diff --git a/test/image.test.js b/test/image.test.js +index 1bae901..4ed61bd 100644 +--- a/test/image.test.js ++++ b/test/image.test.js +@@ -149,6 +149,6 @@ describe('mapnik.Image ', function() { + assert.equal(pixel3.r, 0); + assert.equal(pixel3.g, 128); + assert.equal(pixel3.b, 0); +- assert.equal(pixel3.a, 255); ++ assert(pixel3.a == 254 || pixel3.a == 255); + }); + }); +diff --git a/test/vector-tile.test.js b/test/vector-tile.test.js +index 01977f3..0b0d296 100644 +--- a/test/vector-tile.test.js ++++ b/test/vector-tile.test.js +@@ -126,19 +126,6 @@ describe('mapnik.VectorTile ', function() { + done(); + }); + +- it('should be able to get tile info as various flavors of GeoJSON', function(done) { +- var dt = new mapnik.VectorTile(9,112,195); +- dt.setData(new Buffer(_data,"hex")); +- var expected_geojson = {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-101.25,39.36827914916011],[-101.25,38.82272471585834],[-100.54704666137694,38.82272471585834],[-100.54704666137694,39.36827914916011],[-101.25,39.36827914916011]]]},"properties":{"AREA":915896,"FIPS":"US","ISO2":"US","ISO3":"USA","LAT":39.622,"LON":-98.606,"NAME":"United States","POP2005":299846449,"REGION":19,"SUBREGION":21,"UN":840}}]}; +- var expected_copy = JSON.parse(JSON.stringify(expected_geojson)); +- expected_geojson.name = "world"; +- assert.deepEqual(dt.toGeoJSON(0),expected_geojson) +- assert.deepEqual(dt.toGeoJSON(0),dt.toGeoJSON('world')) +- assert.deepEqual(dt.toGeoJSON('__all__'),expected_copy) +- assert.deepEqual(dt.toGeoJSON('__array__'),[expected_geojson]) +- done(); +- }); +- + it('should be able to get reduce the precision of GeoJSON coordinates', function(done) { + var dt = new mapnik.VectorTile(9,112,195); + dt.setData(new Buffer(_data,"hex")); diff --git a/nodejs-mapnik.spec b/nodejs-mapnik.spec new file mode 100644 index 0000000..d34f1a9 --- /dev/null +++ b/nodejs-mapnik.spec @@ -0,0 +1,83 @@ +%global enable_tests 1 + +Name: nodejs-mapnik +Version: 1.0.0 +Release: 1%{?dist} +Summary: Bindings to Mapnik tile rendering library for Node.js + +License: BSD +URL: https://github.com/mapnik/node-mapnik +Source0: http://registry.npmjs.org/mapnik/-/mapnik-%{version}.tgz +# Drop tests which need the (not present in Fedora) geojson plugin to mapnik +Patch0: nodejs-mapnik-geojson.patch +# Fix and/or drop some tests which have numerical precision issues: +# https://github.com/mapnik/node-mapnik/issues/163 +# https://github.com/mapnik/node-mapnik/issues/164 +Patch1: nodejs-mapnik-precision.patch +ExclusiveArch: %{nodejs_arches} + +BuildRequires: nodejs-devel +BuildRequires: node-gyp +BuildRequires: mapnik-devel +BuildRequires: boost-devel +BuildRequires: libicu-devel +BuildRequires: freetype-devel +BuildRequires: sparsehash-devel +BuildRequires: cairo-devel +BuildRequires: polyclipping-devel +BuildRequires: protobuf-lite-devel +BuildRequires: libtool-ltdl-devel +BuildRequires: npm(mapnik-vector-tile) + +%if 0%{?enable_tests} +BuildRequires: npm(mocha) +BuildRequires: npm(sphericalmercator) +%endif + +%description +%summary + + +%prep +%setup -q -n package +%patch0 -p1 -b .geojson +%patch1 -p1 -b .precision +rm -rf node_modules +%nodejs_symlink_deps --check + + +%build +export CXXFLAGS="%{optflags}" +node-gyp rebuild +install -p -D -m0755 build/Release/_mapnik.node lib +python gen_settings.py + + +%if 0%{?enable_tests} +%check +mkdir test/tmp +NODE_PATH=lib %{nodejs_sitelib}/mocha/bin/mocha -R spec -t 5000 +%endif + + +%install +mkdir -p %{buildroot}/%{nodejs_sitearch}/mapnik +cp -pr package.json bin lib %{buildroot}/%{nodejs_sitearch}/mapnik +mkdir -p %{buildroot}/%{_bindir} +ln -s %{nodejs_sitelib}/mapnik/bin/mapnik-inspect.js %{buildroot}/%{_bindir}/mapnik-inspect +ln -s %{nodejs_sitelib}/mapnik/bin/mapnik-render.js %{buildroot}/%{_bindir}/mapnik-render +%nodejs_symlink_deps + + +%files +%doc LICENSE.txt README.md CHANGELOG.md docs +%{nodejs_sitearch}/mapnik +%{_bindir}/mapnik-* + + +%changelog +* Fri Jul 5 2013 Tom Hughes - 1.0.0-1 +- Update to 1.0.0 upstream release + +* Sun Feb 10 2013 Tom Hughes - 0.7.22-1 +- Initial build of 0.7.22 diff --git a/sources b/sources index e69de29..56e28f1 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +878145dd12a27999a5b4276f26f8d0a5 mapnik-1.0.0.tgz