Explorar o código

Add Solidity compiler to solana installer (#31184)

Co-authored-by: mvines <mvines@gmail.com>
Sean Young %!s(int64=2) %!d(string=hai) anos
pai
achega
1438d9ef08
Modificáronse 1 ficheiros con 34 adicións e 0 borrados
  1. 34 0
      scripts/cargo-install-all.sh

+ 34 - 0
scripts/cargo-install-all.sh

@@ -165,6 +165,40 @@ if [[ -z "$validatorOnly" ]]; then
   cp -a sdk/sbf/* "$installDir"/bin/sdk/sbf
 fi
 
+# Add Solidity Compiler
+if [[ -z "$validatorOnly" ]]; then
+  base="https://github.com/hyperledger/solang/releases/download"
+  version="v0.2.3"
+  curlopt="-sSfL --retry 5 --retry-delay 2 --retry-connrefused"
+
+  case $(uname -s) in
+  "Linux")
+    if [[ $(uname -m) == "x86_64" ]]; then
+      arch="x86-64"
+    else
+      arch="arm64"
+    fi
+    # shellcheck disable=SC2086
+    curl $curlopt -o "$installDir/bin/solang" $base/$version/solang-linux-$arch
+    chmod 755 "$installDir/bin/solang"
+    ;;
+  "Darwin")
+    if [[ $(uname -m) == "x86_64" ]]; then
+      arch="intel"
+    else
+      arch="arm"
+    fi
+    # shellcheck disable=SC2086
+    curl $curlopt -o "$installDir/bin/solang" $base/$version/solang-mac-$arch
+    chmod 755 "$installDir/bin/solang"
+    ;;
+  *)
+    # shellcheck disable=SC2086
+    curl $curlopt -o "$installDir/bin/solang.exe" $base/$version/solang.exe
+    ;;
+  esac
+fi
+
 (
   set -x
   # deps dir can be empty