[nodejs-srs] Initial import of nodejs-srs

Tom Hughes tomh at fedoraproject.org
Mon Mar 4 22:36:20 UTC 2013


commit 610f9da1c5e92b93372a420316d18535498cce16
Author: Tom Hughes <tom at compton.nu>
Date:   Mon Mar 4 22:35:50 2013 +0000

    Initial import of nodejs-srs

 .gitignore                 |    1 +
 nodejs-srs-cleaner.sh      |   14 ++++++++
 nodejs-srs-libraries.patch |   15 +++++++++
 nodejs-srs-settings.js     |    1 +
 nodejs-srs-tests.patch     |   40 ++++++++++++++++++++++++
 nodejs-srs.spec            |   72 ++++++++++++++++++++++++++++++++++++++++++++
 sources                    |    1 +
 7 files changed, 144 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..b03c348 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/srs-0.2.20-fedora.tgz
diff --git a/nodejs-srs-cleaner.sh b/nodejs-srs-cleaner.sh
new file mode 100755
index 0000000..b7798b7
--- /dev/null
+++ b/nodejs-srs-cleaner.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+VERSION="0.2.20"
+
+tar xvfz srs-"${VERSION}".tgz
+
+mv package{,-fedora} && pushd package-fedora
+
+rm lib/srs_data/cubewerx_extra.wkt
+rm lib/srs_data/esri_extra.wkt
+
+popd
+
+tar cvfz srs-"${VERSION}"-fedora.tgz package-fedora
diff --git a/nodejs-srs-libraries.patch b/nodejs-srs-libraries.patch
new file mode 100644
index 0000000..c568038
--- /dev/null
+++ b/nodejs-srs-libraries.patch
@@ -0,0 +1,15 @@
+--- binding.gyp.libraries	2012-07-11 17:42:33.000000000 +0100
++++ binding.gyp	2013-02-10 15:09:37.038037109 +0000
+@@ -23,6 +23,12 @@
+         '_LARGEFILE_SOURCE',
+         '_FILE_OFFSET_BITS=64',
+       ],
++      'libraries': [ 
++        '-lgdal',
++      ],
++      'include_dirs': [
++        '/usr/include/gdal',
++      ],
+       'conditions': [
+         [ 'OS=="mac"', {
+           'libraries': [
diff --git a/nodejs-srs-settings.js b/nodejs-srs-settings.js
new file mode 100644
index 0000000..95e4b04
--- /dev/null
+++ b/nodejs-srs-settings.js
@@ -0,0 +1 @@
+module.exports.static_osr = false;
diff --git a/nodejs-srs-tests.patch b/nodejs-srs-tests.patch
new file mode 100644
index 0000000..d4eacbf
--- /dev/null
+++ b/nodejs-srs-tests.patch
@@ -0,0 +1,40 @@
+commit d0b005ce112dc782017032dff5cd8a6d84222244
+Author: Tom Hughes <tom at compton.nu>
+Date:   Sat Mar 2 14:56:05 2013 +0000
+
+    Patch out tests that rely on data of unknown providence
+
+diff --git a/test/data/world_extent_merc.geojson b/test/data/world_extent_merc.geojson
+index c507016..5207eef 100644
+--- a/test/data/world_extent_merc.geojson
++++ b/test/data/world_extent_merc.geojson
+@@ -1,5 +1,5 @@
+ {
+-"crs": { "type": "name", "properties": { "name": "epsg:900913" } },
++"crs": { "type": "name", "properties": { "name": "epsg:3857" } },
+ "type": "FeatureCollection",
+ "features": [
+ { "type": "Feature",
+diff --git a/test/shapefile.3857.test.js b/test/shapefile.3857.test.js
+index 5ac6abc..1292695 100644
+--- a/test/shapefile.3857.test.js
++++ b/test/shapefile.3857.test.js
+@@ -103,18 +103,6 @@ describe('Mercator', function() {
+         assert.equal(parsed.valid, expected.valid);
+     });
+ 
+-    it('should detect 900913', function() {
+-        var val = '+init=epsg:900913';
+-        var parsed = srs.parse(val);
+-        assert.ok(parsed.proj4);
+-        //assert.equal(parsed.proj4,'');
+-        assert.equal(parsed.srid, expected.srid);
+-        assert.equal(parsed.auth, expected.auth);
+-        assert.equal(parsed.esri, expected.esri);
+-        assert.equal(parsed.is_geographic, expected.is_geographic);
+-        assert.equal(parsed.valid, expected.valid);
+-    });
+-
+     it('should detect esri 900913', function() {
+         var val = fs.readFileSync('./test/data/900913.esri.prj').toString();
+         var parsed = srs.parse(val);
diff --git a/nodejs-srs.spec b/nodejs-srs.spec
new file mode 100644
index 0000000..6d1f200
--- /dev/null
+++ b/nodejs-srs.spec
@@ -0,0 +1,72 @@
+%global enable_tests 0
+
+Name:           nodejs-srs
+Version:        0.2.20
+Release:        1%{?dist}
+Summary:        Spatial reference library for Node.js
+
+License:        BSD
+URL:            https://github.com/springmeyer/node-srs
+# Real source is http://registry.npmjs.org/srs/-/srs-%{version}.tgz
+# but files copied from gdal whose provenance is unclear (as described
+# in PROVENANCE.TXT and PROVENANCE.TXT-fedora in gdal) have been
+# removed from the tar ball by the cleaner script.
+Source0:        srs-%{version}-fedora.tgz
+# Cleaner script for the tarball
+Source1:        nodejs-srs-cleaner.sh
+# Settings file normally generated by waf build
+Source2:        nodejs-srs-settings.js
+# Link against system libraries
+Patch0:         nodejs-srs-libraries.patch
+# Patch out tests which rely on removed files
+Patch1:         nodejs-srs-tests.patch
+
+BuildRequires:  nodejs-devel
+BuildRequires:  node-gyp
+BuildRequires:  gdal-devel
+
+%if 0%{?enable_tests}
+BuildRequires:  npm(mocha)
+BuildRequires:  gdal
+BuildRequires:  proj-epsg
+%endif
+
+%description
+Bindings to libosr for handling spatial references in Node.js.
+
+
+%prep
+%setup -q -n package-fedora
+%patch0 -p0 -b .libraries
+%patch1 -p1 -b .tests
+cp -pr %{SOURCE2} lib/settings.js
+rm -rf deps node_modules lib/srs_data
+
+
+%build
+export CXXFLAGS="%{optflags}"
+node-gyp rebuild
+cp -pr build/Release/_srs.node lib
+
+
+%if 0%{?enable_tests}
+%check
+ln -s %{nodejs_sitearch} .
+NODE_PATH=lib %{nodejs_sitearch}/mocha/bin/mocha -R spec
+%endif
+
+
+%install
+mkdir -p %{buildroot}/%{nodejs_sitearch}/srs
+cp -pr package.json lib %{buildroot}/%{nodejs_sitearch}/srs
+%nodejs_symlink_deps
+
+
+%files
+%doc LICENSE.txt README.md
+%{nodejs_sitearch}/srs
+
+
+%changelog
+* Sun Feb 10 2013 Tom Hughes <tom at compton.nu> - 0.2.20-1
+- Initial build of 0.2.20
diff --git a/sources b/sources
index e69de29..3bd52cd 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+50d018b047b1a776a574f884115dea4f  srs-0.2.20-fedora.tgz


More information about the scm-commits mailing list