%{?nodejs_find_provides_and_requires} # The tests use bundled 'vendor/mt.js/node-mt.js' and unpackaged nodejs-buster. %global enable_tests 0 %global installdir %{_jsdir}/zlib # The following longwinded conditionals are required because both js-zlib # and nodejs-zlibjs are 'BuildArch: noarch', but the nodejs-zlibjs package # is additionally restricted to 'ExclusiveArch: {nodejs_arches} noarch' (while # still remaining a noarch package). We want to build js-zlib on all arches, # but unfortunately the 'ifarch' conditional cannot be combined with # 'BuildArch: noarch'. This rules out the use of 'ifarch {nodejs_arches}' and # we instead have to match {_arch} with each architecture we want to include. %global build_nodejs_pkg %(echo %{nodejs_arches} | grep -E '\\b%{_arch}\\b' -c) Name: js-zlib Version: 0.2.0 Release: 3%{?dist} Summary: JavaScript library reimplementing compression Group: System Environment/Libraries License: MIT URL: https://github.com/imaya/zlib.js Source0: http://registry.npmjs.org/zlibjs/-/zlibjs-%{version}.tgz BuildArch: noarch BuildRequires: ant BuildRequires: closure-compiler BuildRequires: python2 BuildRequires: nodejs-packaging BuildRequires: web-assets-devel Requires: web-assets-filesystem %if 0%{?enable_tests} BuildRequires: npm(buster) %endif %description zlib.js is ZLIB(RFC1950), DEFLATE(RFC1951), GZIP(RFC1952), and PKZIP implementation in JavaScript. This library can be used to perform compression and decompression in the browser. %if 0%{?build_nodejs_pkg} %package -n nodejs-zlibjs Summary: JavaScript library reimplementing compression Group: System Environment/Libraries %description -n nodejs-zlibjs This module allows zlib.js to be used by other Node.js modules. zlib.js is ZLIB(RFC1950), DEFLATE(RFC1951), GZIP(RFC1952), and PKZIP implementation in JavaScript. This library can be used to perform compression and decompression in the browser. %endif %prep echo "Settings: enable_tests=%{?enable_tests} build_nodejs_pkg=%{?build_nodejs_pkg}" %setup -q -n package # Remove bundled and pre-built files. rm -rf bin/* vendor/ # Use system closure-compiler to build. sed -i -e 's###' \ -e 's#PERFORMANCE_OPTIMIZATIONS#ADVANCED_OPTIMIZATIONS#' \ build.xml %build /usr/bin/ant all %install # js-zlib package mkdir -p %{buildroot}%{installdir} cp -p bin/*.min.js %{buildroot}%{installdir} # nodejs-zlibjs package %if 0%{?build_nodejs_pkg} mkdir -p %{buildroot}%{nodejs_sitelib}/zlibjs cp -pr package.json \ %{buildroot}%{nodejs_sitelib}/zlibjs mkdir -p %{buildroot}%{nodejs_sitelib}/zlibjs/bin cp -p bin/node-zlib.js \ %{buildroot}%{nodejs_sitelib}/zlibjs/bin/node-zlib.js %nodejs_symlink_deps %endif %if 0%{?build_nodejs_pkg} %if 0%{?enable_tests} %check %nodejs_symlink_deps --check /usr/bin/buster-test %endif %endif %files %doc ChangeLog.md LICENSE README.md README.en.md %{installdir} %if 0%{?build_nodejs_pkg} %files -n nodejs-zlibjs %doc ChangeLog.md LICENSE README.md README.en.md %{nodejs_sitelib}/zlibjs %endif %changelog * Sun Mar 16 2014 Zbigniew Jędrzejewski-Szmek - 0.2.0-3 - Simplify the arches condition - Restore sed instead of a patch * Fri Mar 14 2014 Jamie Nguyen - 0.2.0-2 - add missing BuildArch: noarch - nodejs-zlibjs should only be built for {nodejs_arches} but js-zlib package does not have this limitation, so add logic for building nodejs-zlibjs only on {nodejs_arches} while allowing js-zlib to be built on all architectures - add logic for building on EPEL 6 * Thu Mar 13 2014 Jamie Nguyen - 0.2.0-1 - update to upstream release 0.2.0 - rename to js-zlib and nodejs-zlibjs - install to {_jsdir} - maintain filenames and locations that upstream are using - use patch instead of sed - include additional documentation in nodejs-zlibjs package * Tue Oct 29 2013 Zbigniew Jędrzejewski-Szmek - 0.1.7-1 - Initial package.