mirror of
https://github.com/ultravioletrs/cocos.git
synced 2026-06-23 04:10:25 +00:00
42 lines
1.1 KiB
Bash
Executable File
42 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
REPO_URL="https://github.com/coconut-svsm/svsm.git"
|
|
BUILD_DIR="$(cd "$(dirname "$0")/../.." && pwd)/build"
|
|
SVSM_BUILD_DIR=""
|
|
|
|
mkdir -p "$BUILD_DIR"
|
|
|
|
# Define the target directory for cloning inside the build directory
|
|
TARGET_DIR="$BUILD_DIR/svsm"
|
|
SUBDIR="tools/igvmmeasure"
|
|
SVSM_BUILD_DIR="$TARGET_DIR/build"
|
|
|
|
# Clone the repository if it doesn't exist
|
|
if [ -d "$TARGET_DIR" ]; then
|
|
echo "Repository already exists in $TARGET_DIR. Pulling latest changes..."
|
|
cd "$TARGET_DIR" && git pull
|
|
else
|
|
echo "Cloning repository into $TARGET_DIR..."
|
|
git clone --recurse-submodules "$REPO_URL" "$TARGET_DIR"
|
|
fi
|
|
|
|
# Ensure submodules are up to date
|
|
cd "$TARGET_DIR"
|
|
git submodule update --init --recursive
|
|
|
|
# Check if the required subdirectory exists
|
|
if [ -d "$SUBDIR" ]; then
|
|
echo "Successfully cloned repository and found '$SUBDIR' directory."
|
|
else
|
|
echo "Error: '$SUBDIR' directory not found inside '$TARGET_DIR'."
|
|
exit 1
|
|
fi
|
|
|
|
echo "Building the Rust crate..."
|
|
|
|
RELEASE=1 make bin/igvmmeasure BUILDDIR="$SVSM_BUILD_DIR"
|
|
|
|
install -m 755 bin/igvmmeasure "$BUILD_DIR/igvmmeasure"
|
|
|
|
echo "Binary stored in: $BUILD_DIR/igvmmeasure"
|