release.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. VERSION=$(sed -n 's/.*Version.*=.*\"\([^"]*\)\".*/\1/p' $GOPATH/src/github.com/v2ray/v2ray-core/core.go)
  3. BIN_PATH=$GOPATH/bin
  4. mkdir -p $BIN_PATH
  5. function build {
  6. local GOOS=$1
  7. local GOARCH=$2
  8. local SUFFIX=$3
  9. local EXT=$4
  10. local REL_PATH=$BIN_PATH/v2ray_${VERSION}${SUFFIX}
  11. local TARGET=$REL_PATH/v2ray${EXT}
  12. if [ -d "$REL_PATH" ]; then
  13. rm -rf "$REL_PATH"
  14. fi
  15. mkdir -p $REL_PATH/config
  16. cp -R $GOPATH/src/github.com/v2ray/v2ray-core/release/config/* $REL_PATH/config/
  17. GOOS=${GOOS} GOARCH=${GOARCH} go build -o ${TARGET} -compiler gc -ldflags "-s" github.com/v2ray/v2ray-core/release/server
  18. ZIP_FILE=$BIN_PATH/v2ray${SUFFIX}.zip
  19. if [ -f $ZIP_FILE ]; then
  20. rm -f $ZIP_FILE
  21. fi
  22. pushd $BIN_PATH
  23. zip -r $ZIP_FILE ./v2ray_${VERSION}${SUFFIX}/*
  24. popd
  25. }
  26. build "darwin" "amd64" "-macos" "-macos"
  27. build "windows" "amd64" "-windows-64" "-windows-64.exe"
  28. build "windows" "amd64" "-windows-32" "-windows-32.exe"
  29. build "linux" "amd64" "-linux-64" "-linux-64"
  30. build "linux" "386" "-linux-32" "-linux-32"
  31. build "linux" "arm" "-armv6" "-armv6"