From 9ddaf7fa0c2eac67626b17414d88286595f8964f Mon Sep 17 00:00:00 2001 From: Fred Brennan Date: Sat, 21 Jan 2023 15:56:21 -0500 Subject: [PATCH 1/4] Add missing arches to cross-compilation --- arches.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++ release.sh | 6 ++---- test.sh | 9 ++------- 3 files changed, 50 insertions(+), 11 deletions(-) create mode 100755 arches.sh diff --git a/arches.sh b/arches.sh new file mode 100755 index 00000000..4feb6b35 --- /dev/null +++ b/arches.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Not intended to be run directly. +ARCHES_USE_LOGFILE=${ARCHES_USE_LOGFILE:=0} + +_launch_arches() { + coproc arches { + echo " Linux i386..." + GOOS=linux GOARCH=386 ./build.sh + echo " Linux amd64..." + GOOS=linux GOARCH=amd64 ./build.sh + echo " Linux arm..." + GOOS=linux GOARCH=arm64 ./build.sh + echo " Linux arm64..." + GOOS=linux GOARCH=arm64 ./build.sh + echo " macOS amd64..." + GOOS=darwin GOARCH=amd64 ./build.sh + echo " macOS arm64..." + GOOS=darwin GOARCH=arm64 ./build.sh + echo " Windows 386..." + GOOS=windows GOARCH=386 ./build.sh + echo " Windows amd64..." + GOOS=windows GOARCH=amd64 ./build.sh + } 2>&1 1>&3 +} + +_wait_arches() { + wait $arches_PID + exec 3>&- +} + +arches() { + [ $ARCHES_USE_LOGFILE -eq 1 ] && exec 3<>arches.log || exec 3>&1 + tail -f /dev/fd/3 & + local tail_PID=$! + _launch_arches + _wait_arches + kill $tail_PID + exec ${arches[1]}>&- + [ $ARCHES_USE_LOGFILE -eq 1 ] && rm arches.log || : + unset _launch_arches _wait_arches arches ARCHES_USE_LOGFILE +} + +if [[ "$0" == "$BASH_SOURCE" ]]; then + 2>&1 echo Note: Not intended for direct use. + arches +fi diff --git a/release.sh b/release.sh index b05ba8f3..b48d3fae 100755 --- a/release.sh +++ b/release.sh @@ -46,10 +46,8 @@ git tag --annotate "${VERSION}" # NOTE: To get the version number right, these builds must be done after the # above tagging. # -# NOTE: Make sure this list matches the one in test.sh -GOOS=linux GOARCH=386 ./build.sh -GOOS=darwin GOARCH=amd64 ./build.sh -GOOS=windows GOARCH=amd64 ./build.sh +source arches.sh +arches # Push the newly built release tag git push --tags diff --git a/test.sh b/test.sh index 75293922..ab986d3f 100755 --- a/test.sh +++ b/test.sh @@ -22,14 +22,9 @@ echo "Running unit tests..." go test -timeout 20s ./... # Ensure we can cross compile -# NOTE: Make sure this list matches the one in release.sh echo "Testing cross compilation..." -echo " Linux i386..." -GOOS=linux GOARCH=386 ./build.sh -echo " macOS amd64..." -GOOS=darwin GOARCH=amd64 ./build.sh -echo " Windows amd64..." -GOOS=windows GOARCH=amd64 ./build.sh +source arches.sh +arches # Verify sending the output to a file RESULT="$(mktemp)" From 14d4b4dfcfd1c70b5efa706d0c08eb8fd8fd3bee Mon Sep 17 00:00:00 2001 From: Fred Brennan Date: Sat, 21 Jan 2023 17:03:09 -0500 Subject: [PATCH 2/4] fuck it this is too complicated lol just do it normal --- arches.sh | 60 +++++++++++++++--------------------------------------- release.sh | 1 - test.sh | 1 - 3 files changed, 16 insertions(+), 46 deletions(-) diff --git a/arches.sh b/arches.sh index 4feb6b35..c61f2890 100755 --- a/arches.sh +++ b/arches.sh @@ -1,46 +1,18 @@ #!/bin/bash # Not intended to be run directly. -ARCHES_USE_LOGFILE=${ARCHES_USE_LOGFILE:=0} - -_launch_arches() { - coproc arches { - echo " Linux i386..." - GOOS=linux GOARCH=386 ./build.sh - echo " Linux amd64..." - GOOS=linux GOARCH=amd64 ./build.sh - echo " Linux arm..." - GOOS=linux GOARCH=arm64 ./build.sh - echo " Linux arm64..." - GOOS=linux GOARCH=arm64 ./build.sh - echo " macOS amd64..." - GOOS=darwin GOARCH=amd64 ./build.sh - echo " macOS arm64..." - GOOS=darwin GOARCH=arm64 ./build.sh - echo " Windows 386..." - GOOS=windows GOARCH=386 ./build.sh - echo " Windows amd64..." - GOOS=windows GOARCH=amd64 ./build.sh - } 2>&1 1>&3 -} - -_wait_arches() { - wait $arches_PID - exec 3>&- -} - -arches() { - [ $ARCHES_USE_LOGFILE -eq 1 ] && exec 3<>arches.log || exec 3>&1 - tail -f /dev/fd/3 & - local tail_PID=$! - _launch_arches - _wait_arches - kill $tail_PID - exec ${arches[1]}>&- - [ $ARCHES_USE_LOGFILE -eq 1 ] && rm arches.log || : - unset _launch_arches _wait_arches arches ARCHES_USE_LOGFILE -} - -if [[ "$0" == "$BASH_SOURCE" ]]; then - 2>&1 echo Note: Not intended for direct use. - arches -fi +echo " Linux i386..." +GOOS=linux GOARCH=386 ./build.sh +echo " Linux amd64..." +GOOS=linux GOARCH=amd64 ./build.sh +echo " Linux arm..." +GOOS=linux GOARCH=arm64 ./build.sh +echo " Linux arm64..." +GOOS=linux GOARCH=arm64 ./build.sh +echo " macOS amd64..." +GOOS=darwin GOARCH=amd64 ./build.sh +echo " macOS arm64..." +GOOS=darwin GOARCH=arm64 ./build.sh +echo " Windows 386..." +GOOS=windows GOARCH=386 ./build.sh +echo " Windows amd64..." +GOOS=windows GOARCH=amd64 ./build.sh diff --git a/release.sh b/release.sh index b48d3fae..f086112f 100755 --- a/release.sh +++ b/release.sh @@ -47,7 +47,6 @@ git tag --annotate "${VERSION}" # above tagging. # source arches.sh -arches # Push the newly built release tag git push --tags diff --git a/test.sh b/test.sh index ab986d3f..02a30bfb 100755 --- a/test.sh +++ b/test.sh @@ -24,7 +24,6 @@ go test -timeout 20s ./... # Ensure we can cross compile echo "Testing cross compilation..." source arches.sh -arches # Verify sending the output to a file RESULT="$(mktemp)" From 393059d2ce0a7daad2626bfb71b332786f69e2b5 Mon Sep 17 00:00:00 2001 From: Fred Brennan Date: Tue, 24 Jan 2023 02:12:03 -0500 Subject: [PATCH 3/4] Drop macOS per maintainer comment Signed-off-by: Fred Brennan --- arches.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arches.sh b/arches.sh index c61f2890..442a142c 100755 --- a/arches.sh +++ b/arches.sh @@ -8,10 +8,6 @@ echo " Linux arm..." GOOS=linux GOARCH=arm64 ./build.sh echo " Linux arm64..." GOOS=linux GOARCH=arm64 ./build.sh -echo " macOS amd64..." -GOOS=darwin GOARCH=amd64 ./build.sh -echo " macOS arm64..." -GOOS=darwin GOARCH=arm64 ./build.sh echo " Windows 386..." GOOS=windows GOARCH=386 ./build.sh echo " Windows amd64..." From 95fff3552be894a39c1c287f33ea6b42c4d1c1d0 Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Tue, 24 Jan 2023 02:13:13 -0500 Subject: [PATCH 4/4] Remove shebang line from arches.sh Co-authored-by: Johan Walles --- arches.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/arches.sh b/arches.sh index 442a142c..29ed6f8a 100755 --- a/arches.sh +++ b/arches.sh @@ -1,4 +1,3 @@ -#!/bin/bash # Not intended to be run directly. echo " Linux i386..." GOOS=linux GOARCH=386 ./build.sh