| 1 | #!/bin/bash |
| 2 | # This script expects to be invoked from the base fio directory. |
| 3 | set -eu |
| 4 | |
| 5 | SCRIPT_DIR=$(dirname "$0") |
| 6 | # shellcheck disable=SC1091 |
| 7 | . "${SCRIPT_DIR}/common.sh" |
| 8 | |
| 9 | main() { |
| 10 | local extra_cflags="-Werror" |
| 11 | local configure_flags=() |
| 12 | |
| 13 | set_ci_target_os |
| 14 | case "${CI_TARGET_BUILD}/${CI_TARGET_OS}" in |
| 15 | android/*) |
| 16 | export UNAME=Android |
| 17 | if [ -z "${CI_TARGET_ARCH}" ]; then |
| 18 | echo "Error: CI_TARGET_ARCH has not been set" |
| 19 | return 1 |
| 20 | fi |
| 21 | NDK=$PWD/android-ndk-r24/toolchains/llvm/prebuilt/linux-x86_64/bin |
| 22 | export PATH="${NDK}:${PATH}" |
| 23 | export LIBS="-landroid" |
| 24 | CC=${NDK}/${CI_TARGET_ARCH}-clang |
| 25 | if [ ! -e "${CC}" ]; then |
| 26 | echo "Error: could not find ${CC}" |
| 27 | return 1 |
| 28 | fi |
| 29 | ;; |
| 30 | */linux) |
| 31 | case "${CI_TARGET_ARCH}" in |
| 32 | "i686") |
| 33 | extra_cflags="${extra_cflags} -m32" |
| 34 | export LDFLAGS="-m32" |
| 35 | ;; |
| 36 | "x86_64") |
| 37 | configure_flags+=( |
| 38 | "--enable-cuda" |
| 39 | "--enable-libiscsi" |
| 40 | "--enable-libnbd" |
| 41 | ) |
| 42 | ;; |
| 43 | esac |
| 44 | ;; |
| 45 | */windows) |
| 46 | configure_flags+=("--disable-native") |
| 47 | case "${CI_TARGET_ARCH}" in |
| 48 | "i686") |
| 49 | configure_flags+=("--build-32bit-win") |
| 50 | ;; |
| 51 | "x86_64") |
| 52 | ;; |
| 53 | esac |
| 54 | ;; |
| 55 | esac |
| 56 | configure_flags+=(--extra-cflags="${extra_cflags}") |
| 57 | |
| 58 | ./configure "${configure_flags[@]}" |
| 59 | make -j 2 |
| 60 | } |
| 61 | |
| 62 | main |