build 915 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. # The basename of our binary
  3. BASE="rss2hook"
  4. #
  5. # We build on only a single platform/arch.
  6. #
  7. BUILD_PLATFORMS="linux"
  8. BUILD_ARCHS="amd64"
  9. # For each platform
  10. for OS in ${BUILD_PLATFORMS[@]}; do
  11. # For each arch
  12. for ARCH in ${BUILD_ARCHS[@]}; do
  13. # Setup a suffix for the binary
  14. SUFFIX="${OS}"
  15. # i386 is better than 386
  16. if [ "$ARCH" = "386" ]; then
  17. SUFFIX="${SUFFIX}-i386"
  18. else
  19. SUFFIX="${SUFFIX}-${ARCH}"
  20. fi
  21. # Windows binaries should end in .EXE
  22. if [ "$OS" = "windows" ]; then
  23. SUFFIX="${SUFFIX}.exe"
  24. fi
  25. echo "Building for ${OS} [${ARCH}] -> ${BASE}-${SUFFIX}"
  26. # Run the build
  27. export GOARCH=${ARCH}
  28. export GOOS=${OS}
  29. export CGO_ENABLED=1
  30. go build -ldflags "-X main.version=$(git describe --tags)" -o "${BASE}-${SUFFIX}"
  31. done
  32. done