3 %bcond_without system_v8 # system v8
4 %bcond_with system_uv # system uv
5 %bcond_without shared # build libnode.so shared library
8 # - https://nodejs.org/en/download/releases/
10 # see "Modules" column in https://nodejs.org/en/download/releases/
11 %define node_module_version 11
12 Summary: Asynchronous JavaScript Engine
16 License: BSD and MIT and Apache v2.0 and GPL v3
17 Group: Development/Languages
18 Source0: https://nodejs.org/dist/v%{version}/node-v%{version}.tar.gz
19 # Source0-md5: f6ef20f327ecd6cb1586c41c7184290c
20 Patch1: %{name}-shared.patch
21 # force node to use /usr/lib/node as the systemwide module directory
22 Patch2: %{name}-libpath.patch
23 # use /usr/lib64/node as an arch-specific module dir when appropriate
24 Patch3: %{name}-lib64path.patch
25 Patch4: %{name}-use-system-certs.patch
27 # The invalid UTF8 fix has been reverted since this breaks v8 API, which cannot
28 # be done in a stable distribution release. This build of nodejs will behave as
29 # if NODE_INVALID_UTF8 was set. For more information on the implications, see:
30 # http://blog.nodejs.org/2014/06/16/openssl-and-breaking-utf-8-change/
31 Patch6: %{name}-revert-utf8-v8.patch
32 Patch7: %{name}-revert-utf8-node.patch
33 URL: https://nodejs.org/
34 BuildRequires: c-ares-devel
35 BuildRequires: gcc >= 5:4.0
36 BuildRequires: http-parser-devel >= 2.0
37 BuildRequires: libstdc++-devel
38 %{?with_system_uv:BuildRequires: libuv-devel >= 0.10}
39 BuildRequires: openssl-devel
40 BuildRequires: pkgconfig
41 BuildRequires: python >= 1:2.5.2
42 BuildRequires: python-jsmin
43 BuildRequires: rpm >= 4.4.9-56
44 BuildRequires: rpmbuild(macros) >= 1.219
45 BuildRequires: sed >= 4.0
46 %{?with_system_v8:BuildRequires: v8-devel >= 3.15.11.18-2}
47 BuildRequires: zlib-devel
48 Requires: ca-certificates
49 Provides: nodejs(engine) = %{version}
50 Provides: nodejs(module-version) = %{node_module_version}
52 ExclusiveArch: %{ix86} %{x8664} arm
53 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
55 %define sover %(echo %{version} | cut -d. -f2)
58 Node.js is a platform built on Chrome's JavaScript runtime for easily
59 building fast, scalable network applications. Node.js uses an
60 event-driven, non-blocking I/O model that makes it lightweight and
61 efficient, perfect for data-intensive real-time applications that run
62 across distributed devices.
65 Summary: Development headers for nodejs
66 Group: Development/Libraries
67 Requires: %{name} = %{version}-%{release}
68 Requires: c-ares-devel
70 Requires: http-parser-devel
71 Requires: libstdc++-devel
72 %{?with_system_uv:Requires: libuv-devel}
73 Requires: openssl-devel
74 %{?with_system_v8:Requires: v8-devel}
78 Development headers for nodejs.
81 Summary: Evented I/O for V8 JavaScript - documentation
83 %if "%{_rpmversion}" >= "5"
88 Node.js is a server-side JavaScript environment that uses an
89 asynchronous event-driven model. Node's goal is to provide an easy way
90 to build scalable network programs.
92 This package contains the documentation for nodejs.
95 %setup -q -n node-v%{version}
96 %{?with_shared:%patch1 -p1}
97 %if %{_lib} == "lib64"
107 grep -r '#!.*env python' -l . | xargs %{__sed} -i -e '1 s,#!.*env python,#!%{__python},'
111 rm -r deps/http_parser
113 %{?with_system_uv:rm -r deps/uv}
114 %{?with_system_v8:rm -r deps/v8}
118 ver=$(awk '/#define NODE_MODULE_VERSION/{print $NF}' src/node.h)
119 if [ $ver != %{node_module_version} ]; then
120 echo "Set %%define node_module_version to $ver and re-run."
124 # CC used only to detect if CC is clang, not used for compiling
127 GYP_DEFINES="soname_version=%{sover}" \
129 %{?with_system_v8:--shared-v8} \
133 %{?with_system_uv:--shared-libuv} \
134 --shared-http-parser \
139 # add LFS defines from libuv (RHBZ#892601)
140 # CXXFLAGS must be exported, as it is needed for make, not gyp
141 CXXFLAGS="%{rpmcxxflags} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" \
142 LDFLAGS="%{rpmldflags}" \
143 %{__make} -C out V=1 BUILDTYPE=Release
146 rm -rf $RPM_BUILD_ROOT
147 %{__python} tools/install.py install "$RPM_BUILD_ROOT" "%{_lib}"
150 lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libnode.so.*.*.*)
151 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so.10
152 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so
155 echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
157 install -d $RPM_BUILD_ROOT%{_includedir}/node
158 cp -p src/*.h $RPM_BUILD_ROOT%{_includedir}/node
160 # install for node-gyp
161 install -d $RPM_BUILD_ROOT%{_usrsrc}/%{name}
162 cp -p common.gypi $RPM_BUILD_ROOT%{_usrsrc}/%{name}
163 ln -s %{_includedir}/node $RPM_BUILD_ROOT%{_usrsrc}/%{name}/src
165 # for compat of fedora derivered scripts (shebangs)
166 ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
168 # globally installed node modules (noarch)
169 install -d $RPM_BUILD_ROOT%{_prefix}/lib/node_modules
171 # default searchpaths
172 install -d $RPM_BUILD_ROOT{%{_libdir},%{_prefix}/lib}/node
175 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
176 cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
179 libdir=${prefix}/%{_lib}
180 includedir=${prefix}/include/node
183 Description: Evented I/O for V8 JavaScript.
185 Cflags: -I${includedir}
188 # install documentation
189 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
190 cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
191 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.markdown
192 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.json
195 rm -rf $RPM_BUILD_ROOT
198 %post -p /sbin/ldconfig
199 %postun -p /sbin/ldconfig
203 %defattr(644,root,root,755)
204 %doc README.md AUTHORS ChangeLog LICENSE
205 %attr(755,root,root) %{_bindir}/node
206 %attr(755,root,root) %{_bindir}/nodejs
208 %attr(755,root,root) %{_libdir}/libnode.so.*.*.*
209 %ghost %{_libdir}/libnode.so.10
211 %if "%{_lib}" != "lib"
214 %dir %{_prefix}/lib/node
215 %dir %{_prefix}/lib/node_modules
216 %{_mandir}/man1/node.1*
217 %{_mandir}/man1/nodejs.1
220 %defattr(644,root,root,755)
222 %{_libdir}/libnode.so
225 %{_pkgconfigdir}/nodejs.pc
229 %defattr(644,root,root,755)
230 %doc %{_docdir}/%{name}-doc-%{version}