-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathPKGBUILD
More file actions
164 lines (144 loc) · 4.47 KB
/
PKGBUILD
File metadata and controls
164 lines (144 loc) · 4.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Daniel M. Capella <polyzen@archlinux.org>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Contributor: James Campos <james.r.campos@gmail.com>
# Contributor: BlackEagle < ike DOT devolder AT gmail DOT com >
# Contributor: Dongsheng Cai <dongsheng at moodle dot com>
# Contributor: Masutu Subric <masutu.arch at googlemail dot com>
# Contributor: TIanyi Cui <tianyicui@gmail.com>
pkgname=nodejs
pkgver=25.9.0
pkgrel=2
pkgdesc='Evented I/O for V8 javascript ("Current" release)'
arch=('x86_64')
url='https://nodejs.org/'
license=('MIT')
depends=(
'ada'
'brotli'
'c-ares'
'icu'
'libnghttp2'
'libnghttp3'
'libngtcp2'
'libuv'
# 'llhttp'
'openssl'
'simdjson'
# 'simdutf'
# 'v8'
'zlib'
'zstd'
)
makedepends=(
'git'
'ninja'
'procps-ng'
'python'
)
optdepends=('npm: nodejs package manager')
options=('!lto')
source=("git+https://github.com/nodejs/node.git#tag=v$pkgver?signed")
sha512sums=('9b8a7ed65c3ccf9769a4d355be84e60799bc24636510aea7b34bdc022c7a972b867d657670a9e70ef8d9d279d130010b39852f57eb93abfe72fda258d307fdf5')
validpgpkeys=(
'8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600' # Michaël Zasso (Targos) <targos@protonmail.com>
'890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4' # RafaelGSS <rafael.nunu@hotmail.com>
'C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C' # Richard Lau <rlau@redhat.com>
'C0D6248439F1D5604AAFFB4021D900FFDB233756' # Antoine du Hamel <duhamelantoine1995@gmail.com>
'5BE8A3F6C8A5C01D106C0AD820B1A390B168D356' # Antoine du Hamel <antoine.duhamel@rosa.be>
'108F52B48DB57BB0CC439B2997B01419BD92F80A' # Ruy Adorno <ruyadorno@hotmail.com>
)
_common_flags=(
-fno-semantic-interposition
-Wno-error=coverage-mismatch
)
_configure_args=(
--ninja
--prefix=/usr
--with-intl=system-icu
--without-npm
--shared-ada
--shared-brotli
--shared-cares
--shared-libuv
--shared-nghttp2
--shared-nghttp3
--shared-ngtcp2
--shared-openssl
--shared-simdjson
--shared-zlib
--shared-zstd
# --shared-http-parser
# --shared-simdutf
# --shared-v8
)
_set_flags() {
# /usr/lib/libnode.so uses malloc_usable_size, which is incompatible with fortification level 3
CFLAGS="${CFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
CXXFLAGS="${CXXFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
export CFLAGS+=" ${_common_flags[*]}"
export CXXFLAGS+=" ${_common_flags[*]}"
}
build() {
_set_flags
cd node
# PGO: instrumented build
./configure "${_configure_args[@]}" --enable-pgo-generate
make
# PGO: generate profile data via test suite (broad coverage)
make test || true
# PGO: generate profile data via synthetic workload (deep coverage of hot paths)
out/Release/node -e "
const crypto = require('crypto');
const zlib = require('zlib');
const { Readable, Writable } = require('stream');
const { URL } = require('url');
// Crypto - heavily used in TLS/HTTPS
for (let i = 0; i < 5000; i++) {
crypto.createHash('sha256').update('bench').digest('hex');
crypto.createHash('md5').update('bench').digest('hex');
crypto.randomBytes(64);
}
// JSON parse/stringify - extremely common in APIs
const obj = {users: Array.from({length: 100}, (_, i) => ({id: i, name: 'user' + i, active: true}))};
for (let i = 0; i < 5000; i++) {
JSON.parse(JSON.stringify(obj));
}
// Buffer operations
for (let i = 0; i < 5000; i++) {
const b = Buffer.alloc(4096);
b.fill('x');
b.toString('utf8');
b.toString('base64');
Buffer.concat([b, b]);
}
// URL parsing
for (let i = 0; i < 5000; i++) {
new URL('https://example.com/path/to/resource?key=value&foo=bar#section');
}
// Zlib compress/decompress
const data = Buffer.alloc(16384, 'abcdefgh');
for (let i = 0; i < 500; i++) {
const compressed = zlib.deflateSync(data);
zlib.inflateSync(compressed);
}
// Stream pipeline
for (let i = 0; i < 500; i++) {
const chunks = [];
const r = new Readable({read() { this.push(Buffer.alloc(1024, 'a')); this.push(null); }});
const w = new Writable({write(chunk, enc, cb) { chunks.push(chunk); cb(); }});
r.pipe(w);
}
"
# PGO: optimized build using collected profile data
./configure "${_configure_args[@]}" --enable-pgo-use
make
}
package() {
_set_flags
cd node
make DESTDIR="$pkgdir" install
install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}
# vim:set ts=2 sw=2 et: