From 8a9097e0f52d14726690ee2b8926a49e0daf22af Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Mon, 12 Jun 2023 13:41:40 -0400 Subject: [PATCH] Run cross-compilation in parallel --- scripts/package.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/package.sh b/scripts/package.sh index c0eac0f5..1b872366 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -124,14 +124,15 @@ archs=( ["mipsle"]="mipsel-linux-gnu-gcc" ["mips64"]="mips64-linux-gnuabi64-gcc" ["mips64le"]="mips64el-linux-gnuabi64-gcc" - ["mipsle"]="mipsel-linux-gnu-gcc" ["ppc64le"]="powerpc64le-linux-gnu-gcc" ) for arch in "${!archs[@]}"; do +( compiler=${archs[$arch]} cd $tmp_build/src/github.com/rqlite/rqlite + echo "Building for $arch using $compiler..." CGO_ENABLED=1 GOARCH=$arch CC=$compiler go install -a -tags sqlite_omit_load_extension -ldflags="$LDFLAGS" ./... if [ "$compiler" == "musl-gcc" ]; then @@ -144,16 +145,25 @@ for arch in "${!archs[@]}"; do tmp_pkg=`mktemp -d` mkdir -p $tmp_pkg/$release - ls $GOPATH/bin if [ "$arch" == "amd64" ]; then copy_binaries $tmp_pkg/$release $GOPATH/bin else copy_binaries $tmp_pkg/$release $GOPATH/bin/linux_$arch fi - ( cd $tmp_pkg; tar cvfz $tarball $release ) + ( + cd $tmp_pkg + tar cfz $tarball $release + if [ $? -ne 0 ]; then + echo "Failed to create $tarball" + exit 1 + fi + ) if [ -n "$API_TOKEN" ]; then upload_asset $tmp_pkg/$tarball $RELEASE_ID $API_TOKEN fi +) & done + +wait