From a1be37b108c24e2479c4a9f3e7b4de051b130d61 Mon Sep 17 00:00:00 2001 From: Vladimir Vukicevic Date: Sun, 19 Apr 2020 15:30:11 -0700 Subject: [PATCH] Review fixups --- Makefile | 18 +++++++++++------- tar_from_installation.sh | 18 +++++++++++++----- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 6f30824..1047567 100644 --- a/Makefile +++ b/Makefile @@ -12,19 +12,23 @@ PREFIX?=c:/wasi-sdk # who knows what BASH?=bash -c -ifneq (x$(MSYSTEM),x) +ifeq (x$(MSYSTEM),x) +$(error On Windows, this Makefile only works in MSYS2 environments such as git-bash.) +endif + # msys needs any /-prefixed arguments, or =/ containing, to turn into // # because it tries to path-expand the / into the msys root. // escapes this. -SLASHY_SLASH=/ -# assuming we're running under msys2 (git-bash), PATH needs /c/foo format directories +ESCAPE_SLASH=/ + +# assuming we're running under msys2 (git-bash), PATH needs /c/foo format directories (because +# it itself is :-delimited) PATH_PREFIX=$(shell cygpath.exe -u $(PREFIX)) -endif endif PREFIX?=/opt/wasi-sdk PATH_PREFIX?=$(PREFIX) -SLASHY_SLASH?= +ESCAPE_SLASH?= BASH?= CLANG_VERSION=$(shell $(BASH) ./llvm_version.sh $(LLVM_PROJ_DIR)) @@ -131,7 +135,7 @@ build/libcxx.BUILT: build/llvm.BUILT build/compiler-rt.BUILT build/wasi-libc.BUI cd build/libcxx && cmake -G Ninja $(LIBCXX_CMAKE_FLAGS) \ -DCMAKE_C_FLAGS="$(DEBUG_PREFIX_MAP)" \ -DCMAKE_CXX_FLAGS="$(DEBUG_PREFIX_MAP)" \ - -DLIBCXX_LIBDIR_SUFFIX=$(SLASHY_SLASH)/wasm32-wasi \ + -DLIBCXX_LIBDIR_SUFFIX=$(ESCAPE_SLASH)/wasm32-wasi \ $(LLVM_PROJ_DIR)/libcxx ninja $(NINJA_FLAGS) -v -C build/libcxx # Do the install. @@ -169,7 +173,7 @@ build/libcxxabi.BUILT: build/libcxx.BUILT build/llvm.BUILT cd build/libcxxabi && cmake -G Ninja $(LIBCXXABI_CMAKE_FLAGS) \ -DCMAKE_C_FLAGS="$(DEBUG_PREFIX_MAP)" \ -DCMAKE_CXX_FLAGS="$(DEBUG_PREFIX_MAP)" \ - -DLIBCXXABI_LIBDIR_SUFFIX=$(SLASHY_SLASH)/wasm32-wasi \ + -DLIBCXXABI_LIBDIR_SUFFIX=$(ESCAPE_SLASH)/wasm32-wasi \ $(LLVM_PROJ_DIR)/libcxxabi ninja $(NINJA_FLAGS) -v -C build/libcxxabi # Do the install. diff --git a/tar_from_installation.sh b/tar_from_installation.sh index e5f2e1b..e6cc0d0 100755 --- a/tar_from_installation.sh +++ b/tar_from_installation.sh @@ -1,19 +1,22 @@ #!/usr/bin/env bash set -ex -OUTDIR=$PWD/dist -VERSION=`./version.sh` -INDIR=/opt/wasi-sdk if [ -n "$1" ]; then OUTDIR=$1 +else + OUTDIR=$PWD/dist fi if [ -n "$2" ]; then VERSION="$2" +else + VERSION=`./version.sh` fi if [ -n "$3" ]; then - INDIR="$3" + INSTALL_DIR="$3" +else + INSTALL_DIR=/opt/wasi-sdk fi PKGDIR=build/wasi-sdk-$VERSION @@ -26,8 +29,13 @@ case "$(uname -s)" in *) MACHINE="UNKNOWN" esac +if [ ! -d $INSTALL_DIR ] ; then + echo "Directory $INSTALL_DIR doesn't exist. Nothing to copy from." + exit 1 +fi + rm -rf $PKGDIR -cp -R $INDIR $PKGDIR +cp -R $INSTALL_DIR $PKGDIR cd build tar czf $OUTDIR/wasi-sdk-$VERSION\-$MACHINE.tar.gz wasi-sdk-$VERSION