1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-22 19:19:46 +01:00
build/util/misc.sh
David Oberhollenzer 94cc2d2c46 Implement board/product config schema
- build needs a pair of product and board name
 - some products can only be built for some boards
 - Config files in product/<name> directory override those in board/<name>
 - For some config files, like LDPATH or ROOTFS, the files are merged
 - product/common provides defaults

Add default config for various services:
 - Add default config for unbound
 - Add default config for dnsmasq

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-03-24 18:28:29 +01:00

93 lines
1.7 KiB
Bash

cat_file_override() {
local fname="$1"
if [ -e "$SCRIPTDIR/product/$PRODUCT/${fname}.${BOARD}" ]; then
cat "$SCRIPTDIR/product/$PRODUCT/${fname}.${BOARD}"
return
fi
if [ -e "$SCRIPTDIR/product/$PRODUCT/$fname" ]; then
cat "$SCRIPTDIR/product/$PRODUCT/$fname"
return
fi
if [ -e "$SCRIPTDIR/board/$BOARD/$fname" ]; then
cat "$SCRIPTDIR/board/$BOARD/$fname"
return
fi
if [ -e "$SCRIPTDIR/product/common/$fname" ]; then
cat "$SCRIPTDIR/product/common/$fname"
fi
}
cat_file_merge() {
local fname="$1"
if [ -e "$SCRIPTDIR/product/$PRODUCT/${fname}.${BOARD}" ]; then
cat "$SCRIPTDIR/product/$PRODUCT/${fname}.${BOARD}"
fi
if [ -e "$SCRIPTDIR/product/$PRODUCT/$fname" ]; then
cat "$SCRIPTDIR/product/$PRODUCT/$fname"
fi
if [ -e "$SCRIPTDIR/board/$BOARD/$fname" ]; then
cat "$SCRIPTDIR/board/$BOARD/$fname"
fi
if [ -e "$SCRIPTDIR/product/common/$fname" ]; then
cat "$SCRIPTDIR/product/common/$fname"
fi
}
apply_patches() {
local PATCH
for PATCH in $SCRIPTDIR/pkg/$PKGNAME/*.patch; do
if [ -f $PATCH ]; then
patch -p1 < $PATCH
fi
done
}
strip_files() {
local f
for f in $@; do
if [ ! -f "$f" ]; then
continue
fi
if file $f | grep -q -i elf; then
${TARGET}-strip --discard-all "$f"
fi
done
}
split_dev_deploy() {
local lib f
if [ -d "$1/include" ]; then
mv "$1/include" "$2"
fi
if [ -d "$1/lib/pkgconfig" ]; then
mkdir -p "$2/lib"
mv "$1/lib/pkgconfig" "$2/lib"
fi
if [ -d "$1/share/pkgconfig" ]; then
mkdir -p "$2/lib"
mv "$1/share/pkgconfig" "$2/lib"
fi
for f in ${1}/lib/*.la; do
if [ -e "$f" ]; then
rm "$f"
fi
done
for f in ${1}/lib/*.a; do
if [ -f "$f" ]; then
mkdir -p "$2/lib"
mv ${1}/lib/*.a "$2/lib"
fi
break
done
}