Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 17de8ce5d3
Fetching contributors…

Cannot retrieve contributors at this time

executable file 106 lines (93 sloc) 2.62 kB
#!/bin/bash
: ${CACHE_DIR:=/var/cache/build}
set_build_arch()
{
: ${BUILD_HOST_ARCH:=`uname -m`}
if [ -z "$BUILD_ARCH" ]; then
BUILD_ARCH="$BUILD_HOST_ARCH"
test i686 != "$BUILD_ARCH" || BUILD_ARCH=i586 # XXX: why?
fi
case $BUILD_ARCH in
i686) BUILD_ARCH="i686:i586:i486:i386" ;;
i586) BUILD_ARCH="i586:i486:i386" ;;
i486) BUILD_ARCH="i486:i386" ;;
i386) BUILD_ARCH="i386" ;;
x86_64) BUILD_ARCH="x86_64:i686:i586:i486:i386" ;;
sparc64v) BUILD_ARCH="sparc64v:sparc64:sparcv9v:sparcv9:sparcv8:sparc" ;;
sparc64) BUILD_ARCH="sparc64:sparcv9:sparcv8:sparc" ;;
sparcv9v) BUILD_ARCH="sparcv9v:sparcv9:sparcv8:sparc" ;;
sparcv9) BUILD_ARCH="sparcv9:sparcv8:sparc" ;;
sparcv8) BUILD_ARCH="sparcv8:sparc" ;;
sparc) BUILD_ARCH="sparc" ;;
esac
if test "$BUILD_ARCH" != "${BUILD_ARCH#i686}" ; then
cpuflags=`grep ^flags /proc/cpuinfo`
cpuflags="$cpuflags "
if test "$cpuflags" = "${cpuflags/ cx8 /}" -o "$cpuflags" = "${cpuflags/ cmov /}"; then
echo "Your cpu doesn't support i686 rpms. Exit."
cleanup_and_exit 1
fi
fi
}
check_exit()
{
if test -e $BUILD_ROOT/exit; then
echo "exit ..."
cleanup_and_exit 1
fi
}
is_emulator_arch()
{
local arch
local qarch=":$BUILD_ARCH:"
for arch in $EMULATOR_ARCHS; do
if test "$qarch" != "${qarch/:$arch:/}" -a "$BUILD_HOST_ARCH" != "$arch"; then
return 0
fi
done
return 1
}
check_use_emulator()
{
is_emulator_arch || return
if [ -z "$VM_TYPE" ]; then
return 0
fi
# to run the qemu initialization in the XEN chroot, we need to
# register it with a static program or shell script
case "$BUILD_HOST_ARCH" in
i?86|x86_64)
if test -e $BUILD_DIR/initvm && \
test -e $BUILD_DIR/qemu-reg; then
return 0 # prefer initvm to handle registration
elif test -e /bin/bash-static \
-a -e /bin/mount-static \
-a -e /usr/sbin/qemu-binfmt-conf.sh; then
return 0 # as backup use /usr/sbin/qemu-binfmt.conf.sh
else
# XXX: error?
echo "Warning: cross compile not possible due to missing static binaries"
fi
;;
esac
return 1
}
# usage:
# progress_setup LIST
# for I in $LIST; do
# progress_step LIST
# action $I
# done
# $1 name of a textual list
progress_setup() {
eval "$1__ARRAY__=(\$$1)"
eval "$1__INDEX__=1"
eval "$1__LENGTH__=\${#$1__ARRAY__[@]}"
}
# $1 name of a textual list
# $2 optional, printf format for 2 numeric arguments (current, total)
progress_step() {
local IDX=$1__INDEX__
local LEN=$1__LENGTH__
printf "${2-[%d/%d] }" $(($IDX++)) ${!LEN}
}
Jump to Line
Something went wrong with that request. Please try again.