LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File nodejs.spec of Package nodejs (Project devel:languages:nodejs)

# 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.7
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
#PATCH-FIX-UPTREAM i@marguerite.su fix gcc 5 version detection
Patch4:         node-gcc5.patch
BuildRequires:  curl
BuildRequires:  gcc-c++
BuildRequires:  procps
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version}
BuildRequires:  libopenssl-devel
BuildRequires:  openssl-devel
BuildRequires:  libopenssl-devel
BuildRequires:  pkg-config
BuildRequires:  python
BuildRequires:  zlib-devel
Recommends:     nodejs-npm = %{version}
#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

Provides an easy way to build scalable network programs

%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

%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

%description docs
The API documentation for the Node.js JavaScript runtime.

%package npm
Summary:        Package manager for Node.js (Bundled)
Group:          Development/Languages/other
Requires:       %{name} = %{version}
Provides:       npm = 2.11.3
Obsoletes:      npm <= 2.11.3
Provides:       npm(npm) = 2.11.3
Conflicts:      otherproviders(npm(npm))
%if 0%{?suse_version} >= 1200
BuildArch:      noarch

%description npm
A package manager for Node.js, bundled in nodejs.

%setup -q -n node-v%{version}
# need rebase
#%patch1 -p0
%patch2 -p1
%patch4 -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.
###for dir in v8 openssl zlib; do
for dir in openssl zlib; do
  find deps/$dir -name *.[ch] -delete

# remove .orig file
find . -name "*.orig" -type f -delete -print

# 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 \
%ifarch s390x
    --dest-cpu=s390x \
%ifnarch aarch64 ppc ppc64 ppc64le s390x
    --gdb \
#    --shared-v8 \
#    --shared-cares 
%ifarch aarch64
make DESTCPU=arm64
%ifarch s390x
make DESTCPU=s390x
make %{?_smp_mflags}

%{?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_sitelib
install -d %{buildroot}%{_prefix}/lib/node_modules

# fix permission
chmod 0644 %{buildroot}%{_includedir}/node/v8-debug.h

%defattr(-, root, root)
%dir %{_docdir}/%{name}
%exclude %{_prefix}/lib/node_modules/npm

%files npm
%defattr(-, root, root)

%files devel
%defattr(-, root, root)
%dir %{_datadir}/systemtap
%dir %{_datadir}/systemtap/tapset

%files docs