2013-03-10 03:16:56 -03:00
|
|
|
#!/bin/bash
|
|
|
|
# script to build the latest binaries for each vehicle type, ready to upload
|
|
|
|
# Andrew Tridgell, March 2013
|
|
|
|
|
2017-08-06 04:02:46 -03:00
|
|
|
export PATH=$HOME/prefix/bin:$PATH:/bin:/usr/bin
|
2013-03-10 03:16:56 -03:00
|
|
|
|
2016-03-29 19:01:24 -03:00
|
|
|
export TMPDIR=$PWD/build.tmp.binaries
|
2013-03-10 03:16:56 -03:00
|
|
|
echo $TMDIR
|
|
|
|
rm -rf $TMPDIR
|
|
|
|
echo "Building in $TMPDIR"
|
|
|
|
|
2013-03-23 00:30:44 -03:00
|
|
|
date
|
2015-04-19 19:59:50 -03:00
|
|
|
git checkout -f master
|
2013-03-10 03:16:56 -03:00
|
|
|
githash=$(git rev-parse HEAD)
|
|
|
|
|
|
|
|
hdate=$(date +"%Y-%m/%Y-%m-%d-%H:%m")
|
|
|
|
mkdir -p binaries/$hdate
|
|
|
|
binaries=$PWD/../buildlogs/binaries
|
2015-06-23 08:43:28 -03:00
|
|
|
BASEDIR=$PWD
|
2013-03-10 03:16:56 -03:00
|
|
|
|
2014-01-22 04:00:15 -04:00
|
|
|
error_count=0
|
|
|
|
|
2013-03-23 00:30:44 -03:00
|
|
|
. config.mk
|
|
|
|
|
2015-08-19 21:13:18 -03:00
|
|
|
board_branch() {
|
|
|
|
board="$1"
|
|
|
|
case $board in
|
|
|
|
apm1|apm2)
|
|
|
|
echo "-AVR"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo ""
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2016-09-15 06:55:19 -03:00
|
|
|
# add board specific options
|
|
|
|
board_options() {
|
|
|
|
board="$1"
|
|
|
|
case $board in
|
|
|
|
bebop)
|
|
|
|
# bebop needs a static build
|
|
|
|
echo "--static"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo ""
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2016-08-09 12:33:00 -03:00
|
|
|
waf() {
|
|
|
|
if [ -x ./waf ]; then
|
|
|
|
./waf "$@"
|
|
|
|
else
|
|
|
|
./modules/waf/waf-light "$@"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-03-23 00:30:44 -03:00
|
|
|
# checkout the right version of the tree
|
|
|
|
checkout() {
|
|
|
|
vehicle="$1"
|
2017-01-09 07:02:24 -04:00
|
|
|
ctag="$2"
|
|
|
|
cboard="$3"
|
|
|
|
cframe="$4"
|
|
|
|
echo "Trying checkout $vehicle $ctag $cboard $cframe"
|
2013-03-23 00:30:44 -03:00
|
|
|
git stash
|
2017-01-09 07:02:24 -04:00
|
|
|
if [ "$ctag" = "latest" ]; then
|
2016-05-10 14:32:47 -03:00
|
|
|
vtag="master"
|
2013-03-23 00:30:44 -03:00
|
|
|
else
|
2017-01-09 07:02:24 -04:00
|
|
|
vtag="$vehicle-$ctag"
|
2013-03-23 00:30:44 -03:00
|
|
|
fi
|
2014-01-14 07:25:42 -04:00
|
|
|
|
2015-09-06 23:10:46 -03:00
|
|
|
# try frame specific tag
|
2017-01-09 07:02:24 -04:00
|
|
|
if [ -n "$cframe" ]; then
|
|
|
|
vtag2="$vtag-$cframe"
|
2015-09-06 23:10:46 -03:00
|
|
|
|
|
|
|
git checkout -f "$vtag2" && {
|
|
|
|
echo "Using frame specific tag $vtag2"
|
2016-03-28 01:01:01 -03:00
|
|
|
[ -f $BASEDIR/.gitmodules ] && git submodule update --recursive -f
|
2015-09-06 23:10:46 -03:00
|
|
|
git log -1
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
fi
|
|
|
|
|
|
|
|
# try board type specific branch extension
|
2017-01-09 07:02:24 -04:00
|
|
|
vtag2="$vtag"$(board_branch $cboard)
|
2015-02-11 15:21:03 -04:00
|
|
|
|
2015-08-19 21:13:18 -03:00
|
|
|
git checkout -f "$vtag2" && {
|
|
|
|
echo "Using board specific tag $vtag2"
|
2016-03-28 01:01:01 -03:00
|
|
|
[ -f $BASEDIR/.gitmodules ] && git submodule update --recursive -f
|
2015-08-19 21:13:18 -03:00
|
|
|
git log -1
|
|
|
|
return 0
|
2014-01-14 00:59:02 -04:00
|
|
|
}
|
2014-01-14 07:25:42 -04:00
|
|
|
|
2015-08-19 21:13:18 -03:00
|
|
|
git checkout -f "$vtag" && {
|
|
|
|
echo "Using generic tag $vtag"
|
2016-03-28 01:01:01 -03:00
|
|
|
[ -f $BASEDIR/.gitmodules ] && git submodule update --recursive -f
|
2015-08-19 21:13:18 -03:00
|
|
|
git log -1
|
|
|
|
return 0
|
|
|
|
}
|
2014-01-14 07:25:42 -04:00
|
|
|
|
2017-01-09 07:02:24 -04:00
|
|
|
echo "Failed to find tag for $vehicle $ctag $cboard $cframe"
|
2015-08-19 21:13:18 -03:00
|
|
|
return 1
|
2013-03-23 00:30:44 -03:00
|
|
|
}
|
|
|
|
|
2016-08-09 12:33:00 -03:00
|
|
|
# check if we should skip this build because we don't
|
|
|
|
# support the board in this release
|
|
|
|
skip_board_waf() {
|
|
|
|
b="$1"
|
|
|
|
if grep -q "$b" $BASEDIR/Tools/ardupilotwaf/boards.py; then
|
2016-05-29 19:25:10 -03:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
echo "Skipping unsupported board $b"
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2016-08-09 12:43:57 -03:00
|
|
|
skip_frame() {
|
2017-01-09 07:02:24 -04:00
|
|
|
sboard=$1
|
|
|
|
sframe=$2
|
2017-05-04 17:35:21 -03:00
|
|
|
if [ "$sboard" = "bebop" -o "$sboard" = "aerofc-v1" ]; then
|
2017-01-12 06:37:33 -04:00
|
|
|
if [ "$sframe" != "quad" -a "$sframe" != "none" ]; then
|
2016-08-11 09:00:25 -03:00
|
|
|
return 0
|
2016-08-09 12:43:57 -03:00
|
|
|
fi
|
|
|
|
fi
|
2016-08-11 09:00:25 -03:00
|
|
|
return 1
|
2016-08-09 12:43:57 -03:00
|
|
|
}
|
|
|
|
|
2013-03-23 00:30:44 -03:00
|
|
|
# check if we should skip this build because we have already
|
|
|
|
# built this version
|
|
|
|
skip_build() {
|
2013-12-27 19:09:40 -04:00
|
|
|
[ "$FORCE_BUILD" = "1" ] && return 1
|
2017-08-06 04:02:46 -03:00
|
|
|
buildtag="$1"
|
|
|
|
builddir="$2"
|
|
|
|
bname=$(basename $builddir)
|
|
|
|
ldir=$(dirname $(dirname $(dirname $builddir)))/$buildtag/$bname
|
2015-06-25 22:32:15 -03:00
|
|
|
[ -f $BASEDIR/.gitmodules ] || {
|
|
|
|
echo "Skipping build without submodules"
|
|
|
|
return 0
|
|
|
|
}
|
2013-03-23 00:30:44 -03:00
|
|
|
[ -d "$ldir" ] || {
|
2016-05-10 14:32:47 -03:00
|
|
|
echo "$ldir doesn't exist - building"
|
|
|
|
return 1
|
2013-03-23 00:30:44 -03:00
|
|
|
}
|
|
|
|
oldversion=$(cat "$ldir/git-version.txt" | head -1)
|
|
|
|
newversion=$(git log -1 | head -1)
|
|
|
|
[ "$oldversion" = "$newversion" ] && {
|
2016-05-10 14:32:47 -03:00
|
|
|
echo "Skipping build - version match $newversion"
|
|
|
|
return 0
|
2013-03-23 00:30:44 -03:00
|
|
|
}
|
|
|
|
echo "$ldir needs rebuild"
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2013-04-24 03:14:12 -03:00
|
|
|
addfwversion() {
|
|
|
|
destdir="$1"
|
2016-08-11 23:24:31 -03:00
|
|
|
src="$2"
|
2013-04-24 03:14:12 -03:00
|
|
|
git log -1 > "$destdir/git-version.txt"
|
2016-10-25 01:29:39 -03:00
|
|
|
versionfile="$src/version.h"
|
|
|
|
[ -f $versionfile ] && {
|
2015-05-22 01:11:20 -03:00
|
|
|
shopt -s nullglob
|
2016-10-25 01:29:39 -03:00
|
|
|
version=$(grep 'define.THISFIRMWARE' $versionfile 2> /dev/null | cut -d'"' -f2)
|
2016-05-10 14:32:47 -03:00
|
|
|
echo >> "$destdir/git-version.txt"
|
|
|
|
echo "APMVERSION: $version" >> "$destdir/git-version.txt"
|
2016-10-25 01:29:39 -03:00
|
|
|
python $BASEDIR/Tools/PrintVersion.py $src >"$destdir/firmware-version.txt"
|
2013-04-24 03:14:12 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-23 00:30:44 -03:00
|
|
|
# copy the built firmware to the right directory
|
2013-03-10 03:16:56 -03:00
|
|
|
copyit() {
|
|
|
|
file="$1"
|
|
|
|
dir="$2"
|
2013-03-23 00:30:44 -03:00
|
|
|
tag="$3"
|
2017-08-15 00:09:45 -03:00
|
|
|
src="$4"
|
2013-03-10 03:16:56 -03:00
|
|
|
bname=$(basename $dir)
|
2013-03-23 00:30:44 -03:00
|
|
|
tdir=$(dirname $(dirname $(dirname $dir)))/$tag/$bname
|
|
|
|
if [ "$tag" = "latest" ]; then
|
2016-05-10 14:32:47 -03:00
|
|
|
mkdir -p "$dir"
|
|
|
|
/bin/cp "$file" "$dir"
|
2016-08-11 23:24:31 -03:00
|
|
|
addfwversion "$dir" "$src"
|
2013-03-23 00:30:44 -03:00
|
|
|
fi
|
|
|
|
echo "Copying $file to $tdir"
|
|
|
|
mkdir -p "$tdir"
|
2016-08-11 23:24:31 -03:00
|
|
|
addfwversion "$tdir" "$src"
|
2013-04-24 03:14:12 -03:00
|
|
|
|
2013-03-23 00:30:44 -03:00
|
|
|
rsync "$file" "$tdir"
|
2013-03-10 03:16:56 -03:00
|
|
|
}
|
|
|
|
|
2015-06-23 00:43:09 -03:00
|
|
|
board_extension() {
|
|
|
|
board="$1"
|
|
|
|
case $board in
|
|
|
|
apm1|apm2)
|
|
|
|
echo "hex"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "elf"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2013-03-23 00:30:44 -03:00
|
|
|
# build plane binaries
|
|
|
|
build_arduplane() {
|
|
|
|
tag="$1"
|
2014-07-13 03:53:08 -03:00
|
|
|
echo "Building ArduPlane $tag binaries from $(pwd)"
|
2016-09-15 06:57:32 -03:00
|
|
|
for b in erlebrain2 navio navio2 pxf pxfmini disco; do
|
2016-08-09 12:33:00 -03:00
|
|
|
checkout ArduPlane $tag $b "" || {
|
|
|
|
echo "Failed checkout of ArduPlane $b $tag"
|
|
|
|
error_count=$((error_count+1))
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
skip_board_waf $b && continue
|
|
|
|
echo "Building ArduPlane $b binaries"
|
|
|
|
ddir=$binaries/Plane/$hdate/$b
|
|
|
|
skip_build $tag $ddir && continue
|
2017-08-06 04:02:46 -03:00
|
|
|
echo "Configuring for $b in $BUILDROOT"
|
|
|
|
waf configure --board $b --out $BUILDROOT clean && waf plane || {
|
2016-08-09 12:33:00 -03:00
|
|
|
echo "Failed build of ArduPlane $b $tag"
|
|
|
|
error_count=$((error_count+1))
|
|
|
|
continue
|
|
|
|
}
|
2016-08-11 23:24:31 -03:00
|
|
|
copyit $BUILDROOT/$b/bin/arduplane $ddir $tag "ArduPlane"
|
2016-08-09 12:33:00 -03:00
|
|
|
touch $binaries/Plane/$tag
|
|
|
|
done
|
2017-08-06 04:02:46 -03:00
|
|
|
|
2015-06-14 17:53:20 -03:00
|
|
|
echo "Building ArduPlane PX4 binaries"
|
|
|
|
ddir=$binaries/Plane/$hdate/PX4
|
2015-09-06 23:10:46 -03:00
|
|
|
checkout ArduPlane $tag PX4 "" || {
|
2015-06-14 17:53:20 -03:00
|
|
|
echo "Failed checkout of ArduPlane PX4 $tag"
|
|
|
|
error_count=$((error_count+1))
|
2015-09-06 23:10:46 -03:00
|
|
|
checkout ArduPlane "latest" "" ""
|
2015-06-14 17:53:20 -03:00
|
|
|
return
|
|
|
|
}
|
|
|
|
skip_build $tag $ddir || {
|
2017-08-06 04:02:46 -03:00
|
|
|
for v in v1 v2 v3 v4 v4pro; do
|
|
|
|
skip_board_waf px4-$v && continue
|
|
|
|
echo "Building plane for px4-$v in $BUILDROOT"
|
|
|
|
waf configure --board $b --out $BUILDROOT clean && waf plane || {
|
2016-09-05 05:21:50 -03:00
|
|
|
echo "Failed build of ArduPlane PX4 $tag for $v"
|
|
|
|
error_count=$((error_count+1))
|
2017-08-06 04:02:46 -03:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
cp -f $BUILDROOT/px4-$v/bin/arduplane.px4 ArduPlane-$v.px4 || {
|
|
|
|
echo "Failed build copy of ArduPlane PX4 $tag for $v"
|
|
|
|
error_count=$((error_count+1))
|
|
|
|
continue
|
2016-09-05 05:21:50 -03:00
|
|
|
}
|
2017-08-15 00:09:45 -03:00
|
|
|
copyit ArduPlane-$v.px4 $ddir $tag "ArduPlane"
|
2016-09-05 05:21:50 -03:00
|
|
|
done
|
2013-03-23 00:30:44 -03:00
|
|
|
}
|
2015-09-06 23:10:46 -03:00
|
|
|
checkout ArduPlane "latest" "" ""
|
2017-08-06 04:02:46 -03:00
|
|
|
|
2013-03-23 00:30:44 -03:00
|
|
|
}
|
2013-03-10 03:16:56 -03:00
|
|
|
|
2013-03-23 00:30:44 -03:00
|
|
|
# build copter binaries
|
|
|
|
build_arducopter() {
|
|
|
|
tag="$1"
|
2014-07-13 03:53:08 -03:00
|
|
|
echo "Building ArduCopter $tag binaries from $(pwd)"
|
2017-01-08 20:52:11 -04:00
|
|
|
|
|
|
|
# work out what frames to build by looking for FRAME_CLASS parameter
|
|
|
|
checkout ArduCopter $tag "" ""
|
2017-08-06 04:02:46 -03:00
|
|
|
frames="none heli"
|
2017-01-09 06:42:38 -04:00
|
|
|
|
|
|
|
echo "Building frames: $frames"
|
|
|
|
|
2017-01-08 20:52:11 -04:00
|
|
|
checkout ArduCopter "latest" "" ""
|
|
|
|
|
2017-05-04 17:35:21 -03:00
|
|
|
for b in erlebrain2 navio navio2 pxf pxfmini bebop aerofc-v1; do
|
2017-01-09 06:42:38 -04:00
|
|
|
echo "Building board: $b"
|
2015-06-23 00:43:09 -03:00
|
|
|
for f in $frames; do
|
2017-01-12 06:37:33 -04:00
|
|
|
if [ "$f" = "none" ]; then
|
|
|
|
framesuffix=""
|
|
|
|
else
|
|
|
|
framesuffix="-$f"
|
|
|
|
fi
|
2017-01-09 06:42:38 -04:00
|
|
|
echo "Building frame $f for board $b"
|
2015-09-06 23:10:46 -03:00
|
|
|
checkout ArduCopter $tag $b $f || {
|
|
|
|
echo "Failed checkout of ArduCopter $b $tag $f"
|
2015-06-23 00:43:09 -03:00
|
|
|
error_count=$((error_count+1))
|
|
|
|
continue
|
|
|
|
}
|
2016-08-09 12:33:00 -03:00
|
|
|
skip_board_waf $b && continue
|
2017-01-09 06:42:38 -04:00
|
|
|
echo "Building ArduCopter $tag $b binaries $f"
|
2017-01-12 06:37:33 -04:00
|
|
|
ddir=$binaries/Copter/$hdate/$b$framesuffix
|
2016-05-10 14:32:47 -03:00
|
|
|
skip_build $tag $ddir && continue
|
2016-08-09 12:43:57 -03:00
|
|
|
skip_frame $b $f && continue
|
2016-09-15 06:55:19 -03:00
|
|
|
options=$(board_options $b)
|
2017-08-06 04:02:46 -03:00
|
|
|
waf configure --board $b $options --out $BUILDROOT clean && \
|
2017-05-08 20:42:27 -03:00
|
|
|
waf build --targets bin/arducopter$framesuffix || {
|
2017-01-12 06:37:33 -04:00
|
|
|
echo "Failed build of ArduCopter $b$framesuffix $tag"
|
2015-06-23 00:43:09 -03:00
|
|
|
error_count=$((error_count+1))
|
|
|
|
continue
|
|
|
|
}
|
2017-05-08 20:20:36 -03:00
|
|
|
extension=""
|
2017-05-04 17:35:21 -03:00
|
|
|
if [ -f $BUILDROOT/$b/bin/arducopter${framesuffix}.px4 ]; then
|
2017-05-08 20:20:36 -03:00
|
|
|
extension=".px4"
|
2017-05-04 17:35:21 -03:00
|
|
|
fi
|
|
|
|
copyit $BUILDROOT/$b/bin/arducopter${framesuffix}${extension} $ddir $tag "ArduCopter"
|
2016-05-10 14:32:47 -03:00
|
|
|
touch $binaries/Copter/$tag
|
2015-06-23 00:43:09 -03:00
|
|
|
done
|
|
|
|
done
|
2015-06-14 17:53:20 -03:00
|
|
|
for f in $frames; do
|
2017-01-09 06:42:38 -04:00
|
|
|
echo "Building frame $f for board PX4"
|
2017-01-12 06:37:33 -04:00
|
|
|
if [ "$f" = "none" ]; then
|
|
|
|
framesuffix=""
|
|
|
|
else
|
|
|
|
framesuffix="-$f"
|
|
|
|
fi
|
2015-09-06 23:10:46 -03:00
|
|
|
checkout ArduCopter $tag PX4 $f || {
|
|
|
|
echo "Failed checkout of ArduCopter PX4 $tag $f"
|
|
|
|
error_count=$((error_count+1))
|
|
|
|
checkout ArduCopter "latest" "" ""
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
rm -rf ../Build.ArduCopter
|
2017-01-12 06:37:33 -04:00
|
|
|
echo "Building ArduCopter $tag PX4$framesuffix binaries"
|
|
|
|
ddir="$binaries/Copter/$hdate/PX4$framesuffix"
|
2016-05-10 14:32:47 -03:00
|
|
|
skip_build $tag $ddir && continue
|
2017-08-06 04:02:46 -03:00
|
|
|
for v in v1 v2 v3 v4 v4pro; do
|
|
|
|
skip_board_waf px4-$v && continue
|
|
|
|
waf configure --board $b --out $BUILDROOT clean && \
|
|
|
|
waf build --target bin/arducopter$framesuffix || {
|
|
|
|
echo "Failed build of ArduCopter$framesuffix PX4 $tag for $v"
|
|
|
|
error_count=$((error_count+1))
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
cp -f $BUILDROOT/px4-$v/bin/arducopter"$framesuffix".px4 ArduCopter-$v.px4 || {
|
|
|
|
echo "Failed build copy of ArduCopter$framesuffix PX4 $tag for $v"
|
2016-09-05 05:21:50 -03:00
|
|
|
error_count=$((error_count+1))
|
|
|
|
continue
|
|
|
|
}
|
2017-08-15 00:09:45 -03:00
|
|
|
copyit ArduCopter-$v.px4 $ddir $tag "ArduCopter"
|
2016-09-05 05:21:50 -03:00
|
|
|
done
|
2015-06-14 17:53:20 -03:00
|
|
|
done
|
2015-09-06 23:10:46 -03:00
|
|
|
checkout ArduCopter "latest" "" ""
|
2013-03-23 00:30:44 -03:00
|
|
|
}
|
2013-03-10 03:16:56 -03:00
|
|
|
|
2013-03-23 00:30:44 -03:00
|
|
|
# build rover binaries
|
|
|
|
build_rover() {
|
|
|
|
tag="$1"
|
2014-07-13 03:53:08 -03:00
|
|
|
echo "Building APMrover2 $tag binaries from $(pwd)"
|
2013-03-10 03:16:56 -03:00
|
|
|
pushd APMrover2
|
2016-08-09 12:33:00 -03:00
|
|
|
for b in apm1 apm2; do
|
2017-01-09 06:42:38 -04:00
|
|
|
echo "Building APMrover2 $tag $b binaries"
|
2015-09-06 23:10:46 -03:00
|
|
|
checkout APMrover2 $tag $b "" || continue
|
2017-08-06 04:02:46 -03:00
|
|
|
skip_board_waf $b && continue
|
2016-05-10 14:32:47 -03:00
|
|
|
ddir=$binaries/Rover/$hdate/$b
|
|
|
|
skip_build $tag $ddir && continue
|
|
|
|
make clean || continue
|
|
|
|
make $b -j4 || {
|
2014-01-22 04:00:15 -04:00
|
|
|
echo "Failed build of APMrover2 $b $tag"
|
|
|
|
error_count=$((error_count+1))
|
|
|
|
continue
|
|
|
|
}
|
2015-06-23 00:43:09 -03:00
|
|
|
extension=$(board_extension $b)
|
2017-08-15 00:09:45 -03:00
|
|
|
copyit $BUILDROOT/APMrover2.$extension $ddir $tag "APMrover2"
|
2016-05-10 14:32:47 -03:00
|
|
|
touch $binaries/Rover/$tag
|
2013-03-23 00:30:44 -03:00
|
|
|
done
|
2016-08-09 12:33:00 -03:00
|
|
|
popd
|
|
|
|
for b in erlebrain2 navio navio2 pxf pxfmini; do
|
2017-01-09 06:42:38 -04:00
|
|
|
echo "Building APMrover2 $tag $b binaries"
|
2016-08-09 12:33:00 -03:00
|
|
|
checkout APMrover2 $tag $b "" || continue
|
|
|
|
skip_board_waf $b && continue
|
|
|
|
ddir=$binaries/Rover/$hdate/$b
|
|
|
|
skip_build $tag $ddir && continue
|
|
|
|
waf configure --board $b --out $BUILDROOT clean rover || {
|
|
|
|
echo "Failed build of APMrover2 $b $tag"
|
|
|
|
error_count=$((error_count+1))
|
|
|
|
continue
|
|
|
|
}
|
2017-03-15 21:09:18 -03:00
|
|
|
copyit $BUILDROOT/$b/bin/ardurover $ddir $tag "APMrover2"
|
2016-08-09 12:33:00 -03:00
|
|
|
touch $binaries/Rover/$tag
|
|
|
|
done
|
2017-08-06 04:02:46 -03:00
|
|
|
|
2017-01-09 06:42:38 -04:00
|
|
|
echo "Building APMrover2 $tag PX4 binaries"
|
2015-06-14 17:53:20 -03:00
|
|
|
ddir=$binaries/Rover/$hdate/PX4
|
2015-09-06 23:10:46 -03:00
|
|
|
checkout APMrover2 $tag PX4 "" || {
|
|
|
|
checkout APMrover2 "latest" "" ""
|
2015-06-14 17:53:20 -03:00
|
|
|
return
|
|
|
|
}
|
|
|
|
skip_build $tag $ddir || {
|
2017-08-06 04:02:46 -03:00
|
|
|
for v in v1 v2 v3 v4 v4pro; do
|
|
|
|
skip_board_waf px4-$v && continue
|
|
|
|
echo "Building rover for px4-$v in $BUILDROOT"
|
|
|
|
waf configure --board $b --out $BUILDROOT clean && waf rover || {
|
|
|
|
echo "Failed build of rover PX4 $tag for $v"
|
|
|
|
error_count=$((error_count+1))
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
cp -f $BUILDROOT/px4-$v/bin/ardurover.px4 APMrover2-$v.px4 || {
|
|
|
|
echo "Failed build copy of rover PX4 $tag for $v"
|
2016-09-05 05:21:50 -03:00
|
|
|
error_count=$((error_count+1))
|
2017-08-06 04:02:46 -03:00
|
|
|
continue
|
2016-09-05 05:21:50 -03:00
|
|
|
}
|
2017-08-15 00:09:45 -03:00
|
|
|
copyit APMrover2-$v.px4 $ddir $tag "APMrover2"
|
2016-09-05 05:21:50 -03:00
|
|
|
done
|
2013-03-23 00:30:44 -03:00
|
|
|
}
|
2015-09-06 23:10:46 -03:00
|
|
|
checkout APMrover2 "latest" "" ""
|
2013-03-23 00:30:44 -03:00
|
|
|
}
|
2013-03-10 03:16:56 -03:00
|
|
|
|
2014-08-14 00:40:50 -03:00
|
|
|
# build antenna tracker binaries
|
|
|
|
build_antennatracker() {
|
|
|
|
tag="$1"
|
|
|
|
echo "Building AntennaTracker $tag binaries from $(pwd)"
|
|
|
|
pushd AntennaTracker
|
|
|
|
for b in apm2; do
|
2017-01-09 06:42:38 -04:00
|
|
|
echo "Building AntennaTracker $tag $b binaries"
|
2015-09-06 23:10:46 -03:00
|
|
|
checkout AntennaTracker $tag $b "" || continue
|
2016-05-10 14:32:47 -03:00
|
|
|
ddir=$binaries/AntennaTracker/$hdate/$b
|
|
|
|
skip_build $tag $ddir && continue
|
|
|
|
make clean || continue
|
|
|
|
make $b -j4 || {
|
2014-08-14 00:40:50 -03:00
|
|
|
echo "Failed build of AntennaTracker $b $tag"
|
|
|
|
error_count=$((error_count+1))
|
|
|
|
continue
|
|
|
|
}
|
2015-06-23 00:43:09 -03:00
|
|
|
extension=$(board_extension $b)
|
2017-08-15 00:09:45 -03:00
|
|
|
copyit $BUILDROOT/AntennaTracker.$extension $ddir $tag "AntennaTracker"
|
2016-05-10 14:32:47 -03:00
|
|
|
touch $binaries/AntennaTracker/$tag
|
2014-08-14 00:40:50 -03:00
|
|
|
done
|
2016-08-09 12:38:40 -03:00
|
|
|
popd
|
|
|
|
for b in navio navio2; do
|
|
|
|
checkout AntennaTracker $tag $b "" || {
|
|
|
|
echo "Failed checkout of AntennaTracker $b $tag"
|
|
|
|
error_count=$((error_count+1))
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
skip_board_waf $b && continue
|
2017-01-09 06:42:38 -04:00
|
|
|
echo "Building AntennaTracker $tag $b binaries"
|
2016-08-09 12:38:40 -03:00
|
|
|
ddir=$binaries/AntennaTracker/$hdate/$b
|
|
|
|
skip_build $tag $ddir && continue
|
|
|
|
waf configure --board $b --out $BUILDROOT clean antennatracker || {
|
|
|
|
echo "Failed build of AntennaTracker $b $tag"
|
|
|
|
error_count=$((error_count+1))
|
|
|
|
continue
|
|
|
|
}
|
2016-08-11 23:24:31 -03:00
|
|
|
copyit $BUILDROOT/$b/bin/antennatracker $ddir $tag "AntennaTracker"
|
2016-08-09 12:38:40 -03:00
|
|
|
touch $binaries/AntennaTracker/$tag
|
|
|
|
done
|
2017-01-09 06:42:38 -04:00
|
|
|
echo "Building AntennaTracker $tag PX4 binaries"
|
2015-06-14 17:53:20 -03:00
|
|
|
ddir=$binaries/AntennaTracker/$hdate/PX4
|
2015-09-06 23:10:46 -03:00
|
|
|
checkout AntennaTracker $tag PX4 "" || {
|
|
|
|
checkout AntennaTracker "latest" "" ""
|
2015-06-14 17:53:20 -03:00
|
|
|
return
|
|
|
|
}
|
|
|
|
skip_build $tag $ddir || {
|
2017-08-06 04:02:46 -03:00
|
|
|
for v in v1 v2 v3 v4 v4pro; do
|
|
|
|
skip_board_waf px4-$v && continue
|
|
|
|
echo "Building antennatracker for px4-$v in $BUILDROOT"
|
|
|
|
waf configure --board $b --out $BUILDROOT clean && waf antennatracker || {
|
|
|
|
echo "Failed build of antennatracker PX4 $tag for $v"
|
2016-09-05 05:21:50 -03:00
|
|
|
error_count=$((error_count+1))
|
2017-08-06 04:02:46 -03:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
cp -f $BUILDROOT/px4-$v/bin/antennatracker.px4 AntennaTracker-$v.px4 || {
|
|
|
|
echo "Failed build copy of antennatracker PX4 $tag for $v"
|
|
|
|
error_count=$((error_count+1))
|
|
|
|
continue
|
2016-09-05 05:21:50 -03:00
|
|
|
}
|
2017-08-15 00:09:45 -03:00
|
|
|
copyit AntennaTracker-$v.px4 $ddir $tag "AntennaTracker"
|
2016-09-05 05:21:50 -03:00
|
|
|
done
|
2014-08-14 00:40:50 -03:00
|
|
|
}
|
2015-09-06 23:10:46 -03:00
|
|
|
checkout AntennaTracker "latest" "" ""
|
2014-08-14 00:40:50 -03:00
|
|
|
}
|
|
|
|
|
2017-02-24 19:25:50 -04:00
|
|
|
# build ardusub binaries
|
|
|
|
build_ardusub() {
|
|
|
|
tag="$1"
|
|
|
|
echo "Building ArduSub $tag binaries from $(pwd)"
|
|
|
|
for b in erlebrain2 navio navio2 pxf pxfmini; do
|
|
|
|
echo "Building ArduSub $tag $b binaries"
|
|
|
|
checkout ArduSub $tag $b "" || continue
|
|
|
|
skip_board_waf $b && continue
|
|
|
|
ddir=$binaries/Sub/$hdate/$b
|
|
|
|
skip_build $tag $ddir && continue
|
|
|
|
waf configure --board $b --out $BUILDROOT clean sub || {
|
|
|
|
echo "Failed build of ArduSub $b $tag"
|
|
|
|
error_count=$((error_count+1))
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
copyit $BUILDROOT/$b/bin/ardusub $ddir $tag "ArduSub"
|
|
|
|
touch $binaries/Sub/$tag
|
|
|
|
done
|
|
|
|
echo "Building ArduSub $tag PX4 binaries"
|
|
|
|
ddir=$binaries/Sub/$hdate/PX4
|
|
|
|
checkout ArduSub $tag PX4 "" || {
|
|
|
|
checkout ArduSub "latest" "" ""
|
|
|
|
return
|
|
|
|
}
|
|
|
|
skip_build $tag $ddir || {
|
2017-08-06 04:02:46 -03:00
|
|
|
for v in v1 v2 v3 v4 v4pro; do
|
|
|
|
skip_board_waf px4-$v && continue
|
|
|
|
echo "Building ArduSub for px4-$v in $BUILDROOT"
|
|
|
|
waf configure --board $b --out $BUILDROOT clean && waf sub || {
|
|
|
|
echo "Failed build of ArduSub PX4 $tag for $v"
|
|
|
|
error_count=$((error_count+1))
|
|
|
|
continue
|
|
|
|
}
|
2017-08-09 20:35:31 -03:00
|
|
|
cp -f $BUILDROOT/px4-$v/bin/ardusub.px4 ArduSub-$v.px4 || {
|
2017-08-06 04:02:46 -03:00
|
|
|
echo "Failed build copy of ArduSub PX4 $tag for $v"
|
2017-02-24 19:25:50 -04:00
|
|
|
error_count=$((error_count+1))
|
2017-08-06 04:02:46 -03:00
|
|
|
continue
|
2017-02-24 19:25:50 -04:00
|
|
|
}
|
2017-08-15 00:09:45 -03:00
|
|
|
copyit ArduSub-$v.px4 $ddir $tag "ArduSub"
|
2017-02-24 19:25:50 -04:00
|
|
|
done
|
|
|
|
}
|
|
|
|
checkout ArduSub "latest" "" ""
|
|
|
|
}
|
|
|
|
|
2015-06-23 20:36:21 -03:00
|
|
|
[ -f .gitmodules ] && {
|
|
|
|
git submodule init
|
2016-03-28 01:01:01 -03:00
|
|
|
git submodule update --recursive -f
|
2015-06-23 20:36:21 -03:00
|
|
|
}
|
2015-06-09 03:57:30 -03:00
|
|
|
|
2016-01-16 01:04:19 -04:00
|
|
|
export BUILDROOT="$TMPDIR/binaries.build"
|
|
|
|
rm -rf $BUILDROOT
|
|
|
|
|
2013-03-23 00:30:44 -03:00
|
|
|
for build in stable beta latest; do
|
|
|
|
build_arduplane $build
|
|
|
|
build_arducopter $build
|
|
|
|
build_rover $build
|
2014-08-18 01:00:16 -03:00
|
|
|
build_antennatracker $build
|
2017-02-24 19:25:50 -04:00
|
|
|
build_ardusub $build
|
2013-03-23 00:30:44 -03:00
|
|
|
done
|
|
|
|
|
2013-03-10 03:16:56 -03:00
|
|
|
rm -rf $TMPDIR
|
|
|
|
|
2017-08-16 07:34:45 -03:00
|
|
|
if ./Tools/scripts/generate_manifest.py $binaries http://firmware.ardupilot.org >$binaries/manifest.json.new; then
|
2016-03-31 21:32:18 -03:00
|
|
|
echo "Manifest generation succeeded"
|
|
|
|
# provide a pre-compressed manifest. For reference, a 7M manifest
|
|
|
|
# "gzip -9"s to 300k in 1 second, "xz -e"s to 80k in 26 seconds
|
|
|
|
gzip -9 <$binaries/manifest.json.new >$binaries/manifest.json.gz.new
|
|
|
|
mv $binaries/manifest.json.new $binaries/manifest.json
|
|
|
|
mv $binaries/manifest.json.gz.new $binaries/manifest.json.gz
|
|
|
|
else
|
|
|
|
echo "Manifest generation failed"
|
|
|
|
fi
|
|
|
|
|
2014-01-22 04:00:15 -04:00
|
|
|
exit $error_count
|