summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml2
-rw-r--r--README.md15
-rwxr-xr-xbuild-js.sh (renamed from build.sh)21
-rwxr-xr-xupdate.py74
4 files changed, 16 insertions, 96 deletions
diff --git a/.travis.yml b/.travis.yml
index 4cd733eaa..953a20e7c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -42,7 +42,7 @@ install:
before_script:
# Check the style of a subset of Python code until the other code is updated.
- - flake8 update.py ./scripts/*
+ - flake8 ./scripts/*
script:
- cmake . -DCMAKE_C_FLAGS="$COMPILER_FLAGS" -DCMAKE_CXX_FLAGS="$COMPILER_FLAGS"
diff --git a/README.md b/README.md
index 1c803c358..cbe4269da 100644
--- a/README.md
+++ b/README.md
@@ -30,18 +30,15 @@ Usage instructions for each are below.
## Building
-First run `update.py` to initialize the git submodules and fetch the test files. You may need to re-run `update.py` from time to time.
-
-Then do
-
```
cmake . && make
```
Note that you can also use `ninja` as your generator: `cmake -G Ninja . && ninja`
-* `binaryen-shell` and `asm2wasm` require a C++11 compiler.
-* If you also want to compile C/C++ to WebAssembly (and not just asm.js to WebAssembly), you'll need Emscripten. You'll need the `incoming` branch there (which you can get via [the SDK](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html)).
-* `wasm.js` also requires Emscripten. You can compile it with `build.sh`. A pre-compiled build is provided in this repo already, so you don't need to.
+* A C++11 compiler is required.
+* The JavaScript components can be built using `build-js.sh`, see notes inside. Normally this is not needed as builds are provided in this repo already.
+
+If you also want to compile C/C++ to WebAssembly (and not just asm.js to WebAssembly), you'll need Emscripten. You'll need the `incoming` branch there (which you can get via [the SDK](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html)), for more details see [the wiki](https://github.com/kripken/emscripten/wiki/WebAssembly).
## Running
@@ -145,7 +142,7 @@ For more details, see the [emscripten wiki](https://github.com/kripken/emscripte
(or `python check.py`) will run `binaryen-shell`, `asm2wasm`, `wasm.js`, etc. on the testcases in `test/`, and verify their outputs.
-It will also run `s2wasm` through the last known good LLVM output from the [build waterfall][], as fetched by `update.py`.
+It will also run `s2wasm` through the last known good LLVM output from the [build waterfall][].
[build waterfall]: https://build.chromium.org/p/client.wasm.llvm/console
@@ -158,7 +155,7 @@ The `check.py` script supports some options:
* If an interpreter is provided, we run the output through it, checking for parse errors.
* If tests are provided, we run exactly those. If none are provided, we run them all.
* Some tests require `emcc` or `nodejs` in the path. They will not run if the tool cannot be found, and you'll see a warning.
- * We have tests from upstream in `tests/spec` and `tests/waterfall`, in git submodules. Running `./update.py` should update those.
+ * We have tests from upstream in `tests/spec` and `tests/waterfall`, in git submodules. Running `./check.py` should update those.
## Design Principles
diff --git a/build.sh b/build-js.sh
index 35d538ffd..dc3ec3326 100755
--- a/build.sh
+++ b/build-js.sh
@@ -1,17 +1,14 @@
-echo "updating"
-./update.py
-echo "building (run cmake . if necessary)"
-make -j
-#echo "building binaryen shell"
-#g++ -O2 -std=c++11 src/binaryen-shell.cpp src/pass.cpp src/passes/LowerIfElse.cpp src/passes/MergeBlocks.cpp src/passes/NameManager.cpp src/passes/RemoveImports.cpp src/passes/RemoveUnusedBrs.cpp src/passes/RemoveUnusedNames.cpp src/support/colors.cpp -o bin/binaryen-shell -Isrc/ -msse2 -mfpmath=sse # use sse for math, avoid x87, necessarily for proper float rounding on 32-bit
-#echo "building asm2wasm"
-#g++ -O2 -std=c++11 src/asm2wasm-main.cpp src/passes/MergeBlocks.cpp src/passes/RemoveUnusedBrs.cpp src/pass.cpp src/passes/RemoveUnusedNames.cpp src/emscripten-optimizer/parser.cpp src/emscripten-optimizer/simple_ast.cpp src/emscripten-optimizer/optimizer-shared.cpp src/support/colors.cpp -Isrc/ -o bin/asm2wasm
-#echo "building wasm2asm"
-#g++ -O2 -std=c++11 src/wasm2asm-main.cpp src/emscripten-optimizer/parser.cpp src/emscripten-optimizer/simple_ast.cpp src/emscripten-optimizer/optimizer-shared.cpp src/support/colors.cpp -Isrc/ -o bin/wasm2asm
-#echo "building s2wasm"
-#g++ -O2 -std=c++11 src/s2wasm-main.cpp src/support/command-line.cpp src/support/file.cpp src/support/colors.cpp -Isrc/ -o bin/s2wasm
+#
+# This file builds the js components using emscripten. You normally don't need
+# to run this, as the builds are bundled in the repo in bin/. Running this is
+# useful if you are a developer and want to update those builds.
+#
+
echo "building wasm.js"
+
em++ -std=c++11 src/wasm-js.cpp src/pass.cpp src/passes/MergeBlocks.cpp src/passes/Print.cpp src/passes/OptimizeInstructions.cpp src/passes/RemoveUnusedBrs.cpp src/passes/RemoveUnusedNames.cpp src/passes/PostEmscripten.cpp src/passes/SimplifyLocals.cpp src/passes/ReorderLocals.cpp src/passes/Vacuum.cpp src/emscripten-optimizer/parser.cpp src/emscripten-optimizer/simple_ast.cpp src/emscripten-optimizer/optimizer-shared.cpp src/support/colors.cpp src/support/safe_integer.cpp src/support/bits.cpp src/support/threads.cpp -Isrc/ -o bin/wasm.js -s MODULARIZE=1 -s 'EXPORT_NAME="WasmJS"' --memory-init-file 0 -Oz -s ALLOW_MEMORY_GROWTH=1 -profiling -s DEMANGLE_SUPPORT=1 #-DWASM_JS_DEBUG -DWASM_INTERPRETER_DEBUG=2
+
echo "building binaryen.js"
+
python ~/Dev/emscripten/tools/webidl_binder.py src/js/binaryen.idl glue
em++ -std=c++11 src/binaryen-js.cpp src/pass.cpp src/passes/MergeBlocks.cpp src/passes/Print.cpp src/passes/RemoveUnusedBrs.cpp src/passes/RemoveUnusedNames.cpp src/passes/PostEmscripten.cpp src/passes/SimplifyLocals.cpp src/passes/ReorderLocals.cpp src/passes/Vacuum.cpp src/emscripten-optimizer/parser.cpp src/emscripten-optimizer/simple_ast.cpp src/emscripten-optimizer/optimizer-shared.cpp src/support/colors.cpp src/support/safe_integer.cpp src/support/bits.cpp -Isrc/ -o bin/binaryen.js -s MODULARIZE=1 -s 'EXPORT_NAME="Binaryen"' --memory-init-file 0 -Oz -s ALLOW_MEMORY_GROWTH=1 -profiling -s DEMANGLE_SUPPORT=1 -s INVOKE_RUN=0 --post-js glue.js
diff --git a/update.py b/update.py
deleted file mode 100755
index 4bc95b5ac..000000000
--- a/update.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#! /usr/bin/env python
-
-# Copyright 2015 WebAssembly Community Group participants
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-import subprocess
-import sys
-
-import scripts.storage
-import scripts.support
-
-
-BASE_DIR = os.path.abspath('test')
-REVISION_PATH = os.path.join(BASE_DIR, 'revision')
-TORTURE_TAR = 'wasm-torture-s-%s.tbz2'
-
-
-def current_revision():
- with open(REVISION_PATH, 'r') as f:
- return f.read()
-
-
-def write_revision(revision):
- with open(REVISION_PATH, 'w') as f:
- f.write(revision)
-
-
-def run(force_latest, override_build):
- print 'Updating git submodules'
- subprocess.check_call(['git', 'submodule', 'sync', '--quiet'])
- subprocess.check_call(['git', 'submodule', 'init', '--quiet'])
- subprocess.check_call(['git', 'submodule', 'update', '--quiet'])
- subprocess.check_call(['git', 'submodule', 'foreach',
- 'git', 'pull', 'origin', 'master', '--quiet'])
- print 'Updating from the waterfall, current revision', current_revision()
- updates = 0
- revision = (override_build if override_build else
- scripts.storage.download_revision(force_latest=force_latest))
- downloaded = scripts.storage.download_tar(TORTURE_TAR, BASE_DIR, revision)
- updates += scripts.support.untar(downloaded, BASE_DIR)
- if updates or override_build:
- # Only update revision if the files it downloaded are different, or if
- # overriding the build ID.
- print 'Updating revision to', revision
- write_revision(revision)
-
-
-def getargs():
- import argparse
- parser = argparse.ArgumentParser(
- description='Update the repository dependencies.')
- parser.add_argument('--force-latest', action='store_true',
- help='Sync to latest waterfall build, not lkgr')
- parser.add_argument('--override-build', type=str, default=None,
- help='Sync to specific build ID from waterfall build')
- return parser.parse_args()
-
-
-if __name__ == '__main__':
- args = getargs()
- sys.exit(run(force_latest=args.force_latest,
- override_build=args.override_build))