blob: 0bfd201ffdbb2e840a9d607fdbc68b755f88f5f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#!/bin/bash
# sb2-init - Copyright (C) 2007 Lauri Leukkunen <lle@rahina.org>
# Licensed under GPL version 2
if [[ "$1" = "" || "$1" = "--help" ]]; then
echo "Usage: sb2-init [compiler]"
echo "example: sb2-init arm-linux-gcc"
exit 0
fi
GCC=$1
GCC_FULLPATH=$(which $GCC)
# test that gcc exists and can be executed
if [ $? != 0 ]; then
echo "$GCC doesn't exist"
exit 1
fi
GCC_PATH=$(dirname $(which $GCC))
if [ $GCC -v > /dev/null 2>&1 != 0 ]; then
echo "Invalid compiler specified: $GCC"
exit 1
fi
GCC_PREFIX=$(basename $GCC | sed 's/-gcc$/-/')
ARCH=$($GCC -dumpmachine | awk -F- '{ print $1 }')
QEMU=$(which qemu-$ARCH)
if [ $? != 0 ]; then
echo "You don't have qemu-$ARCH installed."
exit 1
fi
function write_sb2config()
{
cat - > sb2.config <<EOF
# Scratchbox2 configuration file generated by sb2-init.
SBOX_CPU=$ARCH
SBOX_OS=none-linux-gnueabi
SBOX_CPUTRANSPARENCY_METHOD=$QEMU
SBOX_DEFAULT_GCC_PREFIX=$GCC_PREFIX
SBOX_CROSS_GCC_NAME=cross-gcc
SBOX_CROSS_GCC_PREFIX_LIST=$ARCH-linux-gnueabi-:$ARCH-linux-:$GCC_PREFIX
SBOX_CROSS_GCC_SUBST_PREFIX=$GCC_PREFIX
SBOX_CROSS_GCC_SPECS_FILE=
SBOX_CROSS_GCC_DIR=$GCC_PATH
SBOX_CROSS_GCC_LD_ARGS=
SBOX_HOST_GCC_NAME=host-gcc
SBOX_HOST_GCC_PREFIX_LIST=host-
SBOX_HOST_GCC_SUBST_PREFIX=
SBOX_HOST_GCC_SPECS_FILE=
SBOX_HOST_GCC_DIR=/usr/bin
SBOX_HOST_GCC_LD_ARGS=
EOF
echo "Finished writing sb2.config"
}
write_sb2config
|