rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Wrapper script for llvm-config. Supplies the right environment variables |
| 4 | # for the target and delegates to the native llvm-config for anything else. This |
| 5 | # is needed because arguments like --ldflags, --cxxflags, etc. are set by the |
| 6 | # native compile rather than the target compile. |
| 7 | # |
| 8 | |
| 9 | SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" |
| 10 | NEXT_LLVM_CONFIG="$(which -a llvm-config | sed -n 2p)" |
| 11 | export YOCTO_ALTERNATE_EXE_PATH="$(readlink -f "$SCRIPT_DIR/../llvm-config")" |
| 12 | |
| 13 | if [[ $# == 0 ]]; then |
| 14 | exec "$NEXT_LLVM_CONFIG" |
| 15 | fi |
| 16 | |
| 17 | if [[ $1 == "--libs" ]]; then |
| 18 | exec "$NEXT_LLVM_CONFIG" $@ |
| 19 | fi |
| 20 | |
| 21 | for arg in "$@"; do |
| 22 | case "$arg" in |
| 23 | --cppflags) |
| 24 | echo $TARGET_CPPFLAGS |
| 25 | ;; |
| 26 | --cflags) |
| 27 | echo $TARGET_CFLAGS |
| 28 | ;; |
| 29 | --cxxflags) |
| 30 | echo $TARGET_CXXFLAGS |
| 31 | ;; |
| 32 | --ldflags) |
| 33 | echo $TARGET_LDFLAGS |
| 34 | ;; |
| 35 | *) |
| 36 | echo "$("$NEXT_LLVM_CONFIG" "$arg")" |
| 37 | ;; |
| 38 | esac |
| 39 | done |