2016-11-26 16:23:29 +01:00
|
|
|
#!/bin/bash
|
2017-01-20 01:54:11 +01:00
|
|
|
|
|
|
|
# This file is part of Jehanne.
|
|
|
|
#
|
|
|
|
# Copyright (C) 2016-2017 Giacomo Tesio <giacomo@tesio.it>
|
|
|
|
|
2016-11-26 16:23:29 +01:00
|
|
|
set -e
|
|
|
|
|
2017-08-12 00:27:25 +02:00
|
|
|
if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2016-11-26 16:23:29 +01:00
|
|
|
cd `dirname $0`
|
|
|
|
cd ..
|
|
|
|
export JEHANNE=`pwd`
|
2017-04-23 14:03:18 +02:00
|
|
|
CROSS_TOOLCHAIN=$JEHANNE/hacking/cross/toolchain
|
2016-11-26 16:23:29 +01:00
|
|
|
export PATH="$JEHANNE/hacking/bin:$PATH"
|
|
|
|
export PATH="$JEHANNE/hacking/cross/toolchain/bin:$PATH"
|
|
|
|
export ARCH=amd64
|
2016-11-26 21:20:31 +01:00
|
|
|
|
2017-04-23 14:03:18 +02:00
|
|
|
# since our cross compiler is inside the system root, we need this too
|
|
|
|
# as it can't find it's own headers
|
|
|
|
export CPATH=$CROSS_TOOLCHAIN/lib/gcc/x86_64-jehanne/4.9.4/include:$CROSS_TOOLCHAIN/lib/gcc/x86_64-jehanne/4.9.4/include-fixed
|
|
|
|
|
2016-11-26 16:23:29 +01:00
|
|
|
git clean -xdf arch/ sys/ qa/ usr/
|
|
|
|
if [ ! -f "$JEHANNE/hacking/bin/ufs" ]; then
|
|
|
|
echo "Cannot find build tools in $JEHANNE/hacking/bin"
|
2016-11-26 21:20:31 +01:00
|
|
|
$JEHANNE/hacking/buildtools.sh --no-drawterm
|
2016-11-26 16:23:29 +01:00
|
|
|
fi
|
|
|
|
if [ ! -f "$JEHANNE/hacking/cross/toolchain/bin/x86_64-jehanne-gcc" ]; then
|
|
|
|
echo "Cannot find cross-compiling toolchain in $JEHANNE/hacking/bin"
|
|
|
|
if [ -f "$JEHANNE/tmp/toolchain/bin/x86_64-jehanne-gcc" ]; then
|
|
|
|
echo "Found cross-compiling toolchain in $JEHANNE/tmp/toolchain/"
|
2016-11-26 17:55:21 +01:00
|
|
|
mv $JEHANNE/tmp/toolchain/* $JEHANNE/hacking/cross/toolchain/
|
2016-11-26 16:23:29 +01:00
|
|
|
else
|
|
|
|
echo "Creating cross-compiling toolchain..."
|
|
|
|
(cd $JEHANNE/hacking/cross/; ./init.sh)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
2016-11-26 21:20:31 +01:00
|
|
|
if [ "$1" != "prepare" ]; then
|
2016-11-26 21:59:01 +01:00
|
|
|
export TOOLPREFIX=x86_64-jehanne-
|
|
|
|
export CC=x86_64-jehanne-gcc
|
2016-11-26 21:20:31 +01:00
|
|
|
build all
|
|
|
|
fi
|
2016-11-26 16:23:29 +01:00
|
|
|
|
|
|
|
if [ "$TRAVIS_BUILD_DIR" != "" ]; then
|
|
|
|
echo "Move cross-compiling toolchain to $JEHANNE/tmp/toolchain for Travis caches"
|
2016-11-26 17:55:21 +01:00
|
|
|
if [ ! -d "$JEHANNE/tmp/toolchain" ]; then
|
|
|
|
mkdir $JEHANNE/tmp/toolchain
|
|
|
|
fi
|
|
|
|
mv $JEHANNE/hacking/cross/toolchain/* $JEHANNE/tmp/toolchain/
|
2016-11-26 16:23:29 +01:00
|
|
|
fi
|