File nodejs.spec of Package nodejs

#
# spec file for package nodejs 
#

#SuSe specific Part
%if %{?sles_version:1}0
BuildRequires:	python gcc gcc-c++
%endif

# Centos 7
%if 0%{?centos_version} == 700
BuildRequires: python3 devtoolset-11
# kernel-devel-uname-r needed by devtoolset-8-systemtap-devel: kernel-debug-devel kernel-devel
#libpython2.7.so.1.0()(64bit) needed by devtoolset-11-gdb: python-libs python27-python-libs

#devtoolset-11-annobin-plugin-gcc.x86_64 : annobin gcc plugin
#devtoolset-11-gcc.x86_64 : GCC version 11
#devtoolset-11-gcc-c++.x86_64 : C++ support for GCC  version 11
#devtoolset-11-gcc-gdb-plugin.x86_64 : GCC 11 plugin for GDB
#devtoolset-11-gcc-gfortran.x86_64 : Fortran support for GCC 11
#devtoolset-11-gcc-plugin-devel.x86_64 : Support for compiling GCC plugins
#devtoolset-11-libgccjit.x86_64 : Library for embedding GCC inside programs and libraries
#devtoolset-11-libgccjit-devel.x86_64 : Support for embedding GCC inside programs and libraries
#devtoolset-11-libgccjit-docs.x86_64 : Documentation for embedding GCC inside programs and libraries


%endif

%if 0%{?centos_version} == 800
BuildRequires: gcc gcc-c++ python
%endif

#all Distros
Name:           nodejs
Version:	16.1.0
Release:	0
License:	https://raw.githubusercontent.com/joyent/node/v16.1.0/LICENSE
Summary:	platform for easily building fast, scalable network applications
Url:		http://nodejs.org/
Group:		server/nodejs
Source:		https://nodejs.org/dist/v16.1.0/node-v16.1.0.tar.gz
Provides:	node
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%package devel
Requires:	nodejs = 16.1.0
Provides:	npm node-gyp
Summary:	includes devel files and npm utility for nodejs
Version:        16.1.0
Group:          server/nodejs
Url:            http://nodejs.org/


%description
Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

%description devel
development files for nodejs. Including the npm tool

%prep
cd %{_builddir}
tar -xf %{_sourcedir}/node-v%{version}.tar.gz

%build
cd %{_builddir}/node-v%{version}
#overwriting the default /usr/local prefix duo to a FHS  "Feature"
scl enable devtoolset-11 -- ./configure --prefix=/usr
cd %{_builddir}/node-v%{version}
scl enable devtoolset-11 -- make #%{?_smp_mflags} 

%install
cd %{_builddir}/node-v%{version}
%make_install

%post
ln -s /usr/lib/node_modules /usr/lib/node | :
ln -s /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js /usr/bin/node-gyp | :

%postun
rm -rf /usr/lib/node | :
rm -rf /usr/bin/node-gyp | :

%files
%defattr(-,root,root)
/usr/bin/node
/usr/share/man/man1/node.1.gz
%dir /usr/lib/node_modules

%post devel
ln -s /usr/include/node/* /usr/include/ |:

%postun devel
#links to files in /usr/include/node
rm -rf /usr/include/ares.h | :
rm -rf /usr/include/ares_version.h |:
rm -rf /usr/include/common.gypi | :
rm -rf /usr/include/config.gypi | :
rm -rf /usr/include/nameser.h | :
rm -rf /usr/include/node.h | :
rm -rf /usr/include/node_buffer.h | :
rm -rf /usr/include/node_internals.h | :
rm -rf /usr/include/node_object_wrap.h | :
rm -rf /usr/include/node_version.h | :
rm -rf /usr/include/openssl | :
rm -rf /usr/include/uv-private | :
rm -rf /usr/include/uv.h | :
rm -rf /usr/include/v8-debug.h | :
rm -rf /usr/include/v8-preparser.h | :
rm -rf /usr/include/v8-profiler.h | :
rm -rf /usr/include/v8-testing.h | :
rm -rf /usr/include/v8.h | :
rm -rf /usr/include/v8stdint.h | :
rm -rf /usr/include/zconf.h | :
rm -rf /usr/include/zlib.h | :

%files devel
%defattr(-,root,root)
/usr/bin/npm
/usr/include/node
/usr/lib/node_modules/npm

%changelog

openSUSE Build Service is sponsored by