Lots of fixes

details
  details
  details
This commit is contained in:
2025-08-16 00:51:19 +02:00
parent 809c4efece
commit 653c751535
14 changed files with 246 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -e
ALPINE_ROOT="/build/initramfs"
@@ -56,14 +56,6 @@ build_rust_component() {
# Source cargo environment
. ~/.cargo/env
# Set git version for components that use git_version macro
# Many git_version crates check these environment variables first
export VERGEN_GIT_DESCRIBE=$(cd "$COMPONENTS_DIR/$component_name" && git describe --tags --always --dirty=-modified 2>/dev/null || echo "unknown")
export GIT_VERSION=$(cd "$COMPONENTS_DIR/$component_name" && git describe --tags --always --dirty=-modified 2>/dev/null || echo "unknown")
export VERGEN_GIT_BRANCH=$(cd "$COMPONENTS_DIR/$component_name" && git branch --show-current 2>/dev/null || echo "main")
export VERGEN_GIT_COMMIT_TIMESTAMP=$(cd "$COMPONENTS_DIR/$component_name" && git log -1 --format=%ct 2>/dev/null || echo "0")
export VERGEN_GIT_SHA=$(cd "$COMPONENTS_DIR/$component_name" && git rev-parse HEAD 2>/dev/null || echo "unknown")
# Build with musl target for static linking
cargo build --release --target x86_64-unknown-linux-musl
@@ -124,6 +116,55 @@ build_go_component() {
fi
}
# Function to build mycelium (special case - builds from myceliumd subdirectory)
build_mycelium_component() {
local component_name="$1"
local binary_name="$2"
local install_path="$3"
echo " Building Mycelium component: $component_name"
if ! prepare_component "$component_name"; then
echo " Skipping $component_name (not available)"
return 1
fi
# Change to myceliumd subdirectory
if [ ! -d "myceliumd" ]; then
echo " Error: myceliumd subdirectory not found in $component_name"
return 1
fi
echo " Building from myceliumd subdirectory..."
cd myceliumd
# Source cargo environment
. ~/.cargo/env
# Build with musl target for static linking from myceliumd directory
cargo build --release --target x86_64-unknown-linux-musl
# Debug: Check what was actually built
echo " Checking build results..."
ls -la target/x86_64-unknown-linux-musl/release/ | grep -v "\.d$" | grep -v "\.rlib$" || true
# The binary is in target/x86_64-unknown-linux-musl/release/ (relative to myceliumd directory)
if [ ! -f "target/x86_64-unknown-linux-musl/release/$binary_name" ]; then
echo " Error: Binary not found at target/x86_64-unknown-linux-musl/release/$binary_name"
echo " Available files:"
ls -la target/x86_64-unknown-linux-musl/release/ || true
return 1
fi
# Install binary to Alpine root
mkdir -p "$ALPINE_ROOT$install_path"
cp "target/x86_64-unknown-linux-musl/release/$binary_name" "$ALPINE_ROOT$install_path/"
chmod +x "$ALPINE_ROOT$install_path/$binary_name"
echo " Success: $install_path/$binary_name installed to Alpine root (musl static)"
return 0
}
# Install build dependencies if needed
echo " Checking build dependencies..."
if ! command -v git >/dev/null; then
@@ -167,8 +208,8 @@ else
echo " Warning: CoreX binary not found"
fi
# 4. Mycelium - Networking layer (Rust) - 0.6.1 with musl
if build_rust_component "mycelium" "mycelium" "/usr/bin"; then
# 4. Mycelium - Networking layer (Rust) - 0.6.1 with musl (special build from myceliumd subdirectory)
if build_mycelium_component "mycelium" "mycelium" "/usr/bin"; then
echo " Mycelium built successfully"
else
echo " Warning: Failed to build mycelium"