1
0

build 971 B

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