]> git.pld-linux.org Git - packages/nodejs.git/blob - nodejs.spec
- package systemtap probes
[packages/nodejs.git] / nodejs.spec
1 # TODO
2 # - unpackaged files
3 #   /usr/share/doc/node/gdbinit
4
5 # Conditional build:
6 %bcond_without  system_uv       # system uv
7 %bcond_with     shared          # build libnode.so shared library
8
9 # NOTES:
10 # - https://nodejs.org/en/download/releases/
11
12 # NODE_MODULE_VERSION refers to the ABI (application binary interface) version
13 # number of Node.js, used to determine which versions of Node.js compiled C++
14 # add-on binaries can be loaded in to without needing to be re-compiled. It
15 # used to be stored as hex value in earlier versions, but is now represented as
16 # an integer.
17 %define         node_module_version     48
18 Summary:        Asynchronous JavaScript Engine
19 Summary(pl.UTF-8):      Asynchroniczny silnik JavaScriptu
20 Name:           nodejs
21 # 6.9 is LTS, Active LTS: 2018-04-18, EOL: 2019-04-18
22 # https://github.com/nodejs/LTS
23 Version:        6.9.4
24 Release:        1
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
35 Patch5:         uv-fpic.patch
36 URL:            https://nodejs.org/
37 BuildRequires:  gcc >= 6:4.8
38 BuildRequires:  http-parser-devel >= 2.7.0
39 BuildRequires:  libstdc++-devel >= 6:4.8
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 >= 1:2.7
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}
53 Obsoletes:      nodejs-waf
54 ExclusiveArch:  %{ix86} %{x8664} arm
55 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
56
57 %define         sover   %(echo %{version} | cut -d. -f2)
58 # add macro, so adapter won't replace it back literal
59 %define         doc_ver %{version}
60
61 %description
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.
67
68 %description -l pl.UTF-8
69 Node.js to platforma zbudowana w opacriu o silnik JavaScriptu
70 przeglądarki Chrome, służąca do tworzenia szybkich, skalowalnych
71 aplikacji sieciowych. Node.js wykorzystuje nieblokujący model
72 wejścia/wyjścia sterowany zdarzeniami, dzięki czemu jest lekki i
73 wydajny, dobrze nadający się do aplikacji przetwarzających duże
74 ilości danych w czasie rzeczywistym, uruchamianych na rozproszonych
75 urządzeniach.
76
77 %package devel
78 Summary:        Development headers for nodejs
79 Summary(pl.UTF-8):      Pliki nagłówkowe nodejs
80 Group:          Development/Libraries
81 Requires:       %{name} = %{version}-%{release}
82 Requires:       gcc
83 Requires:       http-parser-devel >= 2.5.0
84 Requires:       libstdc++-devel
85 %{?with_system_uv:Requires:     libuv-devel >= 1.6.0}
86 Requires:       openssl-devel
87 Requires:       zlib-devel
88
89 %description devel
90 Development headers for nodejs.
91
92 %description devel -l pl.UTF-8
93 Pliki nagłówkowe nodejs.
94
95 %package doc
96 Summary:        Documentation for Node.js engine
97 Summary(pl.UTF-8):      Dokumentacja silnika Node.js
98 Group:          Documentation
99 URL:            https://nodejs.org/dist/v%{doc_ver}/docs/api
100 %if "%{_rpmversion}" >= "5"
101 BuildArch:      noarch
102 %endif
103
104 %description doc
105 Node.js is a server-side JavaScript environment that uses an
106 asynchronous event-driven model. Node's goal is to provide an easy way
107 to build scalable network programs.
108
109 This package contains the documentation for Node.js.
110
111 %description doc -l pl.UTF-8
112 Node.js to serwerowe środowisko JavaScriptu wykorzystujące
113 asynchroniczny model sterowany zdarzeniami. Celem Node jest
114 zapewnienie łatwego sposobu tworzenia skalowalnych programów
115 sieciowych.
116
117 Ten pakiet zawiera dokumentację Node.js.
118
119 %package -n systemtap-nodejs
120 Summary:        systemtap/dtrace probes for Node.js
121 Summary(pl.UTF-8):      Sondy systemtap/dtrace dla Node.js
122 Group:          Development/Tools
123 Requires:       %{name} = %{version}-%{release}
124 Requires:       systemtap-client
125
126 %description -n systemtap-nodejs
127 systemtap/dtrace probes for Node.js.
128
129 %description -n systemtap-nodejs -l pl.UTF-8
130 Sondy systemtap/dtrace dla Node.js.
131
132 %prep
133 %setup -q -n node-v%{version}
134 %{?with_shared:%patch1 -p1}
135 #%patch1 -p1
136 %if %{_lib} == "lib64"
137 %patch3 -p1
138 %else
139 %patch2 -p1
140 %endif
141 %patch4 -p1
142 %{__rm} src/node_root_certs.h
143 #%{?with_system_uv:%patch5 -p1}
144
145 grep -r '#!.*env python' -l . | xargs %{__sed} -i -e '1 s,#!.*env python,#!%{__python},'
146
147 %{__rm} -r deps/npm
148 %{__rm} -r deps/http_parser
149 %{__rm} -r deps/openssl
150 %{?with_system_uv:%{__rm} -r deps/uv}
151 %{__rm} -r deps/zlib
152
153 %build
154 ver=$(awk '/#define NODE_MODULE_VERSION/{print $3}' src/node_version.h)
155 test "$ver" = "%{node_module_version}"
156
157 # CC used only to detect if CC is clang, not used for compiling
158 CC="%{__cc}" \
159 CXX="%{__cxx}" \
160 GYP_DEFINES="soname_version=%{sover}" \
161 ./configure \
162         %{?0:--shared-cares} \
163         --shared-openssl \
164         --shared-http-parser \
165         %{?with_system_uv:--shared-libuv} \
166         --shared-zlib \
167         --without-npm \
168         --without-dtrace \
169         --prefix=%{_prefix}
170
171 # add LFS defines from libuv (RHBZ#892601)
172 # CXXFLAGS must be exported, as it is needed for make, not gyp
173 CXXFLAGS="%{rpmcxxflags} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" \
174 LDFLAGS="%{rpmldflags}" \
175 %{__make} -C out \
176         BUILDTYPE=Release \
177         V=1
178
179 %install
180 rm -rf $RPM_BUILD_ROOT
181
182 %{__python} tools/install.py install "$RPM_BUILD_ROOT" "%{_prefix}"
183
184 %if %{with shared}
185 lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libnode.so.*.*.*)
186 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so.10
187 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so
188 %endif
189
190 echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
191
192 install -d $RPM_BUILD_ROOT%{_includedir}/node
193 cp -p src/*.h $RPM_BUILD_ROOT%{_includedir}/node
194
195 # install for node-gyp
196 install -d $RPM_BUILD_ROOT%{_usrsrc}/%{name}
197 cp -p common.gypi $RPM_BUILD_ROOT%{_usrsrc}/%{name}
198 ln -s %{_includedir}/node $RPM_BUILD_ROOT%{_usrsrc}/%{name}/src
199
200 # for compat of fedora derivered scripts (shebangs)
201 ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
202
203 # globally installed node modules (noarch)
204 install -d $RPM_BUILD_ROOT%{_prefix}/lib/node_modules
205
206 # default searchpaths
207 install -d $RPM_BUILD_ROOT{%{_libdir},%{_prefix}/lib}/node
208
209 # create pkgconfig
210 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
211 cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
212 version=%{version}
213 prefix=%{_prefix}
214 libdir=${prefix}/%{_lib}
215 includedir=${prefix}/include/node
216
217 Name: nodejs
218 Description: Evented I/O for V8 JavaScript.
219 Version: ${version}
220 Cflags: -I${includedir}
221 EOF
222
223 # install documentation
224 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
225 cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
226 %{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.md
227 %{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.json
228
229 %clean
230 rm -rf $RPM_BUILD_ROOT
231
232 %if %{with shared}
233 %post   -p /sbin/ldconfig
234 %postun -p /sbin/ldconfig
235 %endif
236
237 %files
238 %defattr(644,root,root,755)
239 %doc README.md AUTHORS CHANGELOG.md ROADMAP.md LICENSE
240 %attr(755,root,root) %{_bindir}/node
241 %attr(755,root,root) %{_bindir}/nodejs
242 %if %{with shared}
243 %attr(755,root,root) %{_libdir}/libnode.so.*.*.*
244 %attr(755,root,root) %ghost %{_libdir}/libnode.so.10
245 %endif
246 %if "%{_lib}" != "lib"
247 %dir %{_libdir}/node
248 %endif
249 %dir %{_prefix}/lib/node
250 %dir %{_prefix}/lib/node_modules
251 %{_mandir}/man1/node.1*
252 %{_mandir}/man1/nodejs.1*
253
254 %files devel
255 %defattr(644,root,root,755)
256 %if %{with shared}
257 %attr(755,root,root) %{_libdir}/libnode.so
258 %endif
259 %{_includedir}/node
260 %{_pkgconfigdir}/nodejs.pc
261 %{_usrsrc}/%{name}
262
263 %files doc
264 %defattr(644,root,root,755)
265 %doc %{_docdir}/%{name}-doc-%{version}
266
267 %files -n systemtap-nodejs
268 %defattr(644,root,root,755)
269 %{_datadir}/systemtap/tapset/node.stp
This page took 0.072401 seconds and 4 git commands to generate.