-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathbuild-linux.sh
More file actions
executable file
·66 lines (55 loc) · 2.11 KB
/
build-linux.sh
File metadata and controls
executable file
·66 lines (55 loc) · 2.11 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
#!/bin/bash
# Script to build canined for Linux using Docker with full CGO/ledger support
set -e
echo "Building canined for Linux with ledger support using Docker..."
# Get the directory of this script
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Parent directory (Github folder)
PARENT_DIR="$(dirname "$SCRIPT_DIR")"
# Architecture (default: amd64)
ARCH="${1:-amd64}"
echo "Build context: $PARENT_DIR"
echo "Target architecture: $ARCH"
# Build the Docker image and extract the binary
docker build \
--build-arg GOARCH="$ARCH" \
--build-arg GOOS=linux \
--build-arg LEDGER_ENABLED=true \
-f "$SCRIPT_DIR/Dockerfile.linux-build" \
-t canined-linux-builder \
"$PARENT_DIR"
# Create a temporary container to copy files out
CONTAINER_ID=$(docker create canined-linux-builder)
# Copy the binary from the container
docker cp "$CONTAINER_ID:/workspace/canine-chain/build/canined" "$SCRIPT_DIR/build/canined-linux-$ARCH"
# Copy libwasmvm.so if it exists
if docker cp "$CONTAINER_ID:/workspace/canine-chain/build/libwasmvm.so" "$SCRIPT_DIR/build/libwasmvm-linux-$ARCH.so" 2>/dev/null; then
echo "✓ Extracted libwasmvm.so"
WASMVM_PRESENT=true
else
echo "⚠ Warning: libwasmvm.so not found in build"
WASMVM_PRESENT=false
fi
# Clean up the container
docker rm "$CONTAINER_ID"
echo ""
echo "✓ Build complete:"
echo " Binary: $SCRIPT_DIR/build/canined-linux-$ARCH"
if [ "$WASMVM_PRESENT" = true ]; then
echo " Library: $SCRIPT_DIR/build/libwasmvm-linux-$ARCH.so"
fi
echo ""
echo "To verify the binary:"
echo " file build/canined-linux-$ARCH"
echo ""
if [ "$WASMVM_PRESENT" = true ]; then
echo "Deployment instructions:"
echo " 1. Copy both files to your Linux server:"
echo " scp build/canined-linux-$ARCH user@server:/usr/local/bin/canined"
echo " scp build/libwasmvm-linux-$ARCH.so user@server:/usr/lib/libwasmvm.so"
echo ""
echo " 2. Or place libwasmvm.so in the same directory as canined and set:"
echo " export LD_LIBRARY_PATH=/path/to/canined:\$LD_LIBRARY_PATH"
else
echo "Note: The binary should be ready for deployment on Linux $ARCH systems."
fi