@@ -40,10 +40,11 @@ rm -f "kitsh/.success" for pkg in ${KITCREATOR_ALLPKGS} ${KITCREATOR_PKGS}; do if [ "${mode}" != "retry" -o ! -f "${pkg}/.success" ]; then rm -f "${pkg}/build.log" "${pkg}/.success" rm -rf "${pkg}/out" "${pkg}/inst" "${pkg}/build" + rm -rf "${pkg}"/workdir-* rm -rf "${pkg}/src"/tmp-* fi if [ "${mode}" = "distclean" ]; then @@ -159,10 +160,28 @@ break fi done export TCLSH_NATIVE + +# Function to determine what build mode is being used +function useCommonBuildSystem() { + local script + + script="$1" + + if head "${script}" 2>/dev/null | grep -i '^# *BuildCompatible: *KitCreator *$' >/dev/null 2>/dev/null; then + return 0 + fi + + return 1 +} + +# Cleanup build logs +for pkg in tcl tclvfs zlib ${KITCREATOR_PKGS} kitsh; do + rm -f "${pkg}/build.log" +done # Verify that each component is happy with the environment validatefailed="0" for pkg in tcl tclvfs zlib ${KITCREATOR_PKGS} kitsh; do failed='0' @@ -172,11 +191,11 @@ if [ -x "${pkg}/validate.sh" ]; then ( cd "${pkg}" >/dev/null 2>/dev/null || exit 1 - ./validate.sh 3>&1 4>&2 > build.log 2>&1 || exit 1 + ./validate.sh 3>&1 4>&2 >> build.log 2>&1 || exit 1 ) || failed="1" if [ "${failed}" = '1' ]; then echo "Failed pre-requisite check for ${pkg}" >&2 @@ -204,11 +223,51 @@ build_script='./build.sh' if [ -x 'kitcreator-build.sh' ]; then build_script='./kitcreator-build.sh' fi - "${build_script}" 3>&1 4>&2 > build.log 2>&1 || exit 1 + + if useCommonBuildSystem "${build_script}"; then + ( + . ../common/common.sh + . "${build_script}" + + set -x + + init || die 'init failed' + + predownload || die 'predownload failed' + download || die 'download failed' + postdownload || die 'postdownload failed' + + extract || die 'extract failed' + + apply_patches || die 'apply patches failed' + + cd "${workdir}" || exit 1 + + preconfigure || die 'preconfigure failed' + configure || die 'configure failed' + postconfigure || die 'postconfigure failed' + + prebuild || die 'prebuild failed' + build || die 'build failed' + postbuild || die 'postbuild failed' + + preinstall || die 'preinstall failed' + install || die 'install failed' + postinstall || die 'postinstall failed' + + createruntime || die 'createruntime failed' + + set +x + + rm -rf "${workdir}" + ) 3>&1 4>&2 > build.log 2>&1 || exit 1 + else + "${build_script}" 3>&1 4>&2 >> build.log 2>&1 || exit 1 + fi ) || failed="1" fi if [ "${failed}" = "1" ]; then echo " failed."