diff --git a/multibuild.sh b/multibuild.sh index 8785c96..92ab732 100755 --- a/multibuild.sh +++ b/multibuild.sh @@ -8,29 +8,27 @@ # $ ./multibuild.sh -as "$(git describe | tr v -)" set -e -arch="" +arch= dryrun= -flavors="" suffix="$(git describe --exact-match 2>/dev/null | tr v - || true)" usage() { cat </dev/null || true } -trap cleanup INT TERM +trap cleanup EXIT -$dryrun git stash -for build in $builds; do - $dryrun git checkout . - ( - IFS=- - set $build; shift - for flavor in "$@"; do - if [ -e src/variant-$flavor.patch ]; then - $dryrun patch -p1 -i src/variant-$flavor.patch - fi - done - ) - $dryrun docker build -t $target . - if [ -n "$dryrun" ]; then - $dryrun docker run --rm $target ">$build$suffix.7z.exe" +for variant in $arch; do + if [ -e "src/variant-$variant.patch" ]; then + tmp=$(mktemp -d) + $dryrun cp Dockerfile "$tmp/" + $dryrun patch "$tmp/Dockerfile" "src/variant-$variant.patch" + $dryrun docker build -f "$tmp/Dockerfile" -t $target . + rm -rf -- "$tmp" else - docker run --rm $target >$build$suffix.7z.exe + $dryrun docker build -t $target . + fi + out="w64devkit-$variant$suffix.7z.exe" + if [ -n "$dryrun" ]; then + $dryrun docker run --rm $target ">$out" + else + docker run --rm $target >"$out" fi done - -cleanup