/[packages]/updates/8/nodejs/current/SPECS/nodejs.spec
ViewVC logotype

Contents of /updates/8/nodejs/current/SPECS/nodejs.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1176260 - (show annotations) (download)
Mon Nov 6 13:42:14 2017 UTC (6 years, 5 months ago) by mjack
Original Path: cauldron/nodejs/current/SPECS/nodejs.spec
File size: 14338 byte(s)
SILENT: Bumping release, rebuilding
1 %global with_debug 1
2
3 %{!?_with_bootstrap: %global bootstrap 0}
4
5 %{?!_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}}
6
7 # ARM builds currently break on the Debug builds, so we'll just
8 # build the standard runtime until that gets sorted out.
9 %ifarch %{arm} aarch64 %{power64}
10 %global with_debug 0
11 %endif
12
13 # == Node.js Version ==
14 # Note: Mageia should only ship LTS versions of Node.js (currently expected
15 # to be major versions with even numbers). The odd-numbered versions are new
16 # feature releases that are only supported for nine months, which is shorter
17 # than a Mageia release lifecycle.
18 %global nodejs_epoch 1
19 %global nodejs_major 8
20 %global nodejs_minor 4
21 %global nodejs_patch 0
22 %global nodejs_rel 2
23 %global nodejs_abi %{nodejs_major}.%{nodejs_minor}
24 %global nodejs_version %{nodejs_major}.%{nodejs_minor}.%{nodejs_patch}
25 %global nodejs_release %mkrel %{nodejs_rel}
26
27 # == Bundled Dependency Versions ==
28 # v8 - from deps/v8/include/v8-version.h
29 %global v8_major 6
30 %global v8_minor 0
31 %global v8_build 286
32 %global v8_patch 52
33 # V8 presently breaks ABI at least every x.y release while never bumping SONAME
34 %global v8_abi %{v8_major}.%{v8_minor}
35 %global v8_version %{v8_major}.%{v8_minor}.%{v8_build}.%{v8_patch}
36
37 # c-ares - from deps/cares/include/ares_version.h
38 # https://github.com/nodejs/node/pull/9332
39 %global c_ares_major 1
40 %global c_ares_minor 10
41 %global c_ares_patch 1
42 %global c_ares_version %{c_ares_major}.%{c_ares_minor}.%{c_ares_patch}
43
44 # http-parser - from deps/http_parser/http_parser.h
45 %global http_parser_major 2
46 %global http_parser_minor 7
47 %global http_parser_patch 0
48 %global http_parser_version %{http_parser_major}.%{http_parser_minor}.%{http_parser_patch}
49
50 # punycode - from lib/punycode.js
51 # Note: this was merged into the mainline since 0.6.x
52 # Note: this will be unmerged in v7 or v8
53 %global punycode_major 2
54 %global punycode_minor 0
55 %global punycode_patch 0
56 %global punycode_version %{punycode_major}.%{punycode_minor}.%{punycode_patch}
57
58 # npm - from deps/npm/package.json
59 %global npm_epoch 1
60 %global npm_major 5
61 %global npm_minor 3
62 %global npm_patch 0
63 %global npm_version %{npm_major}.%{npm_minor}.%{npm_patch}
64
65 # In order to avoid needing to keep incrementing the release version for the
66 # main package forever, we will just construct one for npm that is guaranteed
67 # to increment safely. Changing this can only be done during an update when the
68 # base npm version number is increasing.
69 %global npm_release %mkrel %{nodejs_epoch}.%{nodejs_major}.%{nodejs_minor}.%{nodejs_patch}.%{nodejs_rel}
70
71 # Filter out the NPM bundled dependencies so we aren't providing them
72 %global __provides_exclude_from ^%{_prefix}/lib/node_modules/npm/.*$
73 %global __requires_exclude_from ^%{_prefix}/lib/node_modules/npm/.*$
74
75
76 Name: nodejs
77 Epoch: %{nodejs_epoch}
78 Version: %{nodejs_version}
79 Release: %{nodejs_release}
80 Summary: JavaScript runtime
81 License: MIT and ASL 2.0 and ISC and BSD
82 Group: Development/Other
83 URL: http://nodejs.org/
84
85 # nodejs bundles openssl, but we use the system version in Mageia
86 # because openssl contains prohibited code, we remove openssl completely from
87 # the tarball, using the script in Source100
88 Source0: node-v%{nodejs_version}-stripped.tar.gz
89 Source100: %{name}-tarball.sh
90
91 # The native module Requires generator remains in the nodejs SRPM, so it knows
92 # the nodejs and v8 versions. The remainder has migrated to the
93 # nodejs-packaging SRPM.
94 Source7: nodejs_native.attr
95
96 # Disable running gyp on bundled deps we don't use
97 Patch1: 0001-Disable-running-gyp-files-for-bundled-deps.patch
98
99 BuildRequires: pkgconfig(python2)
100 BuildRequires: pkgconfig(libuv)
101 Requires: libuv
102 BuildRequires: libicu-devel
103 BuildRequires: pkgconfig(zlib)
104 BuildRequires: gcc >= 4.8.0
105 BuildRequires: gcc-c++ >= 4.8.0
106
107 %if ! 0%{?bootstrap}
108 BuildRequires: systemtap
109 BuildRequires: http-parser-devel
110 %else
111 Provides: bundled(http-parser) = %{http_parser_version}
112 %endif
113
114 BuildRequires: compat-openssl10-devel
115
116 #we need ABI virtual provides where SONAMEs aren't enough/not present so deps
117 #break when binary compatibility is broken
118 Provides: nodejs(abi) = %{nodejs_abi}
119 Provides: nodejs(abi%{nodejs_major}) = %{nodejs_abi}
120 Provides: nodejs(v8-abi) = %{v8_abi}
121 Provides: nodejs(v8-abi%{v8_major}) = %{v8_abi}
122
123 #this corresponds to the "engine" requirement in package.json
124 Provides: nodejs(engine) = %{nodejs_version}
125
126 # Node.js currently has a conflict with the 'node' package in Mageia
127 # The ham-radio group has agreed to rename their binary for us, but
128 # in the meantime, we're setting an explicit Conflicts: here
129 Conflicts: node <= 0.3.2-12
130
131 # The punycode module was absorbed into the standard library in v0.6.
132 # It still exists as a seperate package for the benefit of users of older
133 # versions. Since we've never shipped anything older than v0.10 in Mageia,
134 # we don't need the seperate nodejs-punycode package, so we Provide it here so
135 # dependent packages don't need to override the dependency generator.
136 # See also: RHBZ#11511811
137 # UPDATE: punycode will be deprecated and so we should unbundle it in Node v8
138 # and use upstream module instead
139 # https://github.com/nodejs/node/commit/29e49fc286080215031a81effbd59eac092fff2f
140 Provides: nodejs-punycode = %{punycode_version}
141 Provides: npm(punycode) = %{punycode_version}
142
143
144 # Node.js has forked c-ares from upstream in an incompatible way, so we need
145 # to carry the bundled version internally.
146 # See https://github.com/nodejs/node/commit/766d063e0578c0f7758c3a965c971763f43fec85
147 Provides: bundled(c-ares) = %{c_ares_version}
148
149 # Node.js is closely tied to the version of v8 that is used with it. It makes
150 # sense to use the bundled version because upstream consistently breaks ABI
151 # even in point releases. Node.js upstream has now removed the ability to build
152 # against a shared system version entirely.
153 # See https://github.com/nodejs/node/commit/d726a177ed59c37cf5306983ed00ecd858cfbbef
154 Provides: bundled(v8) = %{v8_version}
155
156 # As of v8.4.0, Node.js has http/2 support. They however don't provide --shared-<lib>
157 # option yet.
158 Provides: bundled(nghttp2) = 1.22.0
159
160 # Make sure we keep NPM up to date when we update Node.js
161 Requires: npm = %{npm_epoch}:%{npm_version}
162
163
164 %description
165 Node.js is a platform built on Chrome's JavaScript runtime
166 for easily building fast, scalable network applications.
167 Node.js uses an event-driven, non-blocking I/O model that
168 makes it lightweight and efficient, perfect for data-intensive
169 real-time applications that run across distributed devices.
170
171 %package devel
172 Summary: JavaScript runtime - development headers
173 Group: Development/Other
174 Requires: %{name}%{?_isa} = %{epoch}:%{nodejs_version}
175 Requires: %{_lib}uv-devel%{?_isa}
176 Requires: openssl-devel
177 Requires: zlib-devel
178 Requires: nodejs-packaging
179 %if ! 0%{?bootstrap}
180 Requires: http-parser-devel
181 %endif
182
183 %description devel
184
185 Development headers for the Node.js JavaScript runtime.
186
187 %package -n npm
188 Summary: Node.js Package Manager
189 Epoch: %{npm_epoch}
190 Version: %{npm_version}
191 Release: %{npm_release}
192
193 # We used to ship npm separately, but it is so tightly integrated with Node.js
194 # (and expected to be present on all Node.js systems) that we ship it bundled
195 # now.
196 Obsoletes: npm < 0:3.5.4-6
197 Provides: npm = %{npm_epoch}:%{npm_version}
198 Requires: nodejs = %{epoch}:%{nodejs_version}-%{nodejs_release}
199
200 # Do not add epoch to the virtual NPM provides or it will break
201 # the automatic dependency-generation script.
202 Provides: npm(npm) = %{npm_version}
203
204 %description -n npm
205 npm is a package manager for node.js. You can use it to install and publish
206 your node programs. It manages dependencies and does other cool stuff.
207
208 %package docs
209 Summary: Node.js API documentation
210 Group: Documentation
211 BuildArch: noarch
212
213 # We don't require that the main package be installed to
214 # use the docs, but if it is installed, make sure the
215 # version always matches
216 Conflicts: %{name} > %{epoch}:%{nodejs_version}-%{nodejs_release}
217 Conflicts: %{name} < %{epoch}:%{nodejs_version}-%{nodejs_release}
218
219 %description docs
220 The API documentation for the Node.js JavaScript runtime.
221
222
223 %prep
224 %setup -q -n node-v%{nodejs_version}
225
226 # remove bundled dependencies that we aren't building
227 %autopatch -p1
228 rm -rf deps/icu-small \
229 deps/uv \
230 deps/zlib
231
232 %build
233 # build with debugging symbols and add defines from libuv (#892601)
234 # Node's v8 breaks with GCC 6 because of incorrect usage of methods on
235 # NULL objects. We need to pass -fno-delete-null-pointer-checks
236 export CFLAGS='%{optflags} -g \
237 -D_LARGEFILE_SOURCE \
238 -D_FILE_OFFSET_BITS=64 \
239 -DZLIB_CONST \
240 -fno-delete-null-pointer-checks'
241 export CXXFLAGS='%{optflags} -g \
242 -D_LARGEFILE_SOURCE \
243 -D_FILE_OFFSET_BITS=64 \
244 -DZLIB_CONST \
245 -fno-delete-null-pointer-checks'
246
247 # Explicit new lines in C(XX)FLAGS can break naive build scripts
248 export CFLAGS="$(echo ${CFLAGS} | tr '\n\\' ' ')"
249 export CXXFLAGS="$(echo ${CXXFLAGS} | tr '\n\\' ' ')"
250
251 %if ! 0%{?bootstrap}
252 ./configure --prefix=%{_prefix} \
253 --shared-openssl \
254 --shared-zlib \
255 --shared-libuv \
256 --shared-http-parser \
257 --with-dtrace \
258 --with-intl=system-icu \
259 --openssl-use-def-ca-store
260 %else
261 ./configure --prefix=%{_prefix} \
262 --shared-openssl \
263 --shared-zlib \
264 --shared-libuv \
265 --without-dtrace \
266 --with-intl=system-icu \
267 --debug-http2 \
268 --debug-nghttp2 \
269 --openssl-use-def-ca-store
270 %endif
271
272 %if %{?with_debug} == 1
273 # Setting BUILDTYPE=Debug builds both release and debug binaries
274 make BUILDTYPE=Debug %{?_smp_mflags}
275 %else
276 make BUILDTYPE=Release %{?_smp_mflags}
277 %endif
278
279
280 %install
281 ./tools/install.py install %{buildroot} %{_prefix}
282
283 # Set the binary permissions properly
284 chmod 0755 %{buildroot}/%{_bindir}/node
285
286 %if %{?with_debug} == 1
287 # Install the debug binary and set its permissions
288 install -Dpm0755 out/Debug/node %{buildroot}/%{_bindir}/node_g
289 %endif
290
291 # own the sitelib directory
292 mkdir -p %{buildroot}%{_prefix}/lib/node_modules
293
294 # ensure Requires are added to every native module that match the Provides from
295 # the nodejs build in the buildroot
296 install -Dpm0644 %{SOURCE7} %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs_native.attr
297 cat << EOF > %{buildroot}%{_rpmconfigdir}/nodejs_native.req
298 #!/bin/sh
299 echo 'nodejs(abi%{nodejs_major}) >= %nodejs_abi'
300 echo 'nodejs(v8-abi%{v8_major}) >= %v8_abi'
301 EOF
302 chmod 0755 %{buildroot}%{_rpmconfigdir}/nodejs_native.req
303
304 #install documentation
305 mkdir -p %{buildroot}%{_pkgdocdir}/html
306 cp -pr doc/* %{buildroot}%{_pkgdocdir}/html
307 rm -f %{buildroot}%{_pkgdocdir}/html/nodejs.1
308
309 #node-gyp needs common.gypi too
310 mkdir -p %{buildroot}%{_datadir}/node
311 cp -p common.gypi %{buildroot}%{_datadir}/node
312
313 # Install the GDB init tool into the documentation directory
314 mv %{buildroot}/%{_datadir}/doc/node/gdbinit %{buildroot}/%{_pkgdocdir}/gdbinit
315
316 # Since the old version of NPM was unbundled, there are a lot of symlinks in
317 # it's node_modules directory. We need to keep these as symlinks to ensure we
318 # can backtrack on this if we decide to.
319
320 # Rename the npm node_modules directory to node_modules.bundled
321 mv %{buildroot}/%{_prefix}/lib/node_modules/npm/node_modules \
322 %{buildroot}/%{_prefix}/lib/node_modules/npm/node_modules.bundled
323
324 # Recreate all the symlinks
325 mkdir -p %{buildroot}/%{_prefix}/lib/node_modules/npm/node_modules
326 FILES=%{buildroot}/%{_prefix}/lib/node_modules/npm/node_modules.bundled/*
327 for f in $FILES
328 do
329 module=`basename $f`
330 ln -s ../node_modules.bundled/$module %{buildroot}%{_prefix}/lib/node_modules/npm/node_modules/$module
331 done
332
333 # install NPM docs to mandir
334 mkdir -p %{buildroot}%{_mandir} \
335 %{buildroot}%{_pkgdocdir}/npm
336
337 cp -pr deps/npm/man/* %{buildroot}%{_mandir}/
338 rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/man
339 ln -sf %{_mandir} %{buildroot}%{_prefix}/lib/node_modules/npm/man
340
341 # Install Markdown and HTML documentation to %{_pkgdocdir}
342 cp -pr deps/npm/html deps/npm/doc %{buildroot}%{_pkgdocdir}/npm/
343 rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/html \
344 %{buildroot}%{_prefix}/lib/node_modules/npm/doc
345
346 ln -sf %{_pkgdocdir} %{buildroot}%{_prefix}/lib/node_modules/npm/html
347 ln -sf %{_pkgdocdir}/npm/html %{buildroot}%{_prefix}/lib/node_modules/npm/doc
348
349
350 # Node tries to install some python files into a documentation directory
351 # (and not the proper one). Remove them for now until we figure out what to
352 # do with them.
353 rm -f %{buildroot}/%{_defaultdocdir}/node/lldb_commands.py \
354 %{buildroot}/%{_defaultdocdir}/node/lldbinit
355
356 %check
357 # Fail the build if the versions don't match
358 %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.node, '%{nodejs_version}')"
359 %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.v8, '%{v8_version}')"
360 %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.ares.replace(/-DEV$/, ''), '%{c_ares_version}')"
361
362 # Ensure we have punycode and that the version matches
363 %{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"punycode\").version, '%{punycode_version}')"
364
365 # Ensure we have npm and that the version matches
366 NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules %{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"npm\").version, '%{npm_version}')"
367
368 %files
369 %{_bindir}/node
370 %dir %{_prefix}/lib/node_modules
371 %dir %{_datadir}/node
372 %dir %{_datadir}/systemtap
373 %dir %{_datadir}/systemtap/tapset
374 %{_datadir}/systemtap/tapset/node.stp
375
376 %if ! 0%{?bootstrap}
377 %dir %{_usr}/lib/dtrace
378 %{_usr}/lib/dtrace/node.d
379 %endif
380
381 %{_rpmconfigdir}/fileattrs/nodejs_native.attr
382 %{_rpmconfigdir}/nodejs_native.req
383 %license LICENSE
384 %doc AUTHORS CHANGELOG.md COLLABORATOR_GUIDE.md GOVERNANCE.md README.md
385 %doc %{_mandir}/man1/node.1*
386
387
388 %files devel
389 %if %{?with_debug} == 1
390 %{_bindir}/node_g
391 %endif
392 %{_includedir}/node
393 %{_datadir}/node/common.gypi
394 %{_pkgdocdir}/gdbinit
395
396
397 %files -n npm
398 %{_bindir}/npm
399 %{_bindir}/npx
400 %{_prefix}/lib/node_modules/npm
401 %ghost %{_sysconfdir}/npmrc
402 %ghost %{_sysconfdir}/npmignore
403 %doc %{_mandir}/man*/npm*
404 %doc %{_mandir}/man*/npx*
405 %doc %{_mandir}/man5/package.json.5*
406 %doc %{_mandir}/man5/package-lock.json.5*
407 %doc %{_mandir}/man7/removing-npm.7*
408 %doc %{_mandir}/man7/semver.7*
409
410
411 %files docs
412 %dir %{_pkgdocdir}
413 %{_pkgdocdir}/npm*
414 %{_pkgdocdir}/html
415 %{_pkgdocdir}/npm/html
416 %{_pkgdocdir}/npm/doc

  ViewVC Help
Powered by ViewVC 1.1.30