소스 검색

Modify buildscripts to work with offline builds (e.g. nix builds) (#7811)

prepare build scripts for nix
Patrick Reich 1 개월 전
부모
커밋
2018618765
4개의 변경된 파일30개의 추가작업 그리고 9개의 파일을 삭제
  1. 5 0
      cargo
  2. 17 5
      fetch-perf-libs.sh
  3. 1 1
      net/net.sh
  4. 7 3
      scripts/cargo-install-all.sh

+ 5 - 0
cargo

@@ -1,5 +1,10 @@
 #!/usr/bin/env bash
 
+if [[ -n "${NO_RUSTUP_OVERRIDE}" ]]; then
+  set -x
+  exec cargo "${@}"
+fi
+
 # shellcheck source=ci/rust-version.sh
 here=$(dirname "$0")
 

+ 17 - 5
fetch-perf-libs.sh

@@ -1,5 +1,21 @@
 #!/usr/bin/env bash
 
+function installPerfLibSymlinks() {
+  for dir in target/{debug,release}/{,deps/}; do
+    mkdir -p "$dir"
+    ln -sfT "$1" "${dir}perf-libs"
+  done
+}
+
+if [[ -n "$SOLANA_PERF_LIBS_PATH" ]]; then
+  mkdir -p target
+
+  ln -sfT "$SOLANA_PERF_LIBS_PATH" target/perf-libs
+  installPerfLibSymlinks "$SOLANA_PERF_LIBS_PATH"
+
+  exit 0
+fi
+
 PERF_LIBS_VERSION=v0.19.3
 VERSION=$PERF_LIBS_VERSION-1
 
@@ -41,11 +57,7 @@ if [[ $VERSION != "$(cat target/perf-libs/.version 2> /dev/null)" ]]; then
 
   # Setup symlinks so the perf-libs/ can be found from all binaries run out of
   # target/
-  for dir in target/{debug,release}/{,deps/}; do
-    mkdir -p $dir
-    ln -sfT ../perf-libs ${dir}perf-libs
-  done
-
+  installPerfLibSymlinks ../perf-libs
 fi
 
 exit 0

+ 1 - 1
net/net.sh

@@ -211,7 +211,7 @@ build() {
 
     $MAYBE_DOCKER bash -c "
       set -ex
-      $profilerFlags scripts/cargo-install-all.sh farf $buildVariant --validator-only
+      $profilerFlags scripts/cargo-install-all.sh farf $buildVariant --validator-only --no-spl-token
     "
   )
 

+ 7 - 3
scripts/cargo-install-all.sh

@@ -29,7 +29,7 @@ usage() {
     echo "Error: $*"
   fi
   cat <<EOF
-usage: $0 [+<cargo version>] [--debug] [--validator-only] [--release-with-debug] <install directory>
+usage: $0 [+<cargo version>] [--debug] [--validator-only] [--release-with-debug] [--no-spl-token] <install directory>
 EOF
   exit $exitcode
 }
@@ -42,6 +42,7 @@ installDir=
 buildProfileArg='--profile release'
 buildProfile='release'
 validatorOnly=
+noSPLToken=
 
 while [[ -n $1 ]]; do
   if [[ ${1:0:1} = - ]]; then
@@ -60,6 +61,9 @@ while [[ -n $1 ]]; do
     elif [[ $1 = --validator-only ]]; then
       validatorOnly=true
       shift
+    elif [[ $1 = --no-spl-token ]]; then
+      noSPLToken=true
+      shift
     else
       usage "Unknown option: $1"
     fi
@@ -163,8 +167,8 @@ check_dcou() {
     cargo_build "${dcouBinArgs[@]}"
   fi
 
-  # Exclude `spl-token` binary for net.sh builds
-  if [[ -z "$validatorOnly" ]]; then
+  # Exclude `spl-token` if requested
+  if [[ -z "$noSPLToken" ]]; then
     # shellcheck source=scripts/spl-token-cli-version.sh
     source "$SOLANA_ROOT"/scripts/spl-token-cli-version.sh