build.sh 624 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/sh
  2. # Exit when any command fails
  3. set -e
  4. # Get the script directory and change to the project root
  5. cd "$(dirname "$0")/../"
  6. # Detect the operating system
  7. OS=$(uname -s)
  8. # Set output file name based on the OS
  9. if [[ "$OS" == *"CYGWIN"* || "$OS" == *"MINGW"* || "$OS" == *"MSYS"* ]]; then
  10. OUTPUT="./build/memos.exe"
  11. else
  12. OUTPUT="./build/memos"
  13. fi
  14. echo "Building for $OS..."
  15. # Build the executable
  16. go build -o "$OUTPUT" ./bin/memos/main.go
  17. # Output the success message
  18. echo "Build successful!"
  19. # Output the command to run
  20. echo "To run the application, execute the following command:"
  21. echo "$OUTPUT --mode dev"