Skip to content

Commit

Permalink
fix deb build (#167)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Pat Hickey authored Dec 2, 2020
1 parent 6ad31ed commit b36c433
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
22 changes: 21 additions & 1 deletion deb_from_installation.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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/

0 comments on commit b36c433

Please sign in to comment.