# This is an empty "metapackage". It is used solely as a handle for selecting # one of the other nodejsXY "stream" packages, and does not contain any files itself. # Which "stream" packages gets selected is controlled by the version field/macro. Name: nodejs Epoch: 3 Version: 24 Release: %{autorelease} Summary: Node.js JavaScript runtime meta-package License: MIT URL: https://nodejs.org/ BuildArch: noarch # The %%{version}, %%{release}, etc. macros are only set # *after* the corresponding field (Version:, Release:, …) is parsed! %global nodejs_evr %{epoch}:%{version}-%{release} # This required for dynamic manpages detection and symlinking BuildRequires: nodejs%{version}-npm BuildRequires: nodejs%{version}-bin Requires: nodejs%{version} Recommends: nodejs-bin Recommends: nodejs-npm = %{nodejs_evr} %description This is a meta-package that installs the current supported version of Node.js JavaScript runtime. It relies on nodejs%{version} to provide all necessary dependencies. %package devel Summary: Node.js development headers meta-package Requires: nodejs = %{nodejs_evr} Requires: nodejs%{version}-devel %description devel Meta-package that provides the nodejs%{version}-devel package, which contains development headers for the appropriate Node.js JavaScript runtime. %package npm Summary: Node.js Package Manager meta-package Requires: nodejs = %{nodejs_evr} Requires: nodejs%{version}-npm Recommends: nodejs-npm-bin Provides: npm %description npm Meta-package that provides the nodejs%{version}-npm package, which contains the appropriate version of Node.js Package Manager. # These contain the -bin symlinks and are provided for consistency with other streams %package bin Summary: Node.js JavaScript runtime meta-package – unversioned symlinks Requires: nodejs = %{nodejs_evr} Provides: alternative-for(nodejs-bin) = %{nodejs_evr} Conflicts: alternative-for(nodejs-bin) %description bin Binary symlinks for the rolling meta-package. %package npm-bin Summary: Node.js Package Manager meta-package – binary symlinks Requires: nodejs-npm = %{nodejs_evr} Provides: alternative-for(nodejs-npm-bin) = %{nodejs_evr} Conflicts: alternative-for(nodejs-npm-bin) %description npm-bin Binary symlinks for the rolling meta-package (npm parts). %prep # No source to prepare %build # Nothing to build %install # Create symlinks to versioned binaries mkdir -p "${RPM_BUILD_ROOT}%{_bindir}" pushd "${RPM_BUILD_ROOT}%{_bindir}" for binname in node npm npx; do ln -srfL "${binname}-%{version}" "${binname}" done popd # Create unversioned man page symlinks for -bin packages # Iterate through existing man pages, recreating structure in standard location SYSTEM_VERSIONED_MANDIR="%{_datadir}/node-%{version}/man" # find all the sections, recreate them in %{_mandir} find "${SYSTEM_VERSIONED_MANDIR}" -type d -name 'man[123456789]' -printf "${RPM_BUILD_ROOT}%{_mandir}/%%P\0" | xargs -0 mkdir -p # link all the individual manpages find "${SYSTEM_VERSIONED_MANDIR}" -type f -name '*.[123456789]*' -printf '%%P\n' | while read -r man_stem; do ln -srfL "${SYSTEM_VERSIONED_MANDIR}/${man_stem}" "${RPM_BUILD_ROOT}%{_mandir}/${man_stem}" done %files %files devel %files npm %files bin %{_bindir}/node %{_mandir}/man1/node.1* %files npm-bin %{_bindir}/npm %{_bindir}/npx %{_mandir}/ %exclude %{_mandir}/man1/node.1* %changelog %autochangelog