initial commit
This commit is contained in:
		
							
								
								
									
										42
									
								
								scripts/build.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										42
									
								
								scripts/build.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
 | 
			
		||||
 | 
			
		||||
# Defaults
 | 
			
		||||
OUTDIR=""
 | 
			
		||||
RELEASE=0
 | 
			
		||||
CARGO_ARGS=""
 | 
			
		||||
 | 
			
		||||
usage() {
 | 
			
		||||
  cat <<EOF
 | 
			
		||||
Usage: $(basename "$0") [options]
 | 
			
		||||
 | 
			
		||||
Options:
 | 
			
		||||
  --release              Use cargo --release
 | 
			
		||||
  --outdir <dir>         Output directory (passed to cargo --dist)
 | 
			
		||||
  --cargo-args "..."     Extra arguments forwarded to cargo build
 | 
			
		||||
  -h, --help             Show this help
 | 
			
		||||
EOF
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Parse args
 | 
			
		||||
while [[ $# -gt 0 ]]; do
 | 
			
		||||
  case "$1" in
 | 
			
		||||
    --release) RELEASE=1; shift;;
 | 
			
		||||
    --outdir) OUTDIR="$2"; shift 2;;
 | 
			
		||||
    --cargo-args) CARGO_ARGS="$2"; shift 2;;
 | 
			
		||||
    -h|--help) usage; exit 0;;
 | 
			
		||||
    *) echo "❌ Unknown option: $1"; echo; usage; exit 1;;
 | 
			
		||||
  esac
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
"$SCRIPT_DIR/install.sh"
 | 
			
		||||
 | 
			
		||||
set -x
 | 
			
		||||
cmd=(cargo build)
 | 
			
		||||
if [[ $RELEASE -eq 1 ]]; then cmd+=(--release); fi
 | 
			
		||||
if [[ -n "$OUTDIR" ]]; then cmd+=(--dist "$OUTDIR"); fi
 | 
			
		||||
if [[ -n "$CARGO_ARGS" ]]; then cmd+=($CARGO_ARGS); fi
 | 
			
		||||
"${cmd[@]}"
 | 
			
		||||
set +x
 | 
			
		||||
		Reference in New Issue
	
	Block a user