1ac537
%global with_debug 0
c3d593
c3d593
# PowerPC, s390x and aarch64 segfault during Debug builds
c3d593
# https://github.com/nodejs/node/issues/20642
c3d593
%ifarch %{power64} s390x aarch64
c3d593
%global with_debug 0
c3d593
%endif
c3d593
c3d593
# bundle dependencies that are not available as Fedora modules
c3d593
%bcond_with bootstrap
c3d593
1ac537
# == Master Relase ==
1ac537
# This is used by both the nodejs package and the npm subpackage that
1ac537
# has a separate version - the name is special so that rpmdev-bumpspec
1ac537
# will bump this rather than adding .1 to the end.
1ac537
%global baserelease 3
1ac537
c3d593
%{?!_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}}
c3d593
c3d593
# == Node.js Version ==
c3d593
# Note: Fedora should only ship LTS versions of Node.js (currently expected
c3d593
# to be major versions with even numbers). The odd-numbered versions are new
c3d593
# feature releases that are only supported for nine months, which is shorter
c3d593
# than a Fedora release lifecycle.
c3d593
%global nodejs_epoch 1
c3d593
%global nodejs_major 10
1ac537
%global nodejs_minor 21
4d967e
%global nodejs_patch 0
c3d593
%global nodejs_abi %{nodejs_major}.%{nodejs_minor}
1ac537
# nodejs_soversion - from NODE_MODULE_VERSION in src/node_version.h
1ac537
%global nodejs_soversion 64
c3d593
%global nodejs_version %{nodejs_major}.%{nodejs_minor}.%{nodejs_patch}
1ac537
%global nodejs_release %{baserelease}
1ac537
1ac537
%global nodejs_datadir %{_datarootdir}/nodejs
c3d593
c3d593
# == Bundled Dependency Versions ==
c3d593
# v8 - from deps/v8/include/v8-version.h
1ac537
# Epoch is set to ensure clean upgrades from the old v8 package
1ac537
%global v8_epoch 1
c3d593
%global v8_major 6
c3d593
%global v8_minor 8
c3d593
%global v8_build 275
c3d593
%global v8_patch 32
c3d593
# V8 presently breaks ABI at least every x.y release while never bumping SONAME
c3d593
%global v8_abi %{v8_major}.%{v8_minor}
c3d593
%global v8_version %{v8_major}.%{v8_minor}.%{v8_build}.%{v8_patch}
1ac537
%global v8_release %{nodejs_epoch}.%{nodejs_major}.%{nodejs_minor}.%{nodejs_patch}.%{nodejs_release}
c3d593
c3d593
# c-ares - from deps/cares/include/ares_version.h
c3d593
# https://github.com/nodejs/node/pull/9332
c3d593
%global c_ares_major 1
28a751
%global c_ares_minor 15
c3d593
%global c_ares_patch 0
c3d593
%global c_ares_version %{c_ares_major}.%{c_ares_minor}.%{c_ares_patch}
c3d593
c3d593
# http-parser - from deps/http_parser/http_parser.h
c3d593
%global http_parser_major 2
4d967e
%global http_parser_minor 9
4d967e
%global http_parser_patch 3
c3d593
%global http_parser_version %{http_parser_major}.%{http_parser_minor}.%{http_parser_patch}
c3d593
c3d593
# libuv - from deps/uv/include/uv/version.h
c3d593
%global libuv_major 1
1ac537
%global libuv_minor 34
1ac537
%global libuv_patch 2
c3d593
%global libuv_version %{libuv_major}.%{libuv_minor}.%{libuv_patch}
c3d593
c3d593
# nghttp2 - from deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h
c3d593
%global nghttp2_major 1
1ac537
%global nghttp2_minor 41
1ac537
%global nghttp2_patch 0
c3d593
%global nghttp2_version %{nghttp2_major}.%{nghttp2_minor}.%{nghttp2_patch}
c3d593
1ac537
# ICU - from tools/icu/current_ver.dep
1ac537
%global icu_major 64
1ac537
%global icu_minor 2
c3d593
%global icu_version %{icu_major}.%{icu_minor}
c3d593
1ac537
%global icudatadir %{nodejs_datadir}/icudata
1ac537
%{!?little_endian: %global little_endian %(%{__python3} -c "import sys;print (0 if sys.byteorder=='big' else 1)")}
1ac537
# " this line just fixes syntax highlighting for vim that is confused by the above and continues literal
c3d593
c3d593
c3d593
# punycode - from lib/punycode.js
c3d593
# Note: this was merged into the mainline since 0.6.x
c3d593
# Note: this will be unmerged in an upcoming major release
c3d593
%global punycode_major 2
c3d593
%global punycode_minor 1
c3d593
%global punycode_patch 0
c3d593
%global punycode_version %{punycode_major}.%{punycode_minor}.%{punycode_patch}
c3d593
c3d593
# npm - from deps/npm/package.json
c3d593
%global npm_epoch 1
c3d593
%global npm_major 6
1ac537
%global npm_minor 14
4d967e
%global npm_patch 4
c3d593
%global npm_version %{npm_major}.%{npm_minor}.%{npm_patch}
c3d593
c3d593
# In order to avoid needing to keep incrementing the release version for the
c3d593
# main package forever, we will just construct one for npm that is guaranteed
c3d593
# to increment safely. Changing this can only be done during an update when the
c3d593
# base npm version number is increasing.
c3d593
%global npm_release %{nodejs_epoch}.%{nodejs_major}.%{nodejs_minor}.%{nodejs_patch}.%{nodejs_release}
c3d593
1ac537
# brotli - from deps/brotli/common/version.h
1ac537
# v10.x doesn't have --shared-brotli configure option, so we have to bundle it
1ac537
%global brotli_major 1
1ac537
%global brotli_minor 0
1ac537
%global brotli_patch 7
1ac537
%global brotli_version %{brotli_major}.%{brotli_minor}.%{brotli_patch}
c3d593
c3d593
Name: nodejs
c3d593
Epoch: %{nodejs_epoch}
c3d593
Version: %{nodejs_version}
c3d593
Release: %{nodejs_release}%{?dist}
c3d593
Summary: JavaScript runtime
c3d593
License: MIT and ASL 2.0 and ISC and BSD
c3d593
Group: Development/Languages
c3d593
URL: http://nodejs.org/
c3d593
c3d593
ExclusiveArch: %{nodejs_arches}
c3d593
c3d593
# nodejs bundles openssl, but we use the system version in Fedora
c3d593
# because openssl contains prohibited code, we remove openssl completely from
c3d593
# the tarball, using the script in Source100
c3d593
Source0: node-v%{nodejs_version}-stripped.tar.gz
1ac537
Source1: npmrc
1ac537
Source2: btest402.js
1ac537
Source3: https://github.com/unicode-org/icu/releases/download/release-%{icu_major}-%{icu_minor}/icu4c-%{icu_major}_%{icu_minor}-src.tgz
c3d593
Source100: %{name}-tarball.sh
c3d593
c3d593
# The native module Requires generator remains in the nodejs SRPM, so it knows
c3d593
# the nodejs and v8 versions.  The remainder has migrated to the
c3d593
# nodejs-packaging SRPM.
c3d593
Source7: nodejs_native.attr
c3d593
c3d593
# Disable running gyp on bundled deps we don't use
c3d593
Patch1: 0001-Disable-running-gyp-on-shared-deps.patch
c3d593
c3d593
# Suppress the message from npm to run `npm -g update npm`
c3d593
# This does bad things on an RPM-managed npm.
c3d593
Patch2: 0002-Suppress-NPM-message-to-run-global-update.patch
c3d593
1ac537
# Upstream patch to enable auto-detection of full ICU data
1ac537
# https://github.com/nodejs/node/pull/30825
1ac537
Patch3: 0003-build-auto-load-ICU-data-from-with-icu-default-data-.patch
fd3b1a
c3d593
BuildRequires: python2-devel
c3d593
BuildRequires: python3-devel
c3d593
BuildRequires: zlib-devel
1ac537
BuildRequires: gcc >= 6.3.0
1ac537
BuildRequires: gcc-c++ >= 6.3.0
1ac537
# needed to generate bundled provides for npm dependencies
1ac537
# https://src.fedoraproject.org/rpms/nodejs/pull-request/2
1ac537
# https://pagure.io/nodejs-packaging/pull-request/10
28a751
BuildRequires: nodejs-packaging
1ac537
BuildRequires: chrpath
1ac537
BuildRequires: libatomic
c3d593
c3d593
%if %{with bootstrap}
c3d593
Provides: bundled(http-parser) = %{http_parser_version}
c3d593
Provides: bundled(libuv) = %{libuv_version}
c3d593
Provides: bundled(nghttp2) = %{nghttp2_version}
c3d593
%else
c3d593
BuildRequires: systemtap-sdt-devel
c3d593
BuildRequires: libuv-devel >= 1:%{libuv_version}
c3d593
Requires: libuv >= 1:%{libuv_version}
c3d593
BuildRequires: libnghttp2-devel >= %{nghttp2_version}
c3d593
Requires: libnghttp2 >= %{nghttp2_version}
1ac537
BuildRequires: http-parser-devel >= %{http_parser_version}
1ac537
Requires: http-parser >= %{http_parser_version}
c3d593
c3d593
%endif
c3d593
c3d593
BuildRequires: openssl-devel
c3d593
c3d593
# we need the system certificate store
c3d593
Requires: ca-certificates
c3d593
1ac537
# Pull in the full-icu data by default
1ac537
Recommends: nodejs-full-i18n%{?_isa} = %{nodejs_epoch}:%{version}-%{release}
1ac537
1ac537
# we need ABI virtual provides where SONAMEs aren't enough/not present so deps
1ac537
# break when binary compatibility is broken
c3d593
Provides: nodejs(abi) = %{nodejs_abi}
c3d593
Provides: nodejs(abi%{nodejs_major}) = %{nodejs_abi}
c3d593
Provides: nodejs(v8-abi) = %{v8_abi}
c3d593
Provides: nodejs(v8-abi%{v8_major}) = %{v8_abi}
c3d593
1ac537
# this corresponds to the "engine" requirement in package.json
c3d593
Provides: nodejs(engine) = %{nodejs_version}
c3d593
c3d593
# Node.js currently has a conflict with the 'node' package in Fedora
c3d593
# The ham-radio group has agreed to rename their binary for us, but
c3d593
# in the meantime, we're setting an explicit Conflicts: here
c3d593
Conflicts: node <= 0.3.2-12
c3d593
c3d593
# The punycode module was absorbed into the standard library in v0.6.
c3d593
# It still exists as a seperate package for the benefit of users of older
c3d593
# versions.  Since we've never shipped anything older than v0.10 in Fedora,
c3d593
# we don't need the seperate nodejs-punycode package, so we Provide it here so
c3d593
# dependent packages don't need to override the dependency generator.
c3d593
# See also: RHBZ#11511811
c3d593
# UPDATE: punycode will be deprecated and so we should unbundle it in Node v8
c3d593
# and use upstream module instead
c3d593
# https://github.com/nodejs/node/commit/29e49fc286080215031a81effbd59eac092fff2f
c3d593
Provides: nodejs-punycode = %{punycode_version}
c3d593
Provides: npm(punycode) = %{punycode_version}
c3d593
c3d593
# Node.js has forked c-ares from upstream in an incompatible way, so we need
c3d593
# to carry the bundled version internally.
c3d593
# See https://github.com/nodejs/node/commit/766d063e0578c0f7758c3a965c971763f43fec85
c3d593
Provides: bundled(c-ares) = %{c_ares_version}
c3d593
c3d593
# Node.js is closely tied to the version of v8 that is used with it. It makes
c3d593
# sense to use the bundled version because upstream consistently breaks ABI
c3d593
# even in point releases. Node.js upstream has now removed the ability to build
c3d593
# against a shared system version entirely.
c3d593
# See https://github.com/nodejs/node/commit/d726a177ed59c37cf5306983ed00ecd858cfbbef
c3d593
Provides: bundled(v8) = %{v8_version}
c3d593
c3d593
# Node.js is bound to a specific version of ICU which may not match the OS
c3d593
# We cannot pin the OS to this version of ICU because every update includes
c3d593
# an ABI-break, so we'll use the bundled copy.
c3d593
Provides: bundled(icu) = %{icu_version}
c3d593
c3d593
# Make sure we keep NPM up to date when we update Node.js
c3d593
%if 0%{?rhel}
c3d593
# EPEL doesn't support Recommends, so make it strict
c3d593
Requires: npm = %{npm_epoch}:%{npm_version}-%{npm_release}%{?dist}
c3d593
%else
c3d593
Recommends: npm = %{npm_epoch}:%{npm_version}-%{npm_release}%{?dist}
c3d593
%endif
c3d593
1ac537
# Provide bundled brotli until we can build it with system package
1ac537
Provides: bundled(brotli) = %{brotli_version}
c3d593
c3d593
%description
c3d593
Node.js is a platform built on Chrome's JavaScript runtime
c3d593
for easily building fast, scalable network applications.
c3d593
Node.js uses an event-driven, non-blocking I/O model that
c3d593
makes it lightweight and efficient, perfect for data-intensive
c3d593
real-time applications that run across distributed devices.
c3d593
1ac537
c3d593
%package devel
c3d593
Summary: JavaScript runtime - development headers
c3d593
Group: Development/Languages
c3d593
Requires: %{name}%{?_isa} = %{epoch}:%{nodejs_version}-%{nodejs_release}%{?dist}
c3d593
Requires: openssl-devel%{?_isa}
c3d593
Requires: zlib-devel%{?_isa}
c3d593
Requires: nodejs-packaging
c3d593
c3d593
%if %{with bootstrap}
c3d593
# deps are bundled
c3d593
%else
c3d593
Requires: http-parser-devel%{?_isa}
c3d593
Requires: libuv-devel%{?_isa}
c3d593
%endif
c3d593
c3d593
%description devel
c3d593
Development headers for the Node.js JavaScript runtime.
c3d593
1ac537
1ac537
%package full-i18n
1ac537
Summary: Non-English locale data for Node.js
1ac537
Requires: %{name}%{?_isa} = %{nodejs_epoch}:%{nodejs_version}-%{nodejs_release}%{?dist}
1ac537
1ac537
%description full-i18n
1ac537
Optional data files to provide full-icu support for Node.js. Remove this
1ac537
package to save space if non-English locales are not needed.
1ac537
1ac537
c3d593
%package -n npm
c3d593
Summary: Node.js Package Manager
c3d593
Epoch: %{npm_epoch}
c3d593
Version: %{npm_version}
c3d593
Release: %{npm_release}%{?dist}
c3d593
c3d593
# We used to ship npm separately, but it is so tightly integrated with Node.js
c3d593
# (and expected to be present on all Node.js systems) that we ship it bundled
c3d593
# now.
c3d593
Obsoletes: npm < 0:3.5.4-6
c3d593
Provides: npm = %{npm_epoch}:%{npm_version}
1ac537
Requires: nodejs = %{nodejs_epoch}:%{nodejs_version}-%{nodejs_release}%{?dist}
c3d593
c3d593
# Do not add epoch to the virtual NPM provides or it will break
c3d593
# the automatic dependency-generation script.
c3d593
Provides: npm(npm) = %{npm_version}
c3d593
c3d593
%description -n npm
c3d593
npm is a package manager for node.js. You can use it to install and publish
c3d593
your node programs. It manages dependencies and does other cool stuff.
c3d593
1ac537
c3d593
%package docs
c3d593
Summary: Node.js API documentation
c3d593
Group: Documentation
c3d593
BuildArch: noarch
c3d593
c3d593
# We don't require that the main package be installed to
c3d593
# use the docs, but if it is installed, make sure the
c3d593
# version always matches
1ac537
Conflicts: %{name} > %{nodejs_epoch}:%{nodejs_version}-%{nodejs_release}%{?dist}
1ac537
Conflicts: %{name} < %{nodejs_epoch}:%{nodejs_version}-%{nodejs_release}%{?dist}
c3d593
c3d593
%description docs
c3d593
The API documentation for the Node.js JavaScript runtime.
c3d593
c3d593
c3d593
%prep
1ac537
%autosetup -p1 -n node-v%{nodejs_version}
c3d593
c3d593
# remove bundled dependencies that we aren't building
c3d593
rm -rf deps/zlib
c3d593
c3d593
# Replace any instances of unversioned python' with python2
1ac537
pathfix.py -i %{__python2} -pn $(find -type f ! -name "*.js")
c3d593
find . -type f -exec sed -i "s~/usr\/bin\/env python~/usr/bin/python2~" {} \;
c3d593
find . -type f -exec sed -i "s~/usr\/bin\/python\W~/usr/bin/python2~" {} \;
c3d593
sed -i "s~python~python2~" $(find . -type f | grep "gyp$")
c3d593
sed -i "s~usr\/bin\/python2~usr\/bin\/python3~" ./deps/v8/tools/gen-inlining-tests.py
c3d593
sed -i "s~usr\/bin\/python.*$~usr\/bin\/python2~" ./deps/v8/tools/mb/mb_unittest.py
c3d593
find . -type f -exec sed -i "s~python -c~python2 -c~" {} \;
c3d593
sed -i "s~which('python')~which('python2')~" configure
c3d593
c3d593
%build
1ac537
1ac537
%ifarch s390 s390x %{arm} %ix86
1ac537
# Decrease debuginfo verbosity to reduce memory consumption during final
1ac537
# library linking
1ac537
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
1ac537
%endif
1ac537
c3d593
export RHEL_ALLOW_PYTHON2_FOR_BUILD=1
1ac537
export CC='%{__cc}'
1ac537
export CXX='%{__cxx}'
1ac537
c3d593
# build with debugging symbols and add defines from libuv (#892601)
c3d593
# Node's v8 breaks with GCC 6 because of incorrect usage of methods on
c3d593
# NULL objects. We need to pass -fno-delete-null-pointer-checks
1ac537
export CFLAGS='%{optflags} \
c3d593
               -D_LARGEFILE_SOURCE \
