mirror of
https://github.com/pygos/build.git
synced 2024-11-22 02:59:47 +01:00
Restructure build system configuration
Add a generic, stackable layer based structure instead of special purpose subdirectories with specific behaviour. Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
This commit is contained in:
parent
de14b86043
commit
c7231478d5
34 changed files with 49 additions and 62 deletions
|
@ -1,3 +1,4 @@
|
|||
RELEASEPKG="release-alix"
|
||||
TARGET="i686-linux-musl"
|
||||
GCC_CPU="i686"
|
||||
MUSL_CPU="i386"
|
|
@ -1,3 +1,4 @@
|
|||
RELEASEPKG="release-rpi3"
|
||||
TARGET="arm-linux-musleabihf"
|
||||
GCC_CPU="armv6"
|
||||
MUSL_CPU="arm"
|
49
mk.sh
49
mk.sh
|
@ -2,49 +2,33 @@
|
|||
|
||||
set -e
|
||||
|
||||
if [ ! $# -eq 2 ]; then
|
||||
echo "usage: $0 <board> <product>"
|
||||
if [ ! $# -eq 1 ]; then
|
||||
echo "usage: $0 <product>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BOARD="$1"
|
||||
PRODUCT="$2"
|
||||
PRODUCT="$1"
|
||||
|
||||
################################ basic setup ################################
|
||||
BUILDROOT=$(pwd)
|
||||
SCRIPTDIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
|
||||
NUMJOBS=$(grep -e "^processor" /proc/cpuinfo | wc -l)
|
||||
HOSTTUPLE=$($SCRIPTDIR/util/config.guess)
|
||||
|
||||
if [ ! -d "$SCRIPTDIR/product/$PRODUCT" ]; then
|
||||
echo "No configuration for this product: $PRODUCT"
|
||||
LAYERCONF="$SCRIPTDIR/product/${PRODUCT}.layers"
|
||||
|
||||
if [ ! -f "$LAYERCONF" ]; then
|
||||
echo "Cannot find layer configuration for $PRODUCT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$SCRIPTDIR/board/$BOARD" ]; then
|
||||
echo "No configuration for this board: $BOARD"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -e "$SCRIPTDIR/product/$PRODUCT/BOARDS" ]; then
|
||||
if ! grep -q "$BOARD" "$SCRIPTDIR/product/$PRODUCT/BOARDS"; then
|
||||
echo "Error, $PRODUCT cannot be built for $BOARD"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
TCDIR="$BUILDROOT/${BOARD}-${PRODUCT}/toolchain"
|
||||
PKGBUILDDIR="$BUILDROOT/${BOARD}-${PRODUCT}/build"
|
||||
PKGSRCDIR="$BUILDROOT/src"
|
||||
PKGDEPLOYDIR="$BUILDROOT/${BOARD}-${PRODUCT}/deploy"
|
||||
PKGLOGDIR="$BUILDROOT/${BOARD}-${PRODUCT}/log"
|
||||
PKGDOWNLOADDIR="$BUILDROOT/download"
|
||||
PACKAGELIST="$BUILDROOT/${BOARD}-${PRODUCT}/pkglist"
|
||||
PKGBUILDDIR="$BUILDROOT/$PRODUCT/build"
|
||||
PKGDEPLOYDIR="$BUILDROOT/$PRODUCT/deploy"
|
||||
PKGLOGDIR="$BUILDROOT/$PRODUCT/log"
|
||||
PACKAGELIST="$BUILDROOT/$PRODUCT/pkglist"
|
||||
|
||||
mkdir -p "$PKGDOWNLOADDIR" "$PKGSRCDIR" "$PKGLOGDIR"
|
||||
mkdir -p "$PKGDEPLOYDIR" "$TCDIR/bin"
|
||||
|
||||
export PATH="$TCDIR/bin:$PATH"
|
||||
mkdir -p "$PKGDOWNLOADDIR" "$PKGSRCDIR" "$PKGLOGDIR" "$PKGDEPLOYDIR"
|
||||
|
||||
pushd "$SCRIPTDIR" > /dev/null
|
||||
OS_NAME="Pygos"
|
||||
|
@ -63,14 +47,19 @@ source "$SCRIPTDIR/util/autotools.sh"
|
|||
############################## toolchain config ##############################
|
||||
include_merge "TOOLCHAIN"
|
||||
|
||||
mkdir -p "$TCDIR/$TARGET"
|
||||
HOSTTUPLE=$($SCRIPTDIR/util/config.guess)
|
||||
TCDIR="$BUILDROOT/$PRODUCT/toolchain"
|
||||
|
||||
export PATH="$TCDIR/bin:$PATH"
|
||||
|
||||
mkdir -p "$TCDIR/$TARGET" "$TCDIR/bin"
|
||||
|
||||
CMAKETCFILE="$TCDIR/toolchain.cmake"
|
||||
|
||||
############################### build packages ###############################
|
||||
echo "--- resolving package dependencies ---"
|
||||
|
||||
include_pkg "release-${BOARD}"
|
||||
include_pkg "$RELEASEPKG"
|
||||
dependencies | tsort | tac > "$PACKAGELIST"
|
||||
cat "$PACKAGELIST"
|
||||
|
||||
|
|
3
product/router-alix.layers
Normal file
3
product/router-alix.layers
Normal file
|
@ -0,0 +1,3 @@
|
|||
bsp-alix
|
||||
router-base
|
||||
router-alix
|
3
product/router-rpi3.layers
Normal file
3
product/router-rpi3.layers
Normal file
|
@ -0,0 +1,3 @@
|
|||
bsp-rpi3
|
||||
router-base
|
||||
router-rpi3
|
|
@ -1,2 +0,0 @@
|
|||
rpi3
|
||||
alix
|
|
@ -1,16 +1,12 @@
|
|||
file_path_override() {
|
||||
if [ -e "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1" ]; then
|
||||
echo "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1"
|
||||
return
|
||||
fi
|
||||
if [ -e "$SCRIPTDIR/product/$PRODUCT/$1" ]; then
|
||||
echo "$SCRIPTDIR/product/$PRODUCT/$1"
|
||||
return
|
||||
fi
|
||||
if [ -e "$SCRIPTDIR/board/$BOARD/$1" ]; then
|
||||
echo "$SCRIPTDIR/board/$BOARD/$1"
|
||||
return
|
||||
fi
|
||||
local layer
|
||||
|
||||
tac "$LAYERCONF" | while read layer; do
|
||||
if [ -e "$SCRIPTDIR/layer/$layer/$1" ]; then
|
||||
echo "$SCRIPTDIR/layer/$layer/$1"
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
cat_file_override() {
|
||||
|
@ -22,15 +18,13 @@ cat_file_override() {
|
|||
}
|
||||
|
||||
cat_file_merge() {
|
||||
if [ -e "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1" ]; then
|
||||
cat "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1"
|
||||
fi
|
||||
if [ -e "$SCRIPTDIR/product/$PRODUCT/$1" ]; then
|
||||
cat "$SCRIPTDIR/product/$PRODUCT/$1"
|
||||
fi
|
||||
if [ -e "$SCRIPTDIR/board/$BOARD/$1" ]; then
|
||||
cat "$SCRIPTDIR/board/$BOARD/$1"
|
||||
fi
|
||||
local layer
|
||||
|
||||
while read layer; do
|
||||
if [ -e "$SCRIPTDIR/layer/$layer/$1" ]; then
|
||||
cat "$SCRIPTDIR/layer/$layer/$1"
|
||||
fi
|
||||
done < "$LAYERCONF"
|
||||
}
|
||||
|
||||
include_override() {
|
||||
|
@ -42,13 +36,11 @@ include_override() {
|
|||
}
|
||||
|
||||
include_merge() {
|
||||
if [ -e "$SCRIPTDIR/board/$BOARD/$1" ]; then
|
||||
source "$SCRIPTDIR/board/$BOARD/$1"
|
||||
fi
|
||||
if [ -e "$SCRIPTDIR/product/$PRODUCT/$1" ]; then
|
||||
source "$SCRIPTDIR/product/$PRODUCT/$1"
|
||||
fi
|
||||
if [ -e "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1" ]; then
|
||||
source "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1"
|
||||
fi
|
||||
local layer
|
||||
|
||||
while read layer; do
|
||||
if [ -e "$SCRIPTDIR/layer/$layer/$1" ]; then
|
||||
source "$SCRIPTDIR/layer/$layer/$1"
|
||||
fi
|
||||
done < "$LAYERCONF"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue