build.sh 798 B

123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. # Copyright (C) 2023 Amazon.com Inc. or its affiliates. All rights reserved.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. set -ueo pipefail
  5. CC="${CC:=/opt/wasi-sdk/bin/clang}"
  6. files=("tcp_udp.c" "nslookup.c")
  7. WASI_SYSROOT=${WASI_SYSROOT:=~/dev/wasi-libc/sysroot}
  8. for file in "${files[@]}"
  9. do
  10. echo $file
  11. $CC \
  12. --target=wasm32-wasi-threads \
  13. -I../inc \
  14. --sysroot $WASI_SYSROOT \
  15. ../src/wasi/wasi_socket_ext.c -pthread -ftls-model=local-exec \
  16. -Wl,--allow-undefined \
  17. -Wl,--strip-all,--no-entry \
  18. -Wl,--export=__heap_base \
  19. -Wl,--export=__data_end \
  20. -Wl,--shared-memory,--max-memory=10485760 \
  21. -Wl,--export=malloc \
  22. -Wl,--export=free \
  23. -o "${file%.*}.wasm" "$file"
  24. done