Kaydet (Commit) dcba7fdc authored tarafından Your Name's avatar Your Name

fallback functions && build check added

üst 137435cf
Building with unibuild Building with unibuild
====================== ======================
**Unibuild** need a build spec. Build spec must be bash script. *name* *version* *release* *summary* *description* variables and *_setup* *_build* *_install* functions uses. For example: **Unibuild** need a build spec. Build spec must be bash script. *name* *version* *release* *summary* *description* variables and *_setup* *_build* *_check* *_install* functions uses. For example:
.. code-block:: shell .. code-block:: shell
...@@ -75,7 +75,7 @@ This example uses autotools for compiling. autotools define build functions look ...@@ -75,7 +75,7 @@ This example uses autotools for compiling. autotools define build functions look
The gnu bash source code has ./configure script so if you dont define build functions, unibuild detect and set **BuildType** variable. The gnu bash source code has ./configure script so if you dont define build functions, unibuild detect and set **BuildType** variable.
Function calling order: _setup => _build => _install Function calling order: _setup => _build => _check => _install
Build target and host Build target and host
^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
......
...@@ -18,19 +18,24 @@ else ...@@ -18,19 +18,24 @@ else
err "Source not detected or not supported." err "Source not detected or not supported."
exit 1 exit 1
fi fi
fail_message() {
err "$@"
exit 1
}
source $MODDIR/../target/$TARGET source $MODDIR/../target/$TARGET
source $MODDIR/../host/$HOST source $MODDIR/../host/$HOST
declare -r begintime=$(date +%s%3N) declare -r begintime=$(date +%s%3N)
msg ">>> Checking dependencies" msg ">>> Checking dependencies"
_get_build_deps _get_build_deps || warn "Failed to check dependencies."
declare -r checktime=$(date +%s%3N) declare -r checktime=$(date +%s%3N)
cd $BUILDDIR cd $BUILDDIR
msg ">>> Getting sources" msg ">>> Getting sources"
_fetch _fetch || fail_message "Failed to get sources."
declare -r fetchtime=$(date +%s%3N) declare -r fetchtime=$(date +%s%3N)
msg ">>> Running hooks" msg ">>> Running hooks"
...@@ -40,16 +45,24 @@ done ...@@ -40,16 +45,24 @@ done
if fn_exists "_setup" ; then if fn_exists "_setup" ; then
cd $WORKDIR cd $WORKDIR
msg ">>> Running setup function" msg ">>> Running setup function"
_setup _setup || fail_message "Failed to run setup function."
fi fi
declare -r setuptime=$(date +%s%3N) declare -r setuptime=$(date +%s%3N)
if fn_exists "_build" ; then if fn_exists "_build" ; then
cd $WORKDIR cd $WORKDIR
msg ">>> Running build function" msg ">>> Running build function"
_build _build || fail_message "Failed to run build function."
fi fi
declare -r buildtime=$(date +%s%3N) declare -r buildtime=$(date +%s%3N)
if fn_exists "_check" ; then
cd $WORKDIR
msg ">>> Running check function"
_build || warn "Failed to run check function."
fi
declare -r buildchecktime=$(date +%s%3N)
[ "$PKGS" == "" ] && PKGS=$name [ "$PKGS" == "" ] && PKGS=$name
for package in ${PKGS[@]} ; do for package in ${PKGS[@]} ; do
export PKGDIR=$BUILDDIR/$package/package export PKGDIR=$BUILDDIR/$package/package
...@@ -59,7 +72,7 @@ for package in ${PKGS[@]} ; do ...@@ -59,7 +72,7 @@ for package in ${PKGS[@]} ; do
if fn_exists "_install" ; then if fn_exists "_install" ; then
cd $WORKDIR cd $WORKDIR
msg ">>> Running install function for $package" msg ">>> Running install function for $package"
_install _install || fail_message "Failed to run install function for $package"
fi fi
done done
declare -r installtime=$(date +%s%3N) declare -r installtime=$(date +%s%3N)
...@@ -87,6 +100,7 @@ info " Package Checking: $(($checktime-$begintime))" ...@@ -87,6 +100,7 @@ info " Package Checking: $(($checktime-$begintime))"
info " Source fetching: $(($fetchtime-$checktime))" info " Source fetching: $(($fetchtime-$checktime))"
info " Setup functions: $(($setuptime-$fetchtime))" info " Setup functions: $(($setuptime-$fetchtime))"
info " Source Building: $(($buildtime-$setuptime))" info " Source Building: $(($buildtime-$setuptime))"
info " Source installing: $(($installtime-$buildtime))" info " Build Checking: $(($buildchecktime-$buildtime))"
info " Source installing: $(($installtime-$buildchecktime))"
info " Package generating: $(($packagetime-$installtime))" info " Package generating: $(($packagetime-$installtime))"
info " Total time: $(($packagetime-$inittime))" info " Total time: $(($packagetime-$inittime))"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment