-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·59 lines (51 loc) · 1.57 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·59 lines (51 loc) · 1.57 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
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
usage() {
cat << USAGE
Usage: $0 -n NODE_VERSION
-n <NODE_VERSION> (Required)
-h help
Example:
$0 -n 16.2.0
USAGE
exit 1
}
NODE_VERSION=
while getopts n:h? options; do
case ${options} in
n)
NODE_VERSION=${OPTARG}
;;
h)
usage
;;
\?)
usage
;;
esac
done
if [[ -z ${NODE_VERSION} ]]; then
echo "FATAL: No value for -n, NODE_VERSION"
echo ""
usage
fi
NODE_KEYS=$(curl -fsSLo- --compressed https://github.com/nodejs/node/raw/main/README.md | awk '/^gpg --keyserver hkps:\/\/keys\.openpgp\.org --recv-keys/ {print $5}' | sort | uniq)
for key in $NODE_KEYS; do
if [[ -n "$key" ]]; then
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ||
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"
fi
done
curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz"
curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc"
gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc
grep " node-v$NODE_VERSION.tar.xz\$" SHASUMS256.txt | sha256sum -c -
tar -Jxf "node-v$NODE_VERSION.tar.xz"
cd "node-v$NODE_VERSION/"
./configure --fully-static --enable-static --without-npm --without-intl
# See: https://github.com/nodejs/node/issues/41497#issuecomment-1013137433
for i in out/tools/v8_gypfiles/gen-regexp-special-case.target.mk out/test_crypto_engine.target.mk; do
sed -i.bak 's/-static//g' "$i" || true
done
make -j"$(getconf _NPROCESSORS_ONLN)" V=0 CFLAGS="-O3" CXXFLAGS="-O3"