forked from DataDog/dd-trace-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompile_rust.sh
More file actions
executable file
·26 lines (21 loc) · 973 Bytes
/
compile_rust.sh
File metadata and controls
executable file
·26 lines (21 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
cd components-rs
RUSTFLAGS="${RUSTFLAGS:-} --cfg tokio_unstable"
if if test -z "${host_os:-}"; then case "${host_os}" in linux*) true;; *) false; esac else test "$(uname -s)" = "Linux"; fi then
RUSTFLAGS="$RUSTFLAGS --cfg tokio_taskdump"
fi
if test -n "$SHARED"; then
RUSTFLAGS="$RUSTFLAGS --cfg php_shared_build"
fi
case "${host_os}" in
darwin*)
RUSTFLAGS="$RUSTFLAGS -Clink-arg=-undefined -Clink-arg=dynamic_lookup";
;;
esac
set -x
if test -n "$COMPILE_ASAN"; then
# We need -lresolv due to https://github.com/llvm/llvm-project/issues/59007
export LDFLAGS="-fsanitize=address $(if cc -v 2>&1 | grep -q clang; then echo "-shared-libsan -lresolv"; fi)"
export CFLAGS="$LDFLAGS -fno-omit-frame-pointer" # the cc buildtools will only pick up CFLAGS it seems
fi
SIDECAR_VERSION=$(cat ../VERSION) RUSTFLAGS="$RUSTFLAGS" RUSTC_BOOTSTRAP=1 "${DDTRACE_CARGO:-cargo}" build $(test "${PROFILE:-debug}" = "debug" || echo --profile "$PROFILE") "$@"