File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3+ # Define target OS/arch combinations to build
4+ BUILD_TARGETS=(
5+ " linux/amd64"
6+ " linux/arm"
7+ " linux/arm64"
8+ " linux/riscv64"
9+ " windows/amd64"
10+ " windows/arm64"
11+ " darwin/amd64"
12+ " darwin/arm64"
13+ )
14+
15+ # Define targets that should be compressed with UPX
16+ COMPRESS_TARGETS=(
17+ " linux/amd64"
18+ " linux/arm"
19+ " linux/arm64"
20+ " windows/amd64"
21+ )
22+
323go-build (){
424 CGO_ENABLED=0 \
525 GOOS=$GOOS \
626 GOARCH=$GOARCH \
727 go build \
828 -o _dist/drycc-$1 -$GOOS -$GOARCH \
929 drycc.go
10- if [[ " $GOOS " != " darwin" ]]; then
30+ # Check if current target is in COMPRESS_TARGETS list
31+ target=" $GOOS /$GOARCH "
32+ if [[ ${COMPRESS_TARGETS[@]/ $target / } != ${COMPRESS_TARGETS[@]} ]]; then
1133 upx --lzma --best _dist/drycc-$1 -$GOOS -$GOARCH
1234 fi
1335}
1436
15- GOOS_LIST=(" linux" " windows" " darwin" )
16- GOARCH_LIST=(" 386" " amd64" " arm" " arm64" )
17- EXCLUDE_TARGET=(" darwin/386" , " darwin/arm" " windows/arm64" )
18-
19- for GOOS in ${GOOS_LIST[@]} ; do
20- for GOARCH in ${GOARCH_LIST[@]} ; do
21- target=" $GOOS /$GOARCH "
22- if [[ ${EXCLUDE_TARGET[@]/ $target / } == ${EXCLUDE_TARGET[@]} ]]; then
23- go-build " $1 "
24- fi
25- done
37+ # Process each target
38+ for target in " ${BUILD_TARGETS[@]} " ; do
39+ # Split target into OS and architecture
40+ GOOS=${target%/* }
41+ GOARCH=${target#*/ }
42+ go-build " $1 "
2643done
You can’t perform that action at this time.
0 commit comments