/[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 1256340 - (show annotations) (download)
Mon Sep 3 01:04:29 2018 UTC (5 years, 7 months ago) by joequant
Original Path: cauldron/nodejs/current/SPECS/nodejs.spec
File size: 14704 byte(s)
rebuild with new libraries

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 11
21 %global nodejs_patch 3
22 %global nodejs_rel 4
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 2
31 %global v8_build 414
32 %global v8_patch 54
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 8
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 6
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 # We also remove bundled nghttp2 since node can use the system one.
89 Source0: node-v%{nodejs_version}-stripped.tar.xz
90 Source100: %{name}-tarball.sh
91
92 # The native module Requires generator remains in the nodejs SRPM, so it knows
93 # the nodejs and v8 versions. The remainder has migrated to the
94 # nodejs-packaging SRPM.
95 Source7: nodejs_native.attr
96
97 # Disable running gyp on bundled deps we don't use
98 Patch1: 0001-Disable-running-gyp-files-for-bundled-deps.patch
99
100 BuildRequires: pkgconfig(python2)
101 BuildRequires: pkgconfig(libuv)
102 Requires: libuv
103 BuildRequires: libicu-devel
104 BuildRequires: pkgconfig(zlib)
105 BuildRequires: gcc >= 4.8.0
106 BuildRequires: gcc-c++ >= 4.8.0
107 BuildRequires: pkgconfig(libnghttp2)
108
109 %if ! 0%{?bootstrap}
110 BuildRequires: systemtap
111 BuildRequires: http-parser-devel
112 %else
113 Provides: bundled(http-parser) = %{http_parser_version}
114 %endif
115
116 BuildRequires: pkgconfig(openssl)
117
118 #we need ABI virtual provides where SONAMEs aren't enough/not present so deps
119 #break when binary compatibility is broken
120 Provides: nodejs(abi) = %{nodejs_abi}
121 Provides: nodejs(abi%{nodejs_major}) = %{nodejs_abi}
122 Provides: nodejs(v8-abi) = %{v8_abi}
123 Provides: nodejs(v8-abi%{v8_major}) = %{v8_abi}
124
125 #this corresponds to the "engine" requirement in package.json
126 Provides: nodejs(engine) = %{nodejs_version}
127
128 # Node.js currently has a conflict with the 'node' package in Mageia
129 # The ham-radio group has agreed to rename their binary for us, but
130 # in the meantime, we're setting an explicit Conflicts: here
131 Conflicts: node <= 0.3.2-12
132
133 # The punycode module was absorbed into the standard library in v0.6.
134 # It still exists as a seperate package for the benefit of users of older
135 # versions. Since we've never shipped anything older than v0.10 in Mageia,
136 # we don't need the seperate nodejs-punycode package, so we Provide it here so
137 # dependent packages don't need to override the dependency generator.
138 # See also: RHBZ#11511811
139 # UPDATE: punycode will be deprecated and so we should unbundle it in Node v8
140 # and use upstream module instead
141 # https://github.com/nodejs/node/commit/29e49fc286080215031a81effbd59eac092fff2f
142 Provides: nodejs-punycode = %{punycode_version}
143 Provides: npm(punycode) = %{punycode_version}
144
145
146 # Node.js has forked c-ares from upstream in an incompatible way, so we need
147 # to carry the bundled version internally.
148 # See https://github.com/nodejs/node/commit/766d063e0578c0f7758c3a965c971763f43fec85
149 Provides: bundled(c-ares) = %{c_ares_version}
150
151 # Node.js is closely tied to the version of v8 that is used with it. It makes
152 # sense to use the bundled version because upstream consistently breaks ABI
153 # even in point releases. Node.js upstream has now removed the ability to build
154 # against a shared system version entirely.
155 # See https://github.com/nodejs/node/commit/d726a177ed59c37cf5306983ed00ecd858cfbbef
156 Provides: bundled(v8) = %{v8_version}
157
158 # As of v8.4.0, Node.js has http/2 support. They however don't provide --shared-<lib>
159 # option yet.
160 # Version found in deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h
161 # Found --shared--nghttp2 in configure. Trying now.
162 # (kekePower) 2018-04-30
163 #Provides: bundled(nghttp2) = 1.25.0
164
165 # Make sure we keep NPM up to date when we update Node.js
166 Requires: npm = %{?npm_epoch:%{npm_epoch}:}%{npm_version}
167
168
169 %description
170 Node.js is a platform built on Chrome's JavaScript runtime
171 for easily building fast, scalable network applications.
172 Node.js uses an event-driven, non-blocking I/O model that
173 makes it lightweight and efficient, perfect for data-intensive
174 real-time applications that run across distributed devices.
175
176 %package devel
177 Summary: JavaScript runtime - development headers
178 Group: Development/Other
179 Requires: %{name} = %{?epoch:%{epoch}:}%{nodejs_version}
180 Requires: pkgconfig(libuv)
181 Requires: pkgconfig(openssl)
182 Requires: pkgconfig(zlib)
183 Requires: nodejs-packaging
184 %if ! 0%{?bootstrap}
185 Requires: http-parser-devel
186 %endif
187
188 %description devel
189
190 Development headers for the Node.js JavaScript runtime.
191
192 %package -n npm
193 Summary: Node.js Package Manager
194 Epoch: %{npm_epoch}
195 Version: %{npm_version}
196 Release: %{npm_release}
197
198 # We used to ship npm separately, but it is so tightly integrated with Node.js
199 # (and expected to be present on all Node.js systems) that we ship it bundled
200 # now.
201 Obsoletes: npm < 0:3.5.4-6
202 Provides: npm = %{?npm_epoch:%{npm_epoch}:}%{npm_version}
203 Requires: nodejs = %{epoch}:%{nodejs_version}-%{nodejs_release}
204
205 # Do not add epoch to the virtual NPM provides or it will break
206 # the automatic dependency-generation script.
207 Provides: npm(npm) = %{npm_version}
208
209 %description -n npm
210 npm is a package manager for node.js. You can use it to install and publish
211 your node programs. It manages dependencies and does other cool stuff.
212
213 %package docs
214 Summary: Node.js API documentation
215 Group: Documentation
216 BuildArch: noarch
217
218 # We don't require that the main package be installed to
219 # use the docs, but if it is installed, make sure the
220 # version always matches
221 Conflicts: %{name} > %{?epoch:%{epoch}:}%{nodejs_version}-%{nodejs_release}
222 Conflicts: %{name} < %{?epoch:%{epoch}:}%{nodejs_version}-%{nodejs_release}
223
224 %description docs
225 The API documentation for the Node.js JavaScript runtime.
226
227
228 %prep
229 %setup -q -n node-v%{nodejs_version}
230
231 # remove bundled dependencies that we aren't building
232 %autopatch -p1
233 rm -rf deps/icu-small \
234 deps/uv \
235 deps/zlib
236
237 %build
238 # build with debugging symbols and add defines from libuv (#892601)
239 # Node's v8 breaks with GCC 6 because of incorrect usage of methods on
240 # NULL objects. We need to pass -fno-delete-null-pointer-checks
241 export CFLAGS='%{optflags} -g \
242 -D_LARGEFILE_SOURCE \
243 -D_FILE_OFFSET_BITS=64 \
244 -DZLIB_CONST \
245 -fno-delete-null-pointer-checks'
246 export CXXFLAGS='%{optflags} -g \
247 -D_LARGEFILE_SOURCE \
248 -D_FILE_OFFSET_BITS=64 \
249 -DZLIB_CONST \
250 -fno-delete-null-pointer-checks'
251
252 # Explicit new lines in C(XX)FLAGS can break naive build scripts
253 export CFLAGS="$(echo ${CFLAGS} | tr '\n\\' ' ')"
254 export CXXFLAGS="$(echo ${CXXFLAGS} | tr '\n\\' ' ')"
255
256 %if ! 0%{?bootstrap}
257 ./configure --prefix=%{_prefix} \
258 --shared-openssl \
259 --shared-nghttp2 \
260 --shared-zlib \
261 --shared-libuv \
262 --shared-http-parser \
263 --with-dtrace \
264 --with-intl=system-icu \
265 --openssl-use-def-ca-store
266 %else
267 ./configure --prefix=%{_prefix} \
268 --shared-openssl \
269 --shared-nghttp2 \
270 --shared-zlib \
271 --shared-libuv \
272 --without-dtrace \
273 --with-intl=system-icu \
274 --debug-http2 \
275 --debug-nghttp2 \
276 --openssl-use-def-ca-store
277 %endif
278
279 %if %{?with_debug} == 1
280 # Setting BUILDTYPE=Debug builds both release and debug binaries
281 %__make BUILDTYPE=Debug %{?_smp_mflags}
282 %else
283 %__make BUILDTYPE=Release %{?_smp_mflags}
284 %endif
285
286
287 %install
288 ./tools/install.py install %{buildroot} %{_prefix}
289
290 # Set the binary permissions properly
291 chmod 0755 %{buildroot}/%{_bindir}/node
292
293 %if %{?with_debug} == 1
294 # Install the debug binary and set its permissions
295 install -Dpm0755 out/Debug/node %{buildroot}/%{_bindir}/node_g
296 %endif
297
298 # own the sitelib directory
299 mkdir -p %{buildroot}%{_prefix}/lib/node_modules
300
301 # ensure Requires are added to every native module that match the Provides from
302 # the nodejs build in the buildroot
303 install -Dpm0644 %{SOURCE7} %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs_native.attr
304 cat << EOF > %{buildroot}%{_rpmconfigdir}/nodejs_native.req
305 #!/bin/sh
306 echo 'nodejs(abi%{nodejs_major}) >= %nodejs_abi'
307 echo 'nodejs(v8-abi%{v8_major}) >= %v8_abi'
308 EOF
309 chmod 0755 %{buildroot}%{_rpmconfigdir}/nodejs_native.req
310
311 #install documentation
312 mkdir -p %{buildroot}%{_pkgdocdir}/html
313 cp -pr doc/* %{buildroot}%{_pkgdocdir}/html
314 rm -f %{buildroot}%{_pkgdocdir}/html/nodejs.1
315
316 #node-gyp needs common.gypi too
317 mkdir -p %{buildroot}%{_datadir}/node
318 cp -p common.gypi %{buildroot}%{_datadir}/node
319
320 # Install the GDB init tool into the documentation directory
321 mv %{buildroot}/%{_datadir}/doc/node/gdbinit %{buildroot}/%{_pkgdocdir}/gdbinit
322
323 # Since the old version of NPM was unbundled, there are a lot of symlinks in
324 # it's node_modules directory. We need to keep these as symlinks to ensure we
325 # can backtrack on this if we decide to.
326
327 # Rename the npm node_modules directory to node_modules.bundled
328 mv %{buildroot}/%{_prefix}/lib/node_modules/npm/node_modules \
329 %{buildroot}/%{_prefix}/lib/node_modules/npm/node_modules.bundled
330
331 # Recreate all the symlinks
332 mkdir -p %{buildroot}/%{_prefix}/lib/node_modules/npm/node_modules
333 FILES=%{buildroot}/%{_prefix}/lib/node_modules/npm/node_modules.bundled/*
334 for f in $FILES
335 do
336 module=`basename $f`
337 ln -s ../node_modules.bundled/$module %{buildroot}%{_prefix}/lib/node_modules/npm/node_modules/$module
338 done
339
340 # install NPM docs to mandir
341 mkdir -p %{buildroot}%{_mandir} \
342 %{buildroot}%{_pkgdocdir}/npm
343
344 cp -pr deps/npm/man/* %{buildroot}%{_mandir}/
345 rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/man
346 ln -sf %{_mandir} %{buildroot}%{_prefix}/lib/node_modules/npm/man
347
348 # Install Markdown and HTML documentation to %{_pkgdocdir}
349 cp -pr deps/npm/html deps/npm/doc %{buildroot}%{_pkgdocdir}/npm/
350 rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/html \
351 %{buildroot}%{_prefix}/lib/node_modules/npm/doc
352
353 ln -sf %{_pkgdocdir} %{buildroot}%{_prefix}/lib/node_modules/npm/html
354 ln -sf %{_pkgdocdir}/npm/html %{buildroot}%{_prefix}/lib/node_modules/npm/doc
355
356
357 # Node tries to install some python files into a documentation directory
358 # (and not the proper one). Remove them for now until we figure out what to
359 # do with them.
360 rm -f %{buildroot}/%{_defaultdocdir}/node/lldb_commands.py \
361 %{buildroot}/%{_defaultdocdir}/node/lldbinit
362
363 %check
364 # Fail the build if the versions don't match
365 %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.node, '%{nodejs_version}')"
366 %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.v8, '%{v8_version}')"
367 %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.ares.replace(/-DEV$/, ''), '%{c_ares_version}')"
368
369 # Ensure we have punycode and that the version matches
370 %{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"punycode\").version, '%{punycode_version}')"
371
372 # Ensure we have npm and that the version matches
373 NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules %{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"npm\").version, '%{npm_version}')"
374
375 %files
376 %{_bindir}/node
377 %dir %{_prefix}/lib/node_modules
378 %dir %{_datadir}/node
379 %dir %{_datadir}/systemtap
380 %dir %{_datadir}/systemtap/tapset
381 %{_datadir}/systemtap/tapset/node.stp
382
383 %if ! 0%{?bootstrap}
384 %dir %{_usr}/lib/dtrace
385 %{_usr}/lib/dtrace/node.d
386 %endif
387
388 %{_rpmconfigdir}/fileattrs/nodejs_native.attr
389 %{_rpmconfigdir}/nodejs_native.req
390 %license LICENSE
391 %doc AUTHORS CHANGELOG.md COLLABORATOR_GUIDE.md GOVERNANCE.md README.md
392 %doc %{_mandir}/man1/node.1*
393
394
395 %files devel
396 %if %{?with_debug} == 1
397 %{_bindir}/node_g
398 %endif
399 %{_includedir}/node
400 %{_datadir}/node/common.gypi
401 %{_pkgdocdir}/gdbinit
402
403
404 %files -n npm
405 %{_bindir}/npm
406 %{_bindir}/npx
407 %{_prefix}/lib/node_modules/npm
408 %ghost %{_sysconfdir}/npmrc
409 %ghost %{_sysconfdir}/npmignore
410 %doc %{_mandir}/man*/npm*
411 %doc %{_mandir}/man*/npx*
412 %doc %{_mandir}/man5/package.json.5*
413 %doc %{_mandir}/man5/package-lock.json.5*
414 %doc %{_mandir}/man7/removing-npm.7*
415 %doc %{_mandir}/man7/semver.7*
416
417
418 %files docs
419 %dir %{_pkgdocdir}
420 %{_pkgdocdir}/npm*
421 %{_pkgdocdir}/html
422 %{_pkgdocdir}/npm/html
423 %{_pkgdocdir}/npm/doc

  ViewVC Help
Powered by ViewVC 1.1.30