3 %bcond_without system_v8 # system v8
6 # - https://nodejs.org/en/download/releases/
8 Summary: Asynchronous JavaScript Engine
12 License: BSD and MIT and Apache v2.0 and GPL v3
13 Group: Development/Languages
14 Source0: https://nodejs.org/dist/v%{version}/node-v%{version}.tar.gz
15 # Source0-md5: f6ef20f327ecd6cb1586c41c7184290c
16 Patch1: %{name}-shared.patch
17 # force node to use /usr/lib/node as the systemwide module directory
18 Patch2: %{name}-libpath.patch
19 # use /usr/lib64/node as an arch-specific module dir when appropriate
20 Patch3: %{name}-lib64path.patch
21 Patch4: %{name}-use-system-certs.patch
23 # The invalid UTF8 fix has been reverted since this breaks v8 API, which cannot
24 # be done in a stable distribution release. This build of nodejs will behave as
25 # if NODE_INVALID_UTF8 was set. For more information on the implications, see:
26 # http://blog.nodejs.org/2014/06/16/openssl-and-breaking-utf-8-change/
27 Patch6: %{name}-revert-utf8-v8.patch
28 Patch7: %{name}-revert-utf8-node.patch
29 URL: https://nodejs.org/
30 BuildRequires: c-ares-devel
31 BuildRequires: gcc >= 5:4.0
32 BuildRequires: http-parser-devel >= 2.0
33 BuildRequires: libstdc++-devel
34 BuildRequires: libuv-devel >= 0.10
35 BuildRequires: openssl-devel
36 BuildRequires: pkgconfig
37 BuildRequires: python >= 1:2.5.2
38 BuildRequires: python-jsmin
39 BuildRequires: rpm >= 4.4.9-56
40 BuildRequires: rpmbuild(macros) >= 1.219
41 BuildRequires: sed >= 4.0
42 %{?with_system_v8:BuildRequires: v8-devel >= 3.15.11.10}
43 BuildRequires: zlib-devel
44 Requires: ca-certificates
46 ExclusiveArch: %{ix86} %{x8664} arm
47 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
49 %define sover %(echo %{version} | cut -d. -f2)
52 Node.js is a platform built on Chrome's JavaScript runtime for easily
53 building fast, scalable network applications. Node.js uses an
54 event-driven, non-blocking I/O model that makes it lightweight and
55 efficient, perfect for data-intensive real-time applications that run
56 across distributed devices.
59 Summary: Development headers for nodejs
60 Group: Development/Libraries
61 Requires: %{name} = %{version}-%{release}
62 Requires: c-ares-devel
64 Requires: http-parser-devel
65 Requires: libstdc++-devel
67 Requires: openssl-devel
68 %{?with_system_v8:Requires: v8-devel}
72 Development headers for nodejs.
75 Summary: Evented I/O for V8 JavaScript - documentation
77 %if "%{_rpmversion}" >= "5"
82 Node.js is a server-side JavaScript environment that uses an
83 asynchronous event-driven model. Node's goal is to provide an easy way
84 to build scalable network programs.
86 This package contains the documentation for nodejs.
89 %setup -q -n node-v%{version}
91 %if %{_lib} == "lib64"
101 grep -r '#!.*env python' -l . | xargs %{__sed} -i -e '1 s,#!.*env python,#!%{__python},'
105 rm -r deps/http_parser
108 %{?with_system_v8:rm -r deps/v8}
112 # CC used only to detect if CC is clang, not used for compiling
115 GYP_DEFINES="soname_version=%{sover}" \
117 %{?with_system_v8:--shared-v8} \
122 --shared-http-parser \
127 # add LFS defines from libuv (RHBZ#892601)
128 # CXXFLAGS must be exported, as it is needed for make, not gyp
129 CXXFLAGS="%{rpmcxxflags} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" \
130 LDFLAGS="%{rpmldflags}" \
131 %{__make} -C out V=1 BUILDTYPE=Release
134 rm -rf $RPM_BUILD_ROOT
135 %{__make} justinstall \
136 DESTDIR=$RPM_BUILD_ROOT \
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
143 echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
145 install -d $RPM_BUILD_ROOT%{_includedir}/node
146 cp -p src/*.h $RPM_BUILD_ROOT%{_includedir}/node
148 # install for node-gyp
149 install -d $RPM_BUILD_ROOT%{_usrsrc}/%{name}
150 cp -p common.gypi $RPM_BUILD_ROOT%{_usrsrc}/%{name}
151 ln -s %{_includedir}/node $RPM_BUILD_ROOT%{_usrsrc}/%{name}/src
153 # for compat of fedora derivered scripts (shebangs)
154 ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
156 # globally installed node modules (noarch)
157 install -d $RPM_BUILD_ROOT%{_prefix}/lib/node_modules
159 # default searchpaths
160 install -d $RPM_BUILD_ROOT{%{_libdir},%{_prefix}/lib}/node
163 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
164 cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
167 libdir=${prefix}/%{_lib}
168 includedir=${prefix}/include/node
171 Description: Evented I/O for V8 JavaScript.
173 Cflags: -I${includedir}
176 # install documentation
177 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
178 cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
179 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.markdown
180 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.json
183 rm -rf $RPM_BUILD_ROOT
185 %post -p /sbin/ldconfig
186 %postun -p /sbin/ldconfig
189 %defattr(644,root,root,755)
190 %doc README.md AUTHORS ChangeLog LICENSE
191 %attr(755,root,root) %{_bindir}/node
192 %attr(755,root,root) %{_bindir}/nodejs
193 %attr(755,root,root) %{_libdir}/libnode.so.*.*.*
194 %ghost %{_libdir}/libnode.so.10
195 %if "%{_lib}" != "lib"
198 %dir %{_prefix}/lib/node
199 %dir %{_prefix}/lib/node_modules
200 %{_mandir}/man1/node.1*
201 %{_mandir}/man1/nodejs.1
204 %defattr(644,root,root,755)
205 %{_libdir}/libnode.so
207 %{_pkgconfigdir}/nodejs.pc
211 %defattr(644,root,root,755)
212 %doc %{_docdir}/%{name}-doc-%{version}