feat: Add perl for OpenSSL builds

- Add perl to Dockerfile for rfs OpenSSL compilation
- Clean up rustup environment (remove gcc complications)
- Ready for complete build debugging
This commit is contained in:
2025-08-31 16:21:30 +02:00
parent 1852135945
commit 7cf0d070ef
6 changed files with 382 additions and 44 deletions

View File

@@ -83,17 +83,15 @@ function components_download_git() {
log_info "Version/Branch: ${version}"
log_info "Target directory: ${target_dir}"
# Always do fresh clone to avoid git state issues
if [[ -d "$target_dir" ]]; then
log_info "Component ${name} already exists, updating..."
safe_execute cd "$target_dir"
safe_execute git fetch --all
safe_execute git checkout "$version"
safe_execute git pull origin "$version" 2>/dev/null || log_info "Already up to date"
else
log_info "Cloning ${name} from ${url}"
safe_execute git clone --depth 1 --branch "$version" "$url" "$target_dir"
log_info "Removing existing ${name} directory for fresh clone"
safe_execute rm -rf "$target_dir"
fi
log_info "Cloning ${name} from ${url}"
safe_execute git clone --depth 1 --branch "$version" "$url" "$target_dir"
# Verify checkout
safe_execute cd "$target_dir"
local current_ref=$(git rev-parse HEAD)
@@ -219,7 +217,13 @@ function components_build_component() {
function components_setup_rust_env() {
section_header "Setting Up Rust Environment"
# Check if we have rustup (Ubuntu/GitHub Actions) or system Rust (Alpine container)
# Source cargo environment if available
if [[ -f /root/.cargo/env ]]; then
log_info "Sourcing cargo environment from /root/.cargo/env"
source /root/.cargo/env
fi
# Check if we have rustup (should be available now)
if command_exists "rustup"; then
log_info "Using rustup for Rust toolchain management"
@@ -231,24 +235,11 @@ function components_setup_rust_env() {
log_info "Rust target already installed: ${RUST_TARGET}"
fi
# Set environment variables for rustup
# Set environment variables for rustup (clean and simple)
export RUSTFLAGS="-C target-feature=+crt-static"
export CC_x86_64_unknown_linux_musl="musl-gcc"
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER="musl-gcc"
else
log_info "Using system Rust (Alpine) with musl"
# Verify musl-gcc is available
if ! command_exists "musl-gcc"; then
log_error "musl-gcc not found. Install with: apk add musl-dev"
return 1
fi
# Set environment variables for system Rust
export RUSTFLAGS="-C target-feature=+crt-static -C linker=musl-gcc"
export CC="musl-gcc"
export TARGET_CC="musl-gcc"
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER="musl-gcc"
log_error "rustup not found after setup"
return 1
fi
log_info "Rust environment configured for musl builds"
@@ -269,10 +260,28 @@ function build_zinit() {
log_info "Building zinit from: ${component_dir}"
# Ensure we're in the correct directory
safe_execute cd "$component_dir"
log_info "Current directory: $(pwd)"
if [[ ! -d "$component_dir" ]]; then
log_error "Component directory not found: ${component_dir}"
return 1
fi
# Build with musl target
# Don't use safe_execute for cd - it runs in subshell
log_info "Executing: cd $component_dir"
cd "$component_dir" || {
log_error "Failed to change to directory: $component_dir"
return 1
}
local current_dir=$(pwd)
log_info "Current directory: ${current_dir}"
# Verify Cargo.toml exists
if [[ ! -f "Cargo.toml" ]]; then
log_error "Cargo.toml not found in: ${current_dir}"
return 1
fi
# Build with musl target (rustup properly configured)
safe_execute cargo build --release --target "$RUST_TARGET"
# Find and install binary
@@ -302,6 +311,28 @@ function build_rfs() {
log_info "Building rfs from: ${component_dir}"
# Ensure we're in the correct directory
if [[ ! -d "$component_dir" ]]; then
log_error "Component directory not found: ${component_dir}"
return 1
fi
# Don't use safe_execute for cd - it runs in subshell
log_info "Executing: cd $component_dir"
cd "$component_dir" || {
log_error "Failed to change to directory: $component_dir"
return 1
}
local current_dir=$(pwd)
log_info "Current directory: ${current_dir}"
# Verify Cargo.toml exists
if [[ ! -f "Cargo.toml" ]]; then
log_error "Cargo.toml not found in: ${current_dir}"
return 1
fi
# Build with musl target
safe_execute cargo build --release --target "$RUST_TARGET"
@@ -339,7 +370,12 @@ function build_mycelium() {
return 1
fi
safe_execute cd "$myceliumd_dir"
# Don't use safe_execute for cd - it runs in subshell
log_info "Executing: cd $myceliumd_dir"
cd "$myceliumd_dir" || {
log_error "Failed to change to myceliumd directory: $myceliumd_dir"
return 1
}
log_info "Building in myceliumd subdirectory: $(pwd)"
# Build with musl target