#!/bin/sh # Build script for valaq # Build directory is passed as the first argument BUILD_DIR="$1" if [ -z "$BUILD_DIR" ]; then echo "Error: Build directory not specified" exit 1 fi echo "Building valaq in $BUILD_DIR" # Function to find the source directory (updated for flattened extraction) find_source_dir() { local search_dir="$1" # With flattened extraction, check current directory first if [ -f "$search_dir/meson.build" ]; then echo "$search_dir" return 0 fi # Look for common indicators of a Meson source directory for item in "$search_dir"/*; do if [ -d "$item" ]; then # Check for Meson files if [ -f "$item/meson.build" ]; then echo "$item" return 0 fi fi done # If still not found, return the search directory echo "$search_dir" } # Find the source directory SOURCE_DIR=$(find_source_dir ".") echo "Using source directory: $SOURCE_DIR" # Configure the build echo "Configuring with Meson..." meson setup "$BUILD_DIR" --prefix=/usr "$SOURCE_DIR" # Build the package echo "Building..." meson compile -C "$BUILD_DIR" echo "Build completed for valaq"