Skip to content

Commit 1d5bf61

Browse files
authored
Merge pull request #378 from target/binary-build-script
Add multi-platform Go build script for Strelka executables
2 parents 7176138 + 58d4163 commit 1d5bf61

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
# This script is used to build Go binaries for multiple platforms.
4+
# It should be run from the root of the Strelka directory.
5+
# The resulting executables will be output to the root of the Strelka directory.
6+
#
7+
# Each permutation of GOOS (operating system), GOARCH (architecture), and executable name
8+
# is built using the Go build command.
9+
#
10+
# Before running this script, ensure that you have Go installed and that you are
11+
# in the root of the Strelka directory.
12+
# You may have to run `chmod +x misc/build-binaries/build-all-binaries.sh` to make this script executable.
13+
14+
# Define arrays for goos, goarch, and executable
15+
goos=("linux" "windows" "darwin" "darwin")
16+
goarch=("amd64" "amd64" "amd64" "arm64")
17+
executables=("strelka-fileshot" "strelka-filestream" "strelka-oneshot")
18+
suffixes=("-linux" ".exe" "-mac64" "-macarm")
19+
20+
# Iterate over each permutation and build
21+
for i in ${!goos[@]}; do
22+
for executable in ${executables[@]}; do
23+
GOOS=${goos[$i]} GOARCH=${goarch[$i]} go build -ldflags="-s -w" -o ${executable}${suffixes[$i]} src/go/cmd/${executable}/main.go
24+
done
25+
done

0 commit comments

Comments
 (0)