%global jsname jsroot
Name: js-%{jsname}
Version: 5.3.5
Release: 2%{?dist}
Summary: JavaScript ROOT - Interactive numerical data analysis graphics
# Most files are MIT, d3.js is BSD
License: MIT and BSD
URL: https://jsroot.gsi.de/
Source0: https://github.com/root-project/%{jsname}/archive/%{version}/%{jsname}-%{version}.tar.gz
# Use locally installed mathjax instead of remote installation.
# Plus some adaptations due to unbundling of jquery et al.
Patch0: %{name}-mathjax.patch
BuildArch: noarch
BuildRequires: web-assets-devel
BuildRequires: yuicompressor
BuildRequires: uglify-js
%if %{?fedora}%{!?fedora:0} || %{?rhel}%{!?rhel:0} >= 8
BuildRequires: closure-compiler
%endif
Requires: web-assets-filesystem
Requires: js-jquery2
Requires: js-jquery-mousewheel
%if %{?fedora}%{!?fedora:0} || %{?rhel}%{!?rhel:0} >= 8
Requires: xstatic-jquery-ui-common
%else
Requires: python-XStatic-jquery-ui
%endif
Requires: js-jquery-ui-touch-punch
Requires: mathjax
%description
JavaScript ROOT provides interactive ROOT-like graphics in web browsers.
Data can be read and displayed from binary and JSON ROOT files.
%prep
%setup -q -n %{jsname}-%{version}
%patch0 -p1
# Remove pre-minified scripts
rm scripts/*.min.js
# Remove bundled dependencies packaged in Fedora
rm libs/jquery.js
rm libs/jquery-ui.js
rm style/jquery-ui.css
rm -rf style/images
# Remove .gitignore file
rm demo/gulp/.gitignore
%build
for s in scripts/JSRoot*.js scripts/ThreeCSG.js ; do
yuicompressor ${s} -o ${s%.js}.min.js
done
for s in rawinflate saveSvgAsPng three.extra ; do
yuicompressor libs/${s}.js -o scripts/${s}.min.js
done
for s in style/JSRoot*.css ; do
yuicompressor ${s} -o ${s%.css}.min.css
done
uglifyjs libs/d3.js -c negate_iife=false -m --comments /Copyright/ -o scripts/d3.min.js
uglifyjs libs/dat.gui.js -c -m -o scripts/dat.gui.min.js
%if %{?fedora}%{!?fedora:0} || %{?rhel}%{!?rhel:0} >= 8
cat > three-externs.js << EOF
var THREE;
var define;
var module;
var exports;
var performance;
var WebGL2RenderingContext;
EOF
closure-compiler --warning_level=VERBOSE \
--jscomp_off=globalThis \
--jscomp_off=checkTypes \
--externs three-externs.js \
--language_in=ECMASCRIPT5_STRICT \
--js libs/three.js \
--js_output_file scripts/three.min.js
%else
# Google's closure compiler not available in EPEL - use alternative method
uglifyjs libs/three.js -c -m --preamble "// threejs.org/license" -o scripts/three.min.js
%endif
%install
mkdir -p %{buildroot}%{_jsdir}/%{jsname}/scripts
install -m 644 -p scripts/*.js %{buildroot}%{_jsdir}/%{jsname}/scripts
ln -s %{_jsdir}/jquery/2/jquery.min.js \
%{buildroot}%{_jsdir}/%{jsname}/scripts
ln -s %{_jsdir}/jquery.mousewheel.min.js \
%{buildroot}%{_jsdir}/%{jsname}/scripts
ln -s %{_jsdir}/jquery_ui/ui/minified/jquery-ui.min.js \
%{buildroot}%{_jsdir}/%{jsname}/scripts
ln -s %{_jsdir}/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js \
%{buildroot}%{_jsdir}/%{jsname}/scripts
ln -s %{_jsdir}/mathjax \
%{buildroot}%{_jsdir}/%{jsname}/scripts
mkdir -p %{buildroot}%{_jsdir}/%{jsname}/libs
install -m 644 -p libs/*.js %{buildroot}%{_jsdir}/%{jsname}/libs
rm %{buildroot}%{_jsdir}/%{jsname}/libs/three.extra_head.js
ln -s %{_jsdir}/jquery/2/jquery.js \
%{buildroot}%{_jsdir}/%{jsname}/libs
ln -s %{_jsdir}/jquery.mousewheel.js \
%{buildroot}%{_jsdir}/%{jsname}/libs
ln -s %{_jsdir}/jquery_ui/ui/jquery-ui.js \
%{buildroot}%{_jsdir}/%{jsname}/libs
ln -s %{_jsdir}/jquery-ui-touch-punch/jquery.ui.touch-punch.js \
%{buildroot}%{_jsdir}/%{jsname}/libs
mkdir -p %{buildroot}%{_jsdir}/%{jsname}/style
install -m 644 -p style/*.css %{buildroot}%{_jsdir}/%{jsname}/style
ln -s %{_jsdir}/jquery_ui/themes/base/jquery-ui.css \
%{buildroot}%{_jsdir}/%{jsname}/style
ln -s %{_jsdir}/jquery_ui/themes/base/images \
%{buildroot}%{_jsdir}/%{jsname}/style
mkdir -p %{buildroot}%{_jsdir}/%{jsname}/openui5
install -m 644 -p openui5/Component.js \
%{buildroot}%{_jsdir}/%{jsname}/openui5
mkdir -p %{buildroot}%{_jsdir}/%{jsname}/openui5/controller
install -m 644 -p openui5/controller/*.js \
%{buildroot}%{_jsdir}/%{jsname}/openui5/controller
mkdir -p %{buildroot}%{_jsdir}/%{jsname}/openui5/view
install -m 644 -p openui5/view/*.xml \
%{buildroot}%{_jsdir}/%{jsname}/openui5/view
mkdir -p %{buildroot}%{_jsdir}/%{jsname}/files
install -m 644 -p files/* %{buildroot}%{_jsdir}/%{jsname}/files
mkdir -p %{buildroot}%{_jsdir}/%{jsname}/img
install -m 644 -p img/* %{buildroot}%{_jsdir}/%{jsname}/img
mkdir -p %{buildroot}%{_pkgdocdir}
ln -s %{_jsdir}/%{jsname}/scripts %{buildroot}%{_pkgdocdir}
ln -s %{_jsdir}/%{jsname}/style %{buildroot}%{_pkgdocdir}
ln -s %{_jsdir}/%{jsname}/openui5 %{buildroot}%{_pkgdocdir}
ln -s %{_jsdir}/%{jsname}/files %{buildroot}%{_pkgdocdir}
ln -s %{_jsdir}/%{jsname}/img %{buildroot}%{_pkgdocdir}
%files
%{_jsdir}/%{jsname}
%license LICENSE scripts/*.LICENSE
%doc %{_pkgdocdir}
%doc changes.md demo docs/* index.htm readme.md
%changelog
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.3.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Mon Feb 05 2018 Mattias Ellert <mattias.ellert@physics.uu.se> - 5.3.5-1
- Update to version 5.3.5
* Wed Jan 03 2018 Mattias Ellert <mattias.ellert@physics.uu.se> - 5.3.4-2
- Make Summary more informative
- Add files directory needed by root-net-http
* Mon Dec 25 2017 Mattias Ellert <mattias.ellert@physics.uu.se> - 5.3.4-1
- Initial packaging for Fedora