| 
									
										
										
										
											2018-12-11 22:50:42 -08:00
										 |  |  | #!/usr/bin/env bash
 | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # |cargo install| of the top-level crate will not install binaries for | 
					
						
							| 
									
										
										
										
											2018-12-19 10:30:24 -08:00
										 |  |  | # other workspace crates or native program crates. | 
					
						
							| 
									
										
										
										
											2018-12-11 22:50:42 -08:00
										 |  |  | set -e | 
					
						
							| 
									
										
										
										
											2018-12-19 10:30:24 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-14 19:41:05 -07:00
										 |  |  | export rust_version= | 
					
						
							|  |  |  | if [[ $1 =~ \+ ]]; then | 
					
						
							|  |  |  |   export rust_version=$1 | 
					
						
							|  |  |  |   shift | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-19 10:30:24 -08:00
										 |  |  | if [[ -z $1 ]]; then | 
					
						
							|  |  |  |   echo Install directory not specified | 
					
						
							|  |  |  |   exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2019-03-14 19:41:05 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-19 10:30:24 -08:00
										 |  |  | installDir="$(mkdir -p "$1"; cd "$1"; pwd)" | 
					
						
							|  |  |  | cargoFeatures="$2" | 
					
						
							| 
									
										
										
										
											2019-08-23 19:31:18 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | buildProfile="$3" | 
					
						
							|  |  |  | if [[ -n "$buildProfile" ]]; then | 
					
						
							|  |  |  |   binTargetDir="release" | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  |   binTargetDir="debug" | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-19 10:30:24 -08:00
										 |  |  | echo "Install location: $installDir" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | cd "$(dirname "$0")"/.. | 
					
						
							| 
									
										
										
										
											2018-12-11 22:50:42 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-13 21:11:09 -08:00
										 |  |  | SECONDS=0 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-19 10:30:24 -08:00
										 |  |  | ( | 
					
						
							|  |  |  |   set -x | 
					
						
							| 
									
										
										
										
											2019-05-18 14:48:53 -07:00
										 |  |  |   # shellcheck disable=SC2086 # Don't want to double quote $rust_version | 
					
						
							| 
									
										
										
										
											2019-08-23 19:31:18 -06:00
										 |  |  |   cargo $rust_version build --all $buildProfile --features="$cargoFeatures" | 
					
						
							| 
									
										
										
										
											2018-12-19 10:30:24 -08:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-10 18:49:08 -07:00
										 |  |  | BIN_CRATES=( | 
					
						
							|  |  |  |   drone | 
					
						
							|  |  |  |   genesis | 
					
						
							|  |  |  |   gossip | 
					
						
							|  |  |  |   install | 
					
						
							|  |  |  |   keygen | 
					
						
							|  |  |  |   ledger-tool | 
					
						
							|  |  |  |   replicator | 
					
						
							|  |  |  |   validator | 
					
						
							| 
									
										
										
										
											2019-07-11 12:38:52 -06:00
										 |  |  |   validator-info | 
					
						
							| 
									
										
										
										
											2019-08-22 13:51:16 -07:00
										 |  |  |   cli | 
					
						
							| 
									
										
										
										
											2019-06-10 18:49:08 -07:00
										 |  |  |   bench-exchange | 
					
						
							|  |  |  |   bench-tps | 
					
						
							| 
									
										
										
										
											2018-12-13 21:11:09 -08:00
										 |  |  | ) | 
					
						
							| 
									
										
										
										
											2018-12-19 10:30:24 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-10 18:49:08 -07:00
										 |  |  | for crate in "${BIN_CRATES[@]}"; do | 
					
						
							| 
									
										
										
										
											2018-12-13 21:11:09 -08:00
										 |  |  |   ( | 
					
						
							|  |  |  |     set -x | 
					
						
							| 
									
										
										
										
											2019-06-10 18:49:08 -07:00
										 |  |  |     # shellcheck disable=SC2086 # Don't want to double quote $rust_version | 
					
						
							|  |  |  |     cargo $rust_version install --force --path "$crate" --root "$installDir" --features="$cargoFeatures" | 
					
						
							| 
									
										
										
										
											2018-12-13 21:11:09 -08:00
										 |  |  |   ) | 
					
						
							|  |  |  | done | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 15:05:49 -06:00
										 |  |  | for dir in programs/*; do | 
					
						
							| 
									
										
										
										
											2019-08-23 19:31:18 -06:00
										 |  |  |   for program in echo target/$binTargetDir/deps/libsolana_"$(basename "$dir")".{so,dylib,dll}; do | 
					
						
							| 
									
										
										
										
											2018-12-19 10:30:24 -08:00
										 |  |  |     if [[ -f $program ]]; then | 
					
						
							|  |  |  |       mkdir -p "$installDir/bin/deps" | 
					
						
							|  |  |  |       rm -f "$installDir/bin/deps/$(basename "$program")" | 
					
						
							|  |  |  |       cp -v "$program" "$installDir"/bin/deps | 
					
						
							|  |  |  |     fi | 
					
						
							|  |  |  |   done | 
					
						
							|  |  |  | done | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | du -a "$installDir" | 
					
						
							| 
									
										
										
										
											2018-12-13 21:11:09 -08:00
										 |  |  | echo "Done after $SECONDS seconds" |