Skip to content

Commit

Permalink
Merge pull request #109 from vmware-labs/wasi-sdk-20
Browse files Browse the repository at this point in the history
wasi-sdk version to 20
  • Loading branch information
assambar authored Jun 19, 2023
2 parents 300c157 + 80b950b commit b99289e
Show file tree
Hide file tree
Showing 21 changed files with 54 additions and 52 deletions.
9 changes: 6 additions & 3 deletions Dockerfile.wasi-builder
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
ARG WABT_VERSION=1.0.32
ARG WASI_SDK_VERSION=19.0
ARG WASI_SDK_RELEASE_NAME=wasi-sdk-19
# E.g. WASI_SDK_VERSION=20.0
ARG WASI_SDK_VERSION
# E.g. WASI_SDK_RELEASE_NAME=wasi-sdk-20
ARG WASI_SDK_RELEASE_NAME

# For beta releases with specific features this goes like:
# ARG WASI_SDK_VERSION=20.0.threads
# ARG WASI_SDK_RELEASE_NAME=wasi-sdk-20+threads
ARG WASI_VFS_VERSION=ddbea0e2a6a1e0e8fe0373ec3d1bdccf522178ab
ARG WASI_VFS_VERSION=v0.4.0

ARG WASI_SDK_PATH=/wasi-sdk
ARG WASI_SDK_ASSET_NAME=wasi-sdk-${WASI_SDK_VERSION}
Expand Down
27 changes: 17 additions & 10 deletions Makefile.builders
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,25 @@ wasm-base:
push-wasm-base:
@$(call push_container_image,$(WASM_BASE_NAME))

.PHONY: wasi-builder-19-0
WASI_BUILDER_19_NAME := ghcr.io/vmware-labs/wasmlabs/wasi-builder:19.0
wasi-builder-19-0:
@echo Building $(WASI_BUILDER_19_NAME) in $(BUILDER_ROOT_DIR) ... && \
.PHONY: wasi-builder
WASI_BUILDER_NAME := ghcr.io/vmware-labs/wasmlabs/wasi-builder:$(WASI_SDK_VERSION)
wasi-builder:
@echo Building $(WASI_BUILDER_NAME) in $(BUILDER_ROOT_DIR) ... && \
docker build \
--platform linux/amd64 \
--build-arg WASI_SDK_RELEASE_NAME=wasi-sdk-19 \
--build-arg WASI_SDK_VERSION=19.0 \
--build-arg WASI_SDK_RELEASE_NAME=wasi-sdk-$(word 1,$(subst ., ,$(WASI_SDK_VERSION))) \
--build-arg WASI_SDK_VERSION=$(WASI_SDK_VERSION) \
-f $(BUILDER_ROOT_DIR)/Dockerfile.wasi-builder \
-t $(WASI_BUILDER_19_NAME) \
-t $(WASI_BUILDER_NAME) \
$(BUILDER_ROOT_DIR)

.PHONY: push-wasi-builder-19-0
push-wasi-builder-19-0:
@$(call push_container_image,$(WASI_BUILDER_19_NAME))
.PHONY: update-wasi-builder
update-wasi-builder: wasi-builder
@$(call push_container_image,$(WASI_BUILDER_NAME))


.PHONY: update-all-builders
update-all-builders: update-wasi-builder
make -f php/Makefile update-php-builder
make -f python/Makefile update-python-builder
make -f ruby/Makefile update-ruby-builder
3 changes: 3 additions & 0 deletions Makefile.helpers
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Default wask-sdk version used in builds
WASI_SDK_VERSION ?= 20.0

