%global enable_tests 1
Name: nodejs-mapnik
Version: 1.1.2
Release: 2%{?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
# Reported upstream - https://github.com/mapnik/node-mapnik/issues/163
Patch1: nodejs-mapnik-color.patch
# Correct system font paths
Patch2: nodejs-mapnik-fonts.patch
# Reported upstream - https://github.com/mapnik/node-mapnik/issues/170
Patch3: 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) >= 0.1.0
%if 0%{?enable_tests}
BuildRequires: npm(mocha)
BuildRequires: npm(sphericalmercator)
%endif
%description
%summary
%prep
%setup -q -n package
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
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
%nodejs_fixdep -r mapnik-vector-tile
%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
%if 0%{?enable_tests}
%check
mkdir test/tmp
NODE_PATH=lib %{nodejs_sitelib}/mocha/bin/mocha -R spec -t 5000
%endif
%files
%doc LICENSE.txt README.md CHANGELOG.md docs
%{nodejs_sitearch}/mapnik
%{_bindir}/mapnik-*
%changelog
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Tue Jul 30 2013 Tom Hughes <tom@compton.nu> - 1.1.2-1
- Update to 1.1.2 upstream release
* Tue Jul 30 2013 Petr Machata <pmachata@redhat.com> - 1.1.0-3
- Rebuild for boost 1.54.0
* Tue Jul 16 2013 Tom Hughes <tom@compton.nu> - 1.1.0-2
- Correct system font paths
* Mon Jul 15 2013 Tom Hughes <tom@compton.nu> - 1.1.0-1
- Update to 1.1.0 upstream release
- Remove mapnik-vector-tile from run time dependencies
* Tue Jul 9 2013 Tom Hughes <tom@compton.nu> - 1.0.0-2
- Add upstream patch for numeric precision issue
* Fri Jul 5 2013 Tom Hughes <tom@compton.nu> - 1.0.0-1
- Update to 1.0.0 upstream release
* Sun Feb 10 2013 Tom Hughes <tom@compton.nu> - 0.7.22-1
- Initial build of 0.7.22