#!/bin/bash
set -x
VERSION=v1.11.1
source /root/env-lotus
source /root/env-proxy
#curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
#wget -c https://golang.org/dl/go1.16.7.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
#echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc && source ~/.bashrc
cd /filecoin/cache/build/lotus
make clean
git checkout master
git pull
git checkout $VERSION
git submodule deinit --all
git submodule update --init
# Some older Intel and AMD processors WITHOUT the ADX instruction support may panic with illegal instruction errors.
LSCPU=$(lscpu|grep -i adx)
if [[ $? == 0 ]]
then
echo "Instruction ADX detected."
else
export CGO_CFLAGS_ALLOW="-D__BLST_PORTABLE__"
export CGO_CFLAGS="-D__BLST_PORTABLE__"
fi
# If you have an AMD Zen or Intel Ice Lake CPU (or later), ENABLE the use of SHA extensions by adding these two environment variables:
LSCPU=$(lscpu|grep -i ' sha')
if [[ $? == 0 ]]
then
echo "Instruction SHA detected."
export RUSTFLAGS="-C target-cpu=native -g"
export FFI_BUILD_FROM_SOURCE=1
fi
make -j16
make lotus-bench
make install
export https_proxy=