This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
97 additions
and
55 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,13 +1,27 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
# NOTE `cargo install wasm-gc` before running this script. | ||
# NOTE `cargo install --git https://github.com/pepyakin/wasm-export-table.git` | ||
# This script assumes that all pre-requisites are installed. | ||
|
||
set -e | ||
|
||
source `dirname "$0"`/common.sh | ||
|
||
export CARGO_INCREMENTAL=0 | ||
|
||
cd demo/runtime/wasm && ./build.sh && cd ../../.. | ||
cd substrate/executor/wasm && ./build.sh && cd ../../.. | ||
cd substrate/test-runtime/wasm && ./build.sh && cd ../../.. | ||
cd polkadot/runtime/wasm && ./build.sh && cd ../../.. | ||
cd polkadot/parachain/test-chains && ./build.sh && cd ../../.. | ||
# Save current directory. | ||
pushd . | ||
|
||
cd $ROOT | ||
|
||
for SRC in "${SRCS[@]}" | ||
do | ||
echo "*** Building wasm binaries in $SRC" | ||
cd $SRC | ||
|
||
./build.sh | ||
|
||
cd - >> /dev/null | ||
done | ||
|
||
# Restore initial directory. | ||
popd |
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,22 @@ | ||
#!/bin/bash | ||
|
||
ROOT=`dirname "$0"` | ||
|
||
# A list of directories which contain wasm projects. | ||
SRCS=( | ||
"polkadot/runtime/wasm" | ||
"substrate/executor/wasm" | ||
"demo/runtime/wasm" | ||
"substrate/test-runtime/wasm" | ||
"polkadot/parachain/test-chains/basic_add" | ||
) | ||
|
||
# Make pushd/popd silent. | ||
|
||
pushd () { | ||
command pushd "$@" > /dev/null | ||
} | ||
|
||
popd () { | ||
command popd "$@" > /dev/null | ||
} |
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,4 +1,4 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
set -e | ||
|
||
cargo +nightly build --target=wasm32-unknown-unknown --release | ||
|
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
echo "*** Initilising WASM build environment" | ||
|
||
rustup update nightly | ||
rustup target add wasm32-unknown-unknown --toolchain nightly | ||
rustup update stable | ||
|
||
# Install wasm-gc. It's useful for stripping slimming down wasm binaries. | ||
command -v wasm-gc || \ | ||
cargo +nightly install --git https://github.com/alexcrichton/wasm-gc | ||
|
||
# At the moment of writing, rustc still uses LLD 6 which produces wasm binaries | ||
# that don't export a table. Meanwhile, we are waiting for LLD 7 to come | ||
# in rustc we could use this handy little tool. | ||
command -v wasm-export-table || \ | ||
cargo +nightly install --git https://github.com/pepyakin/wasm-export-table.git |
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,12 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Make LLD produce a binary that imports memory from the outside environment. | ||
export RUSTFLAGS="-C link-arg=--import-memory" | ||
|
||
cargo +nightly build --target=wasm32-unknown-unknown --release --no-default-features | ||
|
||
for i in basic_add | ||
do | ||
wasm-gc target/wasm32-unknown-unknown/release/$i.wasm target/wasm32-unknown-unknown/release/$i.compact.wasm | ||
done |
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,4 +1,4 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
set -e | ||
|
||
rm -rf ./target | ||
|
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,4 +1,4 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
set -e | ||
|
||
cargo +nightly build --target=wasm32-unknown-unknown --release | ||
|
This file was deleted.
Oops, something went wrong.
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,4 +1,4 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
set -e | ||
|
||
cargo +nightly build --target=wasm32-unknown-unknown --release | ||
|
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,4 +1,4 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
set -e | ||
|
||
cargo +nightly build --target=wasm32-unknown-unknown --release | ||
|
This file was deleted.
Oops, something went wrong.