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"
|
TARGET="i686-linux-musl"
|
||||||
GCC_CPU="i686"
|
GCC_CPU="i686"
|
||||||
MUSL_CPU="i386"
|
MUSL_CPU="i386"
|
|
@ -1,3 +1,4 @@
|
||||||
|
RELEASEPKG="release-rpi3"
|
||||||
TARGET="arm-linux-musleabihf"
|
TARGET="arm-linux-musleabihf"
|
||||||
GCC_CPU="armv6"
|
GCC_CPU="armv6"
|
||||||
MUSL_CPU="arm"
|
MUSL_CPU="arm"
|
49
mk.sh
49
mk.sh
|
@ -2,49 +2,33 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ ! $# -eq 2 ]; then
|
if [ ! $# -eq 1 ]; then
|
||||||
echo "usage: $0 <board> <product>"
|
echo "usage: $0 <product>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BOARD="$1"
|
PRODUCT="$1"
|
||||||
PRODUCT="$2"
|
|
||||||
|
|
||||||
################################ basic setup ################################
|
################################ basic setup ################################
|
||||||
BUILDROOT=$(pwd)
|
BUILDROOT=$(pwd)
|
||||||
SCRIPTDIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
|
SCRIPTDIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
|
||||||
NUMJOBS=$(grep -e "^processor" /proc/cpuinfo | wc -l)
|
NUMJOBS=$(grep -e "^processor" /proc/cpuinfo | wc -l)
|
||||||
HOSTTUPLE=$($SCRIPTDIR/util/config.guess)
|
|
||||||
|
|
||||||
if [ ! -d "$SCRIPTDIR/product/$PRODUCT" ]; then
|
LAYERCONF="$SCRIPTDIR/product/${PRODUCT}.layers"
|
||||||
echo "No configuration for this product: $PRODUCT"
|
|
||||||
|
if [ ! -f "$LAYERCONF" ]; then
|
||||||
|
echo "Cannot find layer configuration for $PRODUCT"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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"
|
PKGSRCDIR="$BUILDROOT/src"
|
||||||
PKGDEPLOYDIR="$BUILDROOT/${BOARD}-${PRODUCT}/deploy"
|
|
||||||
PKGLOGDIR="$BUILDROOT/${BOARD}-${PRODUCT}/log"
|
|
||||||
PKGDOWNLOADDIR="$BUILDROOT/download"
|
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 "$PKGDOWNLOADDIR" "$PKGSRCDIR" "$PKGLOGDIR" "$PKGDEPLOYDIR"
|
||||||
mkdir -p "$PKGDEPLOYDIR" "$TCDIR/bin"
|
|
||||||
|
|
||||||
export PATH="$TCDIR/bin:$PATH"
|
|
||||||
|
|
||||||
pushd "$SCRIPTDIR" > /dev/null
|
pushd "$SCRIPTDIR" > /dev/null
|
||||||
OS_NAME="Pygos"
|
OS_NAME="Pygos"
|
||||||
|
@ -63,14 +47,19 @@ source "$SCRIPTDIR/util/autotools.sh"
|
||||||
############################## toolchain config ##############################
|
############################## toolchain config ##############################
|
||||||
include_merge "TOOLCHAIN"
|
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"
|
CMAKETCFILE="$TCDIR/toolchain.cmake"
|
||||||
|
|
||||||
############################### build packages ###############################
|
############################### build packages ###############################
|
||||||
echo "--- resolving package dependencies ---"
|
echo "--- resolving package dependencies ---"
|
||||||
|
|
||||||
include_pkg "release-${BOARD}"
|
include_pkg "$RELEASEPKG"
|
||||||
dependencies | tsort | tac > "$PACKAGELIST"
|
dependencies | tsort | tac > "$PACKAGELIST"
|
||||||
cat "$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() {
|
file_path_override() {
|
||||||
if [ -e "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1" ]; then
|
local layer
|
||||||
echo "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1"
|
|
||||||
return
|
tac "$LAYERCONF" | while read layer; do
|
||||||
fi
|
if [ -e "$SCRIPTDIR/layer/$layer/$1" ]; then
|
||||||
if [ -e "$SCRIPTDIR/product/$PRODUCT/$1" ]; then
|
echo "$SCRIPTDIR/layer/$layer/$1"
|
||||||
echo "$SCRIPTDIR/product/$PRODUCT/$1"
|
return
|
||||||
return
|
fi
|
||||||
fi
|
done
|
||||||
if [ -e "$SCRIPTDIR/board/$BOARD/$1" ]; then
|
|
||||||
echo "$SCRIPTDIR/board/$BOARD/$1"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cat_file_override() {
|
cat_file_override() {
|
||||||
|
@ -22,15 +18,13 @@ cat_file_override() {
|
||||||
}
|
}
|
||||||
|
|
||||||
cat_file_merge() {
|
cat_file_merge() {
|
||||||
if [ -e "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1" ]; then
|
local layer
|
||||||
cat "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1"
|
|
||||||
fi
|
while read layer; do
|
||||||
if [ -e "$SCRIPTDIR/product/$PRODUCT/$1" ]; then
|
if [ -e "$SCRIPTDIR/layer/$layer/$1" ]; then
|
||||||
cat "$SCRIPTDIR/product/$PRODUCT/$1"
|
cat "$SCRIPTDIR/layer/$layer/$1"
|
||||||
fi
|
fi
|
||||||
if [ -e "$SCRIPTDIR/board/$BOARD/$1" ]; then
|
done < "$LAYERCONF"
|
||||||
cat "$SCRIPTDIR/board/$BOARD/$1"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
include_override() {
|
include_override() {
|
||||||
|
@ -42,13 +36,11 @@ include_override() {
|
||||||
}
|
}
|
||||||
|
|
||||||
include_merge() {
|
include_merge() {
|
||||||
if [ -e "$SCRIPTDIR/board/$BOARD/$1" ]; then
|
local layer
|
||||||
source "$SCRIPTDIR/board/$BOARD/$1"
|
|
||||||
fi
|
while read layer; do
|
||||||
if [ -e "$SCRIPTDIR/product/$PRODUCT/$1" ]; then
|
if [ -e "$SCRIPTDIR/layer/$layer/$1" ]; then
|
||||||
source "$SCRIPTDIR/product/$PRODUCT/$1"
|
source "$SCRIPTDIR/layer/$layer/$1"
|
||||||
fi
|
fi
|
||||||
if [ -e "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1" ]; then
|
done < "$LAYERCONF"
|
||||||
source "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue