%{?nodejs_find_provides_and_requires}
%global packagename buffertools
%global enable_tests 1
Name: nodejs-buffertools
Version: 2.1.3
Release: 11%{?dist}
Summary: Working with node.js buffers made easy
License: ISC
URL: https://github.com/bnoordhuis/node-buffertools
Source0: https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz
# Patch for building on ARM
Patch0: nodejs-buffertools_signed_char.patch
# Patch to use the nodejs "bindings" module instead of hardcoding the path
Patch1: nodejs-buffertools_use-bindings.patch
ExclusiveArch: %{nodejs_arches}
BuildRequires: nodejs-packaging
%if 0%{?enable_tests}
BuildRequires: node-gyp
BuildRequires: nodejs-devel
BuildRequires: npm(bindings)
%endif
%description
Working with node.js buffers made easy.
%prep
%setup -q -n package
%patch0 -p2
%patch1 -p2
%build
export CXXFLAGS="%{optflags}"
node-gyp rebuild
mkdir -p %{buildroot}%{nodejs_sitearch}/%{packagename}/build/Release
cp -p package.json buffertools.js %{buildroot}%{nodejs_sitearch}/%{packagename}/
cp -p build/Release/%{packagename}.node %{buildroot}%{nodejs_sitearch}/%{packagename}/build
%nodejs_symlink_deps
%check
%nodejs_symlink_deps --check
%{__nodejs} -e 'require("./")'
%if 0%{?enable_tests}
%__nodejs test.js
%endif
%files
%{!?_licensedir:%global license %doc}
%doc *.md
%license LICENSE
%{nodejs_sitearch}/%{packagename}
%changelog
* Wed Mar 23 2016 Tom Hughes <tom@compton.nu> - 2.1.3-11
- Rebuild for Node.js 4.4.x
* Wed Feb 10 2016 Jared Smith <jsmith@fedoraproject.org> - 2.1.3-10
- Rebuilt for newer nodejs
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.3-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Jan 20 2016 Stephen Gallagher <sgallagh@redhat.com> - 2.1.3-8
- Rebuild for Node.js 4.x
* Tue Jan 19 2016 Jared Smith <jsmith@fedoraproject.org> - 2.1.3-7
- Add missing BuildRequires for bindings
* Tue Jan 19 2016 Jared Smith <jsmith@fedoraproject.org> - 2.1.3-6
- Add patch to use npm(buffertools) to handle path to native code
* Tue Jan 19 2016 Jared Smith <jsmith@fedoraproject.org> - 2.1.3-4
- Add patch to build on ARM
* Tue Jan 19 2016 Jared Smith <jsmith@fedoraproject.org> - 2.1.3-3
- Better handle installation of the output of node-gyp compilation
* Tue Jan 19 2016 Jared Smith <jsmith@fedoraproject.org> - 2.1.3-2
- Fix minor packaging issue for package review
* Thu Oct 22 2015 Jared Smith <jsmith@fedoraproject.org> - 2.1.3-1
- Initial packaging