Skip to content

Commit 0f15d63

Browse files
committed
Remove "bashisms"
1 parent 4d4a797 commit 0f15d63

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

build.sh

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
1-
#!/bin/bash
1+
#!/bin/sh
22
# Builds the binary for several platforms
3-
# TODO: More portable script that uses sh instead of bash
43
set -e
54

6-
platforms=(
7-
darwin-amd64
8-
linux-amd64
9-
linux-386
10-
windows-amd64
11-
windows-386
12-
openbsd-amd64
13-
openbsd-386
14-
freebsd-amd64
15-
freebsd-386
16-
netbsd-amd64
17-
netbsd-386
18-
)
19-
20-
for platform in "${platforms[@]}"; do
21-
goos=${platform%-*}
22-
goarch=${platform##*-}
5+
build() {
6+
platform=$1
7+
goos=$(echo $platform | cut -d- -f1)
8+
goarch=$(echo $platform | cut -d- -f2)
239
ext=""
2410
if [ "$goos" = "windows" ]; then
2511
ext=".exe"
2612
fi
27-
GOOS=${platform%-*} GOARCH=${platform##*-} go build -o "dist/git-lzc-$platform$ext" ./cmd/git-lzc
28-
done
29-
13+
GOOS=$goos GOARCH=$goarch go build -o "dist/git-lzc-$platform$ext" ./cmd/git-lzc
14+
}
3015

16+
build "darwin-amd64"
17+
build "linux-amd64"
18+
build "linux-386"
19+
build "windows-amd64"
20+
build "windows-386"
21+
build "openbsd-amd64"
22+
build "openbsd-386"
23+
build "freebsd-amd64"
24+
build "freebsd-386"
25+
build "netbsd-amd64"
26+
build "netbsd-386"

0 commit comments

Comments
 (0)