Skip to content

Commit 5ed7dd5

Browse files
committed
Docker: added wasm variant.
1 parent 7874798 commit 5ed7dd5

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

pkg/docker/Makefile

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ DEFAULT_VERSION := $(NXT_VERSION)
88
VERSION ?= $(DEFAULT_VERSION)
99
PATCHLEVEL ?= 1
1010

11-
MODULES ?= go jsc node perl php python ruby
11+
MODULES ?= go jsc node perl php python ruby wasm
1212

1313
VARIANT ?= bullseye
1414

@@ -75,10 +75,39 @@ INSTALL_ruby ?= ruby-install
7575
RUN_ruby ?= gem install rack
7676
MODULE_PREBUILD_ruby ?= /bin/true
7777

78+
VERSIONS_wasm ?=
79+
CONTAINER_wasm ?= debian:$(VARIANT)-slim
80+
CONFIGURE_wasm ?= wasm --include-path=\`pwd\`/pkg/contrib/wasmtime/crates/c-api/include --lib-path=/usr/lib/\$$(dpkg-architecture -q DEB_HOST_MULTIARCH)/
81+
INSTALL_wasm ?= wasm-install
82+
RUN_wasm ?= /bin/true
83+
define MODULE_PREBUILD_wasm
84+
export RUST_VERSION=1.71.0 \\\n \
85+
\ \ \ \&\& export RUSTUP_HOME=/usr/src/unit/rustup \\\n \
86+
\ \ \ \&\& export CARGO_HOME=/usr/src/unit/cargo \\\n \
87+
\ \ \ \&\& export PATH=/usr/src/unit/cargo/bin:\$$PATH \\\n \
88+
\ \ \ \&\& dpkgArch="\$$\(dpkg --print-architecture\)" \\\n \
89+
\ \ \ \&\& case "\$${dpkgArch##*-}" in \\\n \
90+
\ \ \ \ \ \ amd64\) rustArch="x86_64-unknown-linux-gnu"; rustupSha256="0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db" ;; \\\n \
91+
\ \ \ \ \ \ arm64\) rustArch="aarch64-unknown-linux-gnu"; rustupSha256="673e336c81c65e6b16dcdede33f4cc9ed0f08bde1dbe7a935f113605292dc800" ;; \\\n \
92+
\ \ \ \ \ \ *\) echo \>\&2 "unsupported architecture: \$${dpkgArch}"; exit 1 ;; \\\n \
93+
\ \ \ \esac \\\n \
94+
\ \ \ \&\& url="https://static.rust-lang.org/rustup/archive/1.26.0/\$${rustArch}/rustup-init" \\\n \
95+
\ \ \ \&\& curl -L -O "\$$url" \\\n \
96+
\ \ \ \&\& echo "\$${rustupSha256} *rustup-init" | sha256sum -c - \\\n \
97+
\ \ \ \&\& chmod +x rustup-init \\\n \
98+
\ \ \ \&\& ./rustup-init -y --no-modify-path --profile minimal --default-toolchain \$$RUST_VERSION --default-host \$${rustArch} \\\n \
99+
\ \ \ \&\& rm rustup-init \\\n \
100+
\ \ \ \&\& rustup --version \\\n \
101+
\ \ \ \&\& cargo --version \\\n \
102+
\ \ \ \&\& rustc --version \\\n \
103+
\ \ \ \&\& make -C pkg/contrib .wasmtime \\\n \
104+
\ \ \ \&\& install -pm 755 pkg/contrib/wasmtime/target/release/libwasmtime.so /usr/lib/\$$\(dpkg-architecture -q DEB_HOST_MULTIARCH\)/
105+
endef
106+
78107
default:
79108
@echo "valid targets: all build dockerfiles library clean"
80109
81-
MODVERSIONS = $(foreach module, $(MODULES), $(foreach modversion, $(shell for v in $(VERSIONS_$(module)); do echo $$v; done | sort -r), $(module)$(modversion))) minimal
110+
MODVERSIONS = $(foreach module, $(MODULES), $(foreach modversion, $(shell for v in $(VERSIONS_$(module)); do echo $$v; done | sort -r), $(module)$(modversion))) wasm minimal
82111
83112
modname = $(shell echo $1 | /usr/bin/tr -d '.01234567890-')
84113

0 commit comments

Comments
 (0)