summaryrefslogtreecommitdiff
path: root/scripts/bitbake
blob: 39d5957078c199d39b7273a14173d7a2e89fd915 (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
#!/bin/sh

export BBFETCH2=True
export BB_ENV_EXTRAWHITE="PSEUDO_BUILD PSEUDO_DISABLED $BB_ENV_EXTRAWHITE"

NO_BUILD_OPTS="--version -h --help -p --parse-only -s --show-versions -e --environment -g --graphviz"
needpseudo="1"
for opt in $@; do
for key in $NO_BUILD_OPTS; do
    if [ $opt = $key ]
    then
        needpseudo="0"
        break
    fi
done
[ $needpseudo = "0" ] && break
done

buildpseudo="1"
if [ $needpseudo = "1" ] && [ -e "$BUILDDIR/pseudodone" ]; then
    PSEUDOBINDIR=`cat $BUILDDIR/pseudodone`
    if [ -e "$PSEUDOBINDIR/pseudo" -a -e "$PSEUDOBINDIR/tar" ]; then
        buildpseudo="0"
    fi
fi
if [ $needpseudo = "0" ]; then
    buildpseudo="0"
fi

OLDPATH=$PATH
export PATH=`echo $PATH | sed s#[^:]*/scripts:##`
if [ $buildpseudo = "1" ]; then
    echo "Pseudo is not present but is required, building this first before the main build"
    export PSEUDO_BUILD=1
    bitbake pseudo-native tar-replacement-native -c populate_sysroot
    ret=$?
    if [ "$ret" != "0" ]; then
        exit 1
    fi
    PSEUDOBINDIR=`bitbake -e | grep STAGING_BINDIR_NATIVE=\" | cut -d '=' -f2 | cut -d '"' -f2`
    ret=$?
    if [ "$ret" != "0" ]; then
        exit 1
    fi
    echo $PSEUDOBINDIR > $BUILDDIR/pseudodone
    # This needs to exist in case pseudo has to log somewhere
    mkdir -p $PSEUDOBINDIR/../../var/pseudo
fi
BITBAKE=`which bitbake`
export PATH=$OLDPATH
if [ $needpseudo = "1" ]; then
    export PSEUDO_BUILD=2
    PSEUDOBINDIR=`cat $BUILDDIR/pseudodone`
    PSEUDO_BINDIR=$PSEUDOBINDIR PSEUDO_LIBDIR=$PSEUDOBINDIR/../lib/pseudo/lib PSEUDO_PREFIX=$PSEUDOBINDIR/../../ PSEUDO_DISABLED=1 $PSEUDOBINDIR/pseudo $BITBAKE $@
else
    export PSEUDO_BUILD=0
    $BITBAKE $@
fi
ret=$?
exit $ret