mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-06-18 10:19:55 +00:00
chore: linux build script
This commit is contained in:
parent
21b2830289
commit
17ba89ea03
32
build.sh
Executable file
32
build.sh
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Hysteria local build script for Linux
|
||||||
|
|
||||||
|
# Change these to whatever you want
|
||||||
|
platforms=("windows/amd64" "linux/amd64" "darwin/amd64")
|
||||||
|
ldflags="-s -w"
|
||||||
|
|
||||||
|
if ! [ -x "$(command -v go)" ]; then
|
||||||
|
echo 'Error: go is not installed.' >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p build
|
||||||
|
rm -rf build/*
|
||||||
|
|
||||||
|
echo "Starting build..."
|
||||||
|
|
||||||
|
for platform in "${platforms[@]}"; do
|
||||||
|
GOOS=${platform%/*}
|
||||||
|
GOARCH=${platform#*/}
|
||||||
|
echo "Building $GOOS/$GOARCH"
|
||||||
|
output="build/hysteria-$GOOS-$GOARCH"
|
||||||
|
if [ $GOOS = "windows" ]; then
|
||||||
|
output="$output.exe"
|
||||||
|
fi
|
||||||
|
env GOOS=$GOOS GOARCH=$GOARCH go build -o $output -ldflags "$ldflags" ./cmd/
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Build complete."
|
||||||
|
|
||||||
|
ls -lh build/ | awk '{print $9, $5}'
|
Loading…
x
Reference in New Issue
Block a user