File nodejs.spec of Package nodejs.1380
#
# spec file for package nodejs
#
# Copyright (c) 2015 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/
#
Name: nodejs
Version: 0.12.0
Release: 0
Summary: Evented I/O for V8 JavaScript
License: MIT
Group: Development/Languages/Other
Url: http://www.nodejs.org
Source: http://nodejs.org/dist/v%{version}/node-v%{version}.tar.gz
Source99: README.SUSE.PowerPC
Patch1: nodejs-openssl-missing-api.patch
Patch2: nodejs-v%{version}-release-ppc.patch.bz2
Patch3: support-arm64-build.patch
BuildRequires: curl
BuildRequires: gcc-c++
BuildRequires: procps
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version}
BuildRequires: libopenssl-devel
%else
BuildRequires: openssl-devel
%endif
BuildRequires: libopenssl-devel
BuildRequires: pkg-config
BuildRequires: python
BuildRequires: zlib-devel
#BuildRequires: v8-devel
#BuildRequires: libcares-devel
#we need ABI virtual provides where SONAMEs aren't enough/not present so deps
#break when binary compatibility is broken
%global nodejs_abi 0.10
Provides: nodejs(abi) = %{nodejs_abi}
#this corresponds to the "engine" requirement in package.json
Provides: nodejs(engine) = %{version}
#building nodejs makes sense only on v8 archs
ExclusiveArch: %{ix86} x86_64 armv7hl aarch64 ppc ppc64 ppc64le s390x
%description
Provides an easy way to build scalable network programs
http://nodejs.org
%package devel
Summary: Files needed for development of NodeJS platforms
Group: Development/Languages/Other
Requires: %{name} = %{version}
Requires: gcc-c++
Requires: python
%description devel
Provides an easy way to build scalable network programs
http://nodejs.org
%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
%setup -q -n node-v%{version}
# need rebase
#%patch1 -p0
%patch2 -p1
%patch3
# Make sure nothing gets included from bundled deps:
# We only delete the source and header files, because
# the remaining build scripts are still used.
###for dir in v8 openssl zlib; do
for dir in openssl zlib; do
find deps/$dir -name *.[ch] -delete
done
# remove .orig file
find . -name "*.orig" -type f -delete -print
%build
# percent-configure pulls in something that confuses node's configure
# script, so we'll do it thus:
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
./configure \
--prefix=%{_prefix} \
--shared-openssl \
--shared-zlib \
%ifarch aarch64
--dest-cpu=arm64 \
%endif
%ifarch s390x
--dest-cpu=s390x \
%endif
%ifnarch aarch64 ppc ppc64 ppc64le s390x
--gdb \
%endif
--without-npm \
--without-dtrace
# --shared-v8 \
# --shared-cares
%ifarch aarch64
make DESTCPU=arm64
%else
%ifarch s390x
make DESTCPU=s390x
%else
make %{?_smp_mflags}
%endif
%endif
%install
%{?make_install} %{!?make_install:make install DESTDIR=$RPM_BUILD_ROOT}
#node-gyp needs common.gypi too
mkdir -p %{buildroot}%{_datadir}/node
cp -p common.gypi %{buildroot}%{_datadir}/node
# Documentation
install -d %{buildroot}%{_docdir}/%{name}
cp -r doc/api %{buildroot}%{_docdir}/%{name}/
cp -r {AUTHORS,ChangeLog,CONTRIBUTING.md,LICENSE,README.md} %{buildroot}%{_docdir}/%{name}/
# Own nodejs_modulesdir
install -d %{buildroot}%{_prefix}/lib/node_modules
# fix permission
chmod 0644 %{buildroot}%{_includedir}/node/v8-debug.h
%files
%defattr(-, root, root)
%{_bindir}/node
%{_prefix}/lib/node_modules
%{_mandir}/man1/*
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/AUTHORS
%{_docdir}/%{name}/ChangeLog
%{_docdir}/%{name}/CONTRIBUTING.md
%{_docdir}/%{name}/LICENSE
%{_docdir}/%{name}/README.md
%files devel
%defattr(-, root, root)
%{_includedir}/node
%{_datadir}/node
%dir %{_datadir}/systemtap
%dir %{_datadir}/systemtap/tapset
%{_datadir}/systemtap/tapset/node.stp
%files docs
%defattr(-,root,root)
%{_docdir}/%{name}/api
%changelog