wasm: Add warpy wasm_MODE.
authorJoel Martin <github@martintribe.org>
Wed, 16 Jan 2019 07:12:00 +0000 (01:12 -0600)
committerJoel Martin <github@martintribe.org>
Wed, 16 Jan 2019 07:12:00 +0000 (01:12 -0600)
- Update Dockerfile to install rpython and then use that build and
  install warpy (nojit).
- Support 'warpy' in wasm_MODE. Update wasm/Makefile and wasm/run to
  support the new mode.

.travis.yml
wasm/Dockerfile
wasm/Makefile
wasm/run

index 2cb06e3..782480e 100644 (file)
@@ -93,6 +93,7 @@ matrix:
     - {env: IMPL=vimscript, services: [docker]}
     - {env: IMPL=wasm wasm_MODE=wace_libc, services: [docker]}
     - {env: IMPL=wasm wasm_MODE=node,      services: [docker]}
+    - {env: IMPL=wasm wasm_MODE=warpy,     services: [docker]}
     - {env: IMPL=yorick,    services: [docker]}
 
 script:
index 2a34283..d533d48 100644 (file)
@@ -45,20 +45,52 @@ RUN dpkg --add-architecture i386 && \
     apt-get -y install \
         git-core cmake g++ lib32gcc-8-dev \
         libsdl2-dev:i386 libsdl2-image-dev:i386 \
-        libedit-dev:i386
+        libedit-dev:i386 freeglut3-dev:i386 lib32gcc-7-dev \
+        libreadline-dev:i386
 
 RUN git clone https://github.com/WebAssembly/binaryen/ && \
     cd binaryen && \
     cmake . && make && \
     make install
 
-# TODO: merge up
-RUN apt-get -y install freeglut3-dev:i386 lib32gcc-7-dev libreadline-dev:i386
+#
+# pypy / rpython
+#
+
+# rpython deps
+ENV DEBIAN_FRONTEND=noninteractive
+RUN apt-get -y install libffi-dev pkg-config libz-dev \
+    libbz2-dev libsqlite3-dev libncurses-dev libexpat1-dev \
+    libssl-dev libgdbm-dev tcl-dev
+
+# install pypy, build and install pypy/rpython, remove prior pypy
+RUN apt-get -y install software-properties-common && \
+    add-apt-repository ppa:pypy && \
+    apt-get -y update && \
+    apt-get -y install pypy && \
+    mkdir -p /opt/pypy && \
+    curl -L https://bitbucket.org/pypy/pypy/downloads/pypy2-v6.0.0-src.tar.bz2 \
+        | tar -xjf - -C /opt/pypy/ --strip-components=1 && \
+    cd /opt/pypy && make && \
+    chmod -R ugo+rw /opt/pypy/rpython/_cache && \
+    ln -sf /opt/pypy/rpython/bin/rpython /usr/local/bin/rpython && \
+    ln -sf /opt/pypy/pypy-c /usr/local/bin/pypy && \
+    rm -rf /tmp/usession* && \
+    ln -sf /opt/pypy/pypy/goal/pypy-c /usr/local/bin/pypy && \
+    apt-get -y autoremove pypy
 
 #
 # wac/wace
 #
 RUN git clone https://github.com/kanaka/wac/ && \
-    cd wac && \
+    cd wac  && \
     make USE_SDL= wac wace && \
     cp wac wace /usr/bin
+
+#
+# warpy
+#
+RUN git clone https://github.com/kanaka/warpy/ && \
+    cd warpy && \
+    make warpy-nojit && \
+    cp warpy-nojit /usr/bin/warpy
index 0c5e1b1..02d4ea1 100644 (file)
@@ -1,4 +1,4 @@
-MODE ?= $(if $(filter node js wace_fooboot,$(wasm_MODE)),os,libc)
+MODE ?= $(if $(filter node js wace_fooboot warpy,$(wasm_MODE)),os,libc)
 
 WASM_AS ?= wasm-as
 WAMP ?= node_modules/.bin/wamp
index 9046547..0dcce47 100755 (executable)
--- a/wasm/run
+++ b/wasm/run
@@ -3,6 +3,8 @@ STEP=${STEP:-stepA_mal}
 case "${wasm_MODE}" in
 node|js)
     exec ./run.js $(dirname $0)/${STEP:-stepA_mal}.wasm "${@}" ;;
+warpy)
+    exec warpy --argv --memory-pages 256 $(dirname $0)/${STEP:-stepA_mal}.wasm "${@}" ;;
 wace_fooboot)
     echo >&2 "wace_fooboot mode not yet supported" ;;
 wace_libc|*)