3 # /usr/share/doc/node/gdbinit
4 # /usr/share/systemtap/tapset/node.stp
7 %bcond_without system_uv # system uv
8 %bcond_with shared # build libnode.so shared library
11 # - https://nodejs.org/en/download/releases/
13 # NODE_MODULE_VERSION refers to the ABI (application binary interface) version
14 # number of Node.js, used to determine which versions of Node.js compiled C++
15 # add-on binaries can be loaded in to without needing to be re-compiled. It
16 # used to be stored as hex value in earlier versions, but is now represented as
18 %define node_module_version 46
19 Summary: Asynchronous JavaScript Engine
24 License: BSD and MIT and Apache v2.0 and GPL v3
25 Group: Development/Languages
26 Source0: https://nodejs.org/dist/v%{version}/node-v%{version}.tar.gz
27 # Source0-md5: 1885586b4b8a2263f77dce27855661e9
28 Patch1: %{name}-shared.patch
29 # force node to use /usr/lib/node as the systemwide module directory
30 Patch2: %{name}-libpath.patch
31 # use /usr/lib64/node as an arch-specific module dir when appropriate
32 Patch3: %{name}-lib64path.patch
33 Patch4: %{name}-use-system-certs.patch
35 URL: https://nodejs.org/
36 BuildRequires: gcc >= 5:4.0
37 BuildRequires: http-parser-devel >= 2.7.0
38 BuildRequires: libstdc++-devel
39 %{?with_system_uv:BuildRequires: libuv-devel >= 1.6.0}
40 BuildRequires: openssl-devel >= 1.0.1
41 BuildRequires: pkgconfig
42 BuildRequires: python >= 1:2.7
43 BuildRequires: python-jsmin
44 BuildRequires: python-modules
45 BuildRequires: rpm >= 4.4.9-56
46 BuildRequires: rpmbuild(macros) >= 1.219
47 BuildRequires: sed >= 4.0
48 BuildRequires: zlib-devel
49 Requires: ca-certificates
50 Provides: nodejs(engine) = %{version}
51 Provides: nodejs(module-version) = %{node_module_version}
53 ExclusiveArch: %{ix86} %{x8664} arm
54 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
56 %define sover %(echo %{version} | cut -d. -f2)
57 # add macro, so adapter won't replace it back literal
58 %define doc_ver %{version}
61 Node.js is a platform built on Chrome's JavaScript runtime for easily
62 building fast, scalable network applications. Node.js uses an
63 event-driven, non-blocking I/O model that makes it lightweight and
64 efficient, perfect for data-intensive real-time applications that run
65 across distributed devices.
68 Summary: Development headers for nodejs
69 Group: Development/Libraries
70 Requires: %{name} = %{version}-%{release}
72 Requires: http-parser-devel >= 2.5.0
73 Requires: libstdc++-devel
74 %{?with_system_uv:Requires: libuv-devel >= 1.6.0}
75 Requires: openssl-devel
79 Development headers for nodejs.
82 Summary: Evented I/O for V8 JavaScript - documentation
84 URL: https://nodejs.org/dist/v%{doc_ver}/docs/api
85 %if "%{_rpmversion}" >= "5"
90 Node.js is a server-side JavaScript environment that uses an
91 asynchronous event-driven model. Node's goal is to provide an easy way
92 to build scalable network programs.
94 This package contains the documentation for nodejs.
97 %setup -q -n node-v%{version}
98 %{?with_shared:%patch1 -p1}
100 %if %{_lib} == "lib64"
106 rm src/node_root_certs.h
107 #%{?with_system_uv:%patch5 -p1}
109 grep -r '#!.*env python' -l . | xargs %{__sed} -i -e '1 s,#!.*env python,#!%{__python},'
112 rm -r deps/http_parser
114 %{?with_system_uv:rm -r deps/uv}
118 ver=$(awk '/#define NODE_MODULE_VERSION/{print $3}' src/node_version.h)
119 test "$ver" = "%{node_module_version}"
121 # CC used only to detect if CC is clang, not used for compiling
124 GYP_DEFINES="soname_version=%{sover}" \
128 %{?0:--shared-cares} \
129 %{?with_system_uv:--shared-libuv} \
130 --shared-http-parser \
135 # add LFS defines from libuv (RHBZ#892601)
136 # CXXFLAGS must be exported, as it is needed for make, not gyp
137 CXXFLAGS="%{rpmcxxflags} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" \
138 LDFLAGS="%{rpmldflags}" \
139 %{__make} -C out V=1 BUILDTYPE=Release
142 rm -rf $RPM_BUILD_ROOT
143 %{__python} tools/install.py install "$RPM_BUILD_ROOT" "%{_prefix}"
146 lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libnode.so.*.*.*)
147 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so.10
148 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so
151 echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
153 install -d $RPM_BUILD_ROOT%{_includedir}/node
154 cp -p src/*.h $RPM_BUILD_ROOT%{_includedir}/node
156 # install for node-gyp
157 install -d $RPM_BUILD_ROOT%{_usrsrc}/%{name}
158 cp -p common.gypi $RPM_BUILD_ROOT%{_usrsrc}/%{name}
159 ln -s %{_includedir}/node $RPM_BUILD_ROOT%{_usrsrc}/%{name}/src
161 # for compat of fedora derivered scripts (shebangs)
162 ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
164 # globally installed node modules (noarch)
165 install -d $RPM_BUILD_ROOT%{_prefix}/lib/node_modules
167 # default searchpaths
168 install -d $RPM_BUILD_ROOT{%{_libdir},%{_prefix}/lib}/node
171 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
172 cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
175 libdir=${prefix}/%{_lib}
176 includedir=${prefix}/include/node
179 Description: Evented I/O for V8 JavaScript.
181 Cflags: -I${includedir}
184 # install documentation
185 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
186 cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
187 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.md
188 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.json
191 rm -rf $RPM_BUILD_ROOT
194 %post -p /sbin/ldconfig
195 %postun -p /sbin/ldconfig
199 %defattr(644,root,root,755)
200 %doc README.md AUTHORS CHANGELOG.md ROADMAP.md LICENSE
201 %attr(755,root,root) %{_bindir}/node
202 %attr(755,root,root) %{_bindir}/nodejs
204 %attr(755,root,root) %{_libdir}/libnode.so.*.*.*
205 %ghost %{_libdir}/libnode.so.10
207 %if "%{_lib}" != "lib"
210 %dir %{_prefix}/lib/node
211 %dir %{_prefix}/lib/node_modules
212 %{_mandir}/man1/node.1*
213 %{_mandir}/man1/nodejs.1
216 %defattr(644,root,root,755)
218 %{_libdir}/libnode.so
221 %{_pkgconfigdir}/nodejs.pc
225 %defattr(644,root,root,755)
226 %doc %{_docdir}/%{name}-doc-%{version}