--- trunk/mage/usr/lib/mage/smage2.sh 2011/12/28 10:31:45 1572 +++ trunk/mage/usr/lib/mage/smage2.sh 2011/12/28 10:56:10 1579 @@ -321,27 +321,31 @@ unset SRC_URI } -# dummy function, used if that not exist in smage file +# dummy function, used if that does not exist in smage file src_prepare() { echo "no src_prepare defined" - sleep 2 return 0 } -# dummy function, used if that not exist in smage file +# dummy function, used if that does not exist in smage file src_compile() { echo "no src_compile defined" - sleep 2 return 0 } -# dummy function, used if that not exist in smage file +# dummy function, used if that does not exist in smage file +src_check() +{ + echo "no src_check defined" + return 0 +} + +# dummy function, used if that does not exist in smage file src_install() { echo "no src_install defined" - sleep 2 return 0 } @@ -551,24 +555,27 @@ { local stripdir="$@" - [ -z "${stripdir}" ] && stripdir=${BINDIR} - find ${stripdir} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip ${STRIP_DYN_LIB} 2> /dev/null + [[ -z ${stripdir} ]] && stripdir="${BINDIR}" + [[ -z ${STRIP_DYN_LIB} ]] && STRIP_DYN_LIB="--strip-debug" + find ${stripdir} ! -type d | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_LIB} 2> /dev/null } mstripbins() { local stripdir="$@" - [ -z "${stripdir}" ] && stripdir=${BINDIR} - find ${stripdir} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip ${STRIP_DYN_BIN} 2> /dev/null + [[ -z ${stripdir} ]] && stripdir="${BINDIR}" + [[ -z ${STRIP_DYN_BIN} ]] && STRIP_DYN_BIN="--strip-debug" + find ${stripdir} ! -type d | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_BIN} 2> /dev/null } mstripstatic() { local stripdir="$@" - [ -z "${stripdir}" ] && stripdir=${BINDIR} - find ${stripdir} | xargs file | grep "ar archive" | cut -f 1 -d : | xargs strip ${STRIP_STATIC_LIB} 2> /dev/null + [[ -z ${stripdir} ]] && stripdir="${BINDIR}" + [[ -z ${STRIP_STATIC_LIB} ]] && STRIP_STATIC_LIB="--strip-debug" + find ${stripdir} ! -type d | xargs file | grep "ar archive" | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_STATIC_LIB} 2> /dev/null } mcompressdocs() @@ -1447,6 +1454,7 @@ # fixes some issues with these functions export -f src_prepare || die "src_prepare export failed" export -f src_compile || die "src_compile export failed" +export -f src_check || die "src_check export failed" export -f src_install || die "src_install export failed" # fixes some compile issues @@ -1464,42 +1472,33 @@ # setup ccache [[ ${SMAGE_USE_CCACHE} = true ]] && setup_ccache_environment -# small sleep to show our settings -sleep 1 - -# cleans up build if a previously one exists +# clean up builddir if a previously one exist if [ -d ${BUILDDIR} ] then rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR." fi install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR." -# cleans up srcdir if a previously unpacked one exists +# clean up srcdir if a previously unpacked one exist if [ -d ${SRCDIR} ] then rm -rf ${SRCDIR} fi -# cleans up bindir if a previous build exists or creates a new one +# clean up bindir if a previous build exist or create a new one if [ -d ${BINDIR} ] then rm -rf ${BINDIR} fi install -d ${BINDIR} || die "couldn't create \$BINDIR." -# cleans up package temp dir if a previous build exists +# clean up package temp dir if a previous build exist if [ -d ${BUILDDIR}/${PKGNAME} ] then rm -rf ${BUILDDIR}/${PKGNAME} fi -# cleans up timestamp if one exists -if [ -f /var/tmp/timestamp ] -then - mage rmstamp -fi - -# setup build loggins +# setup build logging [[ ! -d /var/log/smage ]] && install -d /var/log/smage echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log @@ -1511,6 +1510,17 @@ die_pipestatus 0 "src_compile failed" step_by_step $_ +# only run checks if requested +if [[ ${MAGE_CHECK} != true ]] +then + echo "MAGE_CHECK not requested; src_check() will not be run!" | ${SMAGE_LOG_CMD} + step_by_step src_check +else + src_check | ${SMAGE_LOG_CMD} + die_pipestatus 0 "src_check failed" + step_by_step $_ +fi + # build several subpackages if [[ -n ${SPLIT_PACKAGES} ]] then @@ -1599,7 +1609,7 @@ then for target in ${MAGE_TARGETS} do - # check if an special target_pkgbuild exists + # check if a special target_pkgbuild exists if typeset -f ${target}_pkgbuild > /dev/null then # run it