From 77f89dec5ee5dad3d3d2e30dd96154420b23cf3e Mon Sep 17 00:00:00 2001 From: Lugdunum Date: Fri, 12 Jul 2024 01:27:11 +0200 Subject: [PATCH] Create build.sh --- build.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 build.sh diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..d1de9b8 --- /dev/null +++ b/build.sh @@ -0,0 +1,40 @@ +#!/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 +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 tar/node-v"$node_version"-linux-x$(getconf LONG_BIT).tar.xz node-v"$node_version"-linux-x$(getconf LONG_BIT) +tar zcvf tar/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