%global srcname mathics-threejs-backend %global npm_name @mathicsorg/%{srcname} # The tests require chromium and don't seem to work properly in mock %bcond_with tests Name: nodejs-%{srcname} Version: 1.3.0 Release: %autorelease Summary: Mathics 3D Graphics backend using three.js License: BSD-3-Clause AND GPL-3.0-only AND ISC and MIT URL: https://github.com/Mathics3/mathics-threejs-backend Source0: https://registry.npmjs.org/%{npm_name}/-/%{srcname}-%{version}.tgz Source1: @mathicsorg-%{srcname}-%{version}-nm-prod.tgz Source2: @mathicsorg-%{srcname}-%{version}-nm-dev.tgz Source3: @mathicsorg-%{srcname}-%{version}-bundled-licenses.txt BuildArch: noarch ExclusiveArch: %{nodejs_arches} noarch Requires: nodejs BuildRequires: nodejs-devel %if %{with tests} BuildRequires: chromium %endif # These libraries are bundled under vendors/ and modified Provides: bundled(three.js) = 146 Provides: bundled(earcut.js) = 0 %description This package provides a JavaScript library for rendering Mathics (and eventually Wolfram Language) Graphics3D objects. This can be used in Mathics front ends like Mathics-Django and Symja to handle 3D graphics. The code may also be useful as a guide for other kinds of Mathics/WL frontends to other kinds of JavaScript graphics engines. %prep %setup -q -n package cp %{SOURCE3} . %build # Setup bundled node modules tar xfz %{SOURCE1} mkdir -p node_modules pushd node_modules ln -s ../node_modules_prod/* . ln -s ../node_modules_prod/.bin . popd %install mkdir -p %{buildroot}%{nodejs_sitelib}/%{npm_name} cp -pr package.json src vendors %{buildroot}%{nodejs_sitelib}/%{npm_name} # Copy over bundled nodejs modules cp -pr node_modules node_modules_prod %{buildroot}%{nodejs_sitelib}/%{npm_name} %check %nodejs_symlink_deps --check %if %{with tests} # Setup bundled dev node_modules for testing tar xfz %{SOURCE2} pushd node_modules ln -sf ../node_modules_dev/* . popd pushd node_modules/.bin ln -sf ../../node_modules_dev/.bin/* . popd # Run tests ./node_modules/.bin/jest \ --modulePathIgnorePatterns node_modules_prod node_modules_dev %endif %files %license LICENCE @mathicsorg-%{srcname}-%{version}-bundled-licenses.txt %doc README.md %{nodejs_sitelib}/%{npm_name} %changelog %autochangelog