2017-12-09 21:51:48 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2018-09-23 12:35:57 +02:00
|
|
|
if [ ! $# -eq 1 ]; then
|
|
|
|
echo "usage: $0 <product>"
|
2017-12-09 21:51:48 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-09-23 12:35:57 +02:00
|
|
|
PRODUCT="$1"
|
2017-12-09 21:51:48 +01:00
|
|
|
|
|
|
|
################################ basic setup ################################
|
2019-03-06 16:12:08 +01:00
|
|
|
BUILDROOT="$(pwd)/$PRODUCT"
|
2017-12-09 21:51:48 +01:00
|
|
|
SCRIPTDIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
|
|
|
|
NUMJOBS=$(grep -e "^processor" /proc/cpuinfo | wc -l)
|
|
|
|
|
2018-09-23 12:35:57 +02:00
|
|
|
LAYERCONF="$SCRIPTDIR/product/${PRODUCT}.layers"
|
2018-02-20 21:30:34 +01:00
|
|
|
|
2018-09-23 12:35:57 +02:00
|
|
|
if [ ! -f "$LAYERCONF" ]; then
|
|
|
|
echo "Cannot find layer configuration for $PRODUCT"
|
2018-02-20 21:30:34 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-03-06 16:12:08 +01:00
|
|
|
PKGSRCDIR="$(pwd)/src"
|
|
|
|
PKGDOWNLOADDIR="$(pwd)/download"
|
|
|
|
PKGBUILDDIR="$BUILDROOT/build"
|
|
|
|
PKGDEPLOYDIR="$BUILDROOT/deploy"
|
|
|
|
PKGLOGDIR="$BUILDROOT/log"
|
|
|
|
PACKAGELIST="$BUILDROOT/pkglist"
|
|
|
|
REPODIR="$BUILDROOT/repo"
|
|
|
|
DEPENDSLIST="$BUILDROOT/depends"
|
|
|
|
PROVIDESLIST="$BUILDROOT/provides"
|
2017-12-09 21:51:48 +01:00
|
|
|
|
2019-03-05 15:09:34 +01:00
|
|
|
mkdir -p "$PKGDOWNLOADDIR" "$PKGSRCDIR" "$PKGLOGDIR"
|
2019-01-30 14:18:25 +01:00
|
|
|
mkdir -p "$REPODIR"
|
2017-12-09 21:51:48 +01:00
|
|
|
|
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/download.sh"
|
|
|
|
source "$SCRIPTDIR/util/pkgcmd.sh"
|
2018-02-09 18:49:17 +01:00
|
|
|
source "$SCRIPTDIR/util/misc.sh"
|
2018-05-10 14:42:43 +02:00
|
|
|
source "$SCRIPTDIR/util/override.sh"
|
2018-09-02 14:19:23 +02:00
|
|
|
source "$SCRIPTDIR/util/autotools.sh"
|
2019-03-09 17:15:58 +01:00
|
|
|
source "$SCRIPTDIR/util/build_package.sh"
|
2017-12-09 21:51:48 +01:00
|
|
|
|
2018-05-10 14:41:13 +02:00
|
|
|
############################## toolchain config ##############################
|
|
|
|
include_merge "TOOLCHAIN"
|
|
|
|
|
2018-09-23 12:35:57 +02:00
|
|
|
HOSTTUPLE=$($SCRIPTDIR/util/config.guess)
|
2019-03-06 16:12:08 +01:00
|
|
|
TCDIR="$BUILDROOT/toolchain"
|
2018-09-23 12:35:57 +02:00
|
|
|
|
|
|
|
export PATH="$TCDIR/bin:$PATH"
|
|
|
|
|
|
|
|
mkdir -p "$TCDIR/$TARGET" "$TCDIR/bin"
|
2018-05-10 14:41:13 +02:00
|
|
|
|
|
|
|
CMAKETCFILE="$TCDIR/toolchain.cmake"
|
|
|
|
|
2017-12-09 21:51:48 +01:00
|
|
|
############################### build packages ###############################
|
2019-03-09 17:25:33 +01:00
|
|
|
echo "--- boot strap phase ---"
|
|
|
|
|
|
|
|
for pkg in tc-pkgtool; do
|
|
|
|
include_pkg "$pkg"
|
|
|
|
fetch_package
|
|
|
|
build_package
|
|
|
|
done
|
|
|
|
|
2017-12-09 21:51:48 +01:00
|
|
|
echo "--- resolving package dependencies ---"
|
|
|
|
|
2019-02-27 14:22:03 +01:00
|
|
|
truncate -s 0 $DEPENDSLIST $PROVIDESLIST
|
|
|
|
|
|
|
|
for pkg in $SCRIPTDIR/pkg/*; do
|
|
|
|
include_pkg $(basename $pkg)
|
|
|
|
|
|
|
|
for DEP in $SUBPKG; do
|
|
|
|
echo "$PKGNAME,$DEP" >> "$PROVIDESLIST"
|
|
|
|
done
|
|
|
|
for DEP in $DEPENDS; do
|
|
|
|
echo "$PKGNAME,$DEP" >> "$DEPENDSLIST"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
2019-03-09 17:26:07 +01:00
|
|
|
pkg buildstrategy -p "$PROVIDESLIST" -d "$DEPENDSLIST" "$RELEASEPKG" \
|
|
|
|
> "$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"
|
|
|
|
|
2018-02-19 12:43:22 +01:00
|
|
|
echo "--- building packages ---"
|
2017-12-09 21:51:48 +01:00
|
|
|
|
|
|
|
while read pkg; do
|
2019-03-06 21:15:42 +01:00
|
|
|
include_pkg "$pkg"
|
2019-03-09 17:15:58 +01:00
|
|
|
build_package
|
2017-12-09 21:51:48 +01:00
|
|
|
done < "$PACKAGELIST"
|
|
|
|
|
2018-02-19 12:43:22 +01:00
|
|
|
echo "--- done ---"
|