Files
r36ultra_app/compile.sh
2026-02-01 16:41:07 -03:00

50 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# Check if cross-compilation is requested
if [ "$1" == "arm64" ] || [ "$1" == "aarch64" ]; then
echo "Cross-compiling Vala framebuffer demo for ARM64..."
# Check if cross-compiler is available
if ! command -v aarch64-linux-gnu-gcc &> /dev/null; then
echo "Error: ARM64 cross-compiler not found!"
echo "Install with: sudo apt-get install gcc-aarch64-linux-gnu"
exit 1
fi
# Compile Vala to C
echo "Step 1: Compiling Vala to C..."
valac --pkg posix -C framebuffer_demo.vala
if [ $? -ne 0 ]; then
echo "Vala to C compilation failed!"
exit 1
fi
# Cross-compile C to ARM64
echo "Step 2: Cross-compiling C to ARM64..."
aarch64-linux-gnu-gcc framebuffer_demo.c -o framebuffer_demo \
$(pkg-config --cflags --libs glib-2.0 gobject-2.0)
if [ $? -eq 0 ]; then
echo "Cross-compilation successful!"
echo "Binary compiled for ARM64 (aarch64)"
echo "Transfer to R36 Ultra and run with: sudo ./framebuffer_demo"
file framebuffer_demo
else
echo "Cross-compilation failed!"
exit 1
fi
else
echo "Compiling Vala framebuffer demo (native)..."
valac --pkg posix framebuffer_demo.vala -o framebuffer_demo
if [ $? -eq 0 ]; then
echo "Compilation successful!"
echo "Run with: sudo ./framebuffer_demo"
file framebuffer_demo
else
echo "Compilation failed!"
exit 1
fi
fi