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 ############################### ############################## build toolchain ###############################
echo "--- resolving toolchain dependencies ---" echo "--- resolving toolchain dependencies ---"
dependencies "toolchain" "tcpkg" > "$PACKAGELIST" include_pkg "tcpkg" "toolchain"
dependencies | tsort | tac > "$PACKAGELIST"
cat "$PACKAGELIST" cat "$PACKAGELIST"
echo "--- downloading toolchain files ---" echo "--- downloading toolchain files ---"
while read pkg; do while read pkg; do
fetch_package "tcpkg" "$pkg" include_pkg "tcpkg" "$pkg"
fetch_package
done < "$PACKAGELIST" done < "$PACKAGELIST"
echo "--- building toolchain ---" echo "--- building toolchain ---"
@ -58,8 +60,9 @@ echo "--- building toolchain ---"
gen_cmake_toolchain_file gen_cmake_toolchain_file
while read pkg; do while read pkg; do
run_tcpkg_command "$pkg" "build" include_pkg "tcpkg" "$pkg"
run_tcpkg_command "$pkg" "deploy" run_tcpkg_command "build"
run_tcpkg_command "deploy"
done < "$PACKAGELIST" done < "$PACKAGELIST"
echo "--- backing up toolchain sysroot ---" echo "--- backing up toolchain sysroot ---"
@ -69,22 +72,26 @@ save_toolchain
############################### build packages ############################### ############################### build packages ###############################
echo "--- resolving package dependencies ---" echo "--- resolving package dependencies ---"
dependencies "release-${CFG}" "pkg" > "$PACKAGELIST" include_pkg "pkg" "release-${CFG}"
dependencies | tsort | tac > "$PACKAGELIST"
cat "$PACKAGELIST" cat "$PACKAGELIST"
echo "--- downloading package files ---" echo "--- downloading package files ---"
while read pkg; do while read pkg; do
fetch_package "pkg" "$pkg" include_pkg "pkg" "$pkg"
fetch_package
done < "$PACKAGELIST" done < "$PACKAGELIST"
echo "--- building package ---" echo "--- building package ---"
while read pkg; do while read pkg; do
install_build_deps "$pkg" include_pkg "pkg" "$pkg"
run_pkg_command "$pkg" "build" install_build_deps
run_pkg_command "$pkg" "deploy"
run_pkg_command "build"
run_pkg_command "deploy"
restore_toolchain restore_toolchain
done < "$PACKAGELIST" done < "$PACKAGELIST"

View file

@ -17,7 +17,7 @@ build() {
fi fi
# install packages to rootfs # 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" echo "toolchain" >> "$BUILD/etc/packages"
while read pkgname; do while read pkgname; do

View file

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

View file

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

View file

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