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) 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.5
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
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
%else
BuildRequires:  openssl-devel
%endif
BuildRequires:  pkg-config
BuildRequires:  python
BuildRequires:  zlib-devel
Provides:       npm = %{version}
Obsoletes:      npm <= 1.0.999
#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}

%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

%prep
%setup -q -n node-v%{version}
%if %{_lib} == "lib64"
%patch0 -p1
%else
%patch2 -p1
%endif
(cd deps/npm/node_modules/node-gyp
%patch4 -p1 
)
%patch5 -p1
%patch6
# 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
  find deps/$dir -name *.[ch] -delete
done

%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-v8 \
    --shared-openssl \
    --shared-zlib \
    --gdb
make %{?_smp_mflags}

%install
%{?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

%files
%defattr(-, root, root)
%{_bindir}/node
%{_bindir}/npm
%{_libdir}/node_modules
%{_mandir}/man1/*
%doc AUTHORS LICENSE

%files devel
%defattr(-, root, root)
%{_includedir}/node
%{_libdir}/dtrace
%{_datadir}/node

%changelog