c3d593
               -D_FILE_OFFSET_BITS=64 \
c3d593
               -DZLIB_CONST \
c3d593
               -fno-delete-null-pointer-checks'
1ac537
export CXXFLAGS='%{optflags} \
c3d593
                 -D_LARGEFILE_SOURCE \
c3d593
                 -D_FILE_OFFSET_BITS=64 \
c3d593
                 -DZLIB_CONST \
c3d593
                 -fno-delete-null-pointer-checks'
c3d593
c3d593
# Explicit new lines in C(XX)FLAGS can break naive build scripts
c3d593
export CFLAGS="$(echo ${CFLAGS} | tr '\n\\' '  ')"
c3d593
export CXXFLAGS="$(echo ${CXXFLAGS} | tr '\n\\' '  ')"
c3d593
c3d593
export LDFLAGS="%{build_ldflags}"
c3d593
c3d593
%if %{with bootstrap}
c3d593
./configure --prefix=%{_prefix} \
c3d593
           --shared-openssl \
c3d593
           --shared-zlib \
c3d593
           --without-dtrace \
c3d593
           --with-intl=small-icu \
c3d593
           --debug-nghttp2 \
c3d593
           --openssl-use-def-ca-store
c3d593
%else
c3d593
./configure --prefix=%{_prefix} \
c3d593
           --shared-openssl \
c3d593
           --shared-zlib \
c3d593
           --shared-libuv \
c3d593
           --shared-http-parser \
c3d593
           --shared-nghttp2 \
c3d593
           --with-dtrace \
1ac537
           --with-intl=small-icu \
1ac537
           --with-icu-default-data-dir=%{icudatadir} \
c3d593
           --debug-nghttp2 \
c3d593
           --openssl-use-def-ca-store
c3d593
%endif
c3d593
c3d593
%if %{?with_debug} == 1
c3d593
# Setting BUILDTYPE=Debug builds both release and debug binaries
c3d593
make BUILDTYPE=Debug %{?_smp_mflags}
c3d593
%else
c3d593
make BUILDTYPE=Release %{?_smp_mflags}
c3d593
%endif
c3d593
1ac537
# Extract the ICU data and convert it to the appropriate endianness
1ac537
pushd deps/
1ac537
tar xfz %SOURCE3
1ac537
1ac537
pushd icu/source
1ac537
1ac537
mkdir -p converted
1ac537
%if 0%{?little_endian}
1ac537
# The little endian data file is included in the ICU sources
1ac537
install -Dpm0644 data/in/icudt%{icu_major}l.dat converted/
1ac537
1ac537
%else
1ac537
# For the time being, we need to build ICU and use the included `icupkg` tool
1ac537
# to convert the little endian data file into a big-endian one.
1ac537
# At some point in the future, ICU releases will start including both data
1ac537
# files and we should switch to those.
1ac537
mkdir -p data/out/tmp
1ac537
1ac537
%configure
1ac537
%make_build
1ac537
1ac537
icu_root=$(pwd)
1ac537
LD_LIBRARY_PATH=./lib ./bin/icupkg -tb data/in/icudt%{icu_major}l.dat \
1ac537
                                       converted/icudt%{icu_major}b.dat
1ac537
%endif
1ac537
1ac537
popd # icu/source
1ac537
popd # deps
1ac537
c3d593
c3d593
%install
c3d593
export RHEL_ALLOW_PYTHON2_FOR_BUILD=1
c3d593
c3d593
rm -rf %{buildroot}
c3d593
c3d593
./tools/install.py install %{buildroot} %{_prefix}
c3d593
c3d593
# Set the binary permissions properly
c3d593
chmod 0755 %{buildroot}/%{_bindir}/node
1ac537
chrpath --delete %{buildroot}%{_bindir}/node
c3d593
c3d593
%if %{?with_debug} == 1
c3d593
# Install the debug binary and set its permissions
c3d593
install -Dpm0755 out/Debug/node %{buildroot}/%{_bindir}/node_g
c3d593
%endif
c3d593
c3d593
# own the sitelib directory
c3d593
mkdir -p %{buildroot}%{_prefix}/lib/node_modules
c3d593
c3d593
# ensure Requires are added to every native module that match the Provides from
c3d593
# the nodejs build in the buildroot
c3d593
install -Dpm0644 %{SOURCE7} %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs_native.attr
c3d593
cat << EOF > %{buildroot}%{_rpmconfigdir}/nodejs_native.req
c3d593
#!/bin/sh
c3d593
echo 'nodejs(abi%{nodejs_major}) >= %nodejs_abi'
c3d593
echo 'nodejs(v8-abi%{v8_major}) >= %v8_abi'
c3d593
EOF
c3d593
chmod 0755 %{buildroot}%{_rpmconfigdir}/nodejs_native.req
c3d593
1ac537
# install documentation
c3d593
mkdir -p %{buildroot}%{_pkgdocdir}/html
c3d593
cp -pr doc/* %{buildroot}%{_pkgdocdir}/html
c3d593
rm -f %{buildroot}%{_pkgdocdir}/html/nodejs.1
c3d593
1ac537
# node-gyp needs common.gypi too
c3d593
mkdir -p %{buildroot}%{_datadir}/node
c3d593
cp -p common.gypi %{buildroot}%{_datadir}/node
c3d593
1ac537
# Install the GDB init tool into the documentation directory
1ac537
mv %{buildroot}/%{_datadir}/doc/node/gdbinit %{buildroot}/%{_pkgdocdir}/gdbinit
1ac537
c3d593
# install NPM docs to mandir
c3d593
mkdir -p %{buildroot}%{_mandir} \
c3d593
         %{buildroot}%{_pkgdocdir}/npm
c3d593
c3d593
cp -pr deps/npm/man/* %{buildroot}%{_mandir}/
c3d593
rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/man
c3d593
ln -sf %{_mandir}  %{buildroot}%{_prefix}/lib/node_modules/npm/man
c3d593
4d967e
# Install Gatsby HTML documentation to %{_pkgdocdir}
4d967e
cp -pr deps/npm/docs %{buildroot}%{_pkgdocdir}/npm/
4d967e
rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/docs
4d967e
ln -sf %{_pkgdocdir}/npm %{buildroot}%{_prefix}/lib/node_modules/npm/docs
c3d593
c3d593
# Node tries to install some python files into a documentation directory
c3d593
# (and not the proper one). Remove them for now until we figure out what to
c3d593
# do with them.
c3d593
rm -f %{buildroot}/%{_defaultdocdir}/node/lldb_commands.py \
c3d593
      %{buildroot}/%{_defaultdocdir}/node/lldbinit
c3d593
c3d593
# Some NPM bundled deps are executable but should not be. This causes
c3d593
# unnecessary automatic dependencies to be added. Make them not executable.
c3d593
# Skip the npm bin directory or the npm binary will not work.
c3d593
find %{buildroot}%{_prefix}/lib/node_modules/npm \
c3d593
    -not -path "%{buildroot}%{_prefix}/lib/node_modules/npm/bin/*" \
c3d593
    -executable -type f \
c3d593
    -exec chmod -x {} \;
c3d593
c3d593
# The above command is a little overzealous. Add a few permissions back.
c3d593
chmod 0755 %{buildroot}%{_prefix}/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp
c3d593
chmod 0755 %{buildroot}%{_prefix}/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js
c3d593
1ac537
# Drop the NPM default configuration in place
1ac537
mkdir -p %{buildroot}%{_sysconfdir}
1ac537
cp %{SOURCE1} %{buildroot}%{_sysconfdir}/npmrc
1ac537
1ac537
# NPM upstream expects it to be in /usr/etc/npmrc, so we'll put a symlink here
1ac537
# This is done in the interests of keeping /usr read-only.
1ac537
mkdir -p %{buildroot}%{_prefix}/etc
1ac537
ln -s %{_sysconfdir}/npmrc %{buildroot}%{_prefix}/etc/npmrc
1ac537
1ac537
# Install the full-icu data files
1ac537
install -Dpm0644 -t %{buildroot}%{icudatadir} deps/icu/source/converted/*
1ac537
c3d593
c3d593
%check
c3d593
# Fail the build if the versions don't match
c3d593
%{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.node, '%{nodejs_version}')"
c3d593
%{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.v8.replace(/-node\.\d+$/, ''), '%{v8_version}')"
c3d593
%{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.ares.replace(/-DEV$/, ''), '%{c_ares_version}')"
c3d593
c3d593
# Ensure we have punycode and that the version matches
c3d593
%{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"punycode\").version, '%{punycode_version}')"
c3d593
c3d593
# Ensure we have npm and that the version matches
c3d593
NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{_prefix}/lib/node_modules/npm/node_modules %{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"npm\").version, '%{npm_version}')"
c3d593
1ac537
# Make sure i18n support is working
1ac537
NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{_prefix}/lib/node_modules/npm/node_modules %{buildroot}/%{_bindir}/node --icu-data-dir=%{buildroot}%{icudatadir} %{SOURCE2}
1ac537
c3d593
c3d593
%pretrans -n npm -p <lua>
c3d593
-- Remove all of the symlinks from the bundled npm node_modules directory
c3d593
-- This scriptlet can be removed in Fedora 31
c3d593
base_path = "%{_prefix}/lib/node_modules/npm/node_modules/"
c3d593
d_st = posix.stat(base_path)
c3d593
if d_st then
c3d593
  for f in posix.files(base_path) do
c3d593
    path = base_path..f
c3d593
    st = posix.stat(path)
c3d593
    if st and st.type == "link" then
c3d593
      os.remove(path)
c3d593
    end
c3d593
  end
c3d593
end
c3d593
1ac537
-- Replace the npm man directory with a symlink
1ac537
-- Drop this scriptlet when F31 is EOL
1ac537
path = "%{_prefix}/lib/node_modules/npm/man"
1ac537
st = posix.stat(path)
1ac537
if st and st.type == "directory" then
1ac537
  status = os.rename(path, path .. ".rpmmoved")
1ac537
  if not status then
1ac537
    suffix = 0
1ac537
    while not status do
1ac537
      suffix = suffix + 1
1ac537
      status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
1ac537
    end
1ac537
    os.rename(path, path .. ".rpmmoved")
1ac537
  end
1ac537
end
1ac537
1ac537
c3d593
%files
c3d593
%{_bindir}/node
c3d593
%dir %{_prefix}/lib/node_modules
c3d593
%dir %{_datadir}/node
c3d593
%dir %{_datadir}/systemtap
c3d593
%dir %{_datadir}/systemtap/tapset
c3d593
%{_datadir}/systemtap/tapset/node.stp
c3d593
c3d593
%if %{with bootstrap}
c3d593
# no dtrace
c3d593
%else
c3d593
%dir %{_usr}/lib/dtrace
c3d593
%{_usr}/lib/dtrace/node.d
c3d593
%endif
c3d593
c3d593
%{_rpmconfigdir}/fileattrs/nodejs_native.attr
c3d593
%{_rpmconfigdir}/nodejs_native.req
c3d593
%license LICENSE
c3d593
%doc AUTHORS CHANGELOG.md COLLABORATOR_GUIDE.md GOVERNANCE.md README.md
c3d593
%doc %{_mandir}/man1/node.1*
c3d593
c3d593
c3d593
%files devel
c3d593
%if %{?with_debug} == 1
c3d593
%{_bindir}/node_g
c3d593
%endif
c3d593
%{_includedir}/node
c3d593
%{_datadir}/node/common.gypi
c3d593
%{_pkgdocdir}/gdbinit
c3d593
c3d593
1ac537
%files full-i18n
1ac537
%dir %{icudatadir}
1ac537
%{icudatadir}/icudt%{icu_major}*.dat
1ac537
1ac537
c3d593
%files -n npm
c3d593
%{_bindir}/npm
c3d593
%{_bindir}/npx
c3d593
%{_prefix}/lib/node_modules/npm
1ac537
%config(noreplace) %{_sysconfdir}/npmrc
1ac537
%{_prefix}/etc/npmrc
c3d593
%ghost %{_sysconfdir}/npmignore
4d967e
%doc %{_mandir}/man1/npm*.1*
4d967e
%doc %{_mandir}/man1/npx.1*
4d967e
%doc %{_mandir}/man5/folders.5*
4d967e
%doc %{_mandir}/man5/install.5*
4d967e
%doc %{_mandir}/man5/npmrc.5*
4d967e
%doc %{_mandir}/man5/package-json.5*
4d967e
%doc %{_mandir}/man5/package-lock-json.5*
4d967e
%doc %{_mandir}/man5/package-locks.5*
4d967e
%doc %{_mandir}/man5/shrinkwrap-json.5*
4d967e
%doc %{_mandir}/man7/config.7*
4d967e
%doc %{_mandir}/man7/developers.7*
4d967e
%doc %{_mandir}/man7/disputes.7*
4d967e
%doc %{_mandir}/man7/orgs.7*
4d967e
%doc %{_mandir}/man7/registry.7*
4d967e
%doc %{_mandir}/man7/removal.7*
4d967e
%doc %{_mandir}/man7/scope.7*
4d967e
%doc %{_mandir}/man7/scripts.7*
c3d593
%doc %{_mandir}/man7/semver.7*
c3d593
c3d593
c3d593
%files docs
c3d593
%dir %{_pkgdocdir}
c3d593
%{_pkgdocdir}/html
4d967e
%{_pkgdocdir}/npm/docs
4d967e
c3d593
c3d593
%changelog
1ac537
* Wed Jun 17 2020 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:10.21.0-3
1ac537
- Resolves: RHBZ#1845306
1ac537
- Remove brotli-devel requires from nodejs-devel
1ac537
1ac537
* Tue Jun 16 2020 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:10.21.0-2
1ac537
- Resolves: RHBZ#1845306
1ac537
- Turn off debug builds
1ac537
1ac537
* Mon Jun 15 2020 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:10.21.0-1
1ac537
- Security update to 10.21.0
1ac537
- Resolves: RHBZ#1845306
1ac537
- Fixes CVE-2020-11080, CVE-2020-8174, CVE-2020-10531
1ac537
- Bundle brotli, because --shared-brotli configure option is missing
1ac537
- Add i18n subpackage
1ac537
fd3b1a
* Wed Mar 18 2020 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:10.19.0-2
71a095
- Resolves: RHBZ#1811499
fd3b1a
4d967e
* Mon Feb 10 2020 Jan Staněk <jstanek@redhat.com> - 1:10.19.0-1
4d967e
- Rebase to 10.19.0 to fix CVE-2019-15604 to CVE-2019-15606
4d967e
28a751
* Tue Sep 10 2019 Jan Staněk <jstanek@redhat.com> - 1:10.16.3-1
28a751
- Rebase to 10.16.3 to fix CVE-2019-9511 to CVE-2019-9518
28a751
71a095
* Thu Mar 14 2019 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:10.14.1-2
71a095
- move nodejs-packaging BR out of conditional
71a095
c3d593
* Tue Dec 11 2018 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:10.14.1-1
c3d593
- Resolves: RHBZ#1644207
c3d593
- fixes node-gyp permissions
c3d593
- rebase
c3d593
c3d593
* Thu Oct 11 2018 Jan Staněk <jstanek@redhat.com> - 1:10.11.0-2
c3d593
- BuildRequire nodejs-packaging for proper npm dependency generation
c3d593
- Resolves: rhbz#1615947
c3d593
c3d593
* Mon Oct 08 2018 Jan Staněk <jstanek@redhat.com> - 1:10.11.0-1
c3d593
- Rebase to 10.11.0
c3d593
- Import changes from fedora
c3d593
- Resolves: rhbz#1621766
c3d593
c3d593
* Mon Jul 30 2018 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:10.7.0-5
c3d593
- Import sources from fedora
c3d593
- Allow using python2 at %%build and %%install
c3d593
- turn off debug for aarch64
c3d593
c3d593
* Fri Jul 20 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:10.7.0-4
c3d593
- Fix npm upgrade scriptlet
c3d593
- Fix unexpected trailing .1 in npm release field
c3d593
c3d593
* Fri Jul 20 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:10.7.0-3
c3d593
- Restore annotations to binaries
c3d593
- Fix unexpected trailing .1 in release field
c3d593
c3d593
* Thu Jul 19 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:10.7.0-2
c3d593
- Update to 10.7.0
c3d593
- https://nodejs.org/en/blog/release/v10.7.0/
c3d593
- https://nodejs.org/en/blog/release/v10.6.0/
c3d593
c3d593
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1:10.5.0-1.1
c3d593
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
c3d593
c3d593
* Thu Jun 21 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:10.5.0-1
c3d593
- Update to 10.5.0
c3d593
- https://nodejs.org/en/blog/release/v10.5.0/
c3d593
c3d593
* Thu Jun 14 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:10.4.1-1
c3d593
- Update to 10.4.1 to address security issues
c3d593
- https://nodejs.org/en/blog/release/v10.4.1/
c3d593
- Resolves: rhbz#1590801
c3d593
- Resolves: rhbz#1591014
c3d593
- Resolves: rhbz#1591019
c3d593
c3d593
* Thu Jun 07 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:10.4.0-1
c3d593
- Update to 10.4.0
c3d593
- https://nodejs.org/en/blog/release/v10.4.0/
c3d593
c3d593
* Wed May 30 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:10.3.0-1
c3d593
- Update to 10.3.0
c3d593
- Update npm to 6.1.0
c3d593
- https://nodejs.org/en/blog/release/v10.3.0/
c3d593
c3d593
* Tue May 29 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:10.2.1-2
c3d593
- Fix up bare 'python' to be python2
c3d593
- Drop redundant entry in docs section
c3d593
c3d593
* Fri May 25 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:10.2.1-1
c3d593
- Update to 10.2.1
c3d593
- https://nodejs.org/en/blog/release/v10.2.1/
c3d593
c3d593
* Wed May 23 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:10.2.0-1
c3d593
- Update to 10.2.0
c3d593
- https://nodejs.org/en/blog/release/v10.2.0/
c3d593
c3d593
* Thu May 10 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:10.1.0-3
c3d593
- Fix incorrect rpm macro
c3d593
c3d593
* Thu May 10 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:10.1.0-2
c3d593
- Include upstream v8 fix for ppc64[le]
c3d593
- Disable debug build on ppc64[le] and s390x
c3d593
c3d593
* Wed May 09 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:10.1.0-1
c3d593
- Update to 10.1.0
c3d593
- https://nodejs.org/en/blog/release/v10.1.0/
c3d593
- Reenable node_g binary
c3d593
c3d593
* Thu Apr 26 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:10.0.0-1
c3d593
- Update to 10.0.0
c3d593
- https://nodejs.org/en/blog/release/v10.0.0/
c3d593
- Drop workaround patch
c3d593
- Temporarily drop node_g binary due to
c3d593
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85587
c3d593
c3d593
* Fri Apr 13 2018 Rafael dos Santos <rdossant@redhat.com> - 1:9.11.1-2
c3d593
- Use standard Fedora linker flags (bug #1543859)
c3d593
c3d593
* Thu Apr 05 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:9.11.1-1
c3d593
- Update to 9.11.1
c3d593
- https://nodejs.org/en/blog/release/v9.11.0/
c3d593
- https://nodejs.org/en/blog/release/v9.11.1/
c3d593
c3d593
* Wed Mar 28 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:9.10.0-1
c3d593
- Update to 9.10.0
c3d593
- https://nodejs.org/en/blog/release/v9.10.0/
c3d593
c3d593
* Wed Mar 21 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:9.9.0-1
c3d593
- Update to 9.9.0
c3d593
- https://nodejs.org/en/blog/release/v9.9.0/
c3d593
c3d593
* Thu Mar 08 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:9.8.0-1
c3d593
- Update to 9.8.0
c3d593
- https://nodejs.org/en/blog/release/v9.8.0/
c3d593
c3d593
* Thu Mar 01 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:9.7.0-1
c3d593
- Update to 9.7.0
c3d593
- https://nodejs.org/en/blog/release/v9.7.0/
c3d593
- Work around F28 build issue
c3d593
c3d593
* Sun Feb 25 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:9.6.1-1
c3d593
- Update to 9.6.1
c3d593
- https://nodejs.org/en/blog/release/v9.6.1/
c3d593
- https://nodejs.org/en/blog/release/v9.6.0/
c3d593
c3d593
* Mon Feb 05 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:9.5.0-1
c3d593
- Package Node.js 9.5.0
c3d593
c3d593
* Thu Jan 11 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:8.9.4-2
c3d593
- Fix incorrect Requires:
c3d593
c3d593
* Thu Jan 11 2018 Stephen Gallagher <sgallagh@redhat.com> - 1:8.9.4-1
c3d593
- Update to 8.9.4
c3d593
- https://nodejs.org/en/blog/release/v8.9.4/
c3d593
- Switch to system copy of nghttp2
c3d593
c3d593
* Fri Dec 08 2017 Stephen Gallagher <sgallagh@redhat.com> - 1:8.9.3-2
c3d593
- Update to 8.9.3
c3d593
- https://nodejs.org/en/blog/release/v8.9.3/
c3d593
- https://nodejs.org/en/blog/release/v8.9.2/
c3d593
c3d593
* Thu Nov 30 2017 Pete Walter <pwalter@fedoraproject.org> - 1:8.9.1-2
c3d593
- Rebuild for ICU 60.1
c3d593
c3d593
* Thu Nov 09 2017 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:8.9.1-1
c3d593
- Update to 8.9.1
c3d593
c3d593
* Tue Oct 31 2017 Stephen Gallagher <sgallagh@redhat.com> - 1:8.9.0-1
c3d593
- Update to 8.9.0
c3d593
- Drop upstreamed patch
c3d593
c3d593
* Thu Oct 26 2017 Stephen Gallagher <sgallagh@redhat.com> - 1:8.8.1-1
c3d593
- Update to 8.8.1 to fix a regression
c3d593
c3d593
* Wed Oct 25 2017 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:8.8.0-1
c3d593
- Security update to 8.8.0
c3d593
- https://nodejs.org/en/blog/release/v8.8.0/
c3d593
c3d593
* Sun Oct 15 2017 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:8.7.0-1
c3d593
- Update to 8.7.0
c3d593
- https://nodejs.org/en/blog/release/v8.7.0/
c3d593
c3d593
* Fri Oct 06 2017 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:8.6.0-2
c3d593
- Use bcond macro instead of bootstrap conditional
c3d593
c3d593
* Wed Sep 27 2017 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:8.6.0-1
c3d593
- Fix nghttp2 version
c3d593
- Update to 8.6.0
c3d593
- https://nodejs.org/en/blog/release/v8.6.0/
c3d593
c3d593
* Wed Sep 20 2017 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:8.5.0-3
c3d593
- Build with bootstrap + bundle libuv for modularity
c3d593
- backport patch for aarch64 debug build
c3d593
c3d593
* Wed Sep 13 2017 Stephen Gallagher <sgallagh@redhat.com> - 1:8.5.0-2
c3d593
- Disable debug builds on aarch64 due to https://github.com/nodejs/node/issues/15395
c3d593
c3d593
* Tue Sep 12 2017 Stephen Gallagher <sgallagh@redhat.com> - 1:8.5.0-1
c3d593
- Update to v8.5.0
c3d593
- https://nodejs.org/en/blog/release/v8.5.0/
c3d593
c3d593
* Thu Sep 07 2017 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:8.4.0-2
c3d593
- Refactor openssl BR
c3d593
c3d593
* Wed Aug 16 2017 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:8.4.0-1
c3d593
- Update to v8.4.0
c3d593
- https://nodejs.org/en/blog/release/v8.4.0/
c3d593
- http2 is now supported, add bundled nghttp2
c3d593
- remove openssl 1.0.1 patches, we won't be using them in fedora
c3d593
c3d593
* Thu Aug 10 2017 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:8.3.0-1
c3d593
- Update to v8.3.0
c3d593
- https://nodejs.org/en/blog/release/v8.3.0/
c3d593
- update V8 to 6.0
c3d593
- update minimal gcc and g++ requirements to 4.9.4
c3d593
c3d593
* Wed Aug 09 2017 Tom Hughes <tom@compton.nu> - 1:8.2.1-2
c3d593
- Bump release to fix broken dependencies
c3d593
c3d593
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1:8.2.1-1.2
c3d593
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
c3d593
c3d593
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1:8.2.1-1.1
c3d593
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
c3d593
c3d593
* Fri Jul 21 2017 Stephen Gallagher <sgallagh@redhat.com> - 1:8.2.1-1
c3d593
- Update to v8.2.1
c3d593
- https://nodejs.org/en/blog/release/v8.2.1/
c3d593
c3d593
* Thu Jul 20 2017 Stephen Gallagher <sgallagh@redhat.com> - 1:8.2.0-1
c3d593
- Update to v8.2.0
c3d593
- https://nodejs.org/en/blog/release/v8.2.0/
c3d593
- Update npm to 5.3.0
c3d593
- Adds npx command
c3d593
c3d593
* Tue Jul 18 2017 Igor Gnatenko <ignatenko@redhat.com> - 1:8.1.4-3
c3d593
- s/BuildRequires/Requires/ for http-parser-devel%%{?_isa}
c3d593
c3d593
* Mon Jul 17 2017 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:8.1.4-2
c3d593
- Rename python-devel to python2-devel
c3d593
- own %%{_pkgdocdir}/npm
c3d593
c3d593
* Tue Jul 11 2017 Stephen Gallagher <sgallagh@redhat.com> - 1:8.1.4-1
c3d593
- Update to v8.1.4
c3d593
- https://nodejs.org/en/blog/release/v8.1.4/
c3d593
- Drop upstreamed c-ares patch
c3d593
c3d593
* Thu Jun 29 2017 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:8.1.3-1
c3d593
- Update to v8.1.3
c3d593
- https://nodejs.org/en/blog/release/v8.1.3/
c3d593
c3d593
* Wed Jun 28 2017 Zuzana Svetlikova <zsvetlik@redhat.com> - 1:8.1.2-1
c3d593
- Update to v8.1.2
c3d593
- remove GCC 7 patch, as it is now fixed in node >= 6.12
c3d593