build_wamr.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env bash
  2. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. readonly CURRENT_PATH=$(dirname "$(realpath "$0")")
  5. readonly ROOT=$(realpath "${CURRENT_PATH}/..")
  6. readonly VARIANT=$(lsb_release -c | awk '{print $2}')
  7. docker build \
  8. --memory=4G --cpu-quota=50000 \
  9. -t wamr_dev_${VARIANT}:0.1 -f "${ROOT}"/.devcontainer/Dockerfile "${ROOT}"/.devcontainer \
  10. && docker run --rm -it \
  11. --cap-add=SYS_PTRACE \
  12. --cpus=".5" \
  13. --memory=4G \
  14. --mount type=bind,src="${ROOT}",dst=/workspaces \
  15. --name wamr_build_env \
  16. --security-opt=seccomp=unconfined \
  17. wamr_dev_${VARIANT}:0.1 \
  18. /bin/bash -c "\
  19. pwd \
  20. && pushd product-mini/platforms/linux \
  21. && rm -rf build \
  22. && mkdir build \
  23. && pushd build \
  24. && cmake .. \
  25. && make \
  26. && popd \
  27. && popd \
  28. && echo 'Copying the binary ...' \
  29. && rm -rf build_out \
  30. && mkdir build_out \
  31. && cp product-mini/platforms/linux/build/iwasm build_out/iwasm"