build.sh 709 B

12345678910111213141516171819202122232425
  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 -eo pipefail
  5. CC="${CC:=/opt/wasi-sdk/bin/clang}"
  6. files=("tcp_udp.c" "nslookup.c")
  7. for file in "${files[@]}"
  8. do
  9. echo $file
  10. $CC \
  11. --target=wasm32-wasi-threads \
  12. -I../inc \
  13. ../src/wasi/wasi_socket_ext.c -pthread -ftls-model=local-exec \
  14. -Wl,--allow-undefined \
  15. -Wl,--strip-all,--no-entry \
  16. -Wl,--export=__heap_base \
  17. -Wl,--export=__data_end \
  18. -Wl,--shared-memory,--max-memory=10485760 \
  19. -Wl,--export=malloc \
  20. -Wl,--export=free \
  21. -o "${file%.*}.wasm" "$file"
  22. done