You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gophi/build-all.sh

81 lines
4.2 KiB
Bash

#!/bin/sh
PROJECT='gophor'
OUTDIR='build'
echo "PLEASE BE WARNED THIS SCRIPT IS WRITTEN FOR MY VOID LINUX BUILD ENVIRONMENT"
echo "YOUR CC CROSS-COMPILER LOCATIONS MAY DIFFER ON YOUR BUILD SYSTEM"
echo ""
# Clean and recreate directory
rm -rf "$OUTDIR"
mkdir -p "$OUTDIR"
# Build time :)
echo "Building for linux 386..."
CGO_ENABLED=1 CC='i686-linux-musl-gcc' GOOS='linux' GOARCH='386' go build -trimpath -o "$OUTDIR/$PROJECT.linux.386" -buildmode 'pie' -a -tags 'netgo' -ldflags '-s -w -extldflags "-static"'
upx -9 "$OUTDIR/$PROJECT.linux.386"
echo ""
echo "Building for linux amd64..."
CGO_ENABLED=1 CC='x86_64-linux-musl-gcc' GOOS='linux' GOARCH='amd64' go build -trimpath -o "$OUTDIR/$PROJECT.linux.amd64" -buildmode 'pie' -a -tags 'netgo' -ldflags '-s -w -extldflags "-static"'
upx -9 "$OUTDIR/$PROJECT.linux.amd64"
echo ""
echo "Building for linux armv5..."
CGO_ENABLED=1 CC='arm-linux-musleabi-gcc' GOOS='linux' GOARCH='arm' GOARM=5 go build -trimpath -o "$OUTDIR/$PROJECT.linux.armv5" -buildmode 'pie' -a -tags 'netgo' -ldflags '-s -w -extldflags "-static"'
upx -9 "$OUTDIR/$PROJECT.linux.armv5"
echo ""
echo "Building for linux armv5hf..."
CGO_ENABLED=1 CC='arm-linux-musleabihf-gcc' GOOS='linux' GOARCH='arm' GOARM=5 go build -trimpath -o "$OUTDIR/$PROJECT.linux.armv5hf" -buildmode 'pie' -a -tags 'netgo' -ldflags '-s -w -extldflags "-static"'
upx -9 "$OUTDIR/$PROJECT.linux.armv5hf"
echo ""
echo "Building for linux armv6..."
CGO_ENABLED=1 CC='arm-linux-musleabi-gcc' GOOS='linux' GOARCH='arm' GOARM=6 go build -trimpath -o "$OUTDIR/$PROJECT.linux.armv6" -buildmode 'pie' -a -tags 'netgo' -ldflags '-s -w -extldflags "-static"'
upx -9 "$OUTDIR/$PROJECT.linux.armv6"
echo ""
echo "Building for linux armv6hf..."
CGO_ENABLED=1 CC='arm-linux-musleabihf-gcc' GOOS='linux' GOARCH='arm' GOARM=6 go build -trimpath -o "$OUTDIR/$PROJECT.linux.armv6hf" -buildmode 'pie' -a -tags 'netgo' -ldflags '-s -w -extldflags "-static"'
upx -9 "$OUTDIR/$PROJECT.linux.armv6hf"
echo ""
echo "Building for linux armv7hf..."
CGO_ENABLED=1 CC='armv7l-linux-musleabihf-gcc' GOOS='linux' GOARCH='arm' GOARM=7 go build -trimpath -o "$OUTDIR/$PROJECT.linux.armv7hf" -buildmode 'pie' -a -tags 'netgo' -ldflags '-s -w -extldflags "-static"'
upx -9 "$OUTDIR/$PROJECT.linux.armv7hf"
echo ""
echo "Building for linux arm64..."
CGO_ENABLED=1 CC='aarch64-linux-musl-gcc' GOOS='linux' GOARCH='arm64' go build -trimpath -o "$OUTDIR/$PROJECT.linux.arm64" -buildmode 'pie' -a -tags 'netgo' -ldflags '-s -w -extldflags "-static"'
upx -9 "$OUTDIR/$PROJECT.linux.arm64"
echo ""
echo "Building for linux mips..."
CGO_ENABLED=1 CC='mips-linux-musl-gcc' GOOS='linux' GOARCH='mips' go build -trimpath -o "$OUTDIR/$PROJECT.linux.mips" -buildmode 'default' -a -tags 'netgo' -ldflags '-s -w -extldflags "-static"'
upx -9 "$OUTDIR/$PROJECT.linux.mips"
echo ""
echo "Building for linux mipshf..."
CGO_ENABLED=1 CC='mips-linux-muslhf-gcc' GOOS='linux' GOARCH='mips' go build -trimpath -o "$OUTDIR/$PROJECT.linux.mipshf" -buildmode 'default' -a -tags 'netgo' -ldflags '-s -w -extldflags "-static"'
upx -9 "$OUTDIR/$PROJECT.linux.mipshf"
echo ""
echo "Building for linux mipsle..."
CGO_ENABLED=1 CC='mipsel-linux-musl-gcc' GOOS='linux' GOARCH='mipsle' go build -trimpath -o "$OUTDIR/$PROJECT.linux.mipsle" -buildmode 'default' -a -tags 'netgo' -ldflags '-s -w -extldflags "-static"'
upx -9 "$OUTDIR/$PROJECT.linux.mipsle"
echo ""
echo "Building for linux mipslehf..."
CGO_ENABLED=1 CC='mipsel-linux-muslhf-gcc' GOOS='linux' GOARCH='mipsle' go build -trimpath -o "$OUTDIR/$PROJECT.linux.mipslehf" -buildmode 'default' -a -tags 'netgo' -ldflags '-s -w -extldflags "-static"'
upx -9 "$OUTDIR/$PROJECT.linux.mipslehf"
echo ""
echo "Building for linux ppc64le..."
CGO_ENABLED=1 CC='powerpc64le-linux-musl-gcc' GOOS='linux' GOARCH='ppc64le' go build -trimpath -o "$OUTDIR/$PROJECT.linux.ppc64le" -buildmode 'pie' -a -tags 'netgo' -ldflags '-s -w -extldflags "-static"'
upx -9 "$OUTDIR/$PROJECT.linux.ppc64le"
echo ""
echo "PLEASE DON'T JUDGE THIS SCRIPT, IT IS TRULY SO AWFUL. TO BE IMPROVED..."