Commit | Line | Data |
---|---|---|
9b471ea6 | 1 | #!/usr/bin/env bash |
ce1b5612 SW |
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 | |
787c02a6 | 14 | case "${CI_TARGET_BUILD}/${CI_TARGET_OS}" in |
9b3cc2dd | 15 | android*/*) |
787c02a6 BVA |
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}" | |
9b3cc2dd BVA |
23 | if [ "${CI_TARGET_BUILD}" = "android" ]; then |
24 | export LIBS="-landroid" | |
25 | fi | |
787c02a6 BVA |
26 | CC=${NDK}/${CI_TARGET_ARCH}-clang |
27 | if [ ! -e "${CC}" ]; then | |
28 | echo "Error: could not find ${CC}" | |
29 | return 1 | |
30 | fi | |
31 | ;; | |
9b471ea6 VF |
32 | */linux | */ubuntu) |
33 | case "${CI_TARGET_ARCH}" in | |
34 | "x86_64") | |
35 | configure_flags+=( | |
36 | "--enable-cuda" | |
37 | ) | |
38 | ;; | |
39 | esac | |
40 | ;;& | |
2a262580 | 41 | */linux | */ubuntu | */debian | */fedora | */alma | */oracle | */rocky) |
ce1b5612 SW |
42 | case "${CI_TARGET_ARCH}" in |
43 | "i686") | |
44 | extra_cflags="${extra_cflags} -m32" | |
45 | export LDFLAGS="-m32" | |
46 | ;; | |
47 | "x86_64") | |
48 | configure_flags+=( | |
ce1b5612 SW |
49 | "--enable-libiscsi" |
50 | "--enable-libnbd" | |
51 | ) | |
52 | ;; | |
53 | esac | |
89d08880 VF |
54 | ;; |
55 | */windows) | |
56 | configure_flags+=("--disable-native") | |
57 | case "${CI_TARGET_ARCH}" in | |
58 | "i686") | |
59 | configure_flags+=("--build-32bit-win") | |
60 | ;; | |
61 | "x86_64") | |
62 | ;; | |
63 | esac | |
4820d46c VF |
64 | if [ "${CI_TARGET_BUILD}" = "windows-msys2-64" ]; then |
65 | configure_flags+=("--disable-tls") | |
66 | fi | |
89d08880 | 67 | ;; |
ce1b5612 SW |
68 | esac |
69 | configure_flags+=(--extra-cflags="${extra_cflags}") | |
70 | ||
71 | ./configure "${configure_flags[@]}" | |
aa84b5ba VF |
72 | make -j "$(nproc 2>/dev/null || sysctl -n hw.logicalcpu)" |
73 | # macOS does not have nproc, so we have to use sysctl to obtain the number of | |
74 | # logical CPUs. | |
ce1b5612 SW |
75 | } |
76 | ||
77 | main |