1#!/bin/bash -ex 2 3$CC --version 4 5# Express the compiler version as an integer. e.g. GCC 4.9.2 => 0x040902 6cc-ver() 7{ 8 $CC -dumpversion | awk -F. '{ printf "0x%02x%02x%02x", $1, $2, $3 }' 9} 10 11# random config or default config 12if [[ "${RANDCONFIG}" == "y" ]]; then 13 make -C xen KCONFIG_ALLCONFIG=tools/kconfig/allrandom.config randconfig 14else 15 make -C xen defconfig 16fi 17 18# build up our configure options 19cfgargs=() 20cfgargs+=("--enable-docs") 21 22if [[ "${CC}" == "clang"* ]]; then 23 # SeaBIOS cannot be built with clang 24 cfgargs+=("--with-system-seabios=/usr/share/seabios/bios.bin") 25 # iPXE cannot be built with clang 26 cfgargs+=("--with-system-ipxe=/usr/lib/ipxe/ipxe.pxe") 27 # newlib cannot be built with clang so we cannot build stubdoms 28 cfgargs+=("--disable-stubdom") 29fi 30 31# Qemu requires Python 3.5 or later 32if ! type python3 || python3 -c "import sys; res = sys.version_info < (3, 5); exit(not(res))"; then 33 cfgargs+=("--with-system-qemu=/bin/false") 34fi 35 36# SeaBIOS requires GCC 4.6 or later 37if [[ "${CC}" == "gcc" && `cc-ver` -lt 0x040600 ]]; then 38 cfgargs+=("--with-system-seabios=/bin/false") 39fi 40 41./configure "${cfgargs[@]}" 42 43make -j$(nproc) dist 44 45# Extract artifacts to avoid getting rewritten by customised builds 46cp xen/.config xen-config 47mkdir binaries 48if [[ "${XEN_TARGET_ARCH}" == "x86_64" ]]; then 49 cp xen/xen binaries/xen 50fi 51 52# Build all the configs we care about 53case ${XEN_TARGET_ARCH} in 54 x86_64) arch=x86 ;; 55 *) exit 0 ;; 56esac 57 58cfg_dir="automation/configs/${arch}" 59for cfg in `ls ${cfg_dir}`; do 60 echo "Building $cfg" 61 make -j$(nproc) -C xen clean 62 rm -f xen/.config 63 make -C xen KBUILD_DEFCONFIG=../../../../${cfg_dir}/${cfg} XEN_CONFIG_EXPERT=y defconfig 64 make -j$(nproc) -C xen XEN_CONFIG_EXPERT=y 65done 66