Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions build32.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,21 @@ cd ../../..
# Build the extensions
cargo run --manifest-path tools/wasix-headers/Cargo.toml generate-libc
cp -f libc-bottom-half/headers/public/wasi/api.h libc-bottom-half/headers/public/wasi/api_wasix.h
sed -i 's|__wasi__|__wasix__|g' libc-bottom-half/headers/public/wasi/api_wasix.h
sed -i 's|__wasi_api_h|__wasix_api_h|g' libc-bottom-half/headers/public/wasi/api_wasix.h

OS=`uname -s`

case $OS in
'Linux')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make Linux the fallback default option , just to make sure...

sed -i 's|__wasi__|__wasix__|g' libc-bottom-half/headers/public/wasi/api_wasix.h
sed -i 's|__wasi_api_h|__wasix_api_h|g' libc-bottom-half/headers/public/wasi/api_wasix.h
;;
'Darwin')
sed -i '' 's|__wasi__|__wasix__|g' libc-bottom-half/headers/public/wasi/api_wasix.h
sed -i '' 's|__wasi_api_h|__wasix_api_h|g' libc-bottom-half/headers/public/wasi/api_wasix.h
;;
*) ;;
esac

cp -f libc-bottom-half/sources/__wasilibc_real.c libc-bottom-half/sources/__wasixlibc_real.c

# Build WASI
Expand Down
35 changes: 31 additions & 4 deletions build64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,47 @@ git reset --hard
git pull origin main || true
cd ../../..

OS=`uname -s`

# Build the extensions
cargo run --manifest-path tools/wasix-headers/Cargo.toml generate-libc --64bit
cp -f libc-bottom-half/headers/public/wasi/api.h libc-bottom-half/headers/public/wasi/api_wasix.h
sed -i 's|__wasi__|__wasix__|g' libc-bottom-half/headers/public/wasi/api_wasix.h
sed -i 's|__wasi_api_h|__wasix_api_h|g' libc-bottom-half/headers/public/wasi/api_wasix.h
OS=`uname -s`

case $OS in
'Linux')
sed -i 's|__wasi__|__wasix__|g' libc-bottom-half/headers/public/wasi/api_wasix.h
sed -i 's|__wasi_api_h|__wasix_api_h|g' libc-bottom-half/headers/public/wasi/api_wasix.h
;;
'Darwin')
sed -i '' 's|__wasi__|__wasix__|g' libc-bottom-half/headers/public/wasi/api_wasix.h
sed -i '' 's|__wasi_api_h|__wasix_api_h|g' libc-bottom-half/headers/public/wasi/api_wasix.h
;;
*) ;;
esac

cp -f libc-bottom-half/sources/__wasilibc_real.c libc-bottom-half/sources/__wasixlibc_real.c

# Build WASI
mkdir -p build/temp
rsync -rtvu --delete tools/wasix-headers/ build/temp
cp -r -f tools/wasi-headers/WASI/phases/* build/temp/WASI/phases
mv -f build/temp/WASI/phases/snapshot/witx/wasi_snapshot_preview1.witx build/temp/WASI/phases/snapshot/witx/wasix_v1.witx
sed -i 's|(field $buf_len $size)|(field $buf_len usize)|g' build/temp/WASI/phases/snapshot/witx/typenames.witx
sed -i 's|(param $buf_len $size)|(param $buf_len usize)|g' build/temp/WASI/phases/snapshot/witx/wasix_v1.witx



case $OS in
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make Linux the fallback default option , just to make sure...

'Linux')
sed -i 's/(field $buf_len $size)/(field $buf_len usize)/g' build/temp/WASI/phases/snapshot/witx/typenames.witx
sed -i 's/(param $buf_len $size)/(param $buf_len usize)/g' build/temp/WASI/phases/snapshot/witx/wasix_v1.witx
;;
'Darwin')
sed -i '' 's/(field $buf_len $size)/(field $buf_len usize)/g' build/temp/WASI/phases/snapshot/witx/typenames.witx
sed -i '' 's/(param $buf_len $size)/(param $buf_len usize)/g' build/temp/WASI/phases/snapshot/witx/wasix_v1.witx
;;
*) ;;
esac

cargo clean --manifest-path build/temp/Cargo.toml
cargo run --manifest-path build/temp/Cargo.toml generate-libc --64bit
cp -f libc-bottom-half/headers/public/wasi/api.h libc-bottom-half/headers/public/wasi/api_wasi.h
Expand Down