LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File nodejs.spec of Package nodejs (Project openSUSE:Factory)

# spec file for package nodejs
# Copyright (c) 2013 SUSE LINUX Products 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.10.17
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
Patch0:         nodejs-lib64path.patch
Patch2:         nodejs-libpath.patch
Patch4:         node-gyp-addon-gypi.patch
###Patch5:         nodejs-v8-3.18.0.patch
Patch6:         nodejs-openssl-missing-api.patch
Patch7:         nodejs-add_missing_shebang_to_read-package-json.patch
BuildRequires:  curl
BuildRequires:  gcc-c++
BuildRequires:  procps
# V8 presently breaks ABI at least every x.y release while never bumping SONAME,
# so we need to be more explicit.  v8_ge may be specified as e.g. 
# major.minor.micro-release if necessary.
###%global v8_ge 3.18
###%global v8_lt 3.19
###%global v8_abi 3.18
###BuildRequires:  v8-devel >= %{v8_ge}
###Requires:       v8%{?isa} < %{v8_lt}
###Requires:       v8%{?isa} >= %{v8_ge}

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version}
BuildRequires:  libopenssl-devel
BuildRequires:  openssl-devel
BuildRequires:  fdupes
BuildRequires:  pkg-config
BuildRequires:  python
BuildRequires:  zlib-devel
Provides:       npm = %{version}
Obsoletes:      npm < %{version}
#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}
###Provides:       nodejs(v8-abi) = %{v8_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 %{arm}

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

%setup -q -n node-v%{version}
%if %{_lib} == "lib64"
%patch0 -p1
%patch2 -p1
(cd deps/npm/node_modules/node-gyp;
%patch4 -p1
###%patch5 -p1
%patch7 -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

find ./deps/npm/node_modules/request/ -type f -exec chmod 0644 {} \;

chmod 0644 ./deps/npm/node_modules/uid-number/get-uid-gid.js
chmod 0644 ./deps/npm/node_modules/npmconf/node_modules/config-chain/index.js
chmod 0755 ./deps/npm/scripts/release.sh

# 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 \

###    --shared-v8 \

make %{?_smp_mflags}

%{?make_install} %{!?make_install:make install DESTDIR=$RPM_BUILD_ROOT}
# npm man page
cp -p deps/npm/man/man1/npm.1 %{buildroot}/%{_mandir}/man1
#install development headers
#FIXME: we probably don't really need *.h but node-gyp downloads the whole
#freaking source tree so I can't be sure ATM
mkdir -p %{buildroot}%{_includedir}/node
cp -p src/*.h %{buildroot}%{_includedir}/node
cp -pR deps/uv/include/* %{buildroot}%{_includedir}/node

#node-gyp needs common.gypi too
mkdir -p %{buildroot}%{_datadir}/node
cp -p common.gypi %{buildroot}%{_datadir}/node

find '%{buildroot}%{_libdir}/' -type f -name .travis.yml -delete
find '%{buildroot}%{_libdir}/' -type f -name .npmignore -delete
find '%{buildroot}%{_libdir}/' -type f -name .gitmodules -delete
find '%{buildroot}%{_libdir}/' -type f -name Makefile -delete
find '%{buildroot}%{_libdir}/' -type f \( -name .jshintrc -o -name pylintrc \) -delete
find '%{buildroot}%{_libdir}/' -type f \( -name '*.cmd' -o -name '*.bat' \) -delete
find '%{buildroot}%{_libdir}/node_modules/' -type d -name tests | while read d; do rm -rf "$d"; done
find '%{buildroot}%{_libdir}/node_modules/' -type d -name tools | while read d; do rm -rf "$d"; done
find '%{buildroot}%{_libdir}/node_modules/' -type d \( -name example -o -name examples \) | while read d; do rm -rf "$d"; done
rm '%{buildroot}%{_libdir}/node_modules/npm/node_modules/node-gyp/gyp/gyp_dummy.c'
rm '%{buildroot}%{_libdir}/node_modules/npm/.tern-project'
rm '%{buildroot}%{_libdir}/node_modules/npm/node_modules/request/node_modules/http-signature/.dir-locals.el'
rm -rf '%{buildroot}%{_libdir}/node_modules/npm/node_modules/request/node_modules/node-uuid/benchmark'
find '%{buildroot}%{_libdir}/node_modules/' -type f -name '*_test*' -delete

%fdupes '%{buildroot}%{_libdir}/node_modules/'

%defattr(-, root, root)

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