sbsv2/raptor/bin/gethost.sh
author Jon Chatten
Fri, 12 Nov 2010 14:49:36 +0000
changeset 674 37ee82a83d43
parent 0 044383f39525
permissions -rwxr-xr-x
sbs version 2.15.3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     1
#!/bin/bash
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     2
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     3
674
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents: 0
diff changeset
     4
# Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
0
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     5
# All rights reserved.
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     6
# This component and the accompanying materials are made available
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     7
# under the terms of the License "Eclipse Public License v1.0"
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     8
# which accompanies this distribution, and is available
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     9
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    10
#
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    11
# Initial Contributors:
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    12
# Nokia Corporation - initial contribution.
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    13
#
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    14
# Contributors:
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    15
#
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    16
# Description:
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    17
# Determine hosttype
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    18
#
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    19
#
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    20
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    21
# Print out a list of host information in order of significance.
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    22
# for use within Makefiles and other scripts.
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    23
# The idea is that it should be possible to use it for simple decisions
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    24
# e.g. windows/linux and more complex ones e.g. i386/x86_64
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    25
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    26
getopts de  OPT
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    27
674
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents: 0
diff changeset
    28
if [[ "${OSTYPE}" =~ "linux" || "${HOSTPLATFORM}" =~ "linux" ]]; then
0
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    29
	ARCH=$(uname -i)
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    30
        LIBC=$(echo /lib/libc-* | sed -r 's#.*/libc-([0-9]*)\.([0-9]*)(\.([0-9]*))?.so#libc\1_\2#')
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    31
        HOSTPLATFORM="linux ${ARCH} ${LIBC}"
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    32
674
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents: 0
diff changeset
    33
	# The 32-bit platform is often compatible in the sense that
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents: 0
diff changeset
    34
	# a) 32-bit programs can run on the 64-bit OS.
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents: 0
diff changeset
    35
	# b) a 64-bit OS can tell the compiler to create 32-bit executables.
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents: 0
diff changeset
    36
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents: 0
diff changeset
    37
       	ARCH32="i386"
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents: 0
diff changeset
    38
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents: 0
diff changeset
    39
	# deal with ubuntu/debian:
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents: 0
diff changeset
    40
	if [ "$ARCH" == "unknown" ]; then
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents: 0
diff changeset
    41
		ARCH32="${ARCH}"
0
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    42
	fi
674
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents: 0
diff changeset
    43
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents: 0
diff changeset
    44
       	HOSTPLATFORM_DIR="linux-${ARCH}-${LIBC}"
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents: 0
diff changeset
    45
       	HOSTPLATFORM32_DIR="linux-${ARCH32}-${LIBC}"
0
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    46
	
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    47
elif [[ "$OS" == "Windows_NT" ]]; then
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    48
	HOSTPLATFORM="win 32"
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    49
	HOSTPLATFORM_DIR="win32"
674
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents: 0
diff changeset
    50
	HOSTPLATFORM32_DIR="win32"
0
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    51
else
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    52
	HOSTPLATFORM=unknown
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    53
	HOSTPLATFORM_DIR=unknown
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    54
fi
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    55
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    56
if [ "$OPT" == "e" ]; then 
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    57
	echo "export HOSTPLATFORM_DIR=$HOSTPLATFORM_DIR"
674
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents: 0
diff changeset
    58
	echo "export HOSTPLATFORM32_DIR=$HOSTPLATFORM32_DIR"
0
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    59
	echo "export HOSTPLATFORM='$HOSTPLATFORM'"
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    60
elif [ "$OPT" == "d" ]; then 
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    61
	echo "$HOSTPLATFORM_DIR"
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    62
else
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    63
	echo "$HOSTPLATFORM"
044383f39525 Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    64
fi