define push_container_image
$(eval $@_IMAGE_NAME = $(1))
@(docker image inspect $($@_IMAGE_NAME) 1>/dev/null 2>&1 || \
Expand Down
15 changes: 15 additions & 0 deletions docs/developers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
This document is a work in progress.

# Processes

## Updating Wasi-Sdk version

You will need ghcr.io credentials with rights to publish to `ghcr.io/vmware-labs/wasmlabs`!

- Bump the `WASI_SDK_VERSION ?= ##.#` in [Makefile.helpers](../Makefile.helpers)
- Build and publish all builder images with a new tag based on `WASI_SDK_VERSION`
```
make -f Makefile.builders update-all-builders
```
- Release all independent libraries
- Bump URLs in the libraries/runtimes which depend on them, then publish them, too
2 changes: 0 additions & 2 deletions libs/bundle_wlr/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
WASI_SDK_VERSION ?= 19.0

ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
REPO_ROOT := $(ROOT_DIR)../..

Expand Down
2 changes: 0 additions & 2 deletions libs/bzip2/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
WASI_SDK_VERSION ?= 19.0

ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
REPO_ROOT := $(ROOT_DIR)../..

Expand Down
2 changes: 0 additions & 2 deletions libs/icu/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
WASI_SDK_VERSION ?= 19.0

ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
REPO_ROOT := $(ROOT_DIR)../..

Expand Down
2 changes: 0 additions & 2 deletions libs/libjpeg/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
WASI_SDK_VERSION ?= 19.0

ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
REPO_ROOT := $(ROOT_DIR)../..

Expand Down
2 changes: 0 additions & 2 deletions libs/libpng/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
WASI_SDK_VERSION ?= 19.0

ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
REPO_ROOT := $(ROOT_DIR)../..

Expand Down
3 changes: 0 additions & 3 deletions libs/libuuid/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
WASI_SDK_VERSION ?= 19.0
# NOTE - the default python build is failing with wasi-sdk-19

ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
REPO_ROOT := $(ROOT_DIR)../..

Expand Down
2 changes: 0 additions & 2 deletions libs/libxml2/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
WASI_SDK_VERSION ?= 19.0

ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
REPO_ROOT := $(ROOT_DIR)../..

Expand Down
2 changes: 0 additions & 2 deletions libs/oniguruma/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
WASI_SDK_VERSION ?= 19.0

ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
REPO_ROOT := $(ROOT_DIR)../..

Expand Down
2 changes: 0 additions & 2 deletions libs/sqlite/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
WASI_SDK_VERSION ?= 19.0

ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
REPO_ROOT := $(ROOT_DIR)../..

Expand Down
2 changes: 0 additions & 2 deletions libs/wasmedge_sock/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
WASI_SDK_VERSION ?= 19.0

ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
REPO_ROOT := $(ROOT_DIR)../..

Expand Down
2 changes: 0 additions & 2 deletions libs/zlib/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
WASI_SDK_VERSION ?= 19.0

ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
REPO_ROOT := $(ROOT_DIR)../..

Expand Down
6 changes: 2 additions & 4 deletions php/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
WASI_SDK_VERSION ?= 19.0

ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
REPO_ROOT := $(ROOT_DIR)..

Expand All @@ -10,8 +8,8 @@ PHP_BUILDER_NAME := ghcr.io/vmware-labs/wasmlabs/php-builder:wasi-$(WASI_SDK_VER
php-builder:
@$(call make_builder_image,$(PHP_BUILDER_NAME),$(ROOT_DIR),$(WASI_SDK_VERSION))

.PHONY: push-php-builder
push-php-builder:
.PHONY: update-php-builder
update-php-builder: php-builder
@$(call push_container_image,$(PHP_BUILDER_NAME))

.PHONY: php-*
Expand Down
4 changes: 3 additions & 1 deletion php/php-8.1.11/wlr-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ export LDFLAGS_WASI="--sysroot=${WASI_SYSROOT} -lwasi-emulated-getpid -lwasi-emu
########## Setup the flags for php #############
export CFLAGS_PHP='-D_POSIX_SOURCE=1 -D_GNU_SOURCE=1 -DHAVE_FORK=0 -DWASM_WASI'

export LDFLAGS_WARNINGS='-Wno-unused-command-line-argument -Wno-implicit-function-declaration -Wno-incompatible-function-pointer-types'

# We need to add LDFLAGS ot CFLAGS because autoconf compiles(+links) to binary when checking stuff
export LDFLAGS="${LDFLAGS_WASI} ${LDFLAGS_DEPENDENCIES}"
export LDFLAGS="${LDFLAGS_WASI} ${LDFLAGS_DEPENDENCIES} ${LDFLAGS_WARNINGS}"
export CFLAGS="${CFLAGS_CONFIG} ${CFLAGS_WASI} ${CFLAGS_DEPENDENCIES} ${CFLAGS_PHP} ${LDFLAGS}"

cd "${WLR_SOURCE_PATH}"
Expand Down
4 changes: 3 additions & 1 deletion php/php-8.2.0-slim/wlr-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ export LDFLAGS_WASI="--sysroot=${WASI_SYSROOT} -lwasi-emulated-getpid -lwasi-emu
########## Setup the flags for php #############
export CFLAGS_PHP='-D_POSIX_SOURCE=1 -D_GNU_SOURCE=1 -DHAVE_FORK=0 -DWASM_WASI'

export LDFLAGS_WARNINGS='-Wno-unused-command-line-argument -Werror=implicit-function-declaration -Wno-incompatible-function-pointer-types'

# We need to add LDFLAGS ot CFLAGS because autoconf compiles(+links) to binary when checking stuff
export LDFLAGS="${LDFLAGS_WASI} ${LDFLAGS_DEPENDENCIES} ${LDFLAGS_SQLITE}"
export LDFLAGS="${LDFLAGS_WASI} ${LDFLAGS_DEPENDENCIES} ${LDFLAGS_SQLITE} ${LDFLAGS_WARNINGS}"
export CFLAGS="${CFLAGS_CONFIG} ${CFLAGS_WASI} ${CFLAGS_DEPENDENCIES} ${CFLAGS_PHP} ${LDFLAGS}"

logStatus "CFLAGS="${CFLAGS}
Expand Down
2 changes: 1 addition & 1 deletion php/php-8.2.0/wlr-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export LDFLAGS_WASI="--sysroot=${WASI_SYSROOT} -lwasi-emulated-getpid -lwasi-emu
########## Setup the flags for php #############
export CFLAGS_PHP='-D_POSIX_SOURCE=1 -D_GNU_SOURCE=1 -DHAVE_FORK=0 -DPNG_USER_CONFIG -DWASM_WASI'

export LDFLAGS_WARNINGS='-Wno-unused-command-line-argument -Werror=implicit-function-declaration'
export LDFLAGS_WARNINGS='-Wno-unused-command-line-argument -Werror=implicit-function-declaration -Wno-incompatible-function-pointer-types'

# We need to add LDFLAGS ot CFLAGS because autoconf compiles(+links) to binary when checking stuff
export LDFLAGS="${LDFLAGS_WASI} ${LDFLAGS_DEPENDENCIES} ${LDFLAGS_WARNINGS}"
Expand Down
7 changes: 2 additions & 5 deletions python/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
WASI_SDK_VERSION ?= 19.0
# NOTE - the default python build is failing with wasi-sdk-19

ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
REPO_ROOT := $(ROOT_DIR)..

Expand All @@ -11,8 +8,8 @@ PYTHON_BUILDER_NAME := ghcr.io/vmware-labs/wasmlabs/python-builder:wasi-$(WASI_S
python-builder:
@$(call make_builder_image,$(PYTHON_BUILDER_NAME),$(ROOT_DIR),$(WASI_SDK_VERSION))

.PHONY: push-python-builder
push-python-builder:
.PHONY: update-python-builder
update-python-builder: python-builder
@$(call push_container_image,$(PYTHON_BUILDER_NAME))

.PHONY: v*
Expand Down
6 changes: 2 additions & 4 deletions ruby/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
WASI_SDK_VERSION ?= 19.0

ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
REPO_ROOT := $(ROOT_DIR)..

Expand All @@ -10,8 +8,8 @@ RUBY_BUILDER_NAME := ghcr.io/vmware-labs/wasmlabs/ruby-builder:wasi-$(WASI_SDK_V
ruby-builder:
@$(call make_builder_image,$(RUBY_BUILDER_NAME),$(ROOT_DIR),$(WASI_SDK_VERSION))

.PHONY: push-ruby-builder
push-ruby-builder:
.PHONY: update-ruby-builder
update-ruby-builder: ruby-builder
@$(call push_container_image,$(RUBY_BUILDER_NAME))

.PHONY: v*
Expand Down

0 comments on commit b99289e

Please sign in to comment.