-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathrebuild-precompiled-addons.sh
More file actions
executable file
·101 lines (81 loc) · 2.42 KB
/
Copy pathrebuild-precompiled-addons.sh
File metadata and controls
executable file
·101 lines (81 loc) · 2.42 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
#!/usr/bin/env bash
set -eo pipefail
#######################################
# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. and contributors 2020
#######################################
cd $(dirname $BASH_SOURCE)
# We intentionally skip defining Node.js v25 because:
# - Node.js v21,v23 and v25 are non-LTS releases with a short support window.
# - Excluding these helps reduces the overall package size.
# - Most users remain on stable LTS versions such as 22,24, etc.
declare -A ABI_VERSIONS=(
["108"]="18.18"
["115"]="20.19"
# ["120"]="21.2" \
["127"]="22.0"
# ["131"]="23.0" \
["137"]="24.0"
# ["141"]="25.0" # Non-LTS (skipped intentionally)
["147"]="26.0"
)
LIBC_VARIANTS=(
"glibc"
"musl"
)
LINUX_ARCHS=(
"x64"
"arm64"
"s390x"
)
#########
# Linux #
#########
if [[ -z "$BUILD_FOR_MACOS" ]]; then
for ARCH in "${LINUX_ARCHS[@]}"; do
source ./build-and-copy-node-modules-linux
for ABI_VERSION in "${!ABI_VERSIONS[@]}"; do
NODEJS_VERSION="${ABI_VERSIONS[$ABI_VERSION]}"
for LIBC in "${LIBC_VARIANTS[@]}"; do
# Skip musl for s390x as it is not building correctly
if [[ "$ARCH" == "s390x" && "$LIBC" == "musl" ]]; then
continue
fi
buildAndCopyModulesLinux "$ABI_VERSION" "$NODEJS_VERSION" "$LIBC" "$ARCH"
done
done
done
fi
#########
# MacOS #
#########
# Precompiled versions of the native addons for MacOS are neither added to version control nor are they part of the
# published packages. They are only built locally for test purposes.
if [[ ! -z "$BUILD_FOR_MACOS" ]]; then
if [[ "$OSTYPE" == "darwin"* ]]; then
if [[ ! -e $HOME/.nvm ]]; then
echo This script requires nvm to build native addons for multiple Node.js versions for MacOS.
exit 1
fi
# Make nvm available in this script.
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# Finding the native arch of host machine
case "$(uname -m)" in
x86_64 | amd64) ARCH="x64" ;;
arm64 | aarch64) ARCH="arm64" ;;
*)
echo "Not supported arch type: $(uname -m)" >&2
exit 1
;;
esac
source ./build-and-copy-node-modules-darwin
for ABI_VERSION in ${!ABI_VERSIONS[@]}; do
NODEJS_VERSION=${ABI_VERSIONS[$ABI_VERSION]}
buildAndCopyModulesDarwin $ABI_VERSION $NODEJS_VERSION $ARCH
done
else
echo Native addons for MacOS can only be built on MacOS.
exit 1
fi
fi