From 2a3fadc96f3280f29e9708271fc44dd8239a607c Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Wed, 6 Mar 2019 11:44:11 -0800 Subject: [PATCH] build system fixups --- Dockerfile | 9 +++++++++ Makefile | 10 +++++----- deb_from_installation.sh | 15 +++++++++++++++ docker_build.sh | 4 ++++ package.sh | 15 --------------- src/llvm-project | 2 +- version.sh | 2 +- 7 files changed, 35 insertions(+), 22 deletions(-) create mode 100644 Dockerfile create mode 100755 deb_from_installation.sh create mode 100755 docker_build.sh delete mode 100755 package.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..861cbf6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM ubuntu:xenial as build-env + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + build-essential \ + clang \ + cmake \ + python \ + && rm -rf /var/lib/apt/lists/* diff --git a/Makefile b/Makefile index f69aa31..1c85b23 100644 --- a/Makefile +++ b/Makefile @@ -5,11 +5,11 @@ ROOT_DIR=${CURDIR} PREFIX?=/opt/wasi-sdk CLANG_VERSION=8.0.0 -VERSION=0.2 -DEBUG_PREFIX_MAP=-fdebug-prefix-map=$(ROOT_DIR)=wasmception://v$(VERSION) +VERSION=$(shell version.sh) +DEBUG_PREFIX_MAP=-fdebug-prefix-map=$(ROOT_DIR)=wasisdk://v$(VERSION) default: build - echo "Use -fdebug-prefix-map=$(ROOT_DIR)=wasmception://v$(VERSION)" + echo "Use -fdebug-prefix-map=$(ROOT_DIR)=wasisdk://v$(VERSION)" clean: rm -rf build $(PREFIX) @@ -125,8 +125,8 @@ strip: build/llvm.BUILT package: build/package.BUILT -build/package.BUILT: build - ./package.sh +build/package.BUILT: build strip + ./deb_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 new file mode 100755 index 0000000..cee7181 --- /dev/null +++ b/deb_from_installation.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env sh + +if [ -n "$1" ]; then + export VERSION="$1" +else + export VERSION=`./version.sh` +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/ +dpkg-deb -b build/pkg build/wasi-sdk_$VERSION\_amd64.deb +rm -rf build/pkg diff --git a/docker_build.sh b/docker_build.sh new file mode 100755 index 0000000..01f592b --- /dev/null +++ b/docker_build.sh @@ -0,0 +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 diff --git a/package.sh b/package.sh deleted file mode 100755 index a94c51b..0000000 --- a/package.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env sh - -if [ -n "$1" ]; then - export VERSION="$1" -else - export VERSION=`./version.sh` -fi - -rm -rf pkg -mkdir -p pkg/opt -mkdir pkg/DEBIAN -sed -e s/VERSION/$VERSION/ wasi-sdk.control > pkg/DEBIAN/control -cp -R /opt/wasi-sdk pkg/opt/ -dpkg-deb -b pkg wasi-sdk_$VERSION\_amd64.deb -rm -rf pkg diff --git a/src/llvm-project b/src/llvm-project index 8f7cfec..d39b590 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 8f7cfecfbfe73198f5419f13f0150d7102df97ef +Subproject commit d39b590a4123aadff60a1b5c808fae6ab7cea362 diff --git a/version.sh b/version.sh index 85825fc..8e7c44c 100755 --- a/version.sh +++ b/version.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash set -e GIT_DESCR=$(git describe --long --candidates=999 --match='wasi-sdk-*' --dirty='+m' --abbrev=12) -GIT_PACKAGE_VERSION=$(echo $GIT_DESCR | perl -ne 'if(/^wasi-sdk-(\d+)-(\d+)-g([0-9a-f]{7,12})([+]m)?$/) { print "$1.$2g$3$4"; exit } else { print "could not parse git description"; exit 1 }';) +GIT_PACKAGE_VERSION=$(echo $GIT_DESCR | perl -ne 'if(/^wasi-sdk-(\d+)-(\d+)-g([0-9a-f]{7,12})([+]m)?$/) { if($2 == 0) { print "$1.$2$4" } else { print "$1.$2g$3$4" } exit } else { print "could not parse git description"; exit 1 }';) echo $GIT_PACKAGE_VERSION