2021-05-17 17:43:07 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-09-19 20:23:56 +08:00
|
|
|
rm -rf src
|
2022-03-01 15:18:57 +08:00
|
|
|
|
2024-09-19 20:23:56 +08:00
|
|
|
git pull
|
2022-03-01 15:18:57 +08:00
|
|
|
|
2021-05-17 17:43:07 +08:00
|
|
|
BIN_VERSION="go-fastdfs:${1-$(git describe --tags `git rev-parse HEAD`)}"
|
|
|
|
|
|
|
|
|
2024-09-19 20:23:56 +08:00
|
|
|
cp -rf vendor src
|
2021-05-17 17:43:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-11 08:50:57 +08:00
|
|
|
export GO111MODULE="off"
|
|
|
|
|
2021-10-10 22:17:37 +08:00
|
|
|
mkdir -p src/github.com/sjqzhang/go-fastdfs
|
|
|
|
cp -rf cmd doc server main.go src/github.com/sjqzhang/go-fastdfs
|
|
|
|
|
|
|
|
|
2024-09-18 09:30:47 +08:00
|
|
|
GOPATH=`pwd` go test -v server/*.go
|
2022-03-01 15:18:57 +08:00
|
|
|
|
2024-09-19 20:23:56 +08:00
|
|
|
echo $?
|
2022-03-01 15:18:57 +08:00
|
|
|
if [[ $? -ne 0 ]];then
|
|
|
|
echo "test fail"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-05-17 17:43:07 +08:00
|
|
|
#for linux
|
2021-10-10 22:17:37 +08:00
|
|
|
GOPATH=`pwd` GOOS=linux GOARCH=amd64 go build -o fileserver -ldflags "-w -s -X 'main.VERSION=$BIN_VERSION' -X 'main.BUILD_TIME=build_time:`date`' -X 'main.GO_VERSION=`go version`' -X 'main.GIT_VERSION=git_version:`git rev-parse HEAD`'" src/github.com/sjqzhang/go-fastdfs/main.go
|
|
|
|
GOPATH=`pwd` GOOS=linux GOARCH=386 go build -o fileserver32 -ldflags "-w -s -X 'main.VERSION=$BIN_VERSION' -X 'main.BUILD_TIME=build_time:`date`' -X 'main.GO_VERSION=`go version`' -X 'main.GIT_VERSION=git_version:`git rev-parse HEAD`'" src/github.com/sjqzhang/go-fastdfs/main.go
|
2021-05-17 17:43:07 +08:00
|
|
|
|
|
|
|
#for windows
|
2021-10-10 22:17:37 +08:00
|
|
|
GOPATH=`pwd` GOOS=windows GOARCH=amd64 go build -o fileserver.exe -ldflags "-w -s -X 'main.VERSION=$BIN_VERSION' -X 'main.BUILD_TIME=build_time:`date`' -X 'main.GO_VERSION=`go version`' -X 'main.GIT_VERSION=git_version:`git rev-parse HEAD`'" src/github.com/sjqzhang/go-fastdfs/main.go
|
|
|
|
GOPATH=`pwd` GOOS=windows GOARCH=386 go build -o fileserver32.exe -ldflags "-w -s -X 'main.VERSION=$BIN_VERSION' -X 'main.BUILD_TIME=build_time:`date`' -X 'main.GO_VERSION=`go version`' -X 'main.GIT_VERSION=git_version:`git rev-parse HEAD`'" src/github.com/sjqzhang/go-fastdfs/main.go
|
2021-05-17 17:43:07 +08:00
|
|
|
|
|
|
|
#for mac
|
2021-10-10 22:17:37 +08:00
|
|
|
GOPATH=`pwd` GOOS=darwin GOARCH=amd64 go build -o fileserver_darwin -ldflags "-w -s -X 'main.VERSION=$BIN_VERSION' -X 'main.BUILD_TIME=build_time:`date`' -X 'main.GO_VERSION=`go version`' -X 'main.GIT_VERSION=git_version:`git rev-parse HEAD`'" src/github.com/sjqzhang/go-fastdfs/main.go
|
|
|
|
GOPATH=`pwd` GOOS=darwin GOARCH=386 go build -o fileserver_darwin32 -ldflags "-w -s -X 'main.VERSION=$BIN_VERSION' -X 'main.BUILD_TIME=build_time:`date`' -X 'main.GO_VERSION=`go version`' -X 'main.GIT_VERSION=git_version:`git rev-parse HEAD`'" src/github.com/sjqzhang/go-fastdfs/main.go
|
2022-03-11 15:40:18 +08:00
|
|
|
|
|
|
|
#for arm64
|
2023-04-08 22:11:31 +08:00
|
|
|
GOPATH=`pwd` GOOS=linux GOARCH=arm64 go build -o fileserver_arm -ldflags "-w -s -X 'main.VERSION=$BIN_VERSION' -X 'main.BUILD_TIME=build_time:`date`' -X 'main.GO_VERSION=`go version`' -X 'main.GIT_VERSION=git_version:`git rev-parse HEAD`'" src/github.com/sjqzhang/go-fastdfs/main.go
|
|
|
|
GOPATH=`pwd` GOOS=linux GOARCH=arm go build -o fileserver_arm32 -ldflags "-w -s -X 'main.VERSION=$BIN_VERSION' -X 'main.BUILD_TIME=build_time:`date`' -X 'main.GO_VERSION=`go version`' -X 'main.GIT_VERSION=git_version:`git rev-parse HEAD`'" src/github.com/sjqzhang/go-fastdfs/main.go
|