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 48
19 Summary: Asynchronous JavaScript Engine
21 # 6.9 is LTS, Active LTS: 2018-04-18, EOL: 2019-04-18
22 # https://github.com/nodejs/LTS
25 License: BSD and MIT and Apache v2.0 and GPL v3
26 Group: Development/Languages
27 Source0: https://nodejs.org/dist/v%{version}/node-v%{version}.tar.gz
28 # Source0-md5: 3795199b5950b25179248847b1a5fc86
29 Patch1: %{name}-shared.patch
30 # force node to use /usr/lib/node as the systemwide module directory
31 Patch2: %{name}-libpath.patch
32 # use /usr/lib64/node as an arch-specific module dir when appropriate
33 Patch3: %{name}-lib64path.patch
34 Patch4: %{name}-use-system-certs.patch
36 URL: https://nodejs.org/
37 BuildRequires: gcc >= 5:4.0
38 BuildRequires: http-parser-devel >= 2.7.0
39 BuildRequires: libstdc++-devel
40 %{?with_system_uv:BuildRequires: libuv-devel >= 1.6.0}
41 BuildRequires: openssl-devel >= 1.0.1
42 BuildRequires: pkgconfig
43 BuildRequires: python >= 1:2.7
44 BuildRequires: python-jsmin
45 BuildRequires: python-modules
46 BuildRequires: rpm >= 4.4.9-56
47 BuildRequires: rpmbuild(macros) >= 1.219
48 BuildRequires: sed >= 4.0
49 BuildRequires: zlib-devel
50 Requires: ca-certificates
51 Provides: nodejs(engine) = %{version}
52 Provides: nodejs(module-version) = %{node_module_version}
54 ExclusiveArch: %{ix86} %{x8664} arm
55 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
57 %define sover %(echo %{version} | cut -d. -f2)
58 # add macro, so adapter won't replace it back literal
59 %define doc_ver %{version}
62 Node.js is a platform built on Chrome's JavaScript runtime for easily
63 building fast, scalable network applications. Node.js uses an
64 event-driven, non-blocking I/O model that makes it lightweight and
65 efficient, perfect for data-intensive real-time applications that run
66 across distributed devices.
69 Summary: Development headers for nodejs
70 Group: Development/Libraries
71 Requires: %{name} = %{version}-%{release}
73 Requires: http-parser-devel >= 2.5.0
74 Requires: libstdc++-devel
75 %{?with_system_uv:Requires: libuv-devel >= 1.6.0}
76 Requires: openssl-devel
80 Development headers for nodejs.
83 Summary: Evented I/O for V8 JavaScript - documentation
85 URL: https://nodejs.org/dist/v%{doc_ver}/docs/api
86 %if "%{_rpmversion}" >= "5"
91 Node.js is a server-side JavaScript environment that uses an
92 asynchronous event-driven model. Node's goal is to provide an easy way
93 to build scalable network programs.
95 This package contains the documentation for nodejs.
98 %setup -q -n node-v%{version}
99 %{?with_shared:%patch1 -p1}
101 %if %{_lib} == "lib64"
107 rm src/node_root_certs.h
108 #%{?with_system_uv:%patch5 -p1}
110 grep -r '#!.*env python' -l . | xargs %{__sed} -i -e '1 s,#!.*env python,#!%{__python},'
113 rm -r deps/http_parser
115 %{?with_system_uv:rm -r deps/uv}
119 ver=$(awk '/#define NODE_MODULE_VERSION/{print $3}' src/node_version.h)
120 test "$ver" = "%{node_module_version}"
122 # CC used only to detect if CC is clang, not used for compiling
125 GYP_DEFINES="soname_version=%{sover}" \
129 %{?0:--shared-cares} \
130 %{?with_system_uv:--shared-libuv} \
131 --shared-http-parser \
136 # add LFS defines from libuv (RHBZ#892601)
137 # CXXFLAGS must be exported, as it is needed for make, not gyp
138 CXXFLAGS="%{rpmcxxflags} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" \
139 LDFLAGS="%{rpmldflags}" \
140 %{__make} -C out V=1 BUILDTYPE=Release
143 rm -rf $RPM_BUILD_ROOT
144 %{__python} tools/install.py install "$RPM_BUILD_ROOT" "%{_prefix}"
147 lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libnode.so.*.*.*)
148 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so.10
149 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so
152 echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
154 install -d $RPM_BUILD_ROOT%{_includedir}/node
155 cp -p src/*.h $RPM_BUILD_ROOT%{_includedir}/node
157 # install for node-gyp
158 install -d $RPM_BUILD_ROOT%{_usrsrc}/%{name}
159 cp -p common.gypi $RPM_BUILD_ROOT%{_usrsrc}/%{name}
160 ln -s %{_includedir}/node $RPM_BUILD_ROOT%{_usrsrc}/%{name}/src
162 # for compat of fedora derivered scripts (shebangs)
163 ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
165 # globally installed node modules (noarch)
166 install -d $RPM_BUILD_ROOT%{_prefix}/lib/node_modules
168 # default searchpaths
169 install -d $RPM_BUILD_ROOT{%{_libdir},%{_prefix}/lib}/node
172 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
173 cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
176 libdir=${prefix}/%{_lib}
177 includedir=${prefix}/include/node
180 Description: Evented I/O for V8 JavaScript.
182 Cflags: -I${includedir}
185 # install documentation
186 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
187 cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
188 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.md
189 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.json
192 rm -rf $RPM_BUILD_ROOT
195 %post -p /sbin/ldconfig
196 %postun -p /sbin/ldconfig
200 %defattr(644,root,root,755)
201 %doc README.md AUTHORS CHANGELOG.md ROADMAP.md LICENSE
202 %attr(755,root,root) %{_bindir}/node
203 %attr(755,root,root) %{_bindir}/nodejs
205 %attr(755,root,root) %{_libdir}/libnode.so.*.*.*
206 %ghost %{_libdir}/libnode.so.10
208 %if "%{_lib}" != "lib"
211 %dir %{_prefix}/lib/node
212 %dir %{_prefix}/lib/node_modules
213 %{_mandir}/man1/node.1*
214 %{_mandir}/man1/nodejs.1
217 %defattr(644,root,root,755)
219 %{_libdir}/libnode.so
222 %{_pkgconfigdir}/nodejs.pc
226 %defattr(644,root,root,755)
227 %doc %{_docdir}/%{name}-doc-%{version}