nodejs-acorn/nodejs-acorn.spec
2020-08-28 15:22:43 +08:00

67 lines
1.8 KiB
RPMSpec

%global shortname acorn
%global bootstrap 1
%global enable_tests 1
Name: nodejs-%{shortname}
Version: 5.2.1
Release: 1
Summary: ECMAScript parser
License: MIT
URL: https://github.com/ternjs/acorn
Source0: http://registry.npmjs.org/acorn/-/acorn-%{version}.tgz
# The test files are not included in the npm tarball.
# Source{1-9} are generated by running Source10, which pulls from the upstream
# version control repository.
Source1: rollup-%{version}.tar.bz2
Source2: tests-%{version}.tar.bz2
Source10: dl-tests.sh
BuildArch: noarch
ExclusiveArch: %{nodejs_arches} noarch
BuildRequires: nodejs-packaging npm(rollup)
%description
A tiny, fast JavaScript parser, written completely in JavaScript.
%prep
%setup -qn package
%setup -q -T -D -a 1 -n package
%setup -q -T -D -a 2 -n package
sed -i '1s/env //' bin/acorn
rm dist/.keep
%build
%if 0%{?bootstrap}
%else
%{_bindir}/rollup -c rollup/config.main.js
%{_bindir}/rollup -c rollup/config.walk.js
%{_bindir}/rollup -c rollup/config.loose.js
%{_bindir}/rollup -c rollup/config.bin.js
%endif
%install
mkdir -p %{buildroot}%{nodejs_sitelib}/%{shortname}/
cp -pr package.json bin/ dist/ \
%{buildroot}%{nodejs_sitelib}/%{shortname}
mkdir -p %{buildroot}%{_bindir}
ln -sf %{nodejs_sitelib}/${shortname}/bin/acorn \
%{buildroot}%{_bindir}/${shortname}
%nodejs_symlink_deps
%check
%nodejs_symlink_deps --check
%{__nodejs} -e 'require("./")'
%if 0%{?enable_tests}
%__nodejs test/run.js
%else
%{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m"
%endif
%files
%{!?_licensedir:%global license %doc}
%license LICENSE
%doc README.md
%{nodejs_sitelib}/%{shortname}
%{_bindir}/%{shortname}
%changelog
* Mon Aug 17 2020 Shaoqiang Kang <kangshaoqiang1@huawei.com> - 5.2.1-1
- Package init