build.sh 1.6 KB

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. unset LD_LIBRARY_PATH
  4. cd "$(dirname "$0")"
  5. ROOT_DIR="$(cd ../.. && pwd)"
  6. BUILD_DIR="${ROOT_DIR:?}/build/native"
  7. mkdir -p "${BUILD_DIR:?}"
  8. re2c -b -g -W -Werror parser_re2c.re -o "${BUILD_DIR}/parser_re2c.c"
  9. gcc -c -O3 -fPIC -march=x86-64 -I. "${BUILD_DIR}/parser_re2c.c" -o "${BUILD_DIR}/parser_re2c.o"
  10. gcc -c -O3 -fPIC -march=x86-64 -I. simd_kernels.c -o "${BUILD_DIR}/simd_kernels.o"
  11. gcc -c -O3 -fPIC -march=x86-64 -I. opencl_batch.c -o "${BUILD_DIR}/opencl_batch.o"
  12. gcc -c -O3 -fPIC -march=x86-64 scan_asm.S -o "${BUILD_DIR}/scan_asm.o"
  13. zig build-obj -O ReleaseFast -fPIC -mcpu=x86_64 -femit-bin="${BUILD_DIR}/zig_kernels.o" zig_kernels.zig
  14. if [ -f "${ROOT_DIR}/tools/pxe_sync.zig" ]; then
  15. zig build-exe -O ReleaseSmall -target x86_64-uefi-msvc -femit-bin="${BUILD_DIR}/pxe_sync.efi" "${ROOT_DIR}/tools/pxe_sync.zig"
  16. fi
  17. gcc -c -O3 -fPIC -march=x86-64 -I. c_bridge.c -o "${BUILD_DIR}/c_bridge.o"
  18. ar rcs "${BUILD_DIR}/libstl_kernels.a" \
  19. "${BUILD_DIR}/parser_re2c.o" \
  20. "${BUILD_DIR}/simd_kernels.o" \
  21. "${BUILD_DIR}/opencl_batch.o" \
  22. "${BUILD_DIR}/scan_asm.o" \
  23. "${BUILD_DIR}/zig_kernels.o" \
  24. "${BUILD_DIR}/c_bridge.o"
  25. rustc -O -C target-cpu=x86-64 -C lto=thin -C codegen-units=1 -C strip=debuginfo src/main.rs \
  26. -L "${BUILD_DIR}" -l static=stl_kernels -l freeipmi -l ipmiconsole -l ssh -l util -l dl -l pthread -o "${BUILD_DIR}/stl_native_server"
  27. rustc --test -O -C target-cpu=x86-64 src/main.rs \
  28. -L "${BUILD_DIR}" -l static=stl_kernels -l freeipmi -l ipmiconsole -l ssh -l util -l dl -l pthread -o "${BUILD_DIR}/stl_native_tests"
  29. (cd "${ROOT_DIR}" && "${BUILD_DIR}/stl_native_tests")