2017-12-09 21:51:48 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if [ ! $# -eq 1 ]; then
|
|
|
|
echo "usage: $0 <config>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-02-09 18:06:16 +01:00
|
|
|
BOARD="$1"
|
2017-12-09 21:51:48 +01:00
|
|
|
|
|
|
|
################################ basic setup ################################
|
|
|
|
BUILDROOT=$(pwd)
|
|
|
|
SCRIPTDIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
|
|
|
|
NUMJOBS=$(grep -e "^processor" /proc/cpuinfo | wc -l)
|
|
|
|
HOSTTUPLE=$(uname -m)-$OSTYPE
|
|
|
|
|
2018-02-09 18:06:16 +01:00
|
|
|
TCDIR="$BUILDROOT/$BOARD/toolchain"
|
|
|
|
PKGBUILDDIR="$BUILDROOT/$BOARD/build"
|
2017-12-09 21:51:48 +01:00
|
|
|
PKGSRCDIR="$BUILDROOT/src"
|
2018-02-09 18:06:16 +01:00
|
|
|
PKGDEPLOYDIR="$BUILDROOT/$BOARD/deploy"
|
|
|
|
PKGLOGDIR="$BUILDROOT/$BOARD/log"
|
2017-12-09 21:51:48 +01:00
|
|
|
PKGDOWNLOADDIR="$BUILDROOT/download"
|
2018-02-09 18:06:16 +01:00
|
|
|
PACKAGELIST="$BUILDROOT/$BOARD/pkglist"
|
2017-12-09 21:51:48 +01:00
|
|
|
|
2018-02-16 18:45:25 +01:00
|
|
|
mkdir -p "$PKGDOWNLOADDIR" "$PKGSRCDIR" "$PKGLOGDIR"
|
2017-12-09 21:51:48 +01:00
|
|
|
mkdir -p "$PKGDEPLOYDIR" "$TCDIR/bin"
|
|
|
|
|
|
|
|
export PATH="$TCDIR/bin:$PATH"
|
|
|
|
|
2018-02-09 18:06:16 +01:00
|
|
|
source "$SCRIPTDIR/board/$BOARD/TOOLCHAIN"
|
2017-12-09 21:51:48 +01:00
|
|
|
|
|
|
|
mkdir -p "$TCDIR/$TARGET"
|
|
|
|
|
|
|
|
CMAKETCFILE="$TCDIR/toolchain.cmake"
|
|
|
|
|
2018-02-14 13:07:23 +01:00
|
|
|
pushd "$SCRIPTDIR" > /dev/null
|
|
|
|
OS_NAME="Pygos"
|
2018-02-15 12:17:22 +01:00
|
|
|
OS_RELEASE=$(git describe --always --tags --dirty)
|
2018-02-14 13:07:23 +01:00
|
|
|
popd > /dev/null
|
|
|
|
|
2017-12-09 21:51:48 +01:00
|
|
|
############################# include utilities ##############################
|
|
|
|
source "$SCRIPTDIR/util/depends.sh"
|
|
|
|
source "$SCRIPTDIR/util/download.sh"
|
|
|
|
source "$SCRIPTDIR/util/pkgcmd.sh"
|
|
|
|
source "$SCRIPTDIR/util/toolchain.sh"
|
|
|
|
source "$SCRIPTDIR/util/cmake.sh"
|
2018-02-09 18:49:17 +01:00
|
|
|
source "$SCRIPTDIR/util/misc.sh"
|
2017-12-09 21:51:48 +01:00
|
|
|
|
|
|
|
############################### build packages ###############################
|
|
|
|
echo "--- resolving package dependencies ---"
|
|
|
|
|
2018-02-15 23:47:54 +01:00
|
|
|
include_pkg "release-${BOARD}"
|
2018-01-24 21:48:10 +01:00
|
|
|
dependencies | tsort | tac > "$PACKAGELIST"
|
2017-12-09 21:51:48 +01:00
|
|
|
cat "$PACKAGELIST"
|
|
|
|
|
|
|
|
echo "--- downloading package files ---"
|
|
|
|
|
|
|
|
while read pkg; do
|
2018-02-15 23:47:54 +01:00
|
|
|
include_pkg "$pkg"
|
2018-01-24 21:48:10 +01:00
|
|
|
fetch_package
|
2017-12-09 21:51:48 +01:00
|
|
|
done < "$PACKAGELIST"
|
|
|
|
|
|
|
|
echo "--- building package ---"
|
|
|
|
|
|
|
|
while read pkg; do
|
2018-02-15 23:47:54 +01:00
|
|
|
include_pkg "$pkg"
|
2017-12-09 21:51:48 +01:00
|
|
|
|
2018-01-24 21:48:10 +01:00
|
|
|
install_build_deps
|
|
|
|
|
2018-02-15 23:47:54 +01:00
|
|
|
run_pkg_command "build"
|
|
|
|
run_pkg_command "deploy"
|
2017-12-09 21:51:48 +01:00
|
|
|
|
2018-02-16 18:45:25 +01:00
|
|
|
rm -rf "$PKGBUILDDIR"
|
2017-12-09 21:51:48 +01:00
|
|
|
restore_toolchain
|
|
|
|
done < "$PACKAGELIST"
|
|
|
|
|