more builds
This commit is contained in:
parent
594a6c271b
commit
d71714ff11
15
build.sh
15
build.sh
|
@ -35,13 +35,26 @@ build_binary() {
|
|||
|
||||
output_name="dist/${output_name}"
|
||||
|
||||
echo "Building for ${os}/${arch} -> ${output_name}"
|
||||
# Dynamic Linking
|
||||
echo "Building dynamically linked for ${os}/${arch} -> ${output_name}"
|
||||
GOOS=${os} GOARCH=${arch} go build -o ${output_name} main.go 2>build_logs/${os}_${arch}_build.log
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Successfully built ${output_name}"
|
||||
else
|
||||
echo "Failed to build ${output_name}. Check build_logs/${os}_${arch}_build.log for errors."
|
||||
fi
|
||||
|
||||
# Static Linking
|
||||
if [[ "$os" == "linux" ]]; then # Typically, static linking is most relevant for Linux environments
|
||||
static_output_name="${output_name}_static"
|
||||
echo "Building statically linked for ${os}/${arch} -> ${static_output_name}"
|
||||
CGO_ENABLED=0 GOOS=${os} GOARCH=${arch} go build -a -ldflags '-extldflags "-static"' -o ${static_output_name} main.go 2>build_logs/${os}_${arch}_static_build.log
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Successfully built ${static_output_name}"
|
||||
else
|
||||
echo "Failed to build ${static_output_name}. Check build_logs/${os}_${arch}_static_build.log for errors."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Main Build Process
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue