-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #378 from target/binary-build-script
Add multi-platform Go build script for Strelka executables
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
# This script is used to build Go binaries for multiple platforms. | ||
# It should be run from the root of the Strelka directory. | ||
# The resulting executables will be output to the root of the Strelka directory. | ||
# | ||
# Each permutation of GOOS (operating system), GOARCH (architecture), and executable name | ||
# is built using the Go build command. | ||
# | ||
# Before running this script, ensure that you have Go installed and that you are | ||
# in the root of the Strelka directory. | ||
# You may have to run `chmod +x misc/build-binaries/build-all-binaries.sh` to make this script executable. | ||
|
||
# Define arrays for goos, goarch, and executable | ||
goos=("linux" "windows" "darwin" "darwin") | ||
goarch=("amd64" "amd64" "amd64" "arm64") | ||
executables=("strelka-fileshot" "strelka-filestream" "strelka-oneshot") | ||
suffixes=("-linux" ".exe" "-mac64" "-macarm") | ||
|
||
# Iterate over each permutation and build | ||
for i in ${!goos[@]}; do | ||
for executable in ${executables[@]}; do | ||
GOOS=${goos[$i]} GOARCH=${goarch[$i]} go build -ldflags="-s -w" -o ${executable}${suffixes[$i]} src/go/cmd/${executable}/main.go | ||
done | ||
done |