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 # see "Modules" column in https://nodejs.org/en/download/releases/
14 %define node_module_version 46
15 Summary: Asynchronous JavaScript Engine
20 License: BSD and MIT and Apache v2.0 and GPL v3
21 Group: Development/Languages
22 Source0: https://nodejs.org/dist/v%{version}/node-v%{version}.tar.gz
23 # Source0-md5: 1885586b4b8a2263f77dce27855661e9
24 Patch1: %{name}-shared.patch
25 # force node to use /usr/lib/node as the systemwide module directory
26 Patch2: %{name}-libpath.patch
27 # use /usr/lib64/node as an arch-specific module dir when appropriate
28 Patch3: %{name}-lib64path.patch
29 Patch4: %{name}-use-system-certs.patch
31 URL: https://nodejs.org/
32 BuildRequires: gcc >= 5:4.0
33 BuildRequires: http-parser-devel >= 2.7.0
34 BuildRequires: libstdc++-devel
35 %{?with_system_uv:BuildRequires: libuv-devel >= 1.6.0}
36 BuildRequires: openssl-devel >= 1.0.1
37 BuildRequires: pkgconfig
38 BuildRequires: python >= 2.7
39 BuildRequires: python-jsmin
40 BuildRequires: python-modules
41 BuildRequires: rpm >= 4.4.9-56
42 BuildRequires: rpmbuild(macros) >= 1.219
43 BuildRequires: sed >= 4.0
44 BuildRequires: zlib-devel
45 Requires: ca-certificates
46 Provides: nodejs(engine) = %{version}
47 Provides: nodejs(module-version) = %{node_module_version}
49 ExclusiveArch: %{ix86} %{x8664} arm
50 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
52 %define sover %(echo %{version} | cut -d. -f2)
53 # add macro, so adapter won't replace it back literal
54 %define doc_ver %{version}
57 Node.js is a platform built on Chrome's JavaScript runtime for easily
58 building fast, scalable network applications. Node.js uses an
59 event-driven, non-blocking I/O model that makes it lightweight and
60 efficient, perfect for data-intensive real-time applications that run
61 across distributed devices.
64 Summary: Development headers for nodejs
65 Group: Development/Libraries
66 Requires: %{name} = %{version}-%{release}
68 Requires: http-parser-devel >= 2.5.0
69 Requires: libstdc++-devel
70 %{?with_system_uv:Requires: libuv-devel >= 1.6.0}
71 Requires: openssl-devel
75 Development headers for nodejs.
78 Summary: Evented I/O for V8 JavaScript - documentation
80 URL: https://nodejs.org/dist/v%{doc_ver}/docs/api
81 %if "%{_rpmversion}" >= "5"
86 Node.js is a server-side JavaScript environment that uses an
87 asynchronous event-driven model. Node's goal is to provide an easy way
88 to build scalable network programs.
90 This package contains the documentation for nodejs.
93 %setup -q -n node-v%{version}
94 %{?with_shared:%patch1 -p1}
96 %if %{_lib} == "lib64"
102 rm src/node_root_certs.h
103 #%{?with_system_uv:%patch5 -p1}
105 grep -r '#!.*env python' -l . | xargs %{__sed} -i -e '1 s,#!.*env python,#!%{__python},'
108 rm -r deps/http_parser
110 %{?with_system_uv:rm -r deps/uv}
114 ver=$(awk '/#define NODE_MODULE_VERSION/{print $3}' src/node_version.h)
115 test "$ver" = "%{node_module_version}"
117 # CC used only to detect if CC is clang, not used for compiling
120 GYP_DEFINES="soname_version=%{sover}" \
124 %{?0:--shared-cares} \
125 %{?with_system_uv:--shared-libuv} \
126 --shared-http-parser \
131 # add LFS defines from libuv (RHBZ#892601)
132 # CXXFLAGS must be exported, as it is needed for make, not gyp
133 CXXFLAGS="%{rpmcxxflags} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" \
134 LDFLAGS="%{rpmldflags}" \
135 %{__make} -C out V=1 BUILDTYPE=Release
138 rm -rf $RPM_BUILD_ROOT
139 %{__python} tools/install.py install "$RPM_BUILD_ROOT" "%{_prefix}"
142 lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libnode.so.*.*.*)
143 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so.10
144 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so
147 echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
149 install -d $RPM_BUILD_ROOT%{_includedir}/node
150 cp -p src/*.h $RPM_BUILD_ROOT%{_includedir}/node
152 # install for node-gyp
153 install -d $RPM_BUILD_ROOT%{_usrsrc}/%{name}
154 cp -p common.gypi $RPM_BUILD_ROOT%{_usrsrc}/%{name}
155 ln -s %{_includedir}/node $RPM_BUILD_ROOT%{_usrsrc}/%{name}/src
157 # for compat of fedora derivered scripts (shebangs)
158 ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
160 # globally installed node modules (noarch)
161 install -d $RPM_BUILD_ROOT%{_prefix}/lib/node_modules
163 # default searchpaths
164 install -d $RPM_BUILD_ROOT{%{_libdir},%{_prefix}/lib}/node
167 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
168 cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
171 libdir=${prefix}/%{_lib}
172 includedir=${prefix}/include/node
175 Description: Evented I/O for V8 JavaScript.
177 Cflags: -I${includedir}
180 # install documentation
181 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
182 cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
183 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.md
184 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.json
187 rm -rf $RPM_BUILD_ROOT
190 %post -p /sbin/ldconfig
191 %postun -p /sbin/ldconfig
195 %defattr(644,root,root,755)
196 %doc README.md AUTHORS CHANGELOG.md ROADMAP.md LICENSE
197 %attr(755,root,root) %{_bindir}/node
198 %attr(755,root,root) %{_bindir}/nodejs
200 %attr(755,root,root) %{_libdir}/libnode.so.*.*.*
201 %ghost %{_libdir}/libnode.so.10
203 %if "%{_lib}" != "lib"
206 %dir %{_prefix}/lib/node
207 %dir %{_prefix}/lib/node_modules
208 %{_mandir}/man1/node.1*
209 %{_mandir}/man1/nodejs.1
212 %defattr(644,root,root,755)
214 %{_libdir}/libnode.so
217 %{_pkgconfigdir}/nodejs.pc
221 %defattr(644,root,root,755)
222 %doc %{_docdir}/%{name}-doc-%{version}