-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.sh
41 lines (36 loc) · 1.56 KB
/
build.sh
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
#!/bin/bash
node_version="$1"
# Setting up the environment
echo "::group:: Setting up the environment"
yum makecache
yum install -y devtoolset-12-gcc devtoolset-12-gcc-c++ devtoolset-12-make wget curl patch openssl-devel
bash -c "$(curl -sS https://us.cooluc.com/python3/install.sh)"
echo "::endgroup::"
# Download Source
echo "::group:: Download node-v"$node_version".tar.xz"
wget https://nodejs.org/dist/v"$node_version"/node-v"$node_version".tar.xz
tar -Jxf node-v"$node_version".tar.xz
rm -rf node-v"$node_version".tar.xz
echo "::endgroup::"
# Build Node
source /etc/profile
source /opt/rh/devtoolset-12/enable
cd node-v"$node_version"
sed -i 's/define HAVE_SYS_RANDOM_H 1/undef HAVE_SYS_RANDOM_H/g' deps/cares/config/linux/ares_config.h
sed -i 's/define HAVE_GETRANDOM 1/undef HAVE_GETRANDOM/g' deps/cares/config/linux/ares_config.h
echo "::group:: Configure node-v"$node_version""
./configure --prefix=../node-v"$node_version"-linux-x$(getconf LONG_BIT)
echo "::endgroup::"
echo "::group:: make node-v"$node_version""
make -j$(($(nproc --all)+1))
echo "::endgroup::"
echo "::group:: make install"
make install
echo "::endgroup::"
cp -a ./{LICENSE,CHANGELOG.md,README.md} ../node-v"$node_version"-linux-x$(getconf LONG_BIT)/
strip ../node-v"$node_version"-linux-x$(getconf LONG_BIT)/bin/node
# Create Archive
cd ..
tar Jcvf node-v"$node_version"-linux-x$(getconf LONG_BIT).tar.xz node-v"$node_version"-linux-x$(getconf LONG_BIT)
tar zcvf node-v"$node_version"-linux-x$(getconf LONG_BIT).tar.gz node-v"$node_version"-linux-x$(getconf LONG_BIT)
sha256sum node-v*.tar.* > sha256sum.txt