From b36c433738f0c29160a5ac1c1cee1b1b884bf4a0 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Wed, 2 Dec 2020 14:50:43 -0800 Subject: [PATCH] fix deb build (#167) * fix deb build: change makefile and deb_from_installation to invoke it with the new build directory (changed in #143). deb_from_installation will exit 0 if dpkg-deb missing so we dont try to run it as part of `make package` on non-deb systems, but other errors should cause the makefile to fail, which should catch regressions like this sooner in the future. * thank you fgsch for style fix --- Makefile | 2 +- deb_from_installation.sh | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index fcf8ab8..bde9936 100644 --- a/Makefile +++ b/Makefile @@ -216,7 +216,7 @@ package: build/package.BUILT build/package.BUILT: build strip mkdir -p dist - command -v dpkg-deb >/dev/null && ./deb_from_installation.sh $(shell pwd)/dist || true + ./deb_from_installation.sh $(shell pwd)/dist "$(VERSION)" "$(BUILD_PREFIX)" ./tar_from_installation.sh "$(shell pwd)/dist" "$(VERSION)" "$(BUILD_PREFIX)" touch build/package.BUILT diff --git a/deb_from_installation.sh b/deb_from_installation.sh index 5576eda..053de42 100755 --- a/deb_from_installation.sh +++ b/deb_from_installation.sh @@ -1,5 +1,14 @@ #!/usr/bin/env sh +set -x + +command -v dpkg-deb >/dev/null +if [ $? -ne 0 ]; then + echo "required tool dpkg-deb missing. exiting" + exit 0 +fi + set -ex + if [ -n "$1" ]; then OUTDIR=$1 else @@ -12,10 +21,21 @@ else VERSION=`./version.sh` fi +if [ -n "$3" ]; then + INSTALL_DIR="$3" +else + INSTALL_DIR=/opt/wasi-sdk +fi + +if [ ! -d $INSTALL_DIR ] ; then + echo "Directory $INSTALL_DIR doesn't exist. Nothing to copy from." + exit 1 +fi + rm -rf build/pkg mkdir -p build/pkg/opt mkdir -p build/pkg/DEBIAN sed -e s/VERSION/$VERSION/ wasi-sdk.control > build/pkg/DEBIAN/control -cp -R /opt/wasi-sdk build/pkg/opt/ +cp -R $INSTALL_DIR build/pkg/opt/ cd build && dpkg-deb -b pkg wasi-sdk_$VERSION\_amd64.deb && cd .. mv build/wasi-sdk_$VERSION\_amd64.deb $OUTDIR/