build 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/sh
  2. # Build script for valaq
  3. # Build directory is passed as the first argument
  4. BUILD_DIR="$1"
  5. if [ -z "$BUILD_DIR" ]; then
  6. echo "Error: Build directory not specified"
  7. exit 1
  8. fi
  9. echo "Building valaq in $BUILD_DIR"
  10. # Function to find the source directory (updated for flattened extraction)
  11. find_source_dir() {
  12. local search_dir="$1"
  13. # With flattened extraction, check current directory first
  14. if [ -f "$search_dir/meson.build" ]; then
  15. echo "$search_dir"
  16. return 0
  17. fi
  18. # Look for common indicators of a Meson source directory
  19. for item in "$search_dir"/*; do
  20. if [ -d "$item" ]; then
  21. # Check for Meson files
  22. if [ -f "$item/meson.build" ]; then
  23. echo "$item"
  24. return 0
  25. fi
  26. fi
  27. done
  28. # If still not found, return the search directory
  29. echo "$search_dir"
  30. }
  31. # Find the source directory
  32. SOURCE_DIR=$(find_source_dir ".")
  33. echo "Using source directory: $SOURCE_DIR"
  34. # Configure the build
  35. echo "Configuring with Meson..."
  36. meson setup "$BUILD_DIR" --prefix=/usr "$SOURCE_DIR"
  37. # Build the package
  38. echo "Building..."
  39. meson compile -C "$BUILD_DIR"
  40. echo "Build completed for valaq"