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