]> git.pld-linux.org Git - packages/nodejs.git/blame_incremental - nodejs.spec
shared bcond
[packages/nodejs.git] / nodejs.spec
... / ...
CommitLineData
1#
2# Conditional build:
3%bcond_without system_v8 # system v8
4%bcond_without shared # build libnode.so shared library
5
6# NOTES:
7# - https://nodejs.org/en/download/releases/
8
9Summary: Asynchronous JavaScript Engine
10Name: nodejs
11Version: 0.10.40
12Release: 0.1
13License: BSD and MIT and Apache v2.0 and GPL v3
14Group: Development/Languages
15Source0: https://nodejs.org/dist/v%{version}/node-v%{version}.tar.gz
16# Source0-md5: f6ef20f327ecd6cb1586c41c7184290c
17Patch1: %{name}-shared.patch
18# force node to use /usr/lib/node as the systemwide module directory
19Patch2: %{name}-libpath.patch
20# use /usr/lib64/node as an arch-specific module dir when appropriate
21Patch3: %{name}-lib64path.patch
22Patch4: %{name}-use-system-certs.patch
23Patch5: uv-fpic.patch
24# The invalid UTF8 fix has been reverted since this breaks v8 API, which cannot
25# be done in a stable distribution release. This build of nodejs will behave as
26# if NODE_INVALID_UTF8 was set. For more information on the implications, see:
27# http://blog.nodejs.org/2014/06/16/openssl-and-breaking-utf-8-change/
28Patch6: %{name}-revert-utf8-v8.patch
29Patch7: %{name}-revert-utf8-node.patch
30URL: https://nodejs.org/
31BuildRequires: c-ares-devel
32BuildRequires: gcc >= 5:4.0
33BuildRequires: http-parser-devel >= 2.0
34BuildRequires: libstdc++-devel
35BuildRequires: libuv-devel >= 0.10
36BuildRequires: openssl-devel
37BuildRequires: pkgconfig
38BuildRequires: python >= 1:2.5.2
39BuildRequires: python-jsmin
40BuildRequires: rpm >= 4.4.9-56
41BuildRequires: rpmbuild(macros) >= 1.219
42BuildRequires: sed >= 4.0
43%{?with_system_v8:BuildRequires: v8-devel >= 3.15.11.10}
44BuildRequires: zlib-devel
45Requires: ca-certificates
46Obsoletes: nodejs-waf
47ExclusiveArch: %{ix86} %{x8664} arm
48BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
49
50%define sover %(echo %{version} | cut -d. -f2)
51
52%description
53Node.js is a platform built on Chrome's JavaScript runtime for easily
54building fast, scalable network applications. Node.js uses an
55event-driven, non-blocking I/O model that makes it lightweight and
56efficient, perfect for data-intensive real-time applications that run
57across distributed devices.
58
59%package devel
60Summary: Development headers for nodejs
61Group: Development/Libraries
62Requires: %{name} = %{version}-%{release}
63Requires: c-ares-devel
64Requires: gcc
65Requires: http-parser-devel
66Requires: libstdc++-devel
67Requires: libuv-devel
68Requires: openssl-devel
69%{?with_system_v8:Requires: v8-devel}
70Requires: zlib-devel
71
72%description devel
73Development headers for nodejs.
74
75%package doc
76Summary: Evented I/O for V8 JavaScript - documentation
77Group: Documentation
78%if "%{_rpmversion}" >= "5"
79BuildArch: noarch
80%endif
81
82%description doc
83Node.js is a server-side JavaScript environment that uses an
84asynchronous event-driven model. Node's goal is to provide an easy way
85to build scalable network programs.
86
87This package contains the documentation for nodejs.
88
89%prep
90%setup -q -n node-v%{version}
91%{?with_shared:%patch1 -p1}
92%if %{_lib} == "lib64"
93%patch3 -p1
94%else
95%patch2 -p1
96%endif
97%patch4 -p1
98%patch5 -p1
99%patch6 -p1
100%patch7 -p1
101
102grep -r '#!.*env python' -l . | xargs %{__sed} -i -e '1 s,#!.*env python,#!%{__python},'
103
104rm -r deps/npm
105rm -r deps/cares
106rm -r deps/http_parser
107rm -r deps/openssl
108rm -r deps/uv
109%{?with_system_v8:rm -r deps/v8}
110rm -r deps/zlib
111
112%build
113# CC used only to detect if CC is clang, not used for compiling
114CC="%{__cc}" \
115CXX="%{__cxx}" \
116GYP_DEFINES="soname_version=%{sover}" \
117./configure \
118 %{?with_system_v8:--shared-v8} \
119 --shared-zlib \
120 --shared-openssl \
121 --shared-cares \
122 --shared-libuv \
123 --shared-http-parser \
124 --without-npm \
125 --without-dtrace \
126 --prefix=%{_prefix}
127
128# add LFS defines from libuv (RHBZ#892601)
129# CXXFLAGS must be exported, as it is needed for make, not gyp
130CXXFLAGS="%{rpmcxxflags} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" \
131LDFLAGS="%{rpmldflags}" \
132%{__make} -C out V=1 BUILDTYPE=Release
133
134%install
135rm -rf $RPM_BUILD_ROOT
136%{__python} tools/install.py install "$RPM_BUILD_ROOT" "%{_lib}"
137
138%if %{with shared}
139lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libnode.so.*.*.*)
140ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so.10
141ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so
142%endif
143
144echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
145
146install -d $RPM_BUILD_ROOT%{_includedir}/node
147cp -p src/*.h $RPM_BUILD_ROOT%{_includedir}/node
148
149# install for node-gyp
150install -d $RPM_BUILD_ROOT%{_usrsrc}/%{name}
151cp -p common.gypi $RPM_BUILD_ROOT%{_usrsrc}/%{name}
152ln -s %{_includedir}/node $RPM_BUILD_ROOT%{_usrsrc}/%{name}/src
153
154# for compat of fedora derivered scripts (shebangs)
155ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
156
157# globally installed node modules (noarch)
158install -d $RPM_BUILD_ROOT%{_prefix}/lib/node_modules
159
160# default searchpaths
161install -d $RPM_BUILD_ROOT{%{_libdir},%{_prefix}/lib}/node
162
163# create pkgconfig
164install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
165cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
166version=%{version}
167prefix=%{_prefix}
168libdir=${prefix}/%{_lib}
169includedir=${prefix}/include/node
170
171Name: nodejs
172Description: Evented I/O for V8 JavaScript.
173Version: ${version}
174Cflags: -I${includedir}
175EOF
176
177# install documentation
178install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
179cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
180rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.markdown
181rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.json
182
183%clean
184rm -rf $RPM_BUILD_ROOT
185
186%if %{with shared}
187%post -p /sbin/ldconfig
188%postun -p /sbin/ldconfig
189%endif
190
191%files
192%defattr(644,root,root,755)
193%doc README.md AUTHORS ChangeLog LICENSE
194%attr(755,root,root) %{_bindir}/node
195%attr(755,root,root) %{_bindir}/nodejs
196%if %{with shared}
197%attr(755,root,root) %{_libdir}/libnode.so.*.*.*
198%ghost %{_libdir}/libnode.so.10
199%endif
200%if "%{_lib}" != "lib"
201%dir %{_libdir}/node
202%endif
203%dir %{_prefix}/lib/node
204%dir %{_prefix}/lib/node_modules
205%{_mandir}/man1/node.1*
206%{_mandir}/man1/nodejs.1
207
208%files devel
209%defattr(644,root,root,755)
210%if %{with shared}
211%{_libdir}/libnode.so
212%endif
213%{_includedir}/node
214%{_pkgconfigdir}/nodejs.pc
215%{_usrsrc}/%{name}
216
217%files doc
218%defattr(644,root,root,755)
219%doc %{_docdir}/%{name}-doc-%{version}
This page took 0.035276 seconds and 4 git commands to generate.