-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from ereslibre/skip-wasm-opt
Skip wasm-opt in PHP builds
- Loading branch information
Showing
10 changed files
with
108 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
FROM ubuntu:20.04 | ||
ARG BINARYEN_VERSION=111 | ||
ARG BINARYEN_VERSION | ||
ENV BINARYEN_PATH=/opt | ||
RUN apt update && \ | ||
DEBIAN_FRONTEND=noninteractive apt install -y \ | ||
wget && \ | ||
wget https://github.com/WebAssembly/binaryen/releases/download/version_${BINARYEN_VERSION}/binaryen-version_${BINARYEN_VERSION}-x86_64-linux.tar.gz && \ | ||
tar -xf binaryen-version_${BINARYEN_VERSION}-x86_64-linux.tar.gz --strip-components=1 -C /opt && \ | ||
rm binaryen-version_${BINARYEN_VERSION}-x86_64-linux.tar.gz | ||
ENV PATH="$PATH:/opt/bin" | ||
rm binaryen-version_${BINARYEN_VERSION}-x86_64-linux.tar.gz && \ | ||
mkdir -p /opt/priority-bin | ||
# wasm-opt is called in unexpected contexts | ||
# (https://github.com/llvm/llvm-project/issues/55781). To avoid this, | ||
# we install a `wasm-opt` wrapper with a higher priority in the PATH | ||
# that can disable wasm-opt execution when desired. | ||
ADD images/wasm-base/wasm-opt /opt/priority-bin/ | ||
ENV PATH="/opt/priority-bin:$PATH:/opt/bin" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
BUILDER_ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST)))) | ||
|
||
WASM_BASE_TAG ?= $(shell git rev-parse --short HEAD) | ||
|
||
.PHONY: wasm-base | ||
wasm-base: | ||
docker build --build-arg BINARYEN_VERSION=111 -f ${BUILDER_ROOT_DIR}/Dockerfile.wasm-base -t ghcr.io/vmware-labs/wasm-base:20220116 ${BUILDER_ROOT_DIR} | ||
docker build --build-arg BINARYEN_VERSION=111 -f ${BUILDER_ROOT_DIR}/Dockerfile.wasm-base -t ghcr.io/vmware-labs/wasm-base:$(WASM_BASE_TAG) ${BUILDER_ROOT_DIR} | ||
|
||
.PHONY: wasi-builder-19 | ||
wasi-builder-19: wasm-base | ||
docker build --build-arg WASI_SDK_VERSION=19 -f ${BUILDER_ROOT_DIR}/Dockerfile.wasi-builder -t ghcr.io/vmware-labs/wasi-builder:19 ${BUILDER_ROOT_DIR} | ||
docker build --build-arg WASM_BASE=$(WASM_BASE_TAG) --build-arg WASI_SDK_VERSION=19 -f ${BUILDER_ROOT_DIR}/Dockerfile.wasi-builder -t ghcr.io/vmware-labs/wasi-builder:19 ${BUILDER_ROOT_DIR} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!//usr/bin/env bash | ||
# Inspired by | ||
# https://raw.githubusercontent.com/ruby/ruby/df6b72b8ff7af16a56fa48f3b4abb1d8850f4d1c/wasm/wasm-opt | ||
# | ||
# A fake wasm-opt, which does nothing at all | ||
# See also: tool/wasm-clangw | ||
|
||
function logStatus { | ||
if [[ -n "${WASMLABS_OUTPUT}" ]]; then | ||
echo "$(date --iso-8601=ns) | $@" >> $WASMLABS_OUTPUT/wasmlabs-progress.log | ||
else | ||
echo "$(date --iso-8601=ns) | $@" | ||
fi | ||
} | ||
|
||
if [[ -z "${WASMLABS_SKIP_WASM_OPT}" ]]; then | ||
logStatus "wasm-opt (with args \"$@\") was intercepted; executing $BINARYEN_PATH/bin/wasm-opt" | ||
exec $BINARYEN_PATH/bin/wasm-opt "$@" | ||
fi | ||
|
||
logStatus "wasm-opt (with args \"$@\") was intercepted; this invocation will be a no-op" | ||
|
||
set -e | ||
input= | ||
output= | ||
while [ $# -ne 0 ]; do | ||
case "$1" in | ||
-o) | ||
shift | ||
output=$1 | ||
;; | ||
-*) | ||
# ignore other options | ||
;; | ||
*) | ||
input=$1 | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
if [ -z "$input" ]; then | ||
echo "missing input binary" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$output" ]; then | ||
echo "missing output binary" | ||
exit 1 | ||
fi | ||
|
||
if [ "$input" != "$output" ]; then | ||
cp "$input" "$output" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters