From cea537aef16f8a4ba101e3e3b27ac6989f2d2677 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Wed, 6 Mar 2019 12:28:39 -0800 Subject: [PATCH] produce deb and tars this should hopefully work on the mac, ill have to get someone to test it --- .gitignore | 1 + Dockerfile | 1 + Makefile | 7 ++++--- deb_from_installation.sh | 5 ++--- docker_build.sh | 2 +- tar_from_installation.sh | 22 ++++++++++++++++++++++ wask-sdk.cmake => wasi-sdk.cmake | 0 7 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 .gitignore create mode 100755 tar_from_installation.sh rename wask-sdk.cmake => wasi-sdk.cmake (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/Dockerfile b/Dockerfile index 861cbf6..e00da42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,4 +6,5 @@ RUN apt-get update \ clang \ cmake \ python \ + git \ && rm -rf /var/lib/apt/lists/* diff --git a/Makefile b/Makefile index 1c85b23..fe227f4 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ ROOT_DIR=${CURDIR} PREFIX?=/opt/wasi-sdk CLANG_VERSION=8.0.0 -VERSION=$(shell version.sh) +VERSION:=$(shell ./version.sh) DEBUG_PREFIX_MAP=-fdebug-prefix-map=$(ROOT_DIR)=wasisdk://v$(VERSION) default: build @@ -49,7 +49,7 @@ build/compiler-rt.BUILT: build/llvm.BUILT mkdir -p build/compiler-rt cd build/compiler-rt; cmake -G "Unix Makefiles" \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DCMAKE_TOOLCHAIN_FILE=$(ROOT_DIR)/wasmi-sdk.cmake \ + -DCMAKE_TOOLCHAIN_FILE=$(ROOT_DIR)/wasi-sdk.cmake \ -DCOMPILER_RT_BAREMETAL_BUILD=On \ -DCOMPILER_RT_BUILD_XRAY=OFF \ -DCOMPILER_RT_INCLUDE_TESTS=OFF \ @@ -126,7 +126,8 @@ strip: build/llvm.BUILT package: build/package.BUILT build/package.BUILT: build strip - ./deb_from_installation.sh + command -v dpkg-deb >/dev/null && ./deb_from_installation.sh || true + ./tar_from_installation.sh touch build/package.BUILT .PHONY: default clean build strip package diff --git a/deb_from_installation.sh b/deb_from_installation.sh index cee7181..a1c1b6b 100755 --- a/deb_from_installation.sh +++ b/deb_from_installation.sh @@ -1,5 +1,5 @@ #!/usr/bin/env sh - +set -ex if [ -n "$1" ]; then export VERSION="$1" else @@ -11,5 +11,4 @@ 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/ -dpkg-deb -b build/pkg build/wasi-sdk_$VERSION\_amd64.deb -rm -rf build/pkg +cd build && dpkg-deb -b pkg wasi-sdk_$VERSION\_amd64.deb diff --git a/docker_build.sh b/docker_build.sh index 01f592b..fa99692 100755 --- a/docker_build.sh +++ b/docker_build.sh @@ -1,4 +1,4 @@ #!/usr/bin/env sh set -e docker build -t wasi-sdk-builder:latest . -docker run --mount type=bind,src=$PWD,target=/wasi-sdk wasi-sdk-builder:latest -w /wasi-sdk make package +docker run --mount type=bind,src=$PWD,target=/workspace --workdir /workspace wasi-sdk-builder:latest make package diff --git a/tar_from_installation.sh b/tar_from_installation.sh new file mode 100755 index 0000000..839116a --- /dev/null +++ b/tar_from_installation.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +set -ex +if [ -n "$1" ]; then + export VERSION="$1" +else + export VERSION=`./version.sh` +fi + +PKGDIR=build/wasi-sdk-$VERSION + +case "$(uname -s)" in + Linux*) MACHINE=linux;; + Darwin*) MACHINE=macos;; + CYGWIN*) MACHINE=cygwin;; + MINGW*) MACHINE=mingw;; + *) MACHINE="UNKNOWN" +esac + +rm -rf $PKGDIR +mkdir -p $PKGDIR/opt +cp -R /opt/wasi-sdk $PKGDIR/opt/ +cd build && tar czf wasi-sdk-$VERSION\-$MACHINE.tar.gz wasi-sdk-$VERSION diff --git a/wask-sdk.cmake b/wasi-sdk.cmake similarity index 100% rename from wask-sdk.cmake rename to wasi-sdk.cmake