summaryrefslogtreecommitdiff
path: root/common_functions
diff options
context:
space:
mode:
Diffstat (limited to 'common_functions')
-rwxr-xr-xcommon_functions140
1 files changed, 0 insertions, 140 deletions
diff --git a/common_functions b/common_functions
deleted file mode 100755
index 512d826..0000000
--- a/common_functions
+++ /dev/null
@@ -1,140 +0,0 @@
-#!/bin/bash
-
-################################################################
-#
-# Copyright (c) 1995-2014 SUSE Linux Products GmbH
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 or 3 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program (see the file COPYING); if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-#
-################################################################
-
-build_host_arch() {
- : ${BUILD_HOST_ARCH:=`uname -m`}
- # the linux kernel only knows armv7l, armv7hl is a userland definition
- test armv7l == "$BUILD_HOST_ARCH" && BUILD_HOST_ARCH=armv7hl
-
- BUILD_INITVM_ARCH="$BUILD_HOST_ARCH"
- # avoid multiple initvm.* helpers for i586 and i686
- test i686 != "$BUILD_INITVM_ARCH" || BUILD_INITVM_ARCH=i586
-}
-
-extend_build_arch() {
- case $BUILD_ARCH in
- aarch64) BUILD_ARCH="aarch64:aarch64_ilp32:armv8l" ;;
- aarch64_ilp32) BUILD_ARCH="aarch64_ilp32:aarch64:armv8l" ;;
- armv8l) BUILD_ARCH="armv8l" ;; # armv8l is aarch64 in 32bit mode. not a superset of armv7
- armv7hl) BUILD_ARCH="armv7hl:armv7l:armv6hl:armv6l:armv5tel" ;;
- armv7l) BUILD_ARCH="armv7l:armv6l:armv5tel" ;;
- armv6hl) BUILD_ARCH="armv6hl:armv6l:armv5tel" ;;
- armv6l) BUILD_ARCH="armv6l:armv5tel" ;;
- armv5tel) BUILD_ARCH="armv5tel" ;;
- m68k) BUILD_ARCH="m68k" ;;
- mips64) BUILD_ARCH="mips64:mips" ;;
- mips) BUILD_ARCH="mips" ;;
- i686) BUILD_ARCH="i686:i586:i486:i386" ;;
- i586) BUILD_ARCH="i586:i486:i386" ;;
- i486) BUILD_ARCH="i486:i386" ;;
- i386) BUILD_ARCH="i386" ;;
- ia64) BUILD_ARCH="ia64" ;;
- parisc64) BUILD_ARCH="hppa64:hppa" ;;
- parisc) BUILD_ARCH="hppa" ;;
- ppc) BUILD_ARCH="ppc" ;;
- ppc64) BUILD_ARCH="ppc64:ppc" ;;
- ppc64le) BUILD_ARCH="ppc64le" ;;
- s390x) BUILD_ARCH="s390x:s390" ;;
- s390) BUILD_ARCH="s390" ;;
- 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" ;;
- x86_64) BUILD_ARCH="x86_64:i686:i586:i486:i386" ;;
- esac
-}
-
-set_build_arch() {
- build_host_arch
- if test -z "$BUILD_ARCH" ; then
- BUILD_ARCH="$BUILD_HOST_ARCH"
- fi
- extend_build_arch
- 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
-}
-
-check_use_emulator() {
- INITVM_NAME=
- # check if the extended host arch contains the build arch
- local old_build_arch="$BUILD_ARCH"
- local arch="${BUILD_ARCH%%:*}"
- BUILD_ARCH="$BUILD_HOST_ARCH"
- extend_build_arch
- BUILD_ARCH=":$BUILD_ARCH:"
- if test "$BUILD_ARCH" != "${BUILD_ARCH/:$arch:/}" ; then
- # native supported arch, no emulator
- BUILD_ARCH="$old_build_arch"
- return 1
- fi
- BUILD_ARCH="$old_build_arch"
-
- # to run the qemu initialization in the vm, we need to
- # register it with a static program or shell script
- INITVM_NAME="initvm.$BUILD_INITVM_ARCH"
- if test -e "$BUILD_DIR/$INITVM_NAME" -a -e "$BUILD_DIR/qemu-reg" ; then
- chmod 0755 "$BUILD_DIR/$INITVM_NAME"
- return 0 # chroot build, we need to run
- fi
- # XXX: error?
- echo "Warning: cross compile not possible due to missing static binaries. please install build-initvm package for that purpose."
- echo " check that the right architecture is available for your build host, you need $INITVM_NAME for this one."
- INITVM_NAME=
- 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}
-}