#!/bin/bash 
source $ROOT_PATH/scripts/common.sh
cd tmp/openssl-openssl-$OPENSSL_VERSION || handle_error "Failed to change directory to openssl source"

echo "### Configure and Build OpenSSL for linux x64..."
./Configure linux-x86_64 no-shared no-dynamic-engine --prefix=$GITHUB_WORKSPACE/build/linux/x64 || handle_error "Failed to configure OpenSSL for linux x64"
make || handle_error "Failed to build OpenSSL for linux x64"
make install_sw || handle_error "Failed to install OpenSSL for linux x64"
make clean || handle_error "Failed to clean OpenSSL build for linux x64"

echo "### Configure and Build OpenSSL for linux arm64..."
./Configure linux-aarch64 no-shared no-dynamic-engine --cross-compile-prefix=aarch64-linux-gnu- --prefix=$GITHUB_WORKSPACE/build/linux/arm64 || handle_error "Failed to configure OpenSSL for linux arm64"
make || handle_error "Failed to build OpenSSL for linux arm64"
make install_sw || handle_error "Failed to install OpenSSL for linux arm64"
make clean || handle_error "Failed to clean OpenSSL build for linux arm64"
