Sfoglia il codice sorgente

Add Solidity compiler to solana installer (#31184)

Co-authored-by: mvines <mvines@gmail.com>
Sean Young 2 anni fa
parent
commit
1438d9ef08
1 ha cambiato i file con 34 aggiunte e 0 eliminazioni
  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
   cp -a sdk/sbf/* "$installDir"/bin/sdk/sbf
 fi
 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
   set -x
   # deps dir can be empty
   # deps dir can be empty