1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-22 11:09:46 +01:00

Major cleanup

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
This commit is contained in:
David Oberhollenzer 2018-01-24 21:48:10 +01:00
parent 0932c5ae0b
commit 015cb894cd
6 changed files with 39 additions and 54 deletions

25
mk.sh
View file

@ -44,13 +44,15 @@ source "$SCRIPTDIR/util/cmake.sh"
############################## build toolchain ###############################
echo "--- resolving toolchain dependencies ---"
dependencies "toolchain" "tcpkg" > "$PACKAGELIST"
include_pkg "tcpkg" "toolchain"
dependencies | tsort | tac > "$PACKAGELIST"
cat "$PACKAGELIST"
echo "--- downloading toolchain files ---"
while read pkg; do
fetch_package "tcpkg" "$pkg"
include_pkg "tcpkg" "$pkg"
fetch_package
done < "$PACKAGELIST"
echo "--- building toolchain ---"
@ -58,8 +60,9 @@ echo "--- building toolchain ---"
gen_cmake_toolchain_file
while read pkg; do
run_tcpkg_command "$pkg" "build"
run_tcpkg_command "$pkg" "deploy"
include_pkg "tcpkg" "$pkg"
run_tcpkg_command "build"
run_tcpkg_command "deploy"
done < "$PACKAGELIST"
echo "--- backing up toolchain sysroot ---"
@ -69,22 +72,26 @@ save_toolchain
############################### build packages ###############################
echo "--- resolving package dependencies ---"
dependencies "release-${CFG}" "pkg" > "$PACKAGELIST"
include_pkg "pkg" "release-${CFG}"
dependencies | tsort | tac > "$PACKAGELIST"
cat "$PACKAGELIST"
echo "--- downloading package files ---"
while read pkg; do
fetch_package "pkg" "$pkg"
include_pkg "pkg" "$pkg"
fetch_package
done < "$PACKAGELIST"
echo "--- building package ---"
while read pkg; do
install_build_deps "$pkg"
include_pkg "pkg" "$pkg"
run_pkg_command "$pkg" "build"
run_pkg_command "$pkg" "deploy"
install_build_deps
run_pkg_command "build"
run_pkg_command "deploy"
restore_toolchain
done < "$PACKAGELIST"

View file

@ -17,7 +17,7 @@ build() {
fi
# install packages to rootfs
dependencies "rootfs" "pkg" | grep -v "rootfs" > "$BUILD/etc/packages"
dependencies | tsort | tac | grep -v "$PKGNAME" > "$BUILD/etc/packages"
echo "toolchain" >> "$BUILD/etc/packages"
while read pkgname; do

View file

@ -1,27 +1,23 @@
dependencies_recursive() {
local NAME="$1"
local PKGDIR="$2"
include_pkg() {
PKGDIR="$1" # globally visible package directory
PKGNAME="$2" # globally visible package name
unset -f build deploy prepare
unset -v VERSION TARBALL URL SRCDIR SHA256SUM DEPENDS
source "$SCRIPTDIR/$PKGDIR/$NAME/build"
source "$SCRIPTDIR/$PKGDIR/$PKGNAME/build"
}
dependencies() {
local depends="$DEPENDS"
if [ ! -z "$depends" ]; then
for DEP in $depends; do
echo "$NAME $DEP"
echo "$PKGNAME $DEP"
done
for DEP in $depends; do
dependencies_recursive "$DEP" "$PKGDIR"
include_pkg "$PKGDIR" "$DEP"
dependencies
done
fi
}
dependencies() {
local NAME="$1"
local PKGDIR="$2"
dependencies_recursive "$NAME" "$PKGDIR" | tsort | tac
}

View file

@ -1,11 +1,5 @@
fetch_package() {
local PKGDIR="$1"
local NAME="$2"
echo "$NAME"
unset -f build deploy prepare
unset -v VERSION TARBALL URL SRCDIR SHA256SUM DEPENDS
source "$SCRIPTDIR/$PKGDIR/$NAME/build"
echo "$PKGNAME - download"
if [ -z "$TARBALL" ]; then
return
@ -23,14 +17,14 @@ fetch_package() {
popd > /dev/null
if [ ! -e "$PKGSRCDIR/$SRCDIR" ]; then
local LOGFILE="$PKGLOGDIR/${NAME}-prepare.log"
local LOGFILE="$PKGLOGDIR/${PKGNAME}-prepare.log"
echo "unpacking..."
echo "$PKGNAME - unpack"
tar -C "$PKGSRCDIR" -xf "$PKGDOWNLOADDIR/$TARBALL"
pushd "$PKGSRCDIR/$SRCDIR" > /dev/null
echo "preparing..."
prepare "$SCRIPTDIR/$PKGDIR/$NAME" &>> "$LOGFILE" < /dev/null
echo "$PKGNAME - prepare"
prepare "$SCRIPTDIR/$PKGDIR/$PKGNAME" &>> "$LOGFILE" < /dev/null
popd > /dev/null
fi
}

View file

@ -1,22 +1,16 @@
run_pkg_command_common() {
local NAME="$1"
local FUNCTION="$2"
local PKGDIR="$3"
local DEPLOYDIR="$PKGDEPLOYDIR/$4"
local OUT="$PKGBUILDDIR/$5"
local CHECKFILE="$PKGLOGDIR/.${6}-${FUNCTION}"
local FUNCTION="$1"
local DEPLOYDIR="$PKGDEPLOYDIR/$2"
local OUT="$PKGBUILDDIR/$3"
local CHECKFILE="$PKGLOGDIR/.${4}-${FUNCTION}"
echo "$NAME - $FUNCTION"
echo "$PKGNAME - $FUNCTION"
if [ -e "$CHECKFILE" ]; then
return
fi
unset -f build deploy prepare
unset -v VERSION TARBALL URL SRCDIR SHA256SUM DEPENDS
source "$SCRIPTDIR/$PKGDIR/$NAME/build"
local LOGFILE="$PKGLOGDIR/${7}-${FUNCTION}.log"
local LOGFILE="$PKGLOGDIR/${5}-${FUNCTION}.log"
local SRC="$PKGSRCDIR/$SRCDIR"
mkdir -p "$DEPLOYDIR" "$OUT" "${DEPLOYDIR}-dev"
@ -33,9 +27,9 @@ run_pkg_command_common() {
}
run_pkg_command() {
run_pkg_command_common "$1" "$2" "pkg" "$1" "$1" "$1" "$1"
run_pkg_command_common "$1" "$PKGNAME" "$PKGNAME" "$PKGNAME" "$PKGNAME"
}
run_tcpkg_command() {
run_pkg_command_common "$1" "$2" "tcpkg" "toolchain" "tc-$1" "tc-$1" "tc-$1"
run_pkg_command_common "$1" "toolchain" "tc-$PKGNAME" "tc-$PKGNAME" "tc-$PKGNAME"
}

View file

@ -14,12 +14,6 @@ restore_toolchain() {
}
install_build_deps() {
local NAME="$1"
unset -f build deploy prepare
unset -v VERSION TARBALL URL SRCDIR SHA256SUM DEPENDS
source "$SCRIPTDIR/pkg/$NAME/build"
if [ -z "$DEPENDS" ]; then
return
fi