lemonlang 0.0.4

an experimental, modern, purely safe, programming language.
#!/bin/bash
  #!/bin/bash

  set -e  # Para o script ao encontrar um erro

  echo "🚀 Starting Lemon build process..."

  # Diretório de saída dos binários
  OUTPUT_DIR="release-binaries"
  mkdir -p "$OUTPUT_DIR"

  # Certificar-se de que os targets estão instalados corretamente
  echo "🔄 Ensuring Rust standard library is installed for cross-compilation..."
  rustup target add x86_64-apple-darwin || true
  rustup target add aarch64-apple-darwin || true
  rustup target add x86_64-unknown-linux-gnu
  rustup target add aarch64-unknown-linux-gnu
  rustup target add x86_64-pc-windows-gnu

  # Certificar-se de que o LLVM está configurado corretamente
  # echo "🔍 Checking LLVM installation..."
  # export LLVM_SYS_180_PREFIX=$(brew --prefix llvm)
  # echo "✅ LLVM path set to: $LLVM_SYS_180_PREFIX"

  # Função para compilar Lemon para uma plataforma específica
  build_target() {
      local target="$1"
      local output_name="$2"
      local use_nightly="$3"

      echo "🔨 Building for $target..."

      # if [[ "$use_nightly" == "yes" ]]; then
      #     rustup override set nightly
      #     cargo build --release --target "$target" -Z build-std
      #     rustup override unset
      # else
          cross build --release --target "$target"
      # fi

      # Movendo o binário para a pasta de release
      if [[ "$target" == *"windows"* ]]; then
          mv "target/$target/release/lemon.exe" "$OUTPUT_DIR/$output_name.exe"
      else
          mv "target/$target/release/lemon" "$OUTPUT_DIR/$output_name"
      fi
      echo "✅ Build completed: $output_name"
  }

  # Compilar para macOS (Intel e ARM) usando `build-std` com Nightly
  build_target "x86_64-apple-darwin" "lemon-macos-x86_64" "yes"
  build_target "aarch64-apple-darwin" "lemon-macos-aarch64" "yes"

  # Compilar para Linux (Intel e ARM)
  build_target "x86_64-unknown-linux-gnu" "lemon-linux-x86_64" "yes"
  build_target "aarch64-unknown-linux-gnu" "lemon-linux-aarch64" "yes"

  # Compilar para Windows (Intel)
  build_target "x86_64-pc-windows-gnu" "lemon-windows-x86_64" "yes"

  # Listar arquivos gerados
  echo "📦 Build process completed! Generated binaries:"
  ls -lh "$OUTPUT_DIR"

  echo "🎉 All targets built successfully!"