3 : ${CACHE_DIR:=/var/cache/build}
7 : ${BUILD_HOST_ARCH:=`uname -m`}
9 if [ -z "$BUILD_ARCH" ]; then
10 BUILD_ARCH="$BUILD_HOST_ARCH"
11 test i686 != "$BUILD_ARCH" || BUILD_ARCH=i586 # XXX: why?
15 i686) BUILD_ARCH="i686:i586:i486:i386" ;;
16 i586) BUILD_ARCH="i586:i486:i386" ;;
17 i486) BUILD_ARCH="i486:i386" ;;
18 i386) BUILD_ARCH="i386" ;;
19 x86_64) BUILD_ARCH="x86_64:i686:i586:i486:i386" ;;
20 sparc64v) BUILD_ARCH="sparc64v:sparc64:sparcv9v:sparcv9:sparcv8:sparc" ;;
21 sparc64) BUILD_ARCH="sparc64:sparcv9:sparcv8:sparc" ;;
22 sparcv9v) BUILD_ARCH="sparcv9v:sparcv9:sparcv8:sparc" ;;
23 sparcv9) BUILD_ARCH="sparcv9:sparcv8:sparc" ;;
24 sparcv8) BUILD_ARCH="sparcv8:sparc" ;;
25 sparc) BUILD_ARCH="sparc" ;;
27 if test "$BUILD_ARCH" != "${BUILD_ARCH#i686}" ; then
28 cpuflags=`grep ^flags /proc/cpuinfo`
30 if test "$cpuflags" = "${cpuflags/ cx8 /}" -o "$cpuflags" = "${cpuflags/ cmov /}"; then
31 echo "Your cpu doesn't support i686 rpms. Exit."
39 if test -e $BUILD_ROOT/exit; then
48 for arch in $EMULATOR_ARCHS; do
49 if test "$BUILD_ARCH" = "$arch" -a "$BUILD_HOST_ARCH" != "$arch"; then
58 is_emulator_arch || return
60 if [ -z "$VM_TYPE" ]; then
64 # to run the qemu initialization in the XEN chroot, we need to
65 # register it with a static program or shell script
66 case "$BUILD_HOST_ARCH" in
68 if test -e $BUILD_DIR/initvm && \
69 test -e $BUILD_DIR/qemu-reg; then
70 return 0 # prefer initvm to handle registration
71 elif test -e /bin/bash-static \
72 -a -e /bin/mount-static \
73 -a -e /usr/sbin/qemu-binfmt-conf.sh; then
74 return 0 # as backup use /usr/sbin/qemu-binfmt.conf.sh
77 echo "Warning: cross compile not possible due to missing static binaries"
91 # $1 name of a textual list
93 eval "$1__ARRAY__=(\$$1)"
95 eval "$1__LENGTH__=\${#$1__ARRAY__[@]}"
98 # $1 name of a textual list
99 # $2 optional, printf format for 2 numeric arguments (current, total)
101 local IDX=$1__INDEX__
102 local LEN=$1__LENGTH__
103 printf "${2-[%d/%d] }" $(($IDX++)) ${!LEN}