3 %bcond_without system_v8 # system v8
4 %bcond_without shared # build libnode.so shared library
7 # - https://nodejs.org/en/download/releases/
9 Summary: Asynchronous JavaScript Engine
13 License: BSD and MIT and Apache v2.0 and GPL v3
14 Group: Development/Languages
15 Source0: https://nodejs.org/dist/v%{version}/node-v%{version}.tar.gz
16 # Source0-md5: f6ef20f327ecd6cb1586c41c7184290c
17 Patch1: %{name}-shared.patch
18 # force node to use /usr/lib/node as the systemwide module directory
19 Patch2: %{name}-libpath.patch
20 # use /usr/lib64/node as an arch-specific module dir when appropriate
21 Patch3: %{name}-lib64path.patch
22 Patch4: %{name}-use-system-certs.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/
28 Patch6: %{name}-revert-utf8-v8.patch
29 Patch7: %{name}-revert-utf8-node.patch
30 URL: https://nodejs.org/
31 BuildRequires: c-ares-devel
32 BuildRequires: gcc >= 5:4.0
33 BuildRequires: http-parser-devel >= 2.0
34 BuildRequires: libstdc++-devel
35 BuildRequires: libuv-devel >= 0.10
36 BuildRequires: openssl-devel
37 BuildRequires: pkgconfig
38 BuildRequires: python >= 1:2.5.2
39 BuildRequires: python-jsmin
40 BuildRequires: rpm >= 4.4.9-56
41 BuildRequires: rpmbuild(macros) >= 1.219
42 BuildRequires: sed >= 4.0
43 %{?with_system_v8:BuildRequires: v8-devel >= 3.15.11.10}
44 BuildRequires: zlib-devel
45 Requires: ca-certificates
47 ExclusiveArch: %{ix86} %{x8664} arm
48 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
50 %define sover %(echo %{version} | cut -d. -f2)
53 Node.js is a platform built on Chrome's JavaScript runtime for easily
54 building fast, scalable network applications. Node.js uses an
55 event-driven, non-blocking I/O model that makes it lightweight and
56 efficient, perfect for data-intensive real-time applications that run
57 across distributed devices.
60 Summary: Development headers for nodejs
61 Group: Development/Libraries
62 Requires: %{name} = %{version}-%{release}
63 Requires: c-ares-devel
65 Requires: http-parser-devel
66 Requires: libstdc++-devel
68 Requires: openssl-devel
69 %{?with_system_v8:Requires: v8-devel}
73 Development headers for nodejs.
76 Summary: Evented I/O for V8 JavaScript - documentation
78 %if "%{_rpmversion}" >= "5"
83 Node.js is a server-side JavaScript environment that uses an
84 asynchronous event-driven model. Node's goal is to provide an easy way
85 to build scalable network programs.
87 This package contains the documentation for nodejs.
90 %setup -q -n node-v%{version}
91 %{?with_shared:%patch1 -p1}
92 %if %{_lib} == "lib64"
102 grep -r '#!.*env python' -l . | xargs %{__sed} -i -e '1 s,#!.*env python,#!%{__python},'
106 rm -r deps/http_parser
109 %{?with_system_v8:rm -r deps/v8}
113 # CC used only to detect if CC is clang, not used for compiling
116 GYP_DEFINES="soname_version=%{sover}" \
118 %{?with_system_v8:--shared-v8} \
123 --shared-http-parser \
128 # add LFS defines from libuv (RHBZ#892601)
129 # CXXFLAGS must be exported, as it is needed for make, not gyp
130 CXXFLAGS="%{rpmcxxflags} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" \
131 LDFLAGS="%{rpmldflags}" \
132 %{__make} -C out V=1 BUILDTYPE=Release
135 rm -rf $RPM_BUILD_ROOT
136 %{__python} tools/install.py install "$RPM_BUILD_ROOT" "%{_lib}"
139 lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libnode.so.*.*.*)
140 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so.10
141 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so
144 echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
146 install -d $RPM_BUILD_ROOT%{_includedir}/node
147 cp -p src/*.h $RPM_BUILD_ROOT%{_includedir}/node
149 # install for node-gyp
150 install -d $RPM_BUILD_ROOT%{_usrsrc}/%{name}
151 cp -p common.gypi $RPM_BUILD_ROOT%{_usrsrc}/%{name}
152 ln -s %{_includedir}/node $RPM_BUILD_ROOT%{_usrsrc}/%{name}/src
154 # for compat of fedora derivered scripts (shebangs)
155 ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
157 # globally installed node modules (noarch)
158 install -d $RPM_BUILD_ROOT%{_prefix}/lib/node_modules
160 # default searchpaths
161 install -d $RPM_BUILD_ROOT{%{_libdir},%{_prefix}/lib}/node
164 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
165 cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
168 libdir=${prefix}/%{_lib}
169 includedir=${prefix}/include/node
172 Description: Evented I/O for V8 JavaScript.
174 Cflags: -I${includedir}
177 # install documentation
178 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
179 cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
180 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.markdown
181 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.json
184 rm -rf $RPM_BUILD_ROOT
187 %post -p /sbin/ldconfig
188 %postun -p /sbin/ldconfig
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
197 %attr(755,root,root) %{_libdir}/libnode.so.*.*.*
198 %ghost %{_libdir}/libnode.so.10
200 %if "%{_lib}" != "lib"
203 %dir %{_prefix}/lib/node
204 %dir %{_prefix}/lib/node_modules
205 %{_mandir}/man1/node.1*
206 %{_mandir}/man1/nodejs.1
209 %defattr(644,root,root,755)
211 %{_libdir}/libnode.so
214 %{_pkgconfigdir}/nodejs.pc
218 %defattr(644,root,root,755)
219 %doc %{_docdir}/%{name}-doc-%{version}