-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·80 lines (59 loc) · 2.21 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·80 lines (59 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bash
set -e
BASE_DIR=$(dirname "$0")
LISTENERS_LIB_DIR="$BASE_DIR/bin/listeners/"
LISTENERS_DIR="$BASE_DIR/listener_manager/modules"
# Base directory for listeners and signers
SIGNERS_DIR="$BASE_DIR/signer_manager/modules"
SIGNERS_LIB_DIR="$BASE_DIR/bin/signers"
# Detect the platform (assumes macOS if not Linux)
LIB_EXT="so"
if [[ "$OSTYPE" == "darwin"* ]]; then
LIB_EXT="dylib"
fi
# Check if the first argument is --release and set the BUILD_FLAG accordingly
BUILD_FLAG=""
if [ "$1" == "--release" ]; then
BUILD_FLAG="--release"
fi
# Function to build and copy the library
build_and_copy() {
local module_dir=$1
local lib_name=$2
local lib_dir=$3
cargo build $BUILD_FLAG --manifest-path "$module_dir/Cargo.toml"
cp "$module_dir/target/$([ "$BUILD_FLAG" == "--release" ] && echo "release" || echo "debug")/lib$lib_name.$LIB_EXT" "$lib_dir"
}
# Compile EVM listener
echo "Building evm listener..."
build_and_copy "$LISTENERS_DIR/evm" "evm" "$LISTENERS_LIB_DIR"
echo "Evm listener built successfully"
# Compile Bitcoin listener
echo "Building bitcoin listener..."
build_and_copy "$LISTENERS_DIR/bitcoin" "bitcoin" "$LISTENERS_LIB_DIR"
echo "Bitcoin listener built successfully"
# Compile L1X listener
echo "Building l1x listener..."
build_and_copy "$LISTENERS_DIR/l1x" "l1x" "$LISTENERS_LIB_DIR"
echo "L1X listener built successfully"
# Compile oracle listener
echo "Building oracle listener..."
build_and_copy "$LISTENERS_DIR/oracle" "oracle" "$LISTENERS_LIB_DIR"
echo "Oracle listener built successfully"
echo "Building Solana listener..."
build_and_copy "$LISTENERS_DIR/solana" "solana" "$LISTENERS_LIB_DIR"
echo "Solana listener built successfully"
# Compile EVM signer
echo "Building evm signer..."
build_and_copy "$SIGNERS_DIR/evm" "evm" "$SIGNERS_LIB_DIR"
echo "Evm signer built successfully"
# Compile L1X signer
echo "Building l1x signer..."
build_and_copy "$SIGNERS_DIR/l1x" "l1x" "$SIGNERS_LIB_DIR"
echo "L1X signer built successfully"
echo "Building core..."
cargo build "$@" --manifest-path "$BASE_DIR/Cargo.toml"
echo "Core built successfully"
echo "Building Solana signer..."
build_and_copy "$SIGNERS_DIR/solana" "solana" "$SIGNERS_LIB_DIR"
echo "Solana signer built successfully"