File nodejs6.spec of Package nodejs6
#
# spec file for package nodejs6
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
###########################################################
#
# WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
#
# This spec file is generated from a template hosted at
# https://github.com/AdamMajer/nodejs-packaging
#
###########################################################
Name: nodejs6
Version: 6.11.2
Release: 0
%if 0%{?sles_version} == 11
%define _libexecdir %{_exec_prefix}/lib
%endif
# Only Leap 42.2+, SLE 12 SP2+ and Tumbleweed have OpenSSL 1.0.2.
%if 0%{?suse_version} > 1320 || 0%{?sle_version} >= 120200
%bcond_with intree_openssl
%else
%bcond_without intree_openssl
%endif
%if 0%{suse_version} >= 1330
%bcond_with intree_cares
%else
%bcond_without intree_cares
%endif
%if 0%{?suse_version} >= 1200
%bcond_with intree_icu
%else
%bcond_without intree_icu
%endif
%ifarch aarch64 ppc ppc64 ppc64le s390 s390x
%bcond_with gdb
%else
%bcond_without gdb
%endif
# No binutils_gold on SLE12 (aarch64).
%ifarch aarch64
%if 0%{?sle_version} >= 120100 || 0%{?is_opensuse}
%bcond_without binutils_gold
%else
%bcond_with binutils_gold
%endif
%else # aarch64
# No binutils_gold on s390x.
%ifarch s390x s390
%bcond_with binutils_gold
%else
%bcond_without binutils_gold
%endif # s390x s390
%endif # aarch64
Summary: Evented I/O for V8 JavaScript
License: MIT
Group: Development/Languages/NodeJS
Url: https://nodejs.org
Source: https://nodejs.org/dist/v%{version}/node-v%{version}.tar.xz
Source1: https://nodejs.org/dist/v%{version}/SHASUMS256.txt
Source2: https://nodejs.org/dist/v%{version}/SHASUMS256.txt.sig
Source3: nodejs.keyring
## UPSTREAM PATCHES HERE, if any
Patch1: 8334.diff
Patch2: 0f3e69db.patch
Patch3: icu59.patch
## Our patches
# PATCH-FIX-OPENSUSE -- set correct path for dtrace if it is built
Patch101: nodejs-libpath.patch
# PATCH-FIX-UPSTREAM -- use custom addon.gypi by default instead of
# downloading node source
Patch102: node-gyp-addon-gypi.patch
# PATCH-FIX-SLE -- configure script uses Python check_output method
# which isn't included in Python 2.6 (used in SLE 11).
Patch103: nodejs-sle11-python26-check_output.patch
# PATCH-FIX-OPENSUSE -- install user global npm packages to /usr/local
# instead of /usr
Patch104: npm_search_paths.patch
# Use versioned binaries and paths
Patch200: versioned.patch
%if %{with binutils_gold}
BuildRequires: binutils-gold
%endif
%if 6 >= 8
%if 0%{?sles_version} == 11
BuildRequires: gcc5-c++
%define cc_exec gcc-5
%define cpp_exec g++-5
%else
BuildRequires: gcc6-c++
%define cc_exec gcc-6
%define cpp_exec g++-6
%endif # node8+ GCC requirements
%else # older than node8
%if 0%{?sles_version} == 11
BuildRequires: gcc48-c++
%else
BuildRequires: gcc-c++
%endif
%endif # node7,6,5
BuildRequires: curl
BuildRequires: fdupes
BuildRequires: pkg-config
BuildRequires: procps
BuildRequires: python
BuildRequires: xz
BuildRequires: zlib-devel
%if ! %{with intree_openssl}
BuildRequires: openssl-devel >= 1.0.2
%endif
%if ! %{with intree_cares}
BuildRequires: pkgconfig(libcares) >= 1.10.0
%endif
%if ! %{with intree_icu}
BuildRequires: pkgconfig(icu-i18n) >= 52
%endif
Requires(post): update-alternatives
Requires(postun): update-alternatives
Recommends: npm(npm) = 3.10.10
#we need ABI virtual provides where SONAMEs aren't enough/not present so deps
#break when binary compatibility is broken
%global nodejs_abi 6.0
Provides: nodejs(abi) = %{nodejs_abi}
#this corresponds to the "engine" requirement in package.json
Provides: nodejs(engine) = %{version}
# Multiple versions of NodeJS can be installed at a time, but
# to properly allow correct version execution from 3rd party
# npm software, `env node` requires further help than only
# update-alternatives can provide.
Provides: nodejs = %{version}
Requires: nodejs-common
# For SLE11, to be able to use the certificate store we need to have properly
# symlinked certificates. The compatability symlinks are provided by the
# openssl1 library in the Security Module
%if 0%{?sles_version} == 11
Requires: openssl1
%endif
# Building Node.js only makes sense on V8 architectures.
ExclusiveArch: %{ix86} x86_64 armv7hl aarch64 ppc ppc64 ppc64le s390 s390x
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine.
Node.js uses an event-driven, non-blocking I/O model that makes it
lightweight and efficient. Node.js' package ecosystem, npm, is the largest
ecosystem of open source libraries in the world.
%package devel
Summary: Files needed for development of NodeJS platforms
Group: Development/Languages/NodeJS
Provides: nodejs-devel = %{version}
Requires: %{name} = %{version}
%description devel
This package provides development headers for Node.js.
%package -n npm6
Summary: Package manager for Node.js
Group: Development/Languages/NodeJS
Requires: %{name}-devel = %{version}
Provides: nodejs-npm = %{version}
Obsoletes: nodejs-npm < 4.0.0
Provides: npm = %{version}
Provides: npm(npm) = 3.10.10
%description -n npm6
A package manager for Node.js that allows developers to install and
publish packages to a package registry.
%package docs
Summary: Node.js API documentation
Group: Documentation/Other
%if 0%{?suse_version} >= 1200
# using noarch subpackage seems to break debuginfo on older releases
BuildArch: noarch
%endif
%description docs
The API documentation for the Node.js JavaScript runtime.
%prep
echo "`grep node-v%{version}.tar.xz %{S:1} | head -n1 | cut -c1-64` %{S:0}" | sha256sum -c
%setup -q -n node-v%{version}
%if 6 < 6
%patch1 -p1
%endif
%if 6 < 6
%patch2 -p1
%endif
%if 6 < 8
%patch3 -p1
%endif
%patch101 -p1
%patch102 -p1
# Add check_output to configure script (not part of Python 2.6 in SLE11).
%if 0%{?sles_version} == 11
%patch103 -p1
%endif
%patch104 -p1
%patch200 -p1
# Make sure nothing gets included from bundled deps:
# We only delete the source and header files, because
# the remaining build scripts are still used.
%if ! %{with intree_openssl}
find deps/openssl -name *.[ch] -delete
%endif
%if ! %{with intree_icu}
rm -rf deps/icu-small
%endif
%if ! %{with intree_cares}
find deps/cares -name *.[ch] -delete
%endif
find deps/zlib -name *.[ch] -delete
%build
# percent-configure pulls in something that confuses node's configure
# script, so we'll do it thus:
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
# It seems that GCC 4.8 is needed to compile on SLE 11 SP4.
%if 0%{?sles_version} == 11
export CXX="g++-4.8"
%endif
%if 0%{?cc_exec:1}
export CC=%{?cc_exec}
export CXX=%{?cpp_exec}
%endif
./configure \
--prefix=%{_prefix} \
%if ! %{with intree_openssl}
--shared-openssl \
%endif
--shared-zlib \
%if ! %{with intree_cares}
--shared-cares \
%endif
%if ! %{with intree_icu}
--with-intl=system-icu \
%endif
%if %{with gdb}
--gdb \
%endif
--without-dtrace \
--openssl-use-def-ca-store
make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot} %{?_smp_mflags}
rm %{buildroot}%{_datadir}/doc/node/gdbinit
rm -f %{buildroot}%{_datadir}/doc/node/lldbinit
rm -f %{buildroot}%{_datadir}/doc/node/lldb_commands.py
# npm man page
install -D -m 644 deps/npm/man/man1/npm.1 %{buildroot}%{_mandir}/man1/npm6.1
#node-gyp needs common.gypi too
install -D -m 644 common.gypi \
%{buildroot}%{_libdir}/node_modules/npm6/node_modules/node-gyp/common.gypi
# %%{buildroot}%%{_datadir}/node/common.gypi
# install addon-rpm.gypi
install -D -m 644 addon-rpm.gypi \
%{buildroot}%{_libdir}/node_modules/npm6/node_modules/node-gyp/addon-rpm.gypi
# clean
# hidden files and directories
find %{buildroot}%{_libdir}/node_modules/npm6 -name ".*" -print0 | xargs -r0 -0 rm -rf --
# windows stuff
find %{buildroot}%{_libdir}/node_modules/npm6 -name "*.bat" -delete
find %{buildroot}%{_libdir}/node_modules/npm6 -name "*.cmd" -delete
# build stuff
find %{buildroot}%{_libdir}/node_modules/npm6 -name "Makefile" -delete
rm -rf %{buildroot}%{_libdir}/node_modules/npm6/{test,scripts}
find %{buildroot}%{_libdir}/node_modules/npm6/node_modules -name "*.sh" -delete
rm -rf %{buildroot}%{_libdir}/node_modules/npm6/node_modules/node-gyp/src
# remove examples/tests/benchmark stuff
find %{buildroot}%{_libdir}/node_modules/npm6/node_modules -name "example*" -print0 | xargs -0 rm -rf --
find %{buildroot}%{_libdir}/node_modules/npm6/NODE_MODULES -name "test*" -print0 | xargs -0 rm -rf --
find %{buildroot}%{_libdir}/node_modules/npm6/node_modules -name "*_test.*" -delete
find %{buildroot}%{_libdir}/node_modules/npm6/node_modules -type d -name "benchmark" -print0 | xargs -0 rm -rf --
# README.md LICENSE file permission
find %{buildroot}%{_libdir}/node_modules/npm6 -name "README.md" -exec chmod -x {} +
find %{buildroot}%{_libdir}/node_modules/npm6 -name "LICENSE" -exec chmod -x {} +
# browser.js is useless for npm cli
find %{buildroot}%{_libdir}/node_modules/npm6 -name "browser.js" -delete
# fix permissions
chmod 0644 %{buildroot}%{_libdir}/node_modules/npm6/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js \
%{buildroot}%{_libdir}/node_modules/npm6/node_modules/request/node_modules/qs/lib/parse.js \
%{buildroot}%{_libdir}/node_modules/npm6/node_modules/request/node_modules/hawk/lib/index.js \
%{buildroot}%{_libdir}/node_modules/npm6/node_modules/config-chain/index.js \
%{buildroot}%{_libdir}/node_modules/npm6/node_modules/request/node_modules/qs/lib/stringify.js \
%{buildroot}%{_libdir}/node_modules/npm6/node_modules/request/node_modules/hawk/lib/client.js \
%{buildroot}%{_libdir}/node_modules/npm6/node_modules/request/node_modules/hawk/lib/crypto.js \
%{buildroot}%{_libdir}/node_modules/npm6/node_modules/request/node_modules/hawk/lib/utils.js \
%{buildroot}%{_libdir}/node_modules/npm6/node_modules/request/index.js \
%{buildroot}%{_libdir}/node_modules/npm6/node_modules/request/node_modules/qs/lib/index.js \
%{buildroot}%{_libdir}/node_modules/npm6/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js \
%{buildroot}%{_libdir}/node_modules/npm6/node_modules/request/node_modules/hawk/lib/server.js \
%{buildroot}%{_libdir}/node_modules/npm6/node_modules/request/node_modules/hawk/node_modules/cryptiles/lib/index.js \
%{buildroot}%{_libdir}/node_modules/npm6/node_modules/request/node_modules/hawk/node_modules/sntp/index.js \
%{buildroot}%{_libdir}/node_modules/npm6/node_modules/request/node_modules/qs/lib/utils.js \
%{buildroot}%{_libdir}/node_modules/npm6/node_modules/uid-number/get-uid-gid.js \
%{buildroot}%{_libdir}/node_modules/npm6/bin/read-package-json.js
# file duplicates
%fdupes %{buildroot}%{_libdir}/node_modules/npm6
%fdupes %{buildroot}%{_includedir}/node6
# Update alternatives
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
ln -s -f node-default %{buildroot}%{_sysconfdir}/alternatives/node-default
ln -s -f node.1%{ext_man} %{buildroot}%{_sysconfdir}/alternatives/node.1%{ext_man}
ln -s -f npm-default %{buildroot}%{_sysconfdir}/alternatives/npm-default
ln -s -f npm.1%{ext_man} %{buildroot}%{_sysconfdir}/alternatives/npm.1%{ext_man}
ln -s %{_sysconfdir}/alternatives/node-default %{buildroot}%{_bindir}/node-default
ln -s %{_sysconfdir}/alternatives/node.1%{ext_man} %{buildroot}%{_mandir}/man1/node.1%{ext_man}
ln -s %{_sysconfdir}/alternatives/npm-default %{buildroot}%{_bindir}/npm-default
ln -s %{_sysconfdir}/alternatives/npm.1%{ext_man} %{buildroot}%{_mandir}/man1/npm.1%{ext_man}
%if 6 >= 8
ln -s -f npx-default %{buildroot}%{_sysconfdir}/alternatives/npx-default
ln -s -f npx.1%{ext_man} %{buildroot}%{_sysconfdir}/alternatives/npx.1%{ext_man}
ln -s %{_sysconfdir}/alternatives/npx-default %{buildroot}%{_bindir}/npx-default
ln -s %{_sysconfdir}/alternatives/npx.1%{ext_man} %{buildroot}%{_mandir}/man1/npx.1%{ext_man}
%endif
# Check that Node.js isn't completely broken.
%check
%{buildroot}%{_bindir}/node6 -e 'require("assert").strictEqual(process.versions.node, "%{version}");'
%files
%defattr(-, root, root)
%doc AUTHORS LICENSE *.md
%doc deps/v8/tools/gdbinit
%dir %{_libdir}/node_modules
%{_bindir}/node6
%{_mandir}/man1/node6.1%{ext_man}
%ghost %{_bindir}/node-default
%ghost %{_mandir}/man1/node.1%{ext_man}
%ghost %{_sysconfdir}/alternatives/node-default
%ghost %{_sysconfdir}/alternatives/node.1%{ext_man}
%exclude %{_libdir}/node_modules/npm6
%files -n npm6
%defattr(-, root, root)
%{_bindir}/npm6
%{_libdir}/node_modules/npm6
%{_mandir}/man1/npm6.1%{ext_man}
%ghost %{_bindir}/npm-default
%ghost %{_mandir}/man1/npm.1%{ext_man}
%ghost %{_sysconfdir}/alternatives/npm-default
%ghost %{_sysconfdir}/alternatives/npm.1%{ext_man}
%if 6 >= 8
%{_bindir}/npx6
%ghost %{_bindir}/npx-default
%ghost %{_mandir}/man1/npx.1%{ext_man}
%ghost %{_sysconfdir}/alternatives/npx-default
%ghost %{_sysconfdir}/alternatives/npx.1%{ext_man}
%endif
%files devel
%defattr(-, root, root)
%{_includedir}/node6
%dir %{_datadir}/systemtap
%dir %{_datadir}/systemtap/tapset
%{_datadir}/systemtap/tapset/node6.stp
%files docs
%defattr(-,root,root)
%doc doc/api
%post
update-alternatives \
--install %{_bindir}/node-default node-default %{_bindir}/node6 6 \
--slave %{_mandir}/man1/node.1%{ext_man} node.1%{ext_man} %{_mandir}/man1/node6.1%{ext_man}
%postun
if [ ! -f %{_bindir}/node6 ] ; then
update-alternatives --remove node-default %{_bindir}/node6
fi
%post -n npm6
update-alternatives \
--install %{_bindir}/npm-default npm-default %{_bindir}/npm6 6 \
--slave %{_mandir}/man1/npm.1%{ext_man} npm.1%{ext_man} %{_mandir}/man1/npm6.1%{ext_man}
%if 6 >= 8
update-alternatives \
--install %{_bindir}/npx-default npx-default %{_bindir}/npx6 6 \
--slave %{_mandir}/man1/npx.1%{ext_man} npx.1%{ext_man} %{_mandir}/man1/npx6.1%{ext_man}
%endif
%postun -n npm6
if [ ! -f %{_bindir}/npm6 ] ; then
update-alternatives --remove npm-default %{_bindir}/npm6
fi
%if 6 >= 8
if [ ! -f %{_bindir}/npx6 ] ; then
update-alternatives --remove npx-default %{_bindir}/npx6
fi
%endif
%changelog