mirror of
https://github.com/pygos/build.git
synced 2024-10-31 17:35:37 +01:00
David Oberhollenzer
268c0a605b
This commit renames the release packages so they all produce a single package named "release", creates a preference listing from the PREFERED_PROVIDER array and lets `pkg buildstrategy` decide what package to build. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
103 lines
2.4 KiB
Bash
Executable file
103 lines
2.4 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
if [ ! $# -eq 1 ]; then
|
|
echo "usage: $0 <product>"
|
|
exit 1
|
|
fi
|
|
|
|
PRODUCT="$1"
|
|
|
|
################################ basic setup ################################
|
|
BUILDROOT="$(pwd)/$PRODUCT"
|
|
SCRIPTDIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
|
|
NUMJOBS=$(grep -e "^processor" /proc/cpuinfo | wc -l)
|
|
|
|
LAYERCONF="$SCRIPTDIR/product/${PRODUCT}.layers"
|
|
|
|
if [ ! -f "$LAYERCONF" ]; then
|
|
echo "Cannot find layer configuration for $PRODUCT"
|
|
exit 1
|
|
fi
|
|
|
|
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"
|
|
PREFERESLIST="$BUILDROOT/preferes"
|
|
|
|
declare -A PREFERED_PROVIDER
|
|
|
|
mkdir -p "$PKGDOWNLOADDIR" "$PKGSRCDIR" "$PKGLOGDIR"
|
|
mkdir -p "$REPODIR"
|
|
|
|
pushd "$SCRIPTDIR" > /dev/null
|
|
OS_NAME="Pygos"
|
|
OS_RELEASE=$(git describe --always --tags --dirty)
|
|
popd > /dev/null
|
|
|
|
############################# include utilities ##############################
|
|
source "$SCRIPTDIR/util/download.sh"
|
|
source "$SCRIPTDIR/util/pkgcmd.sh"
|
|
source "$SCRIPTDIR/util/misc.sh"
|
|
source "$SCRIPTDIR/util/override.sh"
|
|
source "$SCRIPTDIR/util/autotools.sh"
|
|
source "$SCRIPTDIR/util/build_package.sh"
|
|
|
|
############################## toolchain config ##############################
|
|
include_merge "TOOLCHAIN"
|
|
|
|
HOSTTUPLE=$($SCRIPTDIR/util/config.guess)
|
|
TCDIR="$BUILDROOT/toolchain"
|
|
|
|
export PATH="$TCDIR/bin:$PATH"
|
|
|
|
mkdir -p "$TCDIR/$TARGET" "$TCDIR/bin"
|
|
|
|
CMAKETCFILE="$TCDIR/toolchain.cmake"
|
|
|
|
############################### build packages ###############################
|
|
echo "--- boot strap phase ---"
|
|
|
|
for pkg in tc-pkgtool; do
|
|
include_pkg "$pkg"
|
|
build_package
|
|
done
|
|
|
|
echo "--- resolving package dependencies ---"
|
|
|
|
truncate -s 0 "$DEPENDSLIST" "$PROVIDESLIST" "$PREFERESLIST"
|
|
|
|
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
|
|
|
|
for pkg in "${!PREFERED_PROVIDER[@]}"; do
|
|
echo "$pkg,${PREFERED_PROVIDER[$pkg]}" >> "$PREFERESLIST"
|
|
done
|
|
|
|
pkg buildstrategy -p "$PROVIDESLIST" -d "$DEPENDSLIST" -P "$PREFERESLIST" \
|
|
"release" > "$PACKAGELIST"
|
|
cat "$PACKAGELIST"
|
|
|
|
echo "--- building packages ---"
|
|
|
|
while read pkg; do
|
|
include_pkg "$pkg"
|
|
build_package
|
|
done < "$PACKAGELIST"
|
|
|
|
echo "--- done ---"
|