Blob Blame History Raw
# The tests use bundled 'vendor/mt.js/node-mt.js' and unpackaged nodejs-buster.
%global enable_tests 0

%if 0%{?fedora} || 0%{?rhel} >= 7
%global installdir  %{_jsdir}/zlib
%else
%global installdir  %{_datadir}/javascript/zlib
%endif

Name:            js-zlib
Version:         0.2.0
Release:         7%{?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:   jarjar
BuildRequires:   junit

%if 0%{?fedora} || 0%{?rhel} >= 7
BuildRequires:   web-assets-devel
Requires:        web-assets-filesystem
%endif

%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.


%prep
echo "Settings: enable_tests=%{?enable_tests}"

%setup -q -n package

# Remove bundled and pre-built files.
rm -rf bin/* vendor/

# arguments.callee is forbidden in strict mode
sed -i s/arguments.callee.caller/null/ closure-primitives/base.js

# Use system closure-compiler to build.
sed -i -e 's#<java jar="${compiler}" fork="true"#<exec executable="closure-compiler"#' \
       -e 's#</java>#</exec>#' \
       -e 's#PERFORMANCE_OPTIMIZATIONS#ADVANCED_OPTIMIZATIONS#' \
    build.xml


%build
/usr/bin/ant all


%install
mkdir -p %{buildroot}%{installdir}
cp -p bin/*.min.js bin/*.min.js.map bin/node-zlib.js \
    %{buildroot}%{installdir}


%if 0%{?enable_tests}
%check
%nodejs_symlink_deps --check
/usr/bin/buster-test
%endif


%files
%license LICENSE
%doc ChangeLog.md README.md README.en.md
%{installdir}


%changelog
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Mon Mar 17 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 0.2.0-5
- also include .map files

* Mon Mar 17 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 0.2.0-4
- As it turns out, matching {_arch} won't solve our problem as it indicates
  the architecture of the build host not the target architecture. Instead
  split nodejs-zlibjs into a separate package, as otherwise js-zlib would be
  restricted to {nodejs_arches}. bin/node-zlib.js will remain in the js-zlib
  package, while nodejs-zlibjs will depend on js-zlib and have a symlink.
- add logic for building on EPEL 6

* Sun Mar 16 2014 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.2.0-3
- Simplify the arches condition
- Restore sed instead of a patch

* Fri Mar 14 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 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

* Thu Mar 13 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 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 <zbyszek@in.waw.pl> - 0.1.7-1
- Initial